Skip to content

Commit

Permalink
[Fix] Fixing typo in IDE section
Browse files Browse the repository at this point in the history
  • Loading branch information
darkartur committed May 2, 2020
1 parent 92caa35 commit 0148471
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/no-unused-modules.js
Expand Up @@ -657,7 +657,7 @@ module.exports = {
resolvedPath = resolve(astNode.source.raw.replace(/('|")/g, ''), context)
astNode.specifiers.forEach(specifier => {
let name
if (specifier.exported.name === DEFAULT) {
if (specifier.local.name === DEFAULT) {
name = IMPORT_DEFAULT_SPECIFIER
} else {
name = specifier.local.name
Expand Down
1 change: 1 addition & 0 deletions tests/files/no-unused-modules/renameDefault/Component.js
@@ -0,0 +1 @@
export default function Component() {}
1 change: 1 addition & 0 deletions tests/files/no-unused-modules/renameDefault/components.js
@@ -0,0 +1 @@
export { default as Component } from './Component'
1 change: 1 addition & 0 deletions tests/files/no-unused-modules/renameDefault/usage.js
@@ -0,0 +1 @@
import { Component } from './components'
13 changes: 13 additions & 0 deletions tests/src/rules/no-unused-modules.js
Expand Up @@ -217,6 +217,19 @@ ruleTester.run('no-unused-modules', rule, {
invalid: [],
})

// test for running in specific order with renaming default
ruleTester.run('no-unused-modules', rule, {
valid: [
test({ options: unusedExportsOptions,
code: 'export { default as Component } from "./Component"',
filename: testFilePath('./no-unused-modules/renameDefault/components.js')}),
test({ options: unusedExportsOptions,
code: 'export default function Component() {}',
filename: testFilePath('./no-unused-modules/renameDefault/Component.js')}),
],
invalid: [],
})

// add named import for file with default export
ruleTester.run('no-unused-modules', rule, {
valid: [
Expand Down

0 comments on commit 0148471

Please sign in to comment.