@nice-move/eslint-config-base 0.13.26 → 0.14.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/index.mjs CHANGED
@@ -39,9 +39,25 @@ const old = compat.config(airbnb).map((item) => {
39
39
 
40
40
  item.files = allExts;
41
41
 
42
+ item.settings &&= Object.fromEntries(
43
+ Object.entries(item.settings).map(([key, value]) => [
44
+ key.replace(/^import\//, 'import-x/'),
45
+ value,
46
+ ]),
47
+ );
48
+
49
+ item.rules &&= Object.fromEntries(
50
+ Object.entries(item.rules).map(([key, value]) => [
51
+ key.replace(/^import\//, 'import-x/'),
52
+ value,
53
+ ]),
54
+ );
55
+
42
56
  return item;
43
57
  });
44
58
 
59
+ console.log(old);
60
+
45
61
  export const create = (...addings) => [
46
62
  {
47
63
  files: allExts,
@@ -59,7 +75,7 @@ export const create = (...addings) => [
59
75
  {
60
76
  files: ['src/**/*.{mjs,mts,cjs,cts}'],
61
77
  settings: {
62
- 'import/core-modules': ['electron'],
78
+ 'import-x/core-modules': ['electron'],
63
79
  },
64
80
  },
65
81
  ],
package/lib/import.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import { fileURLToPath } from 'node:url';
2
2
 
3
- import imports from 'eslint-plugin-import';
3
+ import { flatConfigs } from 'eslint-plugin-import-x';
4
4
 
5
5
  import { configHas, pkgHas } from './utils.mjs';
6
6
 
7
7
  const Vscode = pkgHas(
8
8
  ({ engines: { vscode } = {} }) => vscode,
9
- () => ({ 'import/core-modules': ['vscode'] }),
9
+ () => ({ 'import-x/core-modules': ['vscode'] }),
10
10
  );
11
11
 
12
12
  export default [
13
- imports.flatConfigs.recommended,
13
+ flatConfigs.recommended,
14
14
  {
15
15
  files: ['**/*.{js,jsx,ts,tsx,cjs,mjs,cts,mts}'],
16
16
  ignores: [
@@ -21,20 +21,20 @@ export default [
21
21
  '**/*.md/*',
22
22
  ],
23
23
  rules: {
24
- 'import/no-default-export': 'warn',
24
+ 'import-x/no-default-export': 'warn',
25
25
  },
26
26
  },
27
27
  {
28
28
  files: ['**/*.{js,jsx,ts,tsx,cjs,mjs,cts,mts,qs,wxs,vue}'],
29
29
  rules: {
30
- 'import/extensions': [
30
+ 'import-x/extensions': [
31
31
  'error',
32
32
  'always',
33
33
  {
34
34
  ignorePackages: true,
35
35
  },
36
36
  ],
37
- 'import/no-extraneous-dependencies': [
37
+ 'import-x/no-extraneous-dependencies': [
38
38
  'error',
39
39
  {
40
40
  devDependencies: [
@@ -54,18 +54,18 @@ export default [
54
54
  ],
55
55
  },
56
56
  ],
57
- 'import/newline-after-import': 0,
58
- 'import/no-dynamic-require': 0,
59
- 'import/no-empty-named-blocks': 'error',
60
- 'import/no-relative-packages': 0,
61
- 'import/order': 0,
62
- 'import/prefer-default-export': 0,
63
- 'import/no-cycle': 0,
64
- 'import/no-duplicates': ['warn', { considerQueryString: true }],
57
+ 'import-x/newline-after-import': 0,
58
+ 'import-x/no-dynamic-require': 0,
59
+ 'import-x/no-empty-named-blocks': 'error',
60
+ 'import-x/no-relative-packages': 0,
61
+ 'import-x/order': 0,
62
+ 'import-x/prefer-default-export': 0,
63
+ 'import-x/no-cycle': 0,
64
+ 'import-x/no-duplicates': ['warn', { considerQueryString: true }],
65
65
  },
66
66
  settings: {
67
67
  ...Vscode,
68
- 'import/extensions': [
68
+ 'import-x/extensions': [
69
69
  '.tsx',
70
70
  '.ts',
71
71
  '.cts',
@@ -76,30 +76,22 @@ export default [
76
76
  '.mjs',
77
77
  '.cjs',
78
78
  ],
79
- 'import/parsers': {
79
+ 'import-x/parsers': {
80
80
  '@typescript-eslint/parser': ['.ts', '.cts', '.mts', '.tsx'],
81
81
  'vue-eslint-parser': ['.vue'],
82
82
  [fileURLToPath(import.meta.resolve('./jsx-parser.cjs'))]: ['.jsx'],
83
83
  },
84
- 'import/ignore': false,
84
+ 'import-x/ignore': false,
85
85
  ...configHas(
86
86
  ({ 'internal-regex': internalRegex }) => internalRegex,
87
- (internalRegex) => ({ 'import/internal-regex': internalRegex }),
87
+ (internalRegex) => ({ 'import-x/internal-regex': internalRegex }),
88
88
  ),
89
- 'import/resolver': {
90
- node: false,
91
- [fileURLToPath(import.meta.resolve('./node-next-resolver.cjs'))]:
92
- configHas(
93
- ({ 'import-http': importHttp }) => importHttp,
94
- (importHttp) => ({ importHttp }),
95
- ) || {},
96
- },
97
89
  },
98
90
  },
99
91
  {
100
92
  files: ['**/*.{js,jsx,ts,tsx,vue,qs,wxs}'],
101
93
  rules: {
102
- 'import/no-nodejs-modules': 'error',
94
+ 'import-x/no-nodejs-modules': 'error',
103
95
  },
104
96
  },
105
97
  ];
package/lib/markdown.mjs CHANGED
@@ -23,8 +23,8 @@ export default [
23
23
  '@typescript-eslint/no-extraneous-class': 'off',
24
24
  '@typescript-eslint/no-unused-vars': 'off',
25
25
  'eol-last': 'off',
26
- 'import/no-extraneous-dependencies': 'off',
27
- 'import/no-unresolved': 'off',
26
+ 'import-x/no-extraneous-dependencies': 'off',
27
+ 'import-x/no-unresolved': 'off',
28
28
  'n/no-missing-require': 'off',
29
29
  'no-undef': 'off',
30
30
  'no-unused-expressions': 'off',
package/lib/mini.mjs CHANGED
@@ -104,7 +104,7 @@ function generate({
104
104
  },
105
105
  },
106
106
  rules: {
107
- 'import/no-commonjs': 'off',
107
+ 'import-x/no-commonjs': 'off',
108
108
  'unicorn/prefer-module': 'off',
109
109
  },
110
110
  }
@@ -147,7 +147,7 @@ function generate({
147
147
  },
148
148
  },
149
149
  rules: {
150
- 'import/no-commonjs': 0,
150
+ 'import-x/no-commonjs': 0,
151
151
  'no-var': 0,
152
152
  'object-shorthand': ['error', 'never'],
153
153
  'prefer-arrow-callback': 0,
package/lib/node.mjs CHANGED
@@ -32,7 +32,7 @@ export default [
32
32
  {
33
33
  files: ['**/*.{js,jsx,ts,tsx,mjs,mts,vue}'],
34
34
  rules: {
35
- 'import/no-commonjs': 'error',
35
+ 'import-x/no-commonjs': 'error',
36
36
  },
37
37
  },
38
38
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-move/eslint-config-base",
3
- "version": "0.13.26",
3
+ "version": "0.14.0",
4
4
  "description": "A `eslint` config for best practice",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -35,25 +35,24 @@
35
35
  "type": "module",
36
36
  "dependencies": {
37
37
  "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
38
- "@eslint/eslintrc": "^3.3.4",
39
- "@eslint/js": "^9.39.3",
38
+ "@eslint/eslintrc": "^3.3.5",
39
+ "@eslint/js": "^9.39.4",
40
40
  "@eslint/markdown": "^7.5.1",
41
41
  "@nice-move/eslint-plugin-html": "^0.1.1",
42
42
  "eslint-config-airbnb-base": "^15.0.0",
43
43
  "eslint-config-prettier": "^10.1.8",
44
- "eslint-plugin-import": "^2.32.0",
44
+ "eslint-plugin-import-x": "^4.16.2",
45
45
  "eslint-plugin-n": "^17.24.0",
46
46
  "eslint-plugin-promise": "^7.2.1",
47
- "eslint-plugin-regexp": "^3.0.0",
47
+ "eslint-plugin-regexp": "^3.1.0",
48
48
  "eslint-plugin-unicorn": "^63.0.0",
49
49
  "espree": "^10.4.0",
50
50
  "globals": "^17.4.0",
51
- "resolve.exports": "^2.0.3",
52
51
  "settingz": "^0.2.0",
53
- "typescript-eslint": "^8.56.1"
52
+ "typescript-eslint": "^8.57.0"
54
53
  },
55
54
  "peerDependencies": {
56
- "eslint": "^9.39.3"
55
+ "eslint": "^9.39.4"
57
56
  },
58
57
  "engines": {
59
58
  "node": ">=24.0.0 || ^22.18.0"
@@ -1,59 +0,0 @@
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
- function isValidUrl(string) {
12
- try {
13
- const io = new URL(string);
14
-
15
- return ['http:', 'https:'].includes(io.protocol);
16
- } catch {
17
- return false;
18
- }
19
- }
20
-
21
- module.exports = {
22
- interfaceVersion: 2,
23
- resolve: (source, file, config) => {
24
- if (config.importHttp && isValidUrl(source)) {
25
- return { found: true, path: null };
26
- }
27
-
28
- if (/\.[cm][jt]s$/.test(file) && builtins.has(source)) {
29
- return { found: true, path: null };
30
- }
31
-
32
- try {
33
- const moduleId = require.resolve(source, { paths: [path.dirname(file)] });
34
-
35
- if (builtins.has(moduleId)) {
36
- return { found: false };
37
- }
38
-
39
- return { found: true, path: moduleId };
40
- } catch (error) {
41
- if (
42
- error.code === 'MODULE_NOT_FOUND' &&
43
- error.path?.endsWith('/package.json')
44
- ) {
45
- const { name, module, main, exports, imports } = require(error.path);
46
-
47
- const [resolved] = resolveExports(
48
- { name, module, main, exports, imports },
49
- source,
50
- );
51
- const moduleId = path.join(path.dirname(error.path), resolved);
52
-
53
- return { found: true, path: moduleId };
54
- }
55
-
56
- return { found: false };
57
- }
58
- },
59
- };