@keeex/eslint-config 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/package.json +6 -6
- package/src/config/mocha.js +3 -11
- package/src/config/react.js +1 -1
- package/src/pathutils.js +3 -3
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ export default await eslintConfig({
|
|
|
56
56
|
],
|
|
57
57
|
environments: {
|
|
58
58
|
node: ["", "src/**"],
|
|
59
|
-
mocha: "src/tests
|
|
59
|
+
mocha: "src/tests/**/*",
|
|
60
60
|
},
|
|
61
61
|
ignores: ["lib", "web", "gen", "src/gen"],
|
|
62
62
|
import: 3,
|
|
@@ -101,7 +101,7 @@ Allows you to define general environments for specific directory. The full confi
|
|
|
101
101
|
node: ["", "src/bin/**", "src/server/**"],
|
|
102
102
|
webapp: ["src/webapp/**", "webres/*/js/**"],
|
|
103
103
|
mobile: ["src/mobile/**"],
|
|
104
|
-
mocha: ["src/tests
|
|
104
|
+
mocha: ["src/**/*.test.*", "src/tests/**/*"],
|
|
105
105
|
},
|
|
106
106
|
}
|
|
107
107
|
```
|
|
@@ -110,6 +110,9 @@ The four type of environments are: "node", "webapp", "mobile" and "mocha". They
|
|
|
110
110
|
for the source files in the given directories, as well as restrict some rules (for example, if
|
|
111
111
|
"webapp" or "mobile" are defined, react will only apply to these directories).
|
|
112
112
|
|
|
113
|
+
The "mocha" environment expects a full file specification, where other environments will be applied
|
|
114
|
+
to directories.
|
|
115
|
+
|
|
113
116
|
As a shorthand, it is possible to set the `environments` property to a string, matching the
|
|
114
117
|
following options:
|
|
115
118
|
|
|
@@ -119,7 +122,7 @@ following options:
|
|
|
119
122
|
"environments": {
|
|
120
123
|
"node": ["", "src/bin/**", "src/server/**"],
|
|
121
124
|
"webapp": ["src/webapp/**", "webres/*/js/**"],
|
|
122
|
-
"mocha": "src/tests
|
|
125
|
+
"mocha": ["src/**/*.test.*", "src/tests/**/*"]
|
|
123
126
|
}
|
|
124
127
|
}
|
|
125
128
|
// "environments": "webapp"
|
|
@@ -137,14 +140,14 @@ following options:
|
|
|
137
140
|
// "environments": "library"
|
|
138
141
|
{
|
|
139
142
|
"environments": {
|
|
140
|
-
"mocha": "src/tests
|
|
143
|
+
"mocha": ["src/**/*.test.*", "src/tests/**/*"]
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
146
|
// "environments": "node"
|
|
144
147
|
{
|
|
145
148
|
"environments": {
|
|
146
149
|
"node": ["", "src/**"],
|
|
147
|
-
"mocha": "src/tests
|
|
150
|
+
"mocha": ["src/**/*.test.*", "src/tests/**/*"]
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
```
|
package/package.json
CHANGED
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@eslint/compat": "^1.2.3",
|
|
19
19
|
"@eslint/js": "^9.12.0",
|
|
20
|
-
"eslint": "^9.
|
|
20
|
+
"eslint": "^9.15.0",
|
|
21
21
|
"eslint-import-resolver-typescript": "^3.6.3",
|
|
22
22
|
"eslint-import-resolver-webpack": "^0.13.9",
|
|
23
|
-
"eslint-plugin-import-x": "^4.4.
|
|
23
|
+
"eslint-plugin-import-x": "^4.4.3",
|
|
24
24
|
"eslint-plugin-mocha": "^10.5.0",
|
|
25
|
-
"eslint-plugin-promise": "^7.
|
|
25
|
+
"eslint-plugin-promise": "^7.2.0",
|
|
26
26
|
"eslint-plugin-react": "^7.37.2",
|
|
27
27
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
28
28
|
"eslint-plugin-tsdoc": "^0.3.0",
|
|
29
29
|
"globals": "^15.12.0",
|
|
30
|
-
"prettier": "^3.
|
|
31
|
-
"typescript-eslint": "^8.
|
|
30
|
+
"prettier": "^3.4.1",
|
|
31
|
+
"typescript-eslint": "^8.16.0"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"prettier.config.js",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"test": "echo No test for this project"
|
|
113
113
|
},
|
|
114
114
|
"type": "module",
|
|
115
|
-
"version": "2.2.
|
|
115
|
+
"version": "2.2.2"
|
|
116
116
|
}
|
package/src/config/mocha.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import mochaPlugin from "eslint-plugin-mocha";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {getEnvDirectories} from "../pathutils.js";
|
|
4
4
|
import * as sections from "../sections.js";
|
|
5
5
|
|
|
6
6
|
export const apply = (configResult, eslintConfig) => {
|
|
7
7
|
if (!eslintConfig.mocha) return;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
esm: true,
|
|
11
|
-
javascript: true,
|
|
12
|
-
jsx: Boolean(eslintConfig.react),
|
|
13
|
-
typescript: eslintConfig.typescript,
|
|
14
|
-
};
|
|
15
|
-
const mochaFilter1 = getFilesEnv(eslintConfig, "mocha", undefined, fileTypes, "src/tests");
|
|
16
|
-
const mochaFilter2 = getFilesEnv(eslintConfig, "mocha", "*.test.ext", fileTypes, "src");
|
|
17
|
-
const files = [...mochaFilter1, ...mochaFilter2];
|
|
8
|
+
let files = getEnvDirectories("mocha", eslintConfig.environments);
|
|
9
|
+
if (!files || files.length === 0) files = ["src/**/*.test.*", "src/tests/**/*"];
|
|
18
10
|
const mochaSection = {...mochaPlugin.configs.flat.recommended, files};
|
|
19
11
|
configResult.push(mochaSection);
|
|
20
12
|
const override = sections.getNamedSection(configResult, "keeex/mocha");
|
package/src/config/react.js
CHANGED
|
@@ -46,7 +46,7 @@ export const apply = (configResult, eslintConfig) => {
|
|
|
46
46
|
"jsx-max-depth": ["warn", {max: 8}],
|
|
47
47
|
"jsx-no-bind": "error",
|
|
48
48
|
"jsx-no-constructed-context-values": "error",
|
|
49
|
-
"jsx-no-leaked-render": "warn",
|
|
49
|
+
"jsx-no-leaked-render": ["warn", {validStrategies: ["coerce"]}],
|
|
50
50
|
"jsx-no-script-url": "error",
|
|
51
51
|
"jsx-no-useless-fragment": "warn",
|
|
52
52
|
"jsx-pascal-case": ["warn", {allowNamespace: true}],
|
package/src/pathutils.js
CHANGED
|
@@ -3,12 +3,12 @@ const asArray = (value) => {
|
|
|
3
3
|
return [value];
|
|
4
4
|
};
|
|
5
5
|
const envShorthands = {
|
|
6
|
-
library: {mocha: "src/tests
|
|
6
|
+
library: {mocha: ["src/**/*.test.*", "src/tests/**/*"], node: ""},
|
|
7
7
|
mobile: {mobile: "src/**"},
|
|
8
|
-
node: {node: ["", "src/**"], mocha: "src/tests
|
|
8
|
+
node: {node: ["", "src/**"], mocha: ["src/**/*.test.*", "src/tests/**/*"]},
|
|
9
9
|
webapp: {webapp: ["src/**", "webres/*/js/**"]},
|
|
10
10
|
webservice: {
|
|
11
|
-
mocha: "src/tests
|
|
11
|
+
mocha: ["src/**/*.test.*", "src/tests/**/*"],
|
|
12
12
|
node: ["", "bin/**", "src/bin/**", "src/server/**"],
|
|
13
13
|
webapp: ["src/webapp/**", "webres/*/js/**"],
|
|
14
14
|
},
|