Skip to content

Commit 3f46ccf

Browse files
Hypnosphiljharb
authored andcommitted
Revert "[flow] no-unused-modules: add flow type support"
This reverts commit 05085bb
1 parent 92caa35 commit 3f46ccf

File tree

6 files changed

+6
-43
lines changed

6 files changed

+6
-43
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel
1515
- [`order`]: Recognize pathGroup config for first group ([#1719], [#1724], thanks [@forivall], [@xpl])
1616
- [`no-unused-modules`]: Fix re-export not counting as usage when used in combination with import ([#1722], thanks [@Ephem])
1717
- [`no-duplicates`]: Handle TS import type ([#1676], thanks [@kmui2])
18-
- [``newline-after-import`: recognize decorators ([#1139], thanks [@atos1990])
18+
- [`newline-after-import`]: recognize decorators ([#1139], thanks [@atos1990])
19+
- [`no-unused-modules`]: Revert "[flow] `no-unused-modules`: add flow type support" ([#1770], thanks [@Hypnosphi])
1920

2021
### Changed
2122
- TypeScript config: Disable [`named`][] ([#1726], thanks [@astorije])
@@ -675,6 +676,7 @@ for info on changes for earlier releases.
675676

676677
[`memo-parser`]: ./memo-parser/README.md
677678

679+
[#1770]: https://github.com/benmosher/eslint-plugin-import/issues/1770
678680
[#1726]: https://github.com/benmosher/eslint-plugin-import/issues/1726
679681
[#1724]: https://github.com/benmosher/eslint-plugin-import/issues/1724
680682
[#1722]: https://github.com/benmosher/eslint-plugin-import/issues/1722
@@ -1156,3 +1158,4 @@ for info on changes for earlier releases.
11561158
[@kmui2]: https://github.com/kmui2
11571159
[@arvigeus]: https://github.com/arvigeus
11581160
[@atos1990]: https://github.com/atos1990
1161+
[@Hypnosphi]: https://github.com/Hypnosphi

src/rules/no-unused-modules.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ const VARIABLE_DECLARATION = 'VariableDeclaration'
6464
const FUNCTION_DECLARATION = 'FunctionDeclaration'
6565
const CLASS_DECLARATION = 'ClassDeclaration'
6666
const DEFAULT = 'default'
67-
const TYPE_ALIAS = 'TypeAlias'
6867

6968
/**
7069
* List of imports per file.
@@ -563,8 +562,7 @@ module.exports = {
563562
if (declaration) {
564563
if (
565564
declaration.type === FUNCTION_DECLARATION ||
566-
declaration.type === CLASS_DECLARATION ||
567-
declaration.type === TYPE_ALIAS
565+
declaration.type === CLASS_DECLARATION
568566
) {
569567
newExportIdentifiers.add(declaration.id.name)
570568
}
@@ -889,8 +887,7 @@ module.exports = {
889887
if (node.declaration) {
890888
if (
891889
node.declaration.type === FUNCTION_DECLARATION ||
892-
node.declaration.type === CLASS_DECLARATION ||
893-
node.declaration.type === TYPE_ALIAS
890+
node.declaration.type === CLASS_DECLARATION
894891
) {
895892
checkUsage(node, node.declaration.id.name)
896893
}

tests/files/no-unused-modules/flow-0.js

-1
This file was deleted.

tests/files/no-unused-modules/flow-1.js

-2
This file was deleted.

tests/files/no-unused-modules/flow-2.js

-2
This file was deleted.

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

-32
Original file line numberDiff line numberDiff line change
@@ -680,38 +680,6 @@ describe('do not report unused export for files mentioned in package.json', () =
680680
})
681681
})
682682

683-
describe('correctly report flow types', () => {
684-
ruleTester.run('no-unused-modules', rule, {
685-
valid: [
686-
test({
687-
options: unusedExportsOptions,
688-
code: 'import { type FooType } from "./flow-2";',
689-
parser: require.resolve('babel-eslint'),
690-
filename: testFilePath('./no-unused-modules/flow-0.js'),
691-
}),
692-
test({
693-
options: unusedExportsOptions,
694-
code: `// @flow strict
695-
export type FooType = string;`,
696-
parser: require.resolve('babel-eslint'),
697-
filename: testFilePath('./no-unused-modules/flow-2.js'),
698-
}),
699-
],
700-
invalid: [
701-
test({
702-
options: unusedExportsOptions,
703-
code: `// @flow strict
704-
export type Bar = string;`,
705-
parser: require.resolve('babel-eslint'),
706-
filename: testFilePath('./no-unused-modules/flow-1.js'),
707-
errors: [
708-
error(`exported declaration 'Bar' not used within other modules`),
709-
],
710-
}),
711-
],
712-
})
713-
})
714-
715683
describe('Avoid errors if re-export all from umd compiled library', () => {
716684
ruleTester.run('no-unused-modules', rule, {
717685
valid: [

0 commit comments

Comments
 (0)