@nice-move/eslint-config-base 0.8.10 → 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 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(
@@ -65,6 +65,10 @@ module.exports = {
65
65
  ({ 'internal-regex': internalRegex }) => internalRegex,
66
66
  (internalRegex) => ({ 'import/internal-regex': internalRegex }),
67
67
  ),
68
+ 'import/resolver': {
69
+ node: false,
70
+ [require.resolve('./node-next-resolver.cjs')]: {},
71
+ },
68
72
  },
69
73
  overrides: [
70
74
  pkgHas(
@@ -81,7 +85,7 @@ module.exports = {
81
85
  ),
82
86
  {
83
87
  files: '**/*.*',
84
- excludedFiles: '*.{m,c}js',
88
+ excludedFiles: '*.{m,c}{j,t}s',
85
89
  rules: {
86
90
  'import/no-nodejs-modules': 'error',
87
91
  },
package/lib/mini.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const { relative } = require('path');
3
+ const { relative } = require('node:path');
4
4
  const { reaching } = require('settingz');
5
5
 
6
6
  const cwd = process.cwd();
@@ -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/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.10",
3
+ "version": "0.8.11",
4
4
  "description": "A `eslint` config for best practice",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -47,6 +47,7 @@
47
47
  "eslint-plugin-sonarjs": "^0.15.0",
48
48
  "eslint-plugin-unicorn": "^43.0.2",
49
49
  "espree": "^9.4.0",
50
+ "resolve.exports": "^1.1.0",
50
51
  "settingz": "^0.2.0"
51
52
  },
52
53
  "peerDependencies": {