Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no-unused-modules: make sure that rule with no options will not fail #1330

Merged
merged 3 commits into from
Apr 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
"memo-parser"
],
"scripts": {
"watch": "cross-env NODE_PATH=./src mocha --watch --compilers js:babel-register --recursive tests/src",
"watch": "npm run mocha -- --watch tests/src",
"pretest": "linklocal",
"posttest": "eslint ./src",
"test": "cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive tests/src -t 5s",
"mocha": "cross-env BABEL_ENV=test NODE_PATH=./src nyc -s mocha -R dot --recursive -t 5s",
"test": "npm run mocha tests/src",
"test-compiled": "npm run prepublish && NODE_PATH=./lib mocha --compilers js:babel-register --recursive tests/src",
"test-all": "npm test && for resolver in ./resolvers/*; do cd $resolver && npm test && cd ../..; done",
"prepublish": "gulp prepublish",
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ module.exports = {
ignoreExports = [],
missingExports,
unusedExports,
} = context.options[0]
} = context.options[0] || {}

if (unusedExports && !preparationDone) {
doPreparation(src, ignoreExports, context)
Expand Down
1 change: 1 addition & 0 deletions tests/src/rules/no-unused-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const unusedExportsOptions = [{
// tests for missing exports
ruleTester.run('no-unused-modules', rule, {
valid: [
test({ code: 'export default function noOptions() {}' }),
test({ options: missingExportsOptions,
code: 'export default () => 1'}),
test({ options: missingExportsOptions,
Expand Down