@putout/plugin-putout 25.3.0 → 25.4.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.
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {types} from 'putout';
|
|
2
|
-
import {parseImportSpecifiers} from 'parse-import-specifiers';
|
|
3
|
-
|
|
4
|
-
const {isImportDeclaration} = types;
|
|
5
1
|
const noop = () => {};
|
|
6
2
|
|
|
7
3
|
export const report = () => `Use 'import * as plugin' instead of 'import plugin'`;
|
|
@@ -28,11 +24,6 @@ export const traverse = ({push, listStore, pathStore}) => ({
|
|
|
28
24
|
if (rules.length !== 1)
|
|
29
25
|
return;
|
|
30
26
|
|
|
31
|
-
const [first] = rules;
|
|
32
|
-
|
|
33
|
-
if (isImportDeclaration(first) && pathStore().length > 2)
|
|
34
|
-
return;
|
|
35
|
-
|
|
36
27
|
path.traverse(createImportVisitor({
|
|
37
28
|
push,
|
|
38
29
|
names: ['any'],
|
|
@@ -46,8 +37,11 @@ const createImportVisitor = ({push, names, pathStore = noop}) => ({
|
|
|
46
37
|
pathStore(path);
|
|
47
38
|
|
|
48
39
|
const {value} = path.node.source;
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
|
|
41
|
+
if (value.endsWith('.js'))
|
|
42
|
+
return;
|
|
43
|
+
|
|
44
|
+
const [first] = path.get('specifiers');
|
|
51
45
|
|
|
52
46
|
if (!first)
|
|
53
47
|
return;
|
|
@@ -58,14 +52,8 @@ const createImportVisitor = ({push, names, pathStore = noop}) => ({
|
|
|
58
52
|
if (first.isImportSpecifier())
|
|
59
53
|
return;
|
|
60
54
|
|
|
61
|
-
const {defaults, imports} = parseImportSpecifiers(specifiers);
|
|
62
|
-
|
|
63
|
-
if (defaults.length && imports.length)
|
|
64
|
-
return;
|
|
65
|
-
|
|
66
55
|
for (const name of names) {
|
|
67
|
-
if (!value.replace('
|
|
68
|
-
.includes('/'))
|
|
56
|
+
if (!value.replace('./', '').includes('/'))
|
|
69
57
|
continue;
|
|
70
58
|
|
|
71
59
|
if (value === name || value.startsWith(name) || name === 'any') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/plugin-putout",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout plugin helps with plugins development",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"fullstore": "^3.0.0",
|
|
35
35
|
"just-camel-case": "^6.2.0",
|
|
36
|
-
"parse-import-specifiers": "^1.0.2",
|
|
37
36
|
"try-catch": "^3.0.0"
|
|
38
37
|
},
|
|
39
38
|
"keywords": [
|