diff --git a/lib/rules/no-undef-components.js b/lib/rules/no-undef-components.js index 4371add7c..3c094fca1 100644 --- a/lib/rules/no-undef-components.js +++ b/lib/rules/no-undef-components.js @@ -120,6 +120,9 @@ module.exports = { properties: { ignorePatterns: { type: 'array' + }, + strict: { + type: 'boolean' } }, additionalProperties: false @@ -155,10 +158,15 @@ module.exports = { return false } const pascalCaseName = casing.pascalCase(rawName) + // Check ignored patterns if ( ignorePatterns.some((pattern) => { - const regExp = new RegExp(pattern) + const regExp = new RegExp( + options.strict === true || options.strict === undefined + ? `^${pattern}$` + : pattern + ) return ( regExp.test(rawName) || regExp.test(kebabCaseName) || diff --git a/tests/lib/rules/no-undef-components.js b/tests/lib/rules/no-undef-components.js index 37a3bec68..ce7757c75 100644 --- a/tests/lib/rules/no-undef-components.js +++ b/tests/lib/rules/no-undef-components.js @@ -108,6 +108,7 @@ tester.run('no-undef-components', rule, { } ] }, + // circular references { filename: 'test.vue', @@ -685,6 +686,7 @@ tester.run('no-undef-components', rule, { } } ], + invalid: [ //