Skip to content

Commit

Permalink
Revert "[flow] no-unused-modules: add flow type support"
Browse files Browse the repository at this point in the history
This reverts commit 05085bb
  • Loading branch information
Hypnosphi committed May 19, 2020
1 parent 92caa35 commit a1e9dc0
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 42 deletions.
7 changes: 2 additions & 5 deletions src/rules/no-unused-modules.js
Expand Up @@ -64,7 +64,6 @@ const VARIABLE_DECLARATION = 'VariableDeclaration'
const FUNCTION_DECLARATION = 'FunctionDeclaration'
const CLASS_DECLARATION = 'ClassDeclaration'
const DEFAULT = 'default'
const TYPE_ALIAS = 'TypeAlias'

/**
* List of imports per file.
Expand Down Expand Up @@ -563,8 +562,7 @@ module.exports = {
if (declaration) {
if (
declaration.type === FUNCTION_DECLARATION ||
declaration.type === CLASS_DECLARATION ||
declaration.type === TYPE_ALIAS
declaration.type === CLASS_DECLARATION
) {
newExportIdentifiers.add(declaration.id.name)
}
Expand Down Expand Up @@ -889,8 +887,7 @@ module.exports = {
if (node.declaration) {
if (
node.declaration.type === FUNCTION_DECLARATION ||
node.declaration.type === CLASS_DECLARATION ||
node.declaration.type === TYPE_ALIAS
node.declaration.type === CLASS_DECLARATION
) {
checkUsage(node, node.declaration.id.name)
}
Expand Down
1 change: 0 additions & 1 deletion tests/files/no-unused-modules/flow-0.js

This file was deleted.

2 changes: 0 additions & 2 deletions tests/files/no-unused-modules/flow-1.js

This file was deleted.

2 changes: 0 additions & 2 deletions tests/files/no-unused-modules/flow-2.js

This file was deleted.

32 changes: 0 additions & 32 deletions tests/src/rules/no-unused-modules.js
Expand Up @@ -680,38 +680,6 @@ describe('do not report unused export for files mentioned in package.json', () =
})
})

describe('correctly report flow types', () => {
ruleTester.run('no-unused-modules', rule, {
valid: [
test({
options: unusedExportsOptions,
code: 'import { type FooType } from "./flow-2";',
parser: require.resolve('babel-eslint'),
filename: testFilePath('./no-unused-modules/flow-0.js'),
}),
test({
options: unusedExportsOptions,
code: `// @flow strict
export type FooType = string;`,
parser: require.resolve('babel-eslint'),
filename: testFilePath('./no-unused-modules/flow-2.js'),
}),
],
invalid: [
test({
options: unusedExportsOptions,
code: `// @flow strict
export type Bar = string;`,
parser: require.resolve('babel-eslint'),
filename: testFilePath('./no-unused-modules/flow-1.js'),
errors: [
error(`exported declaration 'Bar' not used within other modules`),
],
}),
],
})
})

describe('Avoid errors if re-export all from umd compiled library', () => {
ruleTester.run('no-unused-modules', rule, {
valid: [
Expand Down

0 comments on commit a1e9dc0

Please sign in to comment.