Skip to content

Commit 1d8fdcb

Browse files
author
avazhov
committed
Fix NCI rule
1 parent 1dba878 commit 1d8fdcb

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/rules/non-correct-import.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@ module.exports = {
22
meta: {
33
type: 'problem',
44
hasSuggestions: true,
5-
fixable: true,
5+
docs: {
6+
description: "All style components files must be imported via a single variable",
7+
},
8+
fixable: false,
69
},
710
create(context) {
811
return {
912
ImportDeclaration(node) {
10-
const pathArray = node.source.raw.substr(1, node.source.raw.length - 2);
11-
console.log(node, node.specifiers[0].type)
13+
const pathArray = node.source.raw.substr(1, node.source.raw.length - 2).split('.');
1214

1315
if (
1416
pathArray.includes('styled') &&
1517
node.specifiers[0].type !== 'ImportNamespaceSpecifier'
1618
) {
17-
console.log('error')
1819

1920
return context.report({
2021
node: node,
21-
message: 'Неправильный импорт. Измените на * as S',
22-
fix(fixer){
23-
return [fixer.replaceTextRange([node.start, node.end], `import * as S from ${node.source.raw}`)]
24-
}
22+
message: 'Incorrect import for the styled file. Replace with import in one variable * as',
2523
})
2624
}
2725
}

0 commit comments

Comments
 (0)