Skip to content

Commit

Permalink
feat: Add ESLint configuration and update linting scripts in package.…
Browse files Browse the repository at this point in the history
…json
  • Loading branch information
maxisam committed Nov 1, 2024
1 parent 55bcdc6 commit f19aefa
Show file tree
Hide file tree
Showing 4 changed files with 381 additions and 306 deletions.
6 changes: 5 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"connor4312.esbuild-problem-matchers"
]
}
37 changes: 37 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const js = require("@eslint/js");
const globals = require("globals");
const pluginJest = require('eslint-plugin-jest');
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');

module.exports = [
{ ignores: [".vscode-test/*"] },
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
globals: {
...globals.node,
...globals.jest,
...globals.mocha,
},
},
...js.configs.recommended,
},
{
// update this to match your test files
files: ['src/**/*.spec.js', 'src/**/*.test.js'],
plugins: { jest: pluginJest },
languageOptions: {
globals: pluginJest.environments.globals.globals,
},
rules: {
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
},
},
eslintPluginPrettierRecommended,
];
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"esbuild:watch": "pnpm esbuild:base --sourcemap --watch",
"esbuild:analyze": "pnpm esbuild:base --minify --metafile --analyze && esbuild-visualizer --metadata ./meta.json --open",
"compile:test": "pnpm clean && tsc -b ./test/tsconfig.json",
"lint": "eslint src --ext ts",
"lint": "eslint src/** --fix",
"test": "pnpm compile:test && node ./out/test/runTests.js",
"package": "vsce package --no-dependencies",
"release": "npx @yutengjing/release",
Expand All @@ -193,23 +193,26 @@
"@types/glob": "^8.1.0",
"@types/jest": "^29.5.14",
"@types/mocha": "^10.0.9",
"@types/node": "~20.17.1",
"@types/node": "~20.17.4",
"@types/npmcli__promise-spawn": "^6.0.3",
"@types/sinon": "17.0.3",
"@types/vscode": "1.94.0",
"@types/vscode": "1.95.0",
"@vscode/test-electron": "^2.4.1",
"@vscode/vsce": "^3.2.1",
"@yutengjing/eslint-config-typescript": "^1.2.5",
"@yutengjing/prettier-config": "^1.3.0",
"@yutengjing/release": "^0.3.1",
"esbuild": "~0.24.0",
"esbuild-visualizer": "^0.6.0",
"eslint": "^8.57.1",
"eslint": "^9.13.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.8.3",
"eslint-plugin-prettier": "^5.2.1",
"glob": "^11.0.0",
"jest": "^29.7.0",
"jest-mock-vscode": "^4.0.3",
"lint-staged": "^15.2.10",
"mocha": "^10.7.3",
"mocha": "^10.8.2",
"ovsx": "^0.10.0",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
Expand All @@ -218,7 +221,7 @@
"stale-dep": "^0.7.0",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"tsx": "^4.19.1",
"tsx": "^4.19.2",
"typescript": "~5.6.3"
}
}
Loading

0 comments on commit f19aefa

Please sign in to comment.