@neolution-ch/eslint-config-neolution 2.1.0 → 2.2.0
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 +13 -13
- package/dist/configs/javascript.d.ts.map +1 -1
- package/dist/configs/javascript.js +2 -6
- package/dist/configs/javascript.js.map +1 -1
- package/dist/configs/providers/typescript.d.ts.map +1 -1
- package/dist/configs/providers/typescript.js +45 -1
- package/dist/configs/providers/typescript.js.map +1 -1
- package/dist/configs/providers/unicorn.d.ts.map +1 -1
- package/dist/configs/providers/unicorn.js +4 -0
- package/dist/configs/providers/unicorn.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -21,19 +21,19 @@ export default [...neolutionEslintConfig.configs.flat.nextjs];
|
|
|
21
21
|
|
|
22
22
|
### Configs
|
|
23
23
|
|
|
24
|
-
| ruleset
|
|
25
|
-
|
|
26
|
-
| eslint.configs.recommended
|
|
27
|
-
| unicorn/recommended
|
|
28
|
-
| typeScriptEslint.configs.recommended
|
|
29
|
-
| eslintPluginReact.configs.flat.recommended
|
|
30
|
-
| eslintPluginReact.configs.flat["jsx-runtime"]
|
|
31
|
-
| eslintPluginPrettierRecommended
|
|
32
|
-
| next/next/recommended
|
|
33
|
-
| import/typescript
|
|
34
|
-
| react-hooks
|
|
35
|
-
| cypress/recommended
|
|
36
|
-
| eslint-plugin-no-only-tests
|
|
24
|
+
| ruleset | nextjs | cypress | react-library | typescript | javascript |
|
|
25
|
+
| --------------------------------------------- | :-----: | :-----: | :-----------: | :--------: | :--------: |
|
|
26
|
+
| eslint.configs.recommended | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
27
|
+
| unicorn/recommended | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
28
|
+
| typeScriptEslint.configs.recommended | ✓ | ✓ | ✓ | ✓ | ✗ |
|
|
29
|
+
| eslintPluginReact.configs.flat.recommended | ✓ | ✓ | ✓ | ✗ | ✗ |
|
|
30
|
+
| eslintPluginReact.configs.flat["jsx-runtime"] | ✓ | ✓ | ✓ | ✗ | ✗ |
|
|
31
|
+
| eslintPluginPrettierRecommended | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
32
|
+
| next/next/recommended | ✓ | ✗ | ✗ | ✗ | ✗ |
|
|
33
|
+
| import/typescript | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
34
|
+
| react-hooks | ✓ | ✗ | ✓ | ✗ | ✗ |
|
|
35
|
+
| cypress/recommended | ✗ | ✓ | ✗ | ✗ | ✗ |
|
|
36
|
+
| eslint-plugin-no-only-tests | ✗ | ✓ | ✗ | ✗ | ✗ |
|
|
37
37
|
|
|
38
38
|
## License
|
|
39
39
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../src/configs/javascript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,QAAA,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../src/configs/javascript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,QAAA,MAAM,gBAAgB,EAAE,iBAQvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -2,14 +2,10 @@ const javascriptConfig = {
|
|
|
2
2
|
defaults: true,
|
|
3
3
|
esLintRecommended: true,
|
|
4
4
|
unicorn: true,
|
|
5
|
-
reactRecommended: true,
|
|
6
|
-
reactJsxRuntime: true,
|
|
7
|
-
prettierRecommended: true,
|
|
8
|
-
next: true,
|
|
9
5
|
import: true,
|
|
10
|
-
|
|
11
|
-
onlyError: true,
|
|
6
|
+
prettierRecommended: true,
|
|
12
7
|
jsdoc: true,
|
|
8
|
+
onlyError: true,
|
|
13
9
|
};
|
|
14
10
|
export default javascriptConfig;
|
|
15
11
|
//# sourceMappingURL=javascript.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"javascript.js","sourceRoot":"","sources":["../../src/configs/javascript.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAsB;IAC1C,QAAQ,EAAE,IAAI;IACd,iBAAiB,EAAE,IAAI;IACvB,OAAO,EAAE,IAAI;IACb,
|
|
1
|
+
{"version":3,"file":"javascript.js","sourceRoot":"","sources":["../../src/configs/javascript.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAsB;IAC1C,QAAQ,EAAE,IAAI;IACd,iBAAiB,EAAE,IAAI;IACvB,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;IACZ,mBAAmB,EAAE,IAAI;IACzB,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/configs/providers/typescript.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/configs/providers/typescript.ts"],"names":[],"mappings":"AAqCA,QAAA,MAAM,eAAe,qEA0DpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
import { config, configs } from "typescript-eslint";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
const findTsConfigRootDir = () => {
|
|
5
|
+
try {
|
|
6
|
+
const findTsConfigRootDirInternal = (directory, filename) => {
|
|
7
|
+
let fileStats;
|
|
8
|
+
try {
|
|
9
|
+
fileStats = fs.statSync(path.join(directory, filename));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
// Do nothing
|
|
13
|
+
}
|
|
14
|
+
// If the file exists and is a file, return the directory
|
|
15
|
+
if (fileStats?.isFile()) {
|
|
16
|
+
return directory;
|
|
17
|
+
}
|
|
18
|
+
// Don't continue when already at the fs root
|
|
19
|
+
if (directory === path.resolve("/")) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
// Recursively check the parent directory
|
|
23
|
+
return findTsConfigRootDirInternal(path.dirname(directory), filename);
|
|
24
|
+
};
|
|
25
|
+
return findTsConfigRootDirInternal(process.cwd(), "tsconfig.json");
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
2
31
|
const typescriptRules = config(configs.eslintRecommended, configs.recommended, configs.recommendedTypeChecked.map((rule) => ({
|
|
3
32
|
...rule,
|
|
4
33
|
files: ["**/*.ts", "**/*.tsx", "**/*.mts"], // We use TS config only for TS files
|
|
@@ -9,6 +38,10 @@ const typescriptRules = config(configs.eslintRecommended, configs.recommended, c
|
|
|
9
38
|
parserOptions: {
|
|
10
39
|
project: true,
|
|
11
40
|
parser: "@typescript-eslint/parser",
|
|
41
|
+
// typescript-eslint defaults to process.cwd() but this is not always correct,
|
|
42
|
+
// for example Visual Studio runs eslint from the folder of the file open in
|
|
43
|
+
// the editor and not the root of the project
|
|
44
|
+
tsconfigRootDir: findTsConfigRootDir() ?? process.cwd(),
|
|
12
45
|
},
|
|
13
46
|
},
|
|
14
47
|
}, {
|
|
@@ -30,7 +63,18 @@ const typescriptRules = config(configs.eslintRecommended, configs.recommended, c
|
|
|
30
63
|
"@typescript-eslint/unbound-method": "off",
|
|
31
64
|
// https://github.com/typescript-eslint/typescript-eslint/issues/2621
|
|
32
65
|
"no-unused-vars": "off",
|
|
33
|
-
"@typescript-eslint/no-unused-vars":
|
|
66
|
+
"@typescript-eslint/no-unused-vars": [
|
|
67
|
+
"error",
|
|
68
|
+
{
|
|
69
|
+
args: "all",
|
|
70
|
+
argsIgnorePattern: "^_",
|
|
71
|
+
caughtErrors: "all",
|
|
72
|
+
caughtErrorsIgnorePattern: "^_",
|
|
73
|
+
destructuredArrayIgnorePattern: "^_",
|
|
74
|
+
varsIgnorePattern: "^_",
|
|
75
|
+
ignoreRestSiblings: true,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
34
78
|
},
|
|
35
79
|
});
|
|
36
80
|
export default typescriptRules;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/configs/providers/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/configs/providers/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,mBAAmB,GAAG,GAAG,EAAE;IAC/B,IAAI,CAAC;QACH,MAAM,2BAA2B,GAAG,CAClC,SAAiB,EACjB,QAAgB,EAChB,EAAE;YACF,IAAI,SAA+B,CAAC;YACpC,IAAI,CAAC;gBACH,SAAS,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC1D,CAAC;YAAC,MAAM,CAAC;gBACP,aAAa;YACf,CAAC;YAED,yDAAyD;YACzD,IAAI,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;gBACxB,OAAO,SAAS,CAAC;YACnB,CAAC;YAED,6CAA6C;YAC7C,IAAI,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBACpC,OAAO,IAAI,CAAC;YACd,CAAC;YAED,yCAAyC;YACzC,OAAO,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;QACxE,CAAC,CAAC;QAEF,OAAO,2BAA2B,CAAC,OAAO,CAAC,GAAG,EAAE,EA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gBACvB,kBAAkB,EAAE,IAAI;aACzB;SACF;KACF;CACF,CACF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../../src/configs/providers/unicorn.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"unicorn.d.ts","sourceRoot":"","sources":["../../../src/configs/providers/unicorn.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,YAAY,qEAqCjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -11,6 +11,10 @@ const unicornRules = config(eslintPluginUnicorn.configs["flat/recommended"], {
|
|
|
11
11
|
"unicorn/prefer-query-selector": "off",
|
|
12
12
|
"unicorn/switch-case-braces": "off",
|
|
13
13
|
"unicorn/no-null": "off",
|
|
14
|
+
"unicorn/no-useless-undefined": [
|
|
15
|
+
"error",
|
|
16
|
+
{ checkArrowFunctionBody: false },
|
|
17
|
+
],
|
|
14
18
|
},
|
|
15
19
|
}, {
|
|
16
20
|
files: ["**/pages/**/*.page.tsx"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unicorn.js","sourceRoot":"","sources":["../../../src/configs/providers/unicorn.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,YAAY,GAAG,MAAM,CACzB,mBAAmB,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC/C;IACE,KAAK,EAAE;QACL,+BAA+B,EAAE,KAAK;QACtC,uBAAuB,EAAE,KAAK;QAC9B,oCAAoC,EAAE,KAAK;QAC3C,8BAA8B,EAAE,KAAK;QACrC,4BAA4B,EAAE,KAAK;QACnC,qCAAqC,EAAE,KAAK;QAC5C,+BAA+B,EAAE,KAAK;QACtC,4BAA4B,EAAE,KAAK;QACnC,iBAAiB,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"unicorn.js","sourceRoot":"","sources":["../../../src/configs/providers/unicorn.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,YAAY,GAAG,MAAM,CACzB,mBAAmB,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC/C;IACE,KAAK,EAAE;QACL,+BAA+B,EAAE,KAAK;QACtC,uBAAuB,EAAE,KAAK;QAC9B,oCAAoC,EAAE,KAAK;QAC3C,8BAA8B,EAAE,KAAK;QACrC,4BAA4B,EAAE,KAAK;QACnC,qCAAqC,EAAE,KAAK;QAC5C,+BAA+B,EAAE,KAAK;QACtC,4BAA4B,EAAE,KAAK;QACnC,iBAAiB,EAAE,KAAK;QACxB,8BAA8B,EAAE;YAC9B,OAAO;YACP,EAAE,sBAAsB,EAAE,KAAK,EAAE;SAClC;KACF;CACF,EACD;IACE,KAAK,EAAE,CAAC,wBAAwB,CAAC;IACjC,KAAK,EAAE;QACL,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;KAC1D;CACF,EACD;IACE,KAAK,EAAE,CAAC,wBAAwB,CAAC;IACjC,KAAK,EAAE;QACL,uBAAuB,EAAE,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;KAC3D;CACF,EACD;IACE,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;IAC9B,KAAK,EAAE;QACL,uBAAuB,EAAE,KAAK;KAC/B;CACF,CACF,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neolution-ch/eslint-config-neolution",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "This package provides Neolution's .eslintrc as an extensible shared config.",
|
|
5
5
|
"homepage": "https://github.com/neolution-ch/eslint-config-neolution",
|
|
6
6
|
"type": "module",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"@release-it/keep-a-changelog": "^6.0.0",
|
|
55
55
|
"@types/eslint-config-prettier": "^6.11.3",
|
|
56
56
|
"@types/eslint__eslintrc": "^2.1.2",
|
|
57
|
+
"@types/node": "^22.15.32",
|
|
57
58
|
"eslint": "^9.18.0",
|
|
58
59
|
"npm-check-updates": "^16.3.8",
|
|
59
60
|
"prettier": "^3.4.2",
|