Skip to content

Commit 0148471

Browse files
committed
[Fix] Fixing typo in IDE section
1 parent 92caa35 commit 0148471

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

src/rules/no-unused-modules.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ module.exports = {
657657
resolvedPath = resolve(astNode.source.raw.replace(/('|")/g, ''), context)
658658
astNode.specifiers.forEach(specifier => {
659659
let name
660-
if (specifier.exported.name === DEFAULT) {
660+
if (specifier.local.name === DEFAULT) {
661661
name = IMPORT_DEFAULT_SPECIFIER
662662
} else {
663663
name = specifier.local.name
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default function Component() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as Component } from './Component'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import { Component } from './components'

tests/src/rules/no-unused-modules.js

+13
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,19 @@ ruleTester.run('no-unused-modules', rule, {
217217
invalid: [],
218218
})
219219

220+
// test for running in specific order with renaming default
221+
ruleTester.run('no-unused-modules', rule, {
222+
valid: [
223+
test({ options: unusedExportsOptions,
224+
code: 'export { default as Component } from "./Component"',
225+
filename: testFilePath('./no-unused-modules/renameDefault/components.js')}),
226+
test({ options: unusedExportsOptions,
227+
code: 'export default function Component() {}',
228+
filename: testFilePath('./no-unused-modules/renameDefault/Component.js')}),
229+
],
230+
invalid: [],
231+
})
232+
220233
// add named import for file with default export
221234
ruleTester.run('no-unused-modules', rule, {
222235
valid: [

0 commit comments

Comments
 (0)