Skip to content

Commit d8fc7b8

Browse files
authored
lint: add eslint based on config-semistandard (#1067)
* lint: add eslint based on config-semistandard
1 parent 79d5651 commit d8fc7b8

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['semistandard']
3+
};

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,12 @@
329329
"benchmark": "^2.1.4",
330330
"bindings": "^1.5.0",
331331
"clang-format": "^1.4.0",
332+
"eslint": "^7.32.0",
333+
"eslint-config-semistandard": "^16.0.0",
334+
"eslint-config-standard": "^16.0.3",
335+
"eslint-plugin-import": "^2.24.2",
336+
"eslint-plugin-node": "^11.1.0",
337+
"eslint-plugin-promise": "^5.1.0",
332338
"fs-extra": "^9.0.1",
333339
"path": "^0.12.7",
334340
"pre-commit": "^1.2.2",
@@ -351,7 +357,6 @@
351357
"license": "MIT",
352358
"main": "index.js",
353359
"name": "node-addon-api",
354-
"optionalDependencies": {},
355360
"readme": "README.md",
356361
"repository": {
357362
"type": "git",
@@ -372,8 +377,8 @@
372377
"predev:incremental": "node-gyp configure build -C test --debug",
373378
"dev:incremental": "node test",
374379
"doc": "doxygen doc/Doxyfile",
375-
"lint": "node tools/clang-format",
376-
"lint:fix": "node tools/clang-format --fix"
380+
"lint": "eslint $(git diff --name-only refs/remotes/origin/main '**/*.js' | xargs) && node tools/clang-format",
381+
"lint:fix": "node tools/clang-format --fix && eslint --fix $(git diff --cached --name-only '**/*.js' | xargs && git diff --name-only '**/*.js' | xargs)"
377382
},
378383
"pre-commit": "lint",
379384
"version": "4.2.0",

0 commit comments

Comments
 (0)