Skip to content

Commit

Permalink
feat: migrate eslint config and scripts from rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Apr 4, 2024
1 parent 7b5fbc0 commit cd71bae
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
23 changes: 21 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ module.exports = {
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 10,
ecmaVersion: "latest",
project: "./tsconfig.json",
sourceType: "script",
},
plugins: ["@typescript-eslint", "eslint-plugin-import", "eslint-plugin-node", "prettier"],
extends: [
Expand Down Expand Up @@ -82,11 +83,29 @@ module.exports = {
},
overrides: [
{
files: ["**/test/**/*.ts"],
files: ["lib/index.mjs"],
parserOptions: {
sourceType: "module"
},
rules: {
// The imports are all resolved via tsconfig.mjs.json but the root tsconfig that eslint uses
// shows them as unresolved.
"import/no-unresolved": "off",
},
},
{
files: ["test/**/*.ts"],
rules: {
"import/no-extraneous-dependencies": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
{
// Is a dev file and squacks about chokidar being a devDependency
files: ["scripts/watch.ts"],
rules: {
"import/no-extraneous-dependencies": "off"
},
},
],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"clean:gyp": "node-gyp clean && node-gyp configure",
"lint": "npm run lint:c && npm run lint:ts",
"lint:c": "clang-format -i ./src/*",
"lint:ts": "eslint --color --ext .ts src/ test/",
"lint:ts": "eslint --color --ext .js,.mjs,.cjs,.ts lib/ scripts/ test/ utils/",
"test": "yarn test:unit && yarn test:spec && yarn test:perf && yarn test:memory",
"test:fuzz": "ts-node test/fuzz/fuzz.test.ts",
"test:memory": "node -r ts-node/register --expose-gc test/memory/memory.test.ts",
Expand Down Expand Up @@ -63,6 +63,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^6.1.0",
"node-fetch": "^2.6.1",
"node-gyp": "^10.0.1"
Expand Down

0 comments on commit cd71bae

Please sign in to comment.