Skip to content

Commit

Permalink
Bump linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorniaky committed Jun 24, 2024
1 parent 252602f commit e2b1756
Show file tree
Hide file tree
Showing 16 changed files with 177 additions and 153 deletions.
31 changes: 0 additions & 31 deletions .eslintrc.json

This file was deleted.

16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Test Extension

on:
push:
branches: [ "**" ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- run: yarn
- run: yarn run test
4 changes: 2 additions & 2 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from '@vscode/test-cli';
import { defineConfig } from "@vscode/test-cli";

export default defineConfig({
files: 'out/test/**/*.test.js',
files: "out/test/**/*.test.js",
});
45 changes: 45 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import pluginJs from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";

export default [
{ files: ["**/*.ts"] },
{ ignores: ["out/", "**/*.js", "**/.d.ts"] },
{ files: ["**/*.ts"], languageOptions: { sourceType: "script" } },
{ languageOptions: { globals: globals.node } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/naming-convention": [
"warn",
{
selector: "import",
format: ["camelCase", "PascalCase"],
},
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/semi": "warn",
"comma-dangle": ["warn", "always-multiline"],
curly: "off",
"eol-last": "warn",
eqeqeq: "warn",
"no-case-declarations": "off",
"no-empty": "off",
"no-extra-semi": "warn",
"no-throw-literal": "warn",
"prefer-const": "warn",
quotes: ["warn", "double"],
semi: "off",
},
},
];
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1257,19 +1257,20 @@
"path-is-absolute": "^1.0.0"
},
"devDependencies": {
"@eslint/js": "^9.5.0",
"@types/adm-zip": "^0.5.5",
"@types/archiver": "^6.0.2",
"@types/json-schema": "^7.0.15",
"@types/jsonwebtoken": "^9.0.6",
"@types/mocha": "^10.0.7",
"@types/node": "20.x",
"@types/vscode": "^1.90.0",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@vscode/test-cli": "^0.0.9",
"@vscode/test-electron": "^2.4.0",
"eslint": "8.x",
"eslint": "^9.5.0",
"globals": "^15.6.0",
"mocha": "^10.4.0",
"typescript": "^5.5.2"
"typescript": "^5.5.2",
"typescript-eslint": "^7.13.1"
}
}
4 changes: 1 addition & 3 deletions src/commands/apps/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export default class extends Command {
const res = await requester<RESTGetApiAppLogResult>(Routes.appLogs(item.appId));
if (!res) return;

if (!res.apps || !res.apps.terminal.big) {
throw Error(t("log404"));
};
if (!res.apps || !res.apps.terminal.big) throw Error(t("log404"));

this.logger(item.output ?? res.apps.id, res.apps.terminal.big);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class extends Command {

if (!res.apps || !res.apps.terminal.big) {
return window.showErrorMessage(t("log404"));
};
}

this.logger(item.output ?? res.apps.id, res.apps.terminal.big);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/team/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class extends Command {

if (!res.apps || !res.apps.terminal.big) {
throw Error(t("log404"));
};
}

this.logger(item.output ?? res.apps.id, res.apps.terminal.big);
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/CompletionItemProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default class CompletionItemProvider extends BaseLanguageProvider {
const item = new CompletionItem(file.name,
file.isFile() ?
CompletionItemKind.File :
CompletionItemKind.Folder
CompletionItemKind.Folder,
);

item.sortText = `${file.isFile()}`;
Expand Down
4 changes: 2 additions & 2 deletions src/providers/LanguageConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default class LanguageConfigurationProvider extends BaseLanguageProvider
message: error.message,
range: new Range(
new Position(0, 0),
new Position(0, 0)
new Position(0, 0),
),
severity: DiagnosticSeverity.Error,
});
Expand Down Expand Up @@ -132,7 +132,7 @@ export default class LanguageConfigurationProvider extends BaseLanguageProvider
message: t("diagnostic.main.not.exist"),
range: new Range(
new Position(i, key.length + 1),
new Position(i, line.text.length)
new Position(i, line.text.length),
),
severity: DiagnosticSeverity.Error,
});
Expand Down
2 changes: 1 addition & 1 deletion src/structures/AppTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class AppTreeItem extends BaseTreeItem<AppChildTreeItem> {

get online(): boolean {
return this.data.online;
};
}

dispose() {
this.output.dispose();
Expand Down
6 changes: 3 additions & 3 deletions src/structures/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export default abstract class Command {
output.show(false);

setTimeout(() => output.show(false), 250);
};
}
}

showApiMessage(data: Data) {
Expand All @@ -290,13 +290,13 @@ export default abstract class Command {
window.showInformationMessage(
`${status}`
+ (typeof data.statusCode === "number" ? ` ${data.statusCode}` : "")
+ (data.message ? `: ${data.message}` : "")
+ (data.message ? `: ${data.message}` : ""),
);
} else {
window.showWarningMessage(
`${status}`
+ (typeof data.statusCode === "number" ? ` ${data.statusCode}` : "")
+ (data.message ? `: ${data.message}` : "")
+ (data.message ? `: ${data.message}` : ""),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class FileSystem {

for (const filename of options.fileNames) {
this.patterns.add(filename);
};
}
}

if (options.ignoreFile) this.ignoreFile = options.ignoreFile;
Expand Down
4 changes: 2 additions & 2 deletions src/util/Zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Zip {
declare readonly zip: Archiver;

constructor(public file: string, format = "zip", public options: ArchiverOptions = {}) {
if (existsSync(file)) try { rmSync(file); } catch { };
if (existsSync(file)) try { rmSync(file); } catch { }
this.zip = create(format, options);
writeFileSync(file, "");
this.stream = createWriteStream(file);
Expand Down Expand Up @@ -81,4 +81,4 @@ export class Zip {
async finalize() {
return await this.zip.finalize().then(() => true);
}
};
}
6 changes: 4 additions & 2 deletions src/util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ export function compareNumbers(a: number, b: number) {
}

export function getIconName(data: any) {
if ("online" in data)
if ("online" in data) {
return data.online ? "on" :
data.ramKilled ? "ramKilled" :
data.exitCode === 1 ? "errorCode" :
"off";
}

if ("container" in data)
if ("container" in data) {
return data.container === "Online" ? "on" :
data.ramKilled ? "ramKilled" :
data.exitCode === 1 ? "errorCode" :
"off";
}
}

export function JSONparse<T extends any[] | Record<any, any>>(s: string) {
Expand Down
Loading

0 comments on commit e2b1756

Please sign in to comment.