@nice-move/eslint-config-base 0.8.8 → 0.8.11
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/lib/import.cjs +18 -4
- package/lib/mini.cjs +1 -1
- package/lib/node-next-resolver.cjs +45 -0
- package/lib/typescript.cjs +20 -0
- package/lib/unicorn.cjs +0 -1
- package/package.json +8 -7
package/lib/import.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { join } = require('path');
|
|
3
|
+
const { join } = require('node:path');
|
|
4
4
|
const { pkgHas, configHas } = require('./utils.cjs');
|
|
5
5
|
|
|
6
6
|
const Vscode = pkgHas(
|
|
@@ -44,9 +44,19 @@ module.exports = {
|
|
|
44
44
|
},
|
|
45
45
|
settings: {
|
|
46
46
|
...Vscode,
|
|
47
|
-
'import/extensions': [
|
|
47
|
+
'import/extensions': [
|
|
48
|
+
'.tsx',
|
|
49
|
+
'.ts',
|
|
50
|
+
'.cts',
|
|
51
|
+
'.mts',
|
|
52
|
+
'.vue',
|
|
53
|
+
'.jsx',
|
|
54
|
+
'.js',
|
|
55
|
+
'.mjs',
|
|
56
|
+
'.cjs',
|
|
57
|
+
],
|
|
48
58
|
'import/parsers': {
|
|
49
|
-
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
59
|
+
'@typescript-eslint/parser': ['.ts', '.cts', '.mts', '.tsx'],
|
|
50
60
|
'vue-eslint-parser': ['.vue'],
|
|
51
61
|
[require.resolve('./jsx-parser.cjs')]: ['.jsx'],
|
|
52
62
|
},
|
|
@@ -55,6 +65,10 @@ module.exports = {
|
|
|
55
65
|
({ 'internal-regex': internalRegex }) => internalRegex,
|
|
56
66
|
(internalRegex) => ({ 'import/internal-regex': internalRegex }),
|
|
57
67
|
),
|
|
68
|
+
'import/resolver': {
|
|
69
|
+
node: false,
|
|
70
|
+
[require.resolve('./node-next-resolver.cjs')]: {},
|
|
71
|
+
},
|
|
58
72
|
},
|
|
59
73
|
overrides: [
|
|
60
74
|
pkgHas(
|
|
@@ -71,7 +85,7 @@ module.exports = {
|
|
|
71
85
|
),
|
|
72
86
|
{
|
|
73
87
|
files: '**/*.*',
|
|
74
|
-
excludedFiles: '*.{m,c}
|
|
88
|
+
excludedFiles: '*.{m,c}{j,t}s',
|
|
75
89
|
rules: {
|
|
76
90
|
'import/no-nodejs-modules': 'error',
|
|
77
91
|
},
|
package/lib/mini.cjs
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const { resolve: resolveExports } = require('resolve.exports');
|
|
5
|
+
const { builtinModules } = require('node:module');
|
|
6
|
+
|
|
7
|
+
const withNodeLabel = builtinModules.map((item) => `node:${item}`);
|
|
8
|
+
|
|
9
|
+
const builtins = new Set([...builtinModules, ...withNodeLabel]);
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
interfaceVersion: 2,
|
|
13
|
+
resolve: (source, file) => {
|
|
14
|
+
if (/\.[cm][jt]s$/.test(file) && builtins.has(source)) {
|
|
15
|
+
return { found: true, path: null };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const moduleId = require.resolve(source, { paths: [path.dirname(file)] });
|
|
20
|
+
|
|
21
|
+
if (builtins.has(moduleId)) {
|
|
22
|
+
return { found: false };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return { found: true, path: moduleId };
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (
|
|
28
|
+
error.code === 'MODULE_NOT_FOUND' &&
|
|
29
|
+
error.path?.endsWith('/package.json')
|
|
30
|
+
) {
|
|
31
|
+
const { name, module, main, exports } = require(error.path);
|
|
32
|
+
|
|
33
|
+
const resolved = resolveExports(
|
|
34
|
+
{ name, module, main, exports },
|
|
35
|
+
source,
|
|
36
|
+
);
|
|
37
|
+
const moduleId = path.join(path.dirname(error.path), resolved);
|
|
38
|
+
|
|
39
|
+
return { found: true, path: moduleId };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { found: false };
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
};
|
package/lib/typescript.cjs
CHANGED
|
@@ -39,6 +39,26 @@ module.exports = {
|
|
|
39
39
|
varsIgnorePattern: '^_+$',
|
|
40
40
|
},
|
|
41
41
|
],
|
|
42
|
+
'import/extensions': [
|
|
43
|
+
'error',
|
|
44
|
+
'always',
|
|
45
|
+
{
|
|
46
|
+
ignorePackages: true,
|
|
47
|
+
pattern: {
|
|
48
|
+
ts: 'never',
|
|
49
|
+
mts: 'never',
|
|
50
|
+
cts: 'never',
|
|
51
|
+
tsx: 'never',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
settings: {
|
|
57
|
+
'import/resolver': {
|
|
58
|
+
node: {
|
|
59
|
+
extensions: ['.ts', '.cts', '.mts', '.tsx'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
42
62
|
},
|
|
43
63
|
},
|
|
44
64
|
],
|
package/lib/unicorn.cjs
CHANGED
|
@@ -15,7 +15,6 @@ module.exports = {
|
|
|
15
15
|
{ onlyIfContainsSeparator: true },
|
|
16
16
|
],
|
|
17
17
|
'unicorn/prefer-export-from': ['error', { ignoreUsedVariables: true }],
|
|
18
|
-
'unicorn/prefer-node-protocol': 'off',
|
|
19
18
|
'unicorn/prefer-prototype-methods': 'off',
|
|
20
19
|
'unicorn/prefer-set-has': 'off',
|
|
21
20
|
'unicorn/prefer-top-level-await': 'off',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice-move/eslint-config-base",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"description": "A `eslint` config for best practice",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -35,22 +35,23 @@
|
|
|
35
35
|
"main": "index.cjs",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@nice-move/eslint-plugin-html": "0.0.0-beta.3",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
39
|
-
"@typescript-eslint/parser": "^5.
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
39
|
+
"@typescript-eslint/parser": "^5.36.2",
|
|
40
40
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
41
41
|
"eslint-config-prettier": "^8.5.0",
|
|
42
42
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
43
43
|
"eslint-plugin-import": "^2.26.0",
|
|
44
44
|
"eslint-plugin-markdown": "^3.0.0",
|
|
45
|
-
"eslint-plugin-n": "^15.2.
|
|
46
|
-
"eslint-plugin-promise": "^6.0.
|
|
45
|
+
"eslint-plugin-n": "^15.2.5",
|
|
46
|
+
"eslint-plugin-promise": "^6.0.1",
|
|
47
47
|
"eslint-plugin-sonarjs": "^0.15.0",
|
|
48
48
|
"eslint-plugin-unicorn": "^43.0.2",
|
|
49
|
-
"espree": "^9.
|
|
49
|
+
"espree": "^9.4.0",
|
|
50
|
+
"resolve.exports": "^1.1.0",
|
|
50
51
|
"settingz": "^0.2.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
53
|
-
"eslint": "^8.
|
|
54
|
+
"eslint": "^8.20.0"
|
|
54
55
|
},
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": "^16.13.0 || >=18.0.0"
|