Skip to content

Commit

Permalink
ew: no-unused-modules rule - remove unnecessary exports
Browse files Browse the repository at this point in the history
  • Loading branch information
rfermann committed Mar 31, 2019
1 parent 90f7217 commit 1ac4bd7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
3 changes: 0 additions & 3 deletions src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,6 @@ const newDefaultImportExists = specifiers =>
specifiers.some(({ type }) => type === IMPORT_DEFAULT_SPECIFIER)

module.exports = {
isNodeModule,
doPreparation,
getSrc,
meta: {
docs: { url: docsUrl('no-unused-modules') },
schema: [{
Expand Down
28 changes: 0 additions & 28 deletions tests/src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { RuleTester } from 'eslint'
import { expect } from 'chai'
import fs from 'fs'

const getSrc = require( '../../../src/rules/no-unused-modules').getSrc
const isNodeModule = require( '../../../src/rules/no-unused-modules').isNodeModule

const ruleTester = new RuleTester()
, rule = require('rules/no-unused-modules')

Expand All @@ -22,31 +19,6 @@ const unusedExportsOptions = [{
ignoreExports: [testFilePath('./no-unused-modules/*ignored*.js')],
}]

describe('getSrc returns correct source', () => {
it('if src is provided', () => {
const src = ['file-a.js']
expect(getSrc(src)).to.eq(src)
})
it('if src is not provided', () => {
expect(getSrc()).to.eql([process.cwd()])
})
})

describe('isNodeModule returns correct value', () => {
it('true for "/node_modules/"', () => {
expect(isNodeModule('/node_modules/')).to.be.true
})
it('true for "/node_modules/package/file.js"', () => {
expect(isNodeModule('/node_modules/package/file.js')).to.be.true
})
it('false for "/node_modules.js"', () => {
expect(isNodeModule('/node_modules.js')).to.be.false
})
it('false for "node_modules_old"', () => {
expect(isNodeModule('node_modules_old')).to.be.false
})
})

// tests for missing exports
ruleTester.run('no-unused-modules', rule, {
valid: [
Expand Down

0 comments on commit 1ac4bd7

Please sign in to comment.