Skip to content

Commit

Permalink
fix typos, enforce type of array of strings in allow option
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Apr 11, 2017
1 parent 0c78a5a commit c2e07a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/rules/no-unassigned-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This rule aims to remove modules with side-effects by reporting when a module is

This rule supports the following option:

`allow`: An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be usefull for some build environment (e.g. css-loader in webpack).
`allow`: An Array of globs. The files that match any of these patterns would be ignored/allowed by the linter. This can be useful for some build environments (e.g. css-loader in webpack).

Note that the globs start from the where the linter is executed (usually project root), but not from each file that includes the source. Learn more in both the pass and fail examples below.

Expand Down
9 changes: 7 additions & 2 deletions src/rules/no-unassigned-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function report(context, node) {

function testIsAllow(globs, filename, source) {
if (!Array.isArray(globs)) {
return false // default doens't allow any pattern
return false // default doesn't allow any patterns
}

let filePath
Expand Down Expand Up @@ -60,7 +60,12 @@ module.exports = {
'devDependencies': { 'type': ['boolean', 'array'] },
'optionalDependencies': { 'type': ['boolean', 'array'] },
'peerDependencies': { 'type': ['boolean', 'array'] },
'allow': { 'type': 'array' },
'allow': {
'type': 'array',
'items': {
'type': 'string',
},
},
},
'additionalProperties': false,
},
Expand Down

0 comments on commit c2e07a3

Please sign in to comment.