eslint-config-decent 2.1.0 → 2.2.1
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 +17 -7
- package/dist/index.cjs +2 -3
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +2 -3
- package/package.json +14 -14
- package/src/index.ts +2 -2
- package/src/jsdoc.ts +0 -1
- package/src/react.ts +2 -1
- package/src/rules/requireExtensionRule.ts +1 -1
- package/src/testingLibrary.ts +2 -1
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@ A decent ESLint configuration for TypeScript projects.
|
|
|
11
11
|
|
|
12
12
|
import { config } from 'eslint-config-decent';
|
|
13
13
|
|
|
14
|
-
export default config(
|
|
14
|
+
export default config({
|
|
15
|
+
tsconfigRootDir: import.meta.dirname,
|
|
16
|
+
});
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
## Override parserOptions
|
|
@@ -22,11 +24,12 @@ export default config();
|
|
|
22
24
|
import { config } from 'eslint-config-decent';
|
|
23
25
|
|
|
24
26
|
export default config({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
parserOptions: {
|
|
28
|
+
projectService: {
|
|
29
|
+
defaultProject: 'tsconfig.json',
|
|
30
|
+
},
|
|
31
|
+
tsconfigRootDir: import.meta.dirname,
|
|
28
32
|
},
|
|
29
|
-
tsconfigRootDir: import.meta.dirname,
|
|
30
33
|
});
|
|
31
34
|
```
|
|
32
35
|
|
|
@@ -39,6 +42,7 @@ import { config } from 'eslint-config-decent';
|
|
|
39
42
|
|
|
40
43
|
export default config({
|
|
41
44
|
enableRequireExtensions: false,
|
|
45
|
+
tsconfigRootDir: import.meta.dirname,
|
|
42
46
|
});
|
|
43
47
|
```
|
|
44
48
|
|
|
@@ -50,7 +54,9 @@ export default config({
|
|
|
50
54
|
import { config } from 'eslint-config-decent';
|
|
51
55
|
|
|
52
56
|
export default [
|
|
53
|
-
...config(
|
|
57
|
+
...config({
|
|
58
|
+
tsconfigRootDir: import.meta.dirname,
|
|
59
|
+
}),
|
|
54
60
|
{
|
|
55
61
|
files: ['**/*.ts'],
|
|
56
62
|
rules: {
|
|
@@ -68,7 +74,11 @@ export default [
|
|
|
68
74
|
import { tsEslintConfig } from 'eslint-config-decent';
|
|
69
75
|
import tsEslint from 'typescript-eslint';
|
|
70
76
|
|
|
71
|
-
export default tsEslint(
|
|
77
|
+
export default tsEslint(
|
|
78
|
+
...tsEslintConfig({
|
|
79
|
+
tsconfigRootDir: import.meta.dirname,
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
72
82
|
```
|
|
73
83
|
|
|
74
84
|
## License
|
package/dist/index.cjs
CHANGED
|
@@ -316,7 +316,7 @@ const requireExtensionRule = utils.ESLintUtils.RuleCreator(() => "https://github
|
|
|
316
316
|
if (!importPath || !importPath.startsWith(".") || importPath.endsWith(".js")) {
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
|
-
const resolvedPath = path.resolve(path.dirname(context.
|
|
319
|
+
const resolvedPath = path.resolve(path.dirname(context.filename), importPath);
|
|
320
320
|
if (!fs.existsSync(resolvedPath)) {
|
|
321
321
|
context.report({
|
|
322
322
|
node: source,
|
|
@@ -491,7 +491,6 @@ const base$7 = {
|
|
|
491
491
|
}
|
|
492
492
|
},
|
|
493
493
|
plugins: {
|
|
494
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
495
494
|
jsdoc: jsdoc__default
|
|
496
495
|
},
|
|
497
496
|
rules: {
|
|
@@ -761,7 +760,7 @@ function tsEslintConfig(options) {
|
|
|
761
760
|
projectService: {
|
|
762
761
|
defaultProject: "tsconfig.json"
|
|
763
762
|
},
|
|
764
|
-
tsconfigRootDir: undefined,
|
|
763
|
+
tsconfigRootDir: options?.tsconfigRootDir ?? undefined,
|
|
765
764
|
...options?.parserOptions
|
|
766
765
|
}
|
|
767
766
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -53,6 +53,7 @@ declare const configs: {
|
|
|
53
53
|
|
|
54
54
|
interface DefaultConfigOptions {
|
|
55
55
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
56
|
+
tsconfigRootDir?: string;
|
|
56
57
|
enableRequireExtensionRule?: boolean;
|
|
57
58
|
enableJest?: boolean;
|
|
58
59
|
enableMocha?: boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -53,6 +53,7 @@ declare const configs: {
|
|
|
53
53
|
|
|
54
54
|
interface DefaultConfigOptions {
|
|
55
55
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
56
|
+
tsconfigRootDir?: string;
|
|
56
57
|
enableRequireExtensionRule?: boolean;
|
|
57
58
|
enableJest?: boolean;
|
|
58
59
|
enableMocha?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ declare const configs: {
|
|
|
53
53
|
|
|
54
54
|
interface DefaultConfigOptions {
|
|
55
55
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
56
|
+
tsconfigRootDir?: string;
|
|
56
57
|
enableRequireExtensionRule?: boolean;
|
|
57
58
|
enableJest?: boolean;
|
|
58
59
|
enableMocha?: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -295,7 +295,7 @@ const requireExtensionRule = ESLintUtils.RuleCreator(() => "https://github.com/j
|
|
|
295
295
|
if (!importPath || !importPath.startsWith(".") || importPath.endsWith(".js")) {
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
-
const resolvedPath = resolve(dirname(context.
|
|
298
|
+
const resolvedPath = resolve(dirname(context.filename), importPath);
|
|
299
299
|
if (!existsSync(resolvedPath)) {
|
|
300
300
|
context.report({
|
|
301
301
|
node: source,
|
|
@@ -470,7 +470,6 @@ const base$7 = {
|
|
|
470
470
|
}
|
|
471
471
|
},
|
|
472
472
|
plugins: {
|
|
473
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
474
473
|
jsdoc
|
|
475
474
|
},
|
|
476
475
|
rules: {
|
|
@@ -740,7 +739,7 @@ function tsEslintConfig(options) {
|
|
|
740
739
|
projectService: {
|
|
741
740
|
defaultProject: "tsconfig.json"
|
|
742
741
|
},
|
|
743
|
-
tsconfigRootDir: import.meta.dirname,
|
|
742
|
+
tsconfigRootDir: options?.tsconfigRootDir ?? import.meta.dirname,
|
|
744
743
|
...options?.parserOptions
|
|
745
744
|
}
|
|
746
745
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-decent",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "A decent ESLint configuration",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -73,36 +73,36 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@eslint/compat": "1.1.1",
|
|
76
|
-
"@eslint/js": "9.
|
|
77
|
-
"@typescript-eslint/utils": "8.
|
|
76
|
+
"@eslint/js": "9.10.0",
|
|
77
|
+
"@typescript-eslint/utils": "8.5.0",
|
|
78
78
|
"eslint-config-prettier": "9.1.0",
|
|
79
|
-
"eslint-plugin-import-x": "
|
|
80
|
-
"eslint-plugin-jest": "28.8.
|
|
79
|
+
"eslint-plugin-import-x": "4.2.1",
|
|
80
|
+
"eslint-plugin-jest": "28.8.3",
|
|
81
81
|
"eslint-plugin-jest-dom": "5.4.0",
|
|
82
|
-
"eslint-plugin-jsdoc": "50.
|
|
83
|
-
"eslint-plugin-jsx-a11y": "6.
|
|
82
|
+
"eslint-plugin-jsdoc": "50.2.2",
|
|
83
|
+
"eslint-plugin-jsx-a11y": "6.10.0",
|
|
84
84
|
"eslint-plugin-mocha": "10.5.0",
|
|
85
85
|
"eslint-plugin-prettier": "5.2.1",
|
|
86
86
|
"eslint-plugin-promise": "7.1.0",
|
|
87
|
-
"eslint-plugin-react": "7.35.
|
|
87
|
+
"eslint-plugin-react": "7.35.2",
|
|
88
88
|
"eslint-plugin-react-hooks": "4.6.2",
|
|
89
89
|
"eslint-plugin-security": "3.0.1",
|
|
90
90
|
"eslint-plugin-testing-library": "6.3.0",
|
|
91
91
|
"eslint-plugin-unicorn": "55.0.0",
|
|
92
92
|
"globals": "15.9.0",
|
|
93
|
-
"typescript-eslint": "8.
|
|
93
|
+
"typescript-eslint": "8.5.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@swc/core": "^1.7.
|
|
96
|
+
"@swc/core": "^1.7.24",
|
|
97
97
|
"@types/node": ">=22",
|
|
98
|
-
"eslint": "^9.
|
|
99
|
-
"husky": "^9.1.
|
|
100
|
-
"lint-staged": "^15.2.
|
|
98
|
+
"eslint": "^9.10.0",
|
|
99
|
+
"husky": "^9.1.5",
|
|
100
|
+
"lint-staged": "^15.2.10",
|
|
101
101
|
"markdownlint-cli": "^0.41.0",
|
|
102
102
|
"npm-run-all": "^4.1.5",
|
|
103
103
|
"pinst": "^3.0.0",
|
|
104
104
|
"prettier": "^3.3.3",
|
|
105
|
-
"typescript": "^5.
|
|
105
|
+
"typescript": "^5.6.2",
|
|
106
106
|
"unbuild": "2.0.0"
|
|
107
107
|
},
|
|
108
108
|
"overrides": {
|
package/src/index.ts
CHANGED
|
@@ -34,6 +34,7 @@ export {
|
|
|
34
34
|
|
|
35
35
|
export interface DefaultConfigOptions {
|
|
36
36
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
37
|
+
tsconfigRootDir?: string;
|
|
37
38
|
enableRequireExtensionRule?: boolean;
|
|
38
39
|
enableJest?: boolean;
|
|
39
40
|
enableMocha?: boolean;
|
|
@@ -65,12 +66,11 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
|
|
|
65
66
|
projectService: {
|
|
66
67
|
defaultProject: 'tsconfig.json',
|
|
67
68
|
},
|
|
68
|
-
tsconfigRootDir: import.meta.dirname,
|
|
69
|
+
tsconfigRootDir: options?.tsconfigRootDir ?? import.meta.dirname,
|
|
69
70
|
...options?.parserOptions,
|
|
70
71
|
},
|
|
71
72
|
};
|
|
72
73
|
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
74
74
|
return [
|
|
75
75
|
{
|
|
76
76
|
ignores: ['**/dist/**', '**/node_modules/**'],
|
package/src/jsdoc.ts
CHANGED
package/src/react.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FixupPluginDefinition } from '@eslint/compat';
|
|
1
2
|
import { fixupPluginRules } from '@eslint/compat';
|
|
2
3
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
3
4
|
import a11y from 'eslint-plugin-jsx-a11y';
|
|
@@ -16,7 +17,7 @@ const base: TSESLint.FlatConfig.Config = {
|
|
|
16
17
|
plugins: {
|
|
17
18
|
'jsx-a11y': a11y,
|
|
18
19
|
react,
|
|
19
|
-
'react-hooks': fixupPluginRules(reactHooks) as typeof reactHooks,
|
|
20
|
+
'react-hooks': fixupPluginRules(reactHooks as FixupPluginDefinition) as typeof reactHooks,
|
|
20
21
|
},
|
|
21
22
|
rules: {
|
|
22
23
|
...a11y.configs.recommended.rules,
|
|
@@ -29,7 +29,7 @@ export const requireExtensionRule = ESLintUtils.RuleCreator(() => 'https://githu
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const resolvedPath = resolve(dirname(context.
|
|
32
|
+
const resolvedPath = resolve(dirname(context.filename), importPath);
|
|
33
33
|
|
|
34
34
|
// If the import/export path doesn't end with a file extension, report an error
|
|
35
35
|
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
package/src/testingLibrary.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { FixupPluginDefinition } from '@eslint/compat';
|
|
1
2
|
import { fixupPluginRules } from '@eslint/compat';
|
|
2
3
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
3
4
|
import testingLibrary from 'eslint-plugin-testing-library';
|
|
4
5
|
|
|
5
6
|
const base: TSESLint.FlatConfig.Config = {
|
|
6
7
|
plugins: {
|
|
7
|
-
'testing-library': fixupPluginRules(testingLibrary) as typeof testingLibrary,
|
|
8
|
+
'testing-library': fixupPluginRules(testingLibrary as FixupPluginDefinition) as typeof testingLibrary,
|
|
8
9
|
},
|
|
9
10
|
rules: {
|
|
10
11
|
...testingLibrary.configs['flat/react'].rules,
|