From 8f9b403f36e511498bcea40b8d21f26a4bbb33ad Mon Sep 17 00:00:00 2001 From: kevin940726 Date: Sun, 5 Feb 2017 16:58:49 +0800 Subject: [PATCH] fix typos, enforce type of array of strings in allow option --- docs/rules/no-unassigned-import.md | 2 +- src/rules/no-unassigned-import.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/rules/no-unassigned-import.md b/docs/rules/no-unassigned-import.md index 324962767..85f9b7c3a 100644 --- a/docs/rules/no-unassigned-import.md +++ b/docs/rules/no-unassigned-import.md @@ -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. diff --git a/src/rules/no-unassigned-import.js b/src/rules/no-unassigned-import.js index e7d5b1e3e..2b1499b34 100644 --- a/src/rules/no-unassigned-import.js +++ b/src/rules/no-unassigned-import.js @@ -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 @@ -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, },