@dword-design/eslint-plugin-import-alias 4.0.9 → 5.0.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/LICENSE.md +1 -1
- package/README.md +2 -2
- package/dist/rules/prefer-alias.js +3 -8
- package/package.json +5 -4
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -118,7 +118,7 @@ If you have a special project setup that does not have a babel config in the pro
|
|
|
118
118
|
{
|
|
119
119
|
"alias": {
|
|
120
120
|
"@": "./src",
|
|
121
|
-
"@components: "./src/components"
|
|
121
|
+
"@components": "./src/components"
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
]
|
|
@@ -162,5 +162,5 @@ Thanks a lot for your support! ❤️
|
|
|
162
162
|
|
|
163
163
|
## License
|
|
164
164
|
|
|
165
|
-
[MIT License](https://opensource.org/
|
|
165
|
+
[MIT License](https://opensource.org/license/mit/) © [Sebastian Landwehr](https://sebastianlandwehr.com)
|
|
166
166
|
<!-- /LICENSE -->
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { OptionManager } from '@babel/core';
|
|
2
|
-
import find from
|
|
3
|
-
import keys from "@dword-design/functions/dist/keys.js";
|
|
4
|
-
import replace from "@dword-design/functions/dist/replace.js";
|
|
5
|
-
import some from "@dword-design/functions/dist/some.js";
|
|
6
|
-
import startsWith from "@dword-design/functions/dist/starts-with.js";
|
|
2
|
+
import { find, keys, replace, some, startsWith } from '@dword-design/functions';
|
|
7
3
|
import { resolvePath as defaultResolvePath } from 'babel-plugin-module-resolver';
|
|
8
4
|
import deepmerge from 'deepmerge';
|
|
9
5
|
import P from 'path';
|
|
@@ -32,16 +28,15 @@ export default {
|
|
|
32
28
|
if (currentFile === '<text>') return {};
|
|
33
29
|
const manager = new OptionManager();
|
|
34
30
|
const babelConfig = manager.init({
|
|
35
|
-
babelrc: true,
|
|
36
31
|
filename: currentFile,
|
|
37
|
-
|
|
32
|
+
rootMode: 'upward-optional'
|
|
38
33
|
});
|
|
39
34
|
const plugin = (_babelConfig$plugins = babelConfig.plugins, find({
|
|
40
35
|
key: 'module-resolver'
|
|
41
36
|
})(_babelConfig$plugins));
|
|
42
37
|
const options = deepmerge.all([{
|
|
43
38
|
alias: []
|
|
44
|
-
},
|
|
39
|
+
}, plugin?.options || {}, context.options[0] || {}]);
|
|
45
40
|
if (options.alias.length === 0) {
|
|
46
41
|
throw new Error('No alias configured. You have to define aliases by either passing them to the babel-plugin-module-resolver plugin in your Babel config, or directly to the prefer-alias rule.');
|
|
47
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/eslint-plugin-import-alias",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "An ESLint plugin that enforces the use of import aliases. Also supports autofixing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"alias",
|
|
@@ -44,23 +44,24 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@babel/core": "^7.10.2",
|
|
47
|
-
"@dword-design/functions": "^
|
|
47
|
+
"@dword-design/functions": "^6.0.0",
|
|
48
48
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
49
49
|
"deepmerge": "^4.3.1",
|
|
50
50
|
"jiti": "^1.18.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@dword-design/base": "^
|
|
53
|
+
"@dword-design/base": "^11.0.7",
|
|
54
54
|
"@dword-design/tester": "^2.0.19",
|
|
55
55
|
"@dword-design/tester-plugin-tmp-dir": "^2.1.26",
|
|
56
56
|
"depcheck-package-name": "^3.0.1",
|
|
57
57
|
"eslint": "^8.0.0",
|
|
58
58
|
"execa": "^8.0.0",
|
|
59
59
|
"fs-extra": "^11.1.1",
|
|
60
|
+
"in-folder": "^1.0.3",
|
|
60
61
|
"output-files": "^2.0.0"
|
|
61
62
|
},
|
|
62
63
|
"engines": {
|
|
63
|
-
"node": ">=
|
|
64
|
+
"node": ">=18"
|
|
64
65
|
},
|
|
65
66
|
"publishConfig": {
|
|
66
67
|
"access": "public"
|