diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 90bd33ad5..fede1a47a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,12 +31,6 @@ jobs: strategy: matrix: node: [18, 20, 21, 'lts/*'] - eslint: [9] - include: - # On old ESLint version - - node: 18 - eslint: 8 - runs-on: ubuntu-latest steps: - name: Checkout @@ -47,8 +41,23 @@ jobs: node-version: ${{ matrix.node }} - name: Install Packages run: npm install - - name: Install ESLint v${{ matrix.eslint }} - run: npm install --save-dev eslint@${{ matrix.eslint }} -f + - name: Test + run: npm test + + test-with-eslint-v8: + name: Test with ESLint v8 + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node.js v18 + uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Install Packages + run: npm install + - name: Install ESLint v8 + run: npm install --save-dev eslint@8 --force - name: Test run: npm test @@ -63,7 +72,25 @@ jobs: - name: Install Packages run: npm install - name: Uninstall @stylistic/eslint-plugin - run: npm uninstall -D @stylistic/eslint-plugin + run: npm uninstall @stylistic/eslint-plugin + - name: Test + run: npm test + + test-with-old-eslint-stylistic: + name: Test with old ESLint Stylistic + strategy: + matrix: + stylistic: [2, 3, 4] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node.js + uses: actions/setup-node@v4 + - name: Install Packages + run: npm install + - name: Install @stylistic/eslint-plugin v${{ matrix.stylistic }} + run: npm install -D @stylistic/eslint-plugin@${{ matrix.stylistic }} --force - name: Test run: npm test @@ -77,7 +104,7 @@ jobs: uses: actions/setup-node@v4 - name: Install Packages run: npm install - - name: Install @typescript-eslint/parser@7 - run: npm install -D @typescript-eslint/parser@7 -f + - name: Install @typescript-eslint/parser v7 + run: npm install -D @typescript-eslint/parser@7 --force - name: Test run: npm test diff --git a/.vscode/settings.json b/.vscode/settings.json index f80681b66..8c7be0b23 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,6 @@ { "editor.tabSize": 2, - "eslint.experimental.useFlatConfig": true, - "eslint.validate": ["javascript", "javascriptreact", "vue", "json", "jsonc"], + "eslint.validate": ["javascript", "javascriptreact", "vue", "json", "jsonc", "markdown"], "typescript.tsdk": "./node_modules/typescript/lib", "vetur.validation.script": false, "[typescript]": { diff --git a/CHANGELOG.md b/CHANGELOG.md index fa7a29427..5ec26c26e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,32 @@ # eslint-plugin-vue +## 10.5.0 + +### Minor Changes + +- Added `ignoredObjectNames` option to [`vue/no-async-in-computed-properties`](https://eslint.vuejs.org/rules/no-async-in-computed-properties.html) ([#2927](https://github.com/vuejs/eslint-plugin-vue/pull/2927)) +- Added `ignorePattern` option to [`vue/no-v-html`](https://eslint.vuejs.org/rules/no-v-html.html) ([#2857](https://github.com/vuejs/eslint-plugin-vue/pull/2857)) +- Added `sortLineLength` option to [`vue/attributes-order`](https://eslint.vuejs.org/rules/attributes-order.html) ([#2759](https://github.com/vuejs/eslint-plugin-vue/pull/2759)) +- Changed [`vue/component-name-in-template-casing`](https://eslint.vuejs.org/rules/component-name-in-template-casing.html) `globals` option to support regex patterns ([#2928](https://github.com/vuejs/eslint-plugin-vue/pull/2928)) +- Changed [`vue/valid-define-options`](https://eslint.vuejs.org/rules/valid-define-options.html) to allow local literal constant references ([#2920](https://github.com/vuejs/eslint-plugin-vue/pull/2920)) +- Changed [`vue/no-mutating-props`](https://eslint.vuejs.org/rules/no-mutating-props.html) and [`vue/no-side-effects-in-computed-properties`](https://eslint.vuejs.org/rules/no-side-effects-in-computed-properties.html) rules to detect `Object.assign` mutations ([#2929](https://github.com/vuejs/eslint-plugin-vue/pull/2929)) +- Added [`@stylistic/eslint-plugin`](https://eslint.style/) as optional peer dependency ([#2884](https://github.com/vuejs/eslint-plugin-vue/pull/2884)) + +### Patch Changes + +- Changed [`vue/define-macros-order`](https://eslint.vuejs.org/rules/define-macros-order.html) to ignore enum declarations and `declare` statements ([#2918](https://github.com/vuejs/eslint-plugin-vue/pull/2918)) + ## 10.4.0 ### Minor Changes - Added `ignoreParents` option to [`vue/no-deprecated-slot-attribute`](https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html) ([#2784](https://github.com/vuejs/eslint-plugin-vue/pull/2784)) - - Added new [`vue/no-negated-v-if-condition`](https://eslint.vuejs.org/rules/no-negated-v-if-condition.html) rule ([#2794](https://github.com/vuejs/eslint-plugin-vue/pull/2794)) - - Added new [`vue/no-negated-condition`](https://eslint.vuejs.org/rules/no-negated-condition.html) rule ([#2795](https://github.com/vuejs/eslint-plugin-vue/pull/2795)) ### Patch Changes -- Resolved TypeScript compatibility issues introduced by eslint-typegen ([#2790](https://github.com/vuejs/eslint-plugin-vue/pull/2790)) - +- Resolved TypeScript compatibility issues introduced by [eslint-typegen](https://github.com/antfu/eslint-typegen) ([#2790](https://github.com/vuejs/eslint-plugin-vue/pull/2790)) - Fixed inconsistent quotes in [`vue/block-lang`](https://eslint.vuejs.org/rules/block-lang.html) error messages ([#2805](https://github.com/vuejs/eslint-plugin-vue/pull/2805)) ## 10.3.0 @@ -21,17 +34,13 @@ ### Minor Changes - Added [`@typescript-eslint/parser`](https://typescript-eslint.io/packages/parser) as an optional peer dependency ([#2775](https://github.com/vuejs/eslint-plugin-vue/pull/2775)) - - Add TypeScript IntelliSense support via [eslint-typegen](https://github.com/antfu/eslint-typegen) ([#2770](https://github.com/vuejs/eslint-plugin-vue/pull/2770)) - - [`vue/no-deprecated-slot-attribute`](https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html) `ignore` option now supports regex patterns ([#2773](https://github.com/vuejs/eslint-plugin-vue/pull/2773)) ### Patch Changes - Fixed false negatives when using typescript-eslint v8 in [`vue/script-indent`](https://eslint.vuejs.org/rules/script-indent.html) rule ([#2775](https://github.com/vuejs/eslint-plugin-vue/pull/2775)) - - Update resources ([#2752](https://github.com/vuejs/eslint-plugin-vue/pull/2752)) - - [`vue/no-restricted-html-elements`](https://eslint.vuejs.org/rules/no-restricted-html-elements.html) now also checks SVG and MathML elements ([#2755](https://github.com/vuejs/eslint-plugin-vue/pull/2755)) ## 10.2.0 diff --git a/README.md b/README.md index bdeb5e167..01bc6b687 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,13 @@ Contributing is welcome! See the [ESLint Vue Plugin Developer Guide](https://esl Be sure to read the [official ESLint guide](https://eslint.org/docs/developer-guide/working-with-rules) before you start writing a new rule. -To see what an abstract syntax tree (AST) of your code looks like, you may use [AST Explorer](https://astexplorer.net). After opening [AST Explorer](https://astexplorer.net), select `Vue` as the syntax and `vue-eslint-parser` as the parser. +To see what an abstract syntax tree (AST) of your code looks like, you may use [AST Explorer](https://astexplorer.net). After opening [AST Explorer](https://astexplorer.net), select `Vue` as the syntax and [`vue-eslint-parser`](https://github.com/vuejs/vue-eslint-parser) as the parser. The default JavaScript parser must be replaced because [Vue.js single file components](https://vuejs.org/guide/scaling-up/sfc.html) are not plain JavaScript, but a custom file format. [`vue-eslint-parser`](https://github.com/vuejs/vue-eslint-parser) is a replacement parser that generates an enhanced AST with nodes that represent specific parts of the template syntax, as well as the contents of the ` +``` + + ## :books: Further Reading -- [vue-async-computed](https://github.com/foxbenjaminfox/vue-async-computed) +- [vue-async-computed] + +[vue-async-computed]: https://github.com/foxbenjaminfox/vue-async-computed ## :rocket: Version diff --git a/docs/rules/no-computed-properties-in-data.md b/docs/rules/no-computed-properties-in-data.md index 960a28c86..85d3b84ed 100644 --- a/docs/rules/no-computed-properties-in-data.md +++ b/docs/rules/no-computed-properties-in-data.md @@ -14,7 +14,7 @@ since: v7.20.0 ## :book: Rule Details -This rule disallow accessing computed properties in `data()`. +This rule disallow accessing computed properties in `data()`.\ The computed property cannot be accessed in `data()` because is before initialization. diff --git a/docs/rules/no-deprecated-data-object-declaration.md b/docs/rules/no-deprecated-data-object-declaration.md index 214aacc30..51b252ab5 100644 --- a/docs/rules/no-deprecated-data-object-declaration.md +++ b/docs/rules/no-deprecated-data-object-declaration.md @@ -16,7 +16,7 @@ since: v7.0.0 ## :book: Rule Details This rule reports use of deprecated object declaration on `data` property (in Vue.js 3.0.0+). -The different from `vue/no-shared-component-data` is the root instance being also disallowed. +The different from [`vue/no-shared-component-data`](./no-shared-component-data.md) is the root instance being also disallowed. See [Migration Guide - Data Option](https://v3-migration.vuejs.org/breaking-changes/data-option.html) for more details. diff --git a/docs/rules/no-duplicate-attr-inheritance.md b/docs/rules/no-duplicate-attr-inheritance.md index fe3cd37bf..e433280ef 100644 --- a/docs/rules/no-duplicate-attr-inheritance.md +++ b/docs/rules/no-duplicate-attr-inheritance.md @@ -12,7 +12,7 @@ since: v7.0.0 ## :book: Rule Details -This rule aims to prevent duplicate attribute inheritance. +This rule aims to prevent duplicate attribute inheritance.\ This rule suggests applying `inheritAttrs: false` when it detects `v-bind="$attrs"` being used. diff --git a/docs/rules/no-expose-after-await.md b/docs/rules/no-expose-after-await.md index 7f8fe9137..bd11f7d44 100644 --- a/docs/rules/no-expose-after-await.md +++ b/docs/rules/no-expose-after-await.md @@ -14,8 +14,8 @@ since: v8.1.0 ## :book: Rule Details -This rule reports usages of `expose()` and `defineExpose()` after an `await` expression. -In the `setup()` function, `expose()` should be registered synchronously. +This rule reports usages of `expose()` and `defineExpose()` after an `await` expression.\ +In the `setup()` function, `expose()` should be registered synchronously.\ In the ` diff --git a/tests/integrations/eslint-plugin-import.js b/tests/integrations/eslint-plugin-import.js index 6f4be7acf..26b2a5140 100644 --- a/tests/integrations/eslint-plugin-import.js +++ b/tests/integrations/eslint-plugin-import.js @@ -35,6 +35,9 @@ describe('Integration with eslint-plugin-import', () => { return } - cp.execSync(`${ESLINT} a.vue`, { cwd: PLUGIN_DIR, stdio: 'inherit' }) + cp.execSync(`${ESLINT} --config eslint.config.mjs a.vue`, { + cwd: PLUGIN_DIR, + stdio: 'inherit' + }) }) }) diff --git a/tests/integrations/eslint-plugin-import/.eslintrc.json b/tests/integrations/eslint-plugin-import/.eslintrc.json deleted file mode 100644 index 20585a5fd..000000000 --- a/tests/integrations/eslint-plugin-import/.eslintrc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "root": true, - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2015 - }, - "parser": "vue-eslint-parser", - "plugins": ["import", "vue"], - "rules": { - "import/default": "warn", - "import/namespace": "warn" - }, - "settings": { - "import/extensions": [".js", ".vue"] - } -} diff --git a/tests/integrations/eslint-plugin-import/eslint.config.mjs b/tests/integrations/eslint-plugin-import/eslint.config.mjs new file mode 100644 index 000000000..ff8eaac7a --- /dev/null +++ b/tests/integrations/eslint-plugin-import/eslint.config.mjs @@ -0,0 +1,27 @@ +import vueEslintParser from 'vue-eslint-parser' +import eslintPluginImport from 'eslint-plugin-import' +import eslintPluginVue from 'eslint-plugin-vue' + +export default [ + { + files: ['*.vue'], + languageOptions: { + parser: vueEslintParser, + parserOptions: { + sourceType: 'module', + ecmaVersion: 2015 + } + }, + plugins: { + import: eslintPluginImport, + vue: eslintPluginVue + }, + rules: { + 'import/default': 'warn', + 'import/namespace': 'warn' + }, + settings: { + 'import/extensions': ['.js', '.vue'] + } + } +] diff --git a/tests/integrations/eslint-plugin-import/package.json b/tests/integrations/eslint-plugin-import/package.json index 6de5b12e5..41d7ec4b6 100644 --- a/tests/integrations/eslint-plugin-import/package.json +++ b/tests/integrations/eslint-plugin-import/package.json @@ -8,8 +8,8 @@ "author": "Toru Nagashima (https://github.com/mysticatea)", "license": "MIT", "dependencies": { - "eslint": "^7.0.0", - "eslint-plugin-import": "~2.23.4", + "eslint": "^9.0.0", + "eslint-plugin-import": "^2.31.0", "eslint-plugin-vue": "file:../../.." } } diff --git a/tests/lib/rules/attributes-order.js b/tests/lib/rules/attributes-order.js index eb4543d1d..edd58b23b 100644 --- a/tests/lib/rules/attributes-order.js +++ b/tests/lib/rules/attributes-order.js @@ -617,6 +617,71 @@ tester.run('attributes-order', rule, { alphabetical: false } ] + }, + { + filename: 'test.vue', + code: ` + `, + options: [{ sortLineLength: true }] + }, + { + filename: 'test.vue', + code: ` + `, + options: [{ sortLineLength: false }] + }, + { + filename: 'test.vue', + code: ` + `, + options: [{ sortLineLength: true }] + }, + { + filename: 'test.vue', + code: ` + `, + options: [{ sortLineLength: true }] + }, + { + filename: 'test.vue', + code: ` + `, + options: [{ sortLineLength: true, alphabetical: true }] } ], @@ -2102,6 +2167,183 @@ tester.run('attributes-order', rule, { endColumn: 26 } ] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true }], + errors: ['Attribute "short" should go before "medium-attr".'] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true }], + errors: ['Attribute "short" should go before "very-long-attribute-name".'] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true }], + errors: ['Attribute "short" should go before "very-long-attribute-name".'] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true }], + errors: [ + 'Attribute "@click" should go before "@mouseover".', + 'Attribute "@input" should go before "@mouseover".' + ] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true }], + errors: [ + 'Attribute ":a" should go before ":abc".', + 'Attribute ":ab" should go before ":abc".' + ] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true }], + errors: ['Attribute "short" should go before "very-long-binding".'] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true, alphabetical: true }], + errors: [{ message: 'Attribute "z" should go before "aa".' }] + }, + { + filename: 'test.vue', + code: ` + `, + output: ` + `, + options: [{ sortLineLength: true, alphabetical: true }], + errors: [ + { message: 'Attribute "bb" should go before "zz".' }, + { message: 'Attribute "@click" should go before "@keyup".' } + ] } ] }) diff --git a/tests/lib/rules/comma-style.js b/tests/lib/rules/comma-style.js index 82c8e4044..e41ba9b44 100644 --- a/tests/lib/rules/comma-style.js +++ b/tests/lib/rules/comma-style.js @@ -3,8 +3,10 @@ */ 'use strict' +const semver = require('semver') const { RuleTester } = require('../../eslint-compat') const rule = require('../../../lib/rules/comma-style') +const { eslintStylisticVersion } = require('../../test-utils/eslint-stylistic') const tester = new RuleTester({ languageOptions: { parser: require('vue-eslint-parser'), ecmaVersion: 2018 } @@ -34,13 +36,6 @@ tester.run('comma-style', rule, { `, options: ['first', { exceptions: { ArrowFunctionExpression: false } }] }, - ` - - `, { code: ` `, output: null, errors: [ - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead." + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 3, + column: 25, + endLine: 3, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 4, + column: 25, + endLine: 4, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 5, + column: 25, + endLine: 5, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 6, + column: 25, + endLine: 6, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 7, + column: 25, + endLine: 7, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 8, + column: 25, + endLine: 8, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 9, + column: 25, + endLine: 9, + endColumn: 28 + } ] }, { @@ -244,11 +405,46 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { `, errors: [ - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", - "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead." + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 3, + column: 25, + endLine: 3, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 4, + column: 25, + endLine: 4, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 5, + column: 25, + endLine: 5, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 6, + column: 25, + endLine: 6, + endColumn: 27 + }, + { + message: + "'KeyboardEvent.keyCode' modifier on 'v-on' directive is deprecated. Using 'KeyboardEvent.key' instead.", + line: 7, + column: 25, + endLine: 7, + endColumn: 27 + } ] } ] diff --git a/tests/lib/rules/no-deprecated-vue-config-keycodes.js b/tests/lib/rules/no-deprecated-vue-config-keycodes.js index ee00e5c37..1a00c1c86 100644 --- a/tests/lib/rules/no-deprecated-vue-config-keycodes.js +++ b/tests/lib/rules/no-deprecated-vue-config-keycodes.js @@ -46,12 +46,28 @@ ruleTester.run('no-deprecated-vue-config-keycodes', rule, { { filename: 'test.js', code: 'Vue?.config?.keyCodes', - errors: ['`Vue.config.keyCodes` are deprecated.'] + errors: [ + { + message: '`Vue.config.keyCodes` are deprecated.', + line: 1, + column: 1, + endLine: 1, + endColumn: 22 + } + ] }, { filename: 'test.js', code: '(Vue?.config)?.keyCodes', - errors: ['`Vue.config.keyCodes` are deprecated.'] + errors: [ + { + message: '`Vue.config.keyCodes` are deprecated.', + line: 1, + column: 1, + endLine: 1, + endColumn: 24 + } + ] } ] }) diff --git a/tests/lib/rules/no-dupe-keys.js b/tests/lib/rules/no-dupe-keys.js index 2df95908c..794dbd2ec 100644 --- a/tests/lib/rules/no-dupe-keys.js +++ b/tests/lib/rules/no-dupe-keys.js @@ -546,22 +546,34 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 5 + line: 5, + column: 13, + endLine: 5, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 10 + line: 10, + column: 15, + endLine: 10, + endColumn: 18 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 14 + line: 14, + column: 13, + endLine: 14, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 21 + line: 21, + column: 15, + endLine: 21, + endColumn: 18 } ] }, @@ -596,22 +608,34 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 5 + line: 5, + column: 13, + endLine: 5, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 10 + line: 10, + column: 15, + endLine: 10, + endColumn: 18 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 14 + line: 14, + column: 13, + endLine: 14, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 21 + line: 21, + column: 15, + endLine: 21, + endColumn: 18 } ] }, @@ -637,17 +661,26 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 5 + line: 5, + column: 13, + endLine: 5, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 9 + line: 9, + column: 13, + endLine: 9, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 12 + line: 12, + column: 13, + endLine: 12, + endColumn: 16 } ] }, @@ -684,22 +717,34 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 7 + line: 7, + column: 13, + endLine: 7, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 13 + line: 13, + column: 13, + endLine: 13, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 16 + line: 16, + column: 13, + endLine: 16, + endColumn: 16 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 23 + line: 23, + column: 15, + endLine: 23, + endColumn: 18 } ] }, @@ -720,7 +765,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'bar'. May cause name collision in script or template tag.", - line: 7 + line: 7, + column: 13, + endLine: 7, + endColumn: 16 } ] }, @@ -746,7 +794,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 12 + line: 12, + column: 15, + endLine: 12, + endColumn: 18 } ] }, @@ -770,7 +821,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 10 + line: 10, + column: 15, + endLine: 10, + endColumn: 18 } ] }, @@ -792,7 +846,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 9 + line: 9, + column: 13, + endLine: 9, + endColumn: 16 } ] }, @@ -814,7 +871,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 9 + line: 9, + column: 13, + endLine: 9, + endColumn: 16 } ] }, @@ -836,7 +896,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 9 + line: 9, + column: 13, + endLine: 9, + endColumn: 16 } ] }, @@ -858,7 +921,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 9 + line: 9, + column: 13, + endLine: 9, + endColumn: 16 } ] }, @@ -879,7 +945,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'bar'. May cause name collision in script or template tag.", - line: 7 + line: 7, + column: 13, + endLine: 7, + endColumn: 16 } ] }, @@ -900,7 +969,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'bar'. May cause name collision in script or template tag.", - line: 7 + line: 7, + column: 13, + endLine: 7, + endColumn: 16 } ] }, @@ -925,7 +997,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 6 + line: 6, + column: 17, + endLine: 6, + endColumn: 20 } ] }, @@ -946,7 +1021,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 7 + line: 7, + column: 17, + endLine: 7, + endColumn: 20 } ] }, @@ -966,7 +1044,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 6 + line: 6, + column: 17, + endLine: 6, + endColumn: 20 } ] }, @@ -987,7 +1068,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 7 + line: 7, + column: 17, + endLine: 7, + endColumn: 20 } ] }, @@ -1008,7 +1092,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 7 + line: 7, + column: 17, + endLine: 7, + endColumn: 20 } ] }, @@ -1027,7 +1114,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 6 + line: 6, + column: 15, + endLine: 6, + endColumn: 22 } ] }, @@ -1055,17 +1145,26 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'baz'. May cause name collision in script or template tag.", - line: 4 + line: 4, + column: 16, + endLine: 4, + endColumn: 19 }, { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 12 + line: 12, + column: 9, + endLine: 14, + endColumn: 10 }, { message: "Duplicate key 'bar'. May cause name collision in script or template tag.", - line: 15 + line: 15, + column: 15, + endLine: 15, + endColumn: 32 } ] }, @@ -1090,12 +1189,18 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'foo'. May cause name collision in script or template tag.", - line: 8 + line: 8, + column: 13, + endLine: 8, + endColumn: 24 }, { message: "Duplicate key 'bar'. May cause name collision in script or template tag.", - line: 9 + line: 9, + column: 13, + endLine: 9, + endColumn: 24 } ] }, @@ -1113,7 +1218,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'bar'. May cause name collision in script or template tag.", - line: 5 + line: 5, + column: 13, + endLine: 5, + endColumn: 21 } ] }, @@ -1131,7 +1239,10 @@ ruleTester.run('no-dupe-keys', rule, { { message: "Duplicate key 'bar'. May cause name collision in script or template tag.", - line: 5 + line: 5, + column: 13, + endLine: 5, + endColumn: 24 } ] } diff --git a/tests/lib/rules/no-dupe-v-else-if.js b/tests/lib/rules/no-dupe-v-else-if.js index 8e1388b4f..0d65ddf31 100644 --- a/tests/lib/rules/no-dupe-v-else-if.js +++ b/tests/lib/rules/no-dupe-v-else-if.js @@ -165,7 +165,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 4 + line: 4, + column: 25, + endLine: 4, + endColumn: 39 } ] }, @@ -182,7 +185,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 6 + line: 6, + column: 25, + endLine: 6, + endColumn: 31 } ] }, @@ -200,7 +206,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 6 + line: 6, + column: 25, + endLine: 6, + endColumn: 32 } ] }, @@ -215,7 +224,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 4 + line: 4, + column: 25, + endLine: 4, + endColumn: 26 } ] }, @@ -231,7 +243,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 5 + line: 5, + column: 25, + endLine: 5, + endColumn: 31 } ] }, @@ -246,7 +261,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 4 + line: 4, + column: 25, + endLine: 4, + endColumn: 26 } ] }, @@ -261,7 +279,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 4 + line: 4, + column: 25, + endLine: 4, + endColumn: 36 } ] }, @@ -276,7 +297,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 4 + line: 4, + column: 25, + endLine: 4, + endColumn: 26 } ] }, @@ -292,7 +316,10 @@ tester.run('no-dupe-v-else-if', rule, { errors: [ { messageId: 'unexpected', - line: 5 + line: 5, + column: 31, + endLine: 5, + endColumn: 47 } ] }, @@ -332,8 +359,20 @@ tester.run('no-dupe-v-else-if', rule, { `, errors: [ - { messageId: 'unexpected', line: 4 }, - { messageId: 'unexpected', line: 5 } + { + messageId: 'unexpected', + line: 4, + column: 25, + endLine: 4, + endColumn: 36 + }, + { + messageId: 'unexpected', + line: 5, + column: 25, + endLine: 5, + endColumn: 36 + } ] }, { @@ -346,8 +385,20 @@ tester.run('no-dupe-v-else-if', rule, { `, errors: [ - { messageId: 'unexpected', line: 4 }, - { messageId: 'unexpected', line: 5 } + { + messageId: 'unexpected', + line: 4, + column: 25, + endLine: 4, + endColumn: 26 + }, + { + messageId: 'unexpected', + line: 5, + column: 25, + endLine: 5, + endColumn: 26 + } ] }, { @@ -359,263 +410,702 @@ tester.run('no-dupe-v-else-if', rule, {
`, - errors: [{ messageId: 'unexpected' }, { messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 4, + column: 26, + endLine: 4, + endColumn: 60 + }, + { + messageId: 'unexpected', + line: 5, + column: 26, + endLine: 5, + endColumn: 60 + } + ] }, // Referred to the ESLint core rule. { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 43, + endLine: 1, + endColumn: 44 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 64, + endLine: 1, + endColumn: 65 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 64, + endLine: 1, + endColumn: 65 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 85, + endLine: 1, + endColumn: 86 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 64, + endLine: 1, + endColumn: 65 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 85, + endLine: 1, + endColumn: 86 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 85, + endLine: 1, + endColumn: 86 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 106, + endLine: 1, + endColumn: 107 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }, { messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 43, + endLine: 1, + endColumn: 44 + }, + { + messageId: 'unexpected', + line: 1, + column: 64, + endLine: 1, + endColumn: 65 + } + ] }, { filename: 'test.vue', code: '', errors: [ - { messageId: 'unexpected' }, - { messageId: 'unexpected' }, - { messageId: 'unexpected' } + { + messageId: 'unexpected', + line: 1, + column: 64, + endLine: 1, + endColumn: 65 + }, + { + messageId: 'unexpected', + line: 1, + column: 85, + endLine: 1, + endColumn: 86 + }, + { + messageId: 'unexpected', + line: 1, + column: 106, + endLine: 1, + endColumn: 107 + } ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 63, + endLine: 1, + endColumn: 64 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 49, + endLine: 1, + endColumn: 56 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 47, + endLine: 1, + endColumn: 52 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 46, + endLine: 1, + endColumn: 50 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 54 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 53, + endLine: 1, + endColumn: 64 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 46, + endLine: 1, + endColumn: 50 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 49, + endLine: 1, + endColumn: 54 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 49, + endLine: 1, + endColumn: 70 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 49 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }, { messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 49 + }, + { + messageId: 'unexpected', + line: 1, + column: 69, + endLine: 1, + endColumn: 70 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 54 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 64, + endLine: 1, + endColumn: 70 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 74, + endLine: 1, + endColumn: 80 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 65, + endLine: 1, + endColumn: 81 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 43, + endLine: 1, + endColumn: 44 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 59 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 59 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 64, + endLine: 1, + endColumn: 75 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 70, + endLine: 1, + endColumn: 76 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 75, + endLine: 1, + endColumn: 91 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 53, + endLine: 1, + endColumn: 64 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 49 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 65, + endLine: 1, + endColumn: 71 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 62, + endLine: 1, + endColumn: 80 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 58, + endLine: 1, + endColumn: 69 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 75, + endLine: 1, + endColumn: 91 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 62, + endLine: 1, + endColumn: 75 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 49, + endLine: 1, + endColumn: 55 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 90, + endLine: 1, + endColumn: 91 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 53, + endLine: 1, + endColumn: 78 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 55, + endLine: 1, + endColumn: 68 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 91, + endLine: 1, + endColumn: 97 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 70, + endLine: 1, + endColumn: 81 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 43, + endLine: 1, + endColumn: 49 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 54 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 49 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 43, + endLine: 1, + endColumn: 44 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 49 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 48, + endLine: 1, + endColumn: 49 + } + ] } ] }) diff --git a/tests/lib/rules/no-duplicate-attr-inheritance.js b/tests/lib/rules/no-duplicate-attr-inheritance.js index 41e9f1522..8a007b491 100644 --- a/tests/lib/rules/no-duplicate-attr-inheritance.js +++ b/tests/lib/rules/no-duplicate-attr-inheritance.js @@ -157,7 +157,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, { { filename: 'test.vue', code: '', - errors: ['Set "inheritAttrs" to false.'] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 1, + column: 29, + endLine: 1, + endColumn: 35 + } + ] }, { filename: 'test.vue', @@ -169,7 +177,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, { } `, - errors: ['Set "inheritAttrs" to false.'] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 2, + column: 37, + endLine: 2, + endColumn: 43 + } + ] }, { filename: 'test.vue', @@ -184,7 +200,10 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, { errors: [ { message: 'Set "inheritAttrs" to false.', - line: 7 + line: 7, + column: 30, + endLine: 7, + endColumn: 36 } ] }, @@ -199,7 +218,10 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, { errors: [ { message: 'Set "inheritAttrs" to false.', - line: 5 + line: 5, + column: 30, + endLine: 5, + endColumn: 36 } ] }, @@ -207,7 +229,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, { filename: 'test.vue', code: ``, options: [{ checkMultiRootNodes: true }], - errors: [{ message: 'Set "inheritAttrs" to false.' }] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 1, + column: 24, + endLine: 1, + endColumn: 30 + } + ] }, { filename: 'test.vue', @@ -219,7 +249,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, { `, options: [{ checkMultiRootNodes: true }], - errors: [{ message: 'Set "inheritAttrs" to false.' }] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 3, + column: 40, + endLine: 3, + endColumn: 46 + } + ] }, // condition group as a single root node { @@ -231,7 +269,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, {
`, - errors: [{ message: 'Set "inheritAttrs" to false.' }] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 3, + column: 40, + endLine: 3, + endColumn: 46 + } + ] }, { filename: 'test.vue', @@ -243,7 +289,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, {
`, - errors: [{ message: 'Set "inheritAttrs" to false.' }] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 3, + column: 40, + endLine: 3, + endColumn: 46 + } + ] }, { filename: 'test.vue', @@ -253,7 +307,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, {
`, - errors: [{ message: 'Set "inheritAttrs" to false.' }] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 3, + column: 40, + endLine: 3, + endColumn: 46 + } + ] }, { filename: 'test.vue', @@ -262,7 +324,15 @@ ruleTester.run('no-duplicate-attr-inheritance', rule, {
`, - errors: [{ message: 'Set "inheritAttrs" to false.' }] + errors: [ + { + message: 'Set "inheritAttrs" to false.', + line: 3, + column: 40, + endLine: 3, + endColumn: 46 + } + ] } ] }) diff --git a/tests/lib/rules/no-duplicate-attributes.js b/tests/lib/rules/no-duplicate-attributes.js index ddb82db16..48dedf509 100644 --- a/tests/lib/rules/no-duplicate-attributes.js +++ b/tests/lib/rules/no-duplicate-attributes.js @@ -62,36 +62,84 @@ tester.run('no-duplicate-attributes', rule, { { filename: 'test.vue', code: '', - errors: ["Duplicate attribute 'foo'."] + errors: [ + { + message: "Duplicate attribute 'foo'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 35 + } + ] }, { filename: 'test.vue', code: '', - errors: ["Duplicate attribute 'foo'."] + errors: [ + { + message: "Duplicate attribute 'foo'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 29 + } + ] }, { filename: 'test.vue', code: '', options: [{ allowCoexistStyle: false }], - errors: ["Duplicate attribute 'style'."] + errors: [ + { + message: "Duplicate attribute 'style'.", + line: 1, + column: 27, + endLine: 1, + endColumn: 33 + } + ] }, { filename: 'test.vue', code: '', options: [{ allowCoexistClass: false }], - errors: ["Duplicate attribute 'class'."] + errors: [ + { + message: "Duplicate attribute 'class'.", + line: 1, + column: 27, + endLine: 1, + endColumn: 33 + } + ] }, { filename: 'test.vue', code: '', options: [{ allowCoexistStyle: false }], - errors: ["Duplicate attribute 'style'."] + errors: [ + { + message: "Duplicate attribute 'style'.", + line: 1, + column: 28, + endLine: 1, + endColumn: 33 + } + ] }, { filename: 'test.vue', code: '', options: [{ allowCoexistClass: false }], - errors: ["Duplicate attribute 'class'."] + errors: [ + { + message: "Duplicate attribute 'class'.", + line: 1, + column: 28, + endLine: 1, + endColumn: 33 + } + ] } ] }) diff --git a/tests/lib/rules/no-empty-component-block.js b/tests/lib/rules/no-empty-component-block.js index 0a014099a..87ad2dd66 100644 --- a/tests/lib/rules/no-empty-component-block.js +++ b/tests/lib/rules/no-empty-component-block.js @@ -30,7 +30,11 @@ tester.run('no-empty-component-block', rule, { output: '', errors: [ { - message: '`