Skip to content

Commit ecd7109

Browse files
adopt lint with usual plugins
1 parent 7d3a9b2 commit ecd7109

File tree

6 files changed

+585
-316
lines changed

6 files changed

+585
-316
lines changed

.eslintrc

Lines changed: 107 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,112 @@
11
{
2+
"root": true,
23
"extends": [
3-
"semistandard",
4-
"plugin:promise/recommended",
4+
"eslint:recommended",
5+
"plugin:prettier/recommended",
6+
"plugin:@typescript-eslint/eslint-recommended",
57
"plugin:@typescript-eslint/recommended"
68
],
9+
"env": {
10+
"node": true,
11+
"mocha": true,
12+
"es6": true
13+
},
14+
"parserOptions": {
15+
"ecmaVersion": 2019
16+
},
17+
"plugins": [
18+
"@typescript-eslint",
19+
"prettier"
20+
],
21+
"parser": "@typescript-eslint/parser",
722
"rules": {
8-
"@typescript-eslint/no-explicit-any": 0,
9-
"@typescript-eslint/no-empty-function": 0,
10-
"no-return-assign": 0,
11-
"space-before-function-paren": ["error", "never"]
12-
}
13-
}
23+
"no-restricted-properties": [
24+
"error",
25+
{
26+
"object": "describe",
27+
"property": "only"
28+
},
29+
{
30+
"object": "it",
31+
"property": "only"
32+
},
33+
{
34+
"object": "context",
35+
"property": "only"
36+
}
37+
],
38+
"prettier/prettier": "error",
39+
"no-console": "error",
40+
"valid-typeof": "error",
41+
"eqeqeq": [
42+
"error",
43+
"always",
44+
{
45+
"null": "ignore"
46+
}
47+
],
48+
"strict": [
49+
"error",
50+
"global"
51+
],
52+
"no-restricted-syntax": [
53+
"error",
54+
{
55+
"selector": "TSEnumDeclaration",
56+
"message": "Do not declare enums"
57+
},
58+
{
59+
"selector": "BinaryExpression[operator=/[=!]==/] Identifier[name='undefined']",
60+
"message": "Do not strictly check undefined"
61+
},
62+
{
63+
"selector": "BinaryExpression[operator=/[=!]==/] Literal[raw='null']",
64+
"message": "Do not strictly check null"
65+
},
66+
{
67+
"selector": "BinaryExpression[operator=/[=!]==?/] Literal[value='undefined']",
68+
"message": "Do not strictly check typeof undefined (NOTE: currently this rule only detects the usage of 'undefined' string literal so this could be a misfire)"
69+
}
70+
],
71+
"@typescript-eslint/no-require-imports": "off",
72+
"@typescript-eslint/no-unused-vars": [
73+
"error",
74+
{
75+
"argsIgnorePattern": "^_",
76+
"caughtErrorsIgnorePattern": "^_",
77+
"destructuredArrayIgnorePattern": "^_",
78+
"varsIgnorePattern": "^_"
79+
}
80+
]
81+
},
82+
"overrides": [
83+
{
84+
"files": [
85+
"lib/*.js"
86+
],
87+
"parserOptions": {
88+
"ecmaVersion": 2019,
89+
"sourceType": "commonjs"
90+
}
91+
},
92+
{
93+
"files": [
94+
"test/**/*ts"
95+
],
96+
"rules": {
97+
// chat `expect(..)` style chaining is considered
98+
// an unused expression
99+
"@typescript-eslint/no-unused-expressions": "off"
100+
}
101+
},
102+
{
103+
// json configuration files
104+
"files": [
105+
".*.json"
106+
],
107+
"rules": {
108+
"@typescript-eslint/no-unused-expressions": "off"
109+
}
110+
}
111+
]
112+
}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
".esm-wrapper.mjs"
2929
],
3030
"scripts": {
31-
"lint": "eslint \"{src,test}/**/*.ts\"",
31+
"lint": "ESLINT_USE_FLAT_CONFIG=false eslint \"{src,test}/**/*.ts\"",
3232
"test": "npm run lint && npm run build && nyc mocha --colors -r ts-node/register test/*.ts",
3333
"build": "npm run compile-ts && gen-esm-wrapper . ./.esm-wrapper.mjs",
3434
"prepack": "npm run build",
@@ -39,16 +39,16 @@
3939
"@types/chai": "^5.0.1",
4040
"@types/mocha": "^10.0.10",
4141
"@types/node": "^24.1.0",
42-
"@typescript-eslint/eslint-plugin": "^4.2.0",
43-
"@typescript-eslint/parser": "^4.2.0",
42+
"@typescript-eslint/eslint-plugin": "^8.39.1",
43+
"@typescript-eslint/parser": "^8.39.1",
4444
"chai": "^4.2.0",
45-
"eslint": "^7.9.0",
46-
"eslint-config-semistandard": "^15.0.1",
47-
"eslint-config-standard": "^14.1.1",
45+
"eslint": "^9.33.0",
4846
"eslint-plugin-import": "^2.22.0",
4947
"eslint-plugin-node": "^11.1.0",
5048
"eslint-plugin-promise": "^7.1.0",
5149
"eslint-plugin-standard": "^5.0.0",
50+
"eslint-config-prettier": "^10.1.8",
51+
"eslint-plugin-prettier": "^5.5.4",
5252
"gen-esm-wrapper": "^1.1.3",
5353
"mocha": "^11.0.1",
5454
"nyc": "^15.1.0",
@@ -59,4 +59,4 @@
5959
"@types/whatwg-url": "^13.0.0",
6060
"whatwg-url": "^14.1.0 || ^13.0.0"
6161
}
62-
}
62+
}

0 commit comments

Comments
 (0)