Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use eslint v9 #79

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

15 changes: 0 additions & 15 deletions .eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
"typescript.tsc.autoDetect": "off",
"typescript.preferences.quoteStyle": "single",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
Expand Down
4 changes: 2 additions & 2 deletions client/src/command.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path = require("path");
import * as path from "path";
import { objectToCamel, objectToSnake } from "ts-case-convert";
import type { ObjectToSnake } from "ts-case-convert/lib/caseConvert";
import {
Expand Down Expand Up @@ -73,7 +73,7 @@ const isFileExists = async (uri: Uri): Promise<boolean> => {
try {
await workspace.fs.stat(uri);
return true;
} catch (_) {
} catch {
return false;
}
};
Expand Down
44 changes: 20 additions & 24 deletions client/src/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as path from "path";
import * as Mocha from "mocha";
import * as glob from "glob";
import Mocha from "mocha";
import { glob } from "glob";

export function run(): Promise<void> {
export async function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: "tdd",
Expand All @@ -12,28 +12,24 @@ export function run(): Promise<void> {

const testsRoot = __dirname;

return new Promise((resolve, reject) => {
glob("**.test.js", { cwd: testsRoot }, (err, files) => {
if (err) {
return reject(err);
}
const files = await glob("**.test.js", { cwd: testsRoot });

// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));
// Add files to the test suite
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f)));

try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
console.error(err);
reject(err);
}
});
return new Promise((resolve, reject) => {
try {
// Run the mocha test
mocha.run((failures) => {
if (failures > 0) {
reject(new Error(`${failures} tests failed.`));
} else {
resolve();
}
});
} catch (err) {
console.error(err);
reject(err);
}
});
}
2 changes: 1 addition & 1 deletion client/src/test/runTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ async function main() {

// Download VS Code, unzip it and run the integration test
await runTests({ extensionDevelopmentPath, extensionTestsPath });
} catch (err) {
} catch {
console.error("Failed to run tests");
process.exit(1);
}
Expand Down
3 changes: 2 additions & 1 deletion client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"lib": ["es2020"],
"outDir": "out",
"rootDir": "src",
"sourceMap": true
"sourceMap": true,
"esModuleInterop": true
},
"include": ["src"],
"exclude": ["node_modules", ".vscode-test"]
Expand Down
30 changes: 30 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import globals from "globals";
import tsEslint from "typescript-eslint";
import js from "@eslint/js";

export default [
{
ignores: [
"**/node_modules/",
"client/node_modules/",
"client/out/",
"server/node_modules/",
"server/out/",
],
},
js.configs.recommended,
...tsEslint.config({
files: ["**/*.ts", "**/*.mts"],
extends: [tsEslint.configs.recommended],
}),
{
languageOptions: {
globals: {
...globals.node,
},
},
},
{
files: ["**/*.mjs"],
},
];
Loading
Loading