Skip to content

Commit bb1660b

Browse files
authored
Lint - fix overriding local import specifier (#772)
1 parent 526a233 commit bb1660b

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

eslint-rules/lib/rules/assets-deprecation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ module.exports = {
7979
}
8080

8181
return {
82-
ImportDeclaration: node => setLocalImportSpecifier(node),
82+
ImportDeclaration: node => !localImportSpecifier && setLocalImportSpecifier(node),
8383
MemberExpression: node => localImportSpecifier && testMemberDeprecation(node),
8484

8585

eslint-rules/lib/rules/typography-deprecation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
}
6969

7070
return {
71-
ImportDeclaration: node => setLocalImportSpecifier(node),
71+
ImportDeclaration: node => !localImportSpecifier && setLocalImportSpecifier(node),
7272
MemberExpression: node => localImportSpecifier && testMemberDeprecation(node),
7373
JSXAttribute: node => testJSXAttribute(node),
7474

eslint-rules/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-uilib",
3-
"version": "1.0.21",
3+
"version": "1.0.23",
44
"description": "uilib set of eslint rules",
55
"keywords": [
66
"eslint",

eslint-rules/tests/lib/rules/assets-deprecation.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const ruleTester = new RuleTester();
1212

1313
const ourSource = 'our-source';
1414
const notOurSource = 'another-source';
15+
const notOurSource2 = 'another-source-2';
1516

1617
const options = [{deprecations: deprecationsJson, source: ourSource}];
1718
const optionsWithDate = [{deprecations: deprecationsJson, source: ourSource, dueDate: '2 November, Friday'}];
@@ -116,7 +117,9 @@ class Example extends Component {
116117
}`;
117118

118119
const fullClassTest1 = `
120+
import {Something} from '${notOurSource}';
119121
${ourImport}
122+
import {SomethingElse} from '${notOurSource2}';
120123
121124
const validIcon = (icon) => (typeof icon === 'number' ? icon : undefined);
122125

eslint-rules/tests/lib/rules/typography-deprecation.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const ruleTester = new RuleTester();
1212

1313
const ourSource = 'our-source';
1414
const notOurSource = 'another-source';
15+
const notOurSource2 = 'another-source-2';
1516

1617
const options = [{deprecations: deprecationsJson, source: ourSource}];
1718
const optionsWithDate = [{deprecations: deprecationsJson, source: ourSource, dueDate: '2 November, Friday'}];
@@ -124,7 +125,9 @@ class Example extends Component {
124125
}`;
125126

126127
const fullClassTest1 = `
128+
import {Something} from '${notOurSource}';
127129
${ourImport}
130+
import {SomethingElse} from '${notOurSource2}';
128131
129132
const validTypography = (typography) => (myLogic(typography) ? typography : undefined);
130133

0 commit comments

Comments
 (0)