@w5s/eslint-config 2.0.30 → 2.1.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/dist/rules/es/import.js +19 -6
- package/package.json +5 -4
- package/src/rules/es/import.ts +21 -6
package/dist/rules/es/import.js
CHANGED
|
@@ -7,6 +7,14 @@ const dev_1 = require("@w5s/dev");
|
|
|
7
7
|
const imports_1 = __importDefault(require("eslint-config-airbnb-base/rules/imports"));
|
|
8
8
|
// @see https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import
|
|
9
9
|
const extensionsToMatcher = (extensions) => `.{${extensions.map((_) => _.slice(1)).join(',')}}`;
|
|
10
|
+
const configFiles = [
|
|
11
|
+
// plopfile.js, plopfile.cjs, plopfile.mts, plopfile.ts, ...
|
|
12
|
+
`plopfile${extensionsToMatcher(dev_1.Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
13
|
+
// dangerfile.js, dangerfile.cjs, dangerfile.mts, dangerfile.ts, ...
|
|
14
|
+
`dangerfile${extensionsToMatcher(dev_1.Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
15
|
+
// *.config.js, *.config.cjs, *.config.mts, *.config.ts, ...
|
|
16
|
+
`**/*.config${extensionsToMatcher(dev_1.Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
17
|
+
];
|
|
10
18
|
const config = dev_1.ESLintConfig.concat(imports_1.default,
|
|
11
19
|
// Overrides
|
|
12
20
|
{
|
|
@@ -20,6 +28,7 @@ const config = dev_1.ESLintConfig.concat(imports_1.default,
|
|
|
20
28
|
// mjs: 'never',
|
|
21
29
|
},
|
|
22
30
|
],
|
|
31
|
+
'import/no-default-export': 'error', // Default exports are bad, especially when refactoring/renaming module
|
|
23
32
|
'import/no-deprecated': 'off', // Performance issues
|
|
24
33
|
'import/no-extraneous-dependencies': [
|
|
25
34
|
'error',
|
|
@@ -27,12 +36,7 @@ const config = dev_1.ESLintConfig.concat(imports_1.default,
|
|
|
27
36
|
...imports_1.default.rules['import/no-extraneous-dependencies'][1],
|
|
28
37
|
devDependencies: [
|
|
29
38
|
...imports_1.default.rules['import/no-extraneous-dependencies'][1].devDependencies,
|
|
30
|
-
|
|
31
|
-
`plopfile${extensionsToMatcher(dev_1.Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
32
|
-
// dangerfile.js, dangerfile.cjs, dangerfile.mts, dangerfile.ts, ...
|
|
33
|
-
`dangerfile${extensionsToMatcher(dev_1.Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
34
|
-
// *.config.js, *.config.cjs, *.config.mts, *.config.ts, ...
|
|
35
|
-
`**/*.config${extensionsToMatcher(dev_1.Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
39
|
+
...configFiles,
|
|
36
40
|
],
|
|
37
41
|
},
|
|
38
42
|
],
|
|
@@ -57,5 +61,14 @@ const config = dev_1.ESLintConfig.concat(imports_1.default,
|
|
|
57
61
|
},
|
|
58
62
|
},
|
|
59
63
|
},
|
|
64
|
+
}, {
|
|
65
|
+
overrides: [
|
|
66
|
+
{
|
|
67
|
+
files: configFiles,
|
|
68
|
+
rules: {
|
|
69
|
+
'import/no-default-export': 'off', // Enable default exports only for config files
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
60
73
|
});
|
|
61
74
|
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@rushstack/eslint-patch": "^1.1.0",
|
|
37
37
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
38
38
|
"@typescript-eslint/parser": "^8.0.0",
|
|
39
|
-
"@w5s/dev": "^2.2.
|
|
40
|
-
"@w5s/prettier-config": "^2.0
|
|
39
|
+
"@w5s/dev": "^2.2.13",
|
|
40
|
+
"@w5s/prettier-config": "^2.1.0",
|
|
41
41
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
42
42
|
"eslint-config-prettier": "^9.0.0",
|
|
43
43
|
"eslint-plugin-import": "^2.25.0",
|
|
@@ -70,5 +70,6 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"
|
|
73
|
+
"sideEffect": false,
|
|
74
|
+
"gitHead": "8342e0884a000565d2727d65092ae024ac6c0669"
|
|
74
75
|
}
|
package/src/rules/es/import.ts
CHANGED
|
@@ -7,6 +7,15 @@ import importConfig from 'eslint-config-airbnb-base/rules/imports';
|
|
|
7
7
|
|
|
8
8
|
const extensionsToMatcher = (extensions: readonly Project.Extension[]): string =>
|
|
9
9
|
`.{${extensions.map((_) => _.slice(1)).join(',')}}`;
|
|
10
|
+
const configFiles = [
|
|
11
|
+
// plopfile.js, plopfile.cjs, plopfile.mts, plopfile.ts, ...
|
|
12
|
+
`plopfile${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
13
|
+
// dangerfile.js, dangerfile.cjs, dangerfile.mts, dangerfile.ts, ...
|
|
14
|
+
`dangerfile${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
15
|
+
// *.config.js, *.config.cjs, *.config.mts, *.config.ts, ...
|
|
16
|
+
`**/*.config${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
17
|
+
];
|
|
18
|
+
|
|
10
19
|
const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
11
20
|
importConfig,
|
|
12
21
|
// Overrides
|
|
@@ -21,6 +30,7 @@ const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
|
21
30
|
// mjs: 'never',
|
|
22
31
|
},
|
|
23
32
|
],
|
|
33
|
+
'import/no-default-export': 'error', // Default exports are bad, especially when refactoring/renaming module
|
|
24
34
|
'import/no-deprecated': 'off', // Performance issues
|
|
25
35
|
'import/no-extraneous-dependencies': [
|
|
26
36
|
'error',
|
|
@@ -28,12 +38,7 @@ const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
|
28
38
|
...importConfig.rules['import/no-extraneous-dependencies'][1],
|
|
29
39
|
devDependencies: [
|
|
30
40
|
...importConfig.rules['import/no-extraneous-dependencies'][1].devDependencies,
|
|
31
|
-
|
|
32
|
-
`plopfile${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
33
|
-
// dangerfile.js, dangerfile.cjs, dangerfile.mts, dangerfile.ts, ...
|
|
34
|
-
`dangerfile${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
35
|
-
// *.config.js, *.config.cjs, *.config.mts, *.config.ts, ...
|
|
36
|
-
`**/*.config${extensionsToMatcher(Project.queryExtensions(['javascript', 'typescript']))}`,
|
|
41
|
+
...configFiles,
|
|
37
42
|
],
|
|
38
43
|
},
|
|
39
44
|
],
|
|
@@ -60,6 +65,16 @@ const config: eslint.Linter.Config = ESLintConfig.concat(
|
|
|
60
65
|
},
|
|
61
66
|
},
|
|
62
67
|
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
overrides: [
|
|
71
|
+
{
|
|
72
|
+
files: configFiles,
|
|
73
|
+
rules: {
|
|
74
|
+
'import/no-default-export': 'off', // Enable default exports only for config files
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
63
78
|
}
|
|
64
79
|
);
|
|
65
80
|
|