@fullstacksjs/eslint-config 11.8.0 → 11.8.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/cjs/modules/imports.js +23 -18
- package/package.json +1 -2
- package/src/modules/imports.mjs +23 -21
package/cjs/modules/imports.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var _eslintImportResolverTypescript = require("eslint-import-resolver-typescript");
|
|
8
7
|
var _eslintPluginImportX = _interopRequireDefault(require("eslint-plugin-import-x"));
|
|
9
8
|
var _conditions = require("../utils/conditions.js");
|
|
10
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -18,28 +17,28 @@ const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
|
18
17
|
*/
|
|
19
18
|
function imports(options = {}) {
|
|
20
19
|
const isObject = typeof options.import === 'object';
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const opt = options.esm ? 'always' : 'never';
|
|
21
|
+
const extensionOptions = {
|
|
22
|
+
ignorePackages: true,
|
|
23
|
+
js: opt,
|
|
24
|
+
jsx: opt,
|
|
25
|
+
mjs: opt,
|
|
26
|
+
cjs: opt,
|
|
27
|
+
...(options.typescript && {
|
|
28
|
+
ts: opt,
|
|
29
|
+
tsx: opt,
|
|
30
|
+
mts: opt,
|
|
31
|
+
cts: opt
|
|
32
|
+
})
|
|
33
|
+
};
|
|
30
34
|
const config = {
|
|
31
35
|
plugins: {
|
|
32
36
|
import: _eslintPluginImportX.default
|
|
33
37
|
},
|
|
34
38
|
settings: {
|
|
35
39
|
'import-x/extensions': jsExtensions,
|
|
36
|
-
'import-x/
|
|
37
|
-
'import-x/ignore': ['node_modules', '\\.(scss|css|svg|json)$'],
|
|
40
|
+
'import-x/ignore': ['node_modules', '\\.(scss|css|svg|json|mdx)$'],
|
|
38
41
|
...(0, _conditions.predicate)(options.typescript, {
|
|
39
|
-
'import-x/resolver-next': [(0, _eslintImportResolverTypescript.createTypeScriptImportResolver)({
|
|
40
|
-
alwaysTryTypes: true,
|
|
41
|
-
project: options.typescript.projects
|
|
42
|
-
})],
|
|
43
42
|
'import-x/parsers': {
|
|
44
43
|
'@typescript-eslint/parser': tsExtensions
|
|
45
44
|
},
|
|
@@ -56,7 +55,7 @@ function imports(options = {}) {
|
|
|
56
55
|
},
|
|
57
56
|
rules: {
|
|
58
57
|
'import/consistent-type-specifier-style': ['warn', 'prefer-top-level'],
|
|
59
|
-
'import/extensions': ['error', 'ignorePackages',
|
|
58
|
+
// 'import/extensions': ['error', 'ignorePackages', extensionOptions], FIXME: This rule is broken!
|
|
60
59
|
'import/first': 'error',
|
|
61
60
|
'import/newline-after-import': 'warn',
|
|
62
61
|
'import/no-absolute-path': 'error',
|
|
@@ -106,7 +105,13 @@ function imports(options = {}) {
|
|
|
106
105
|
'import/no-unassigned-import': 'off',
|
|
107
106
|
'import/no-unused-modules': 'off',
|
|
108
107
|
'import/prefer-default-export': 'off',
|
|
109
|
-
'import/unambiguous': 'off'
|
|
108
|
+
'import/unambiguous': 'off',
|
|
109
|
+
...(0, _conditions.predicate)(options.typescript, {
|
|
110
|
+
'import/default': 'off',
|
|
111
|
+
'import/named': 'off',
|
|
112
|
+
'import/no-named-as-default-member': 'off',
|
|
113
|
+
'import/no-unresolved': 'off'
|
|
114
|
+
})
|
|
110
115
|
}
|
|
111
116
|
};
|
|
112
117
|
return config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstacksjs/eslint-config",
|
|
3
|
-
"version": "11.8.
|
|
3
|
+
"version": "11.8.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "fullstacks <fullstacksjs@gmail.com>",
|
|
6
6
|
"description": "fullstacks eslint config",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"@next/eslint-plugin-next": "15.1.7",
|
|
39
39
|
"@stylistic/eslint-plugin": "4.1.0",
|
|
40
40
|
"deepmerge": "4.3.1",
|
|
41
|
-
"eslint-import-resolver-typescript": "4.2.2",
|
|
42
41
|
"eslint-plugin-cypress": "4.1.0",
|
|
43
42
|
"eslint-plugin-import-x": "4.6.1",
|
|
44
43
|
"eslint-plugin-jest": "28.11.0",
|
package/src/modules/imports.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
|
|
2
1
|
import plugin from 'eslint-plugin-import-x';
|
|
3
2
|
|
|
4
3
|
import { predicate } from '../utils/conditions.mjs';
|
|
@@ -13,31 +12,27 @@ const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
|
13
12
|
*/
|
|
14
13
|
function imports(options = {}) {
|
|
15
14
|
const isObject = typeof options.import === 'object';
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const opt = options.esm ? 'always' : 'never';
|
|
16
|
+
const extensionOptions = {
|
|
17
|
+
ignorePackages: true,
|
|
18
|
+
js: opt,
|
|
19
|
+
jsx: opt,
|
|
20
|
+
mjs: opt,
|
|
21
|
+
cjs: opt,
|
|
22
|
+
...(options.typescript && {
|
|
23
|
+
ts: opt,
|
|
24
|
+
tsx: opt,
|
|
25
|
+
mts: opt,
|
|
26
|
+
cts: opt,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
26
29
|
|
|
27
30
|
const config = {
|
|
28
31
|
plugins: { import: plugin },
|
|
29
|
-
|
|
30
32
|
settings: {
|
|
31
33
|
'import-x/extensions': jsExtensions,
|
|
32
|
-
'import-x/
|
|
33
|
-
'import-x/ignore': ['node_modules', '\\.(scss|css|svg|json)$'],
|
|
34
|
+
'import-x/ignore': ['node_modules', '\\.(scss|css|svg|json|mdx)$'],
|
|
34
35
|
...predicate(options.typescript, {
|
|
35
|
-
'import-x/resolver-next': [
|
|
36
|
-
createTypeScriptImportResolver({
|
|
37
|
-
alwaysTryTypes: true,
|
|
38
|
-
project: options.typescript.projects,
|
|
39
|
-
}),
|
|
40
|
-
],
|
|
41
36
|
'import-x/parsers': { '@typescript-eslint/parser': tsExtensions },
|
|
42
37
|
'import-x/extensions': allExtensions,
|
|
43
38
|
}),
|
|
@@ -51,7 +46,7 @@ function imports(options = {}) {
|
|
|
51
46
|
|
|
52
47
|
rules: {
|
|
53
48
|
'import/consistent-type-specifier-style': ['warn', 'prefer-top-level'],
|
|
54
|
-
'import/extensions': ['error', 'ignorePackages',
|
|
49
|
+
// 'import/extensions': ['error', 'ignorePackages', extensionOptions], FIXME: This rule is broken!
|
|
55
50
|
'import/first': 'error',
|
|
56
51
|
'import/newline-after-import': 'warn',
|
|
57
52
|
'import/no-absolute-path': 'error',
|
|
@@ -98,6 +93,13 @@ function imports(options = {}) {
|
|
|
98
93
|
'import/no-unused-modules': 'off',
|
|
99
94
|
'import/prefer-default-export': 'off',
|
|
100
95
|
'import/unambiguous': 'off',
|
|
96
|
+
|
|
97
|
+
...predicate(options.typescript, {
|
|
98
|
+
'import/default': 'off',
|
|
99
|
+
'import/named': 'off',
|
|
100
|
+
'import/no-named-as-default-member': 'off',
|
|
101
|
+
'import/no-unresolved': 'off',
|
|
102
|
+
}),
|
|
101
103
|
},
|
|
102
104
|
};
|
|
103
105
|
|