diff --git a/.changeset/gorgeous-colts-bathe.md b/.changeset/gorgeous-colts-bathe.md new file mode 100644 index 000000000..e5f3a14a8 --- /dev/null +++ b/.changeset/gorgeous-colts-bathe.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": patch +--- + +Updates resources diff --git a/.changeset/rich-zebras-type.md b/.changeset/rich-zebras-type.md new file mode 100644 index 000000000..62c2438ae --- /dev/null +++ b/.changeset/rich-zebras-type.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": minor +--- + +Changed `vue/no-negated-v-if-condition` suggestion to autofix diff --git a/.changeset/swift-spies-nail.md b/.changeset/swift-spies-nail.md new file mode 100644 index 000000000..6d8ffe174 --- /dev/null +++ b/.changeset/swift-spies-nail.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": minor +--- + +Added new `ignoreEOLComments` option to `vue/no-multi-spaces` rule diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 90bd33ad5..69cac752d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -18,9 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 - name: Install Packages run: npm install --legacy-peer-deps - name: Lint @@ -31,24 +31,33 @@ 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 - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Node.js v${{ matrix.node }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: 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@v5 + - name: Install Node.js v18 + uses: actions/setup-node@v6 + 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 @@ -57,13 +66,31 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 - 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@v5 + - name: Install Node.js + uses: actions/setup-node@v6 + - 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 @@ -72,12 +99,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 - 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/.github/workflows/Release.yml b/.github/workflows/Release.yml index 3653780d5..feb5a19e5 100644 --- a/.github/workflows/Release.yml +++ b/.github/workflows/Release.yml @@ -14,13 +14,16 @@ jobs: permissions: contents: write # to create release (changesets/action) pull-requests: write # to create pull request (changesets/action) + id-token: write # OpenID Connect token needed for Trusted Publisher name: Release runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 + with: + node-version: 24 - name: Install Dependencies run: npm install @@ -32,4 +35,3 @@ jobs: publish: npm run changeset:publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/check-for-resources-update.yml b/.github/workflows/check-for-resources-update.yml index 31f881b1d..362ca48cc 100644 --- a/.github/workflows/check-for-resources-update.yml +++ b/.github/workflows/check-for-resources-update.yml @@ -14,9 +14,9 @@ jobs: if: ${{ github.repository == 'vuejs/eslint-plugin-vue' }} steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Install Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: node-version: 18 - name: Install Packages diff --git a/.vscode/launch.json b/.vscode/launch.json index 2fa4db9b2..997cf0bca 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,8 +5,16 @@ "type": "node", "request": "launch", "name": "Start testing", - "program": "${workspaceFolder}/node_modules/.bin/mocha", - "args": ["${file}", "--watch"], + "program": "${workspaceFolder}/node_modules/.bin/vitest", + "args": ["run", "${file}", "--reporter=verbose"], + "console": "integratedTerminal" + }, + { + "type": "node", + "request": "launch", + "name": "Start testing (watch)", + "program": "${workspaceFolder}/node_modules/.bin/vitest", + "args": ["${file}", "--reporter=verbose"], "console": "integratedTerminal" } ] diff --git a/.vscode/settings.json b/.vscode/settings.json index f80681b66..20102543c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,13 @@ { "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 d48439d99..4bbb44fa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,79 @@ # eslint-plugin-vue +## 10.6.2 + +### Patch Changes + +- Fixed false positives in non-intersecting conditions in [`vue/no-duplicate-class-names`](https://eslint.vuejs.org/rules/no-duplicate-class-names.html) and correctly detect duplicates in combining expressions ([#2980](https://github.com/vuejs/eslint-plugin-vue/pull/2980)) +- Fixed false positives for `TSImportType` in [`vue/script-indent`](https://eslint.vuejs.org/rules/script-indent.html) rule ([#2969](https://github.com/vuejs/eslint-plugin-vue/pull/2969)) +- Improved performance and type safety in [`vue/prefer-use-template-ref`](https://eslint.vuejs.org/rules/prefer-use-template-ref.html) ([#2982](https://github.com/vuejs/eslint-plugin-vue/pull/2982)) + +## 10.6.1 + +### Patch Changes + +- Fixed false positives for comments outside ``, options: [anyWith({ html: { normal: 'always' } })], errors: [ - { message: 'Require self-closing on HTML elements (
).', line: 2 } + { + message: 'Require self-closing on HTML elements (
).', + line: 2, + column: 8, + endLine: 2, + endColumn: 14 + } ] }, { @@ -149,7 +195,13 @@ tester.run('html-self-closing', rule, { `, options: [anyWith({ html: { normal: 'never' } })], errors: [ - { message: 'Disallow self-closing on HTML elements (
).', line: 3 } + { + message: 'Disallow self-closing on HTML elements (
).', + line: 3, + column: 7, + endLine: 3, + endColumn: 9 + } ] }, { @@ -170,7 +222,10 @@ tester.run('html-self-closing', rule, { errors: [ { message: 'Require self-closing on HTML void elements ().', - line: 4 + line: 4, + column: 3, + endLine: 4, + endColumn: 8 } ] }, @@ -192,7 +247,10 @@ tester.run('html-self-closing', rule, { errors: [ { message: 'Disallow self-closing on HTML void elements ().', - line: 5 + line: 5, + column: 7, + endLine: 5, + endColumn: 9 } ] }, @@ -215,7 +273,10 @@ tester.run('html-self-closing', rule, { { message: 'Require self-closing on Vue.js custom components ().', - line: 6 + line: 6, + column: 11, + endLine: 6, + endColumn: 20 } ] }, @@ -238,7 +299,10 @@ tester.run('html-self-closing', rule, { { message: 'Disallow self-closing on Vue.js custom components ().', - line: 7 + line: 7, + column: 10, + endLine: 7, + endColumn: 12 } ] }, @@ -258,7 +322,13 @@ tester.run('html-self-closing', rule, { `, options: [anyWith({ svg: 'always' })], errors: [ - { message: 'Require self-closing on SVG elements ().', line: 8 } + { + message: 'Require self-closing on SVG elements ().', + line: 8, + column: 14, + endLine: 8, + endColumn: 21 + } ] }, { @@ -277,7 +347,13 @@ tester.run('html-self-closing', rule, { `, options: [anyWith({ svg: 'never' })], errors: [ - { message: 'Disallow self-closing on SVG elements ().', line: 9 } + { + message: 'Disallow self-closing on SVG elements ().', + line: 9, + column: 13, + endLine: 9, + endColumn: 15 + } ] }, { @@ -298,7 +374,10 @@ tester.run('html-self-closing', rule, { errors: [ { message: 'Require self-closing on MathML elements ().', - line: 10 + line: 10, + column: 17, + endLine: 10, + endColumn: 26 } ] }, @@ -320,7 +399,10 @@ tester.run('html-self-closing', rule, { errors: [ { message: 'Disallow self-closing on MathML elements ().', - line: 11 + line: 11, + column: 16, + endLine: 11, + endColumn: 18 } ] } diff --git a/tests/lib/rules/jsx-uses-vars.js b/tests/lib/rules/jsx-uses-vars.js index 81d907dae..0f7c71146 100644 --- a/tests/lib/rules/jsx-uses-vars.js +++ b/tests/lib/rules/jsx-uses-vars.js @@ -124,7 +124,11 @@ describe('jsx-uses-vars', () => { ` } ] - : null + : null, + line: 3, + column: 16, + endLine: 3, + endColumn: 29 } ] }, @@ -162,7 +166,11 @@ describe('jsx-uses-vars', () => { ` } ] - : null + : null, + line: 4, + column: 15, + endLine: 4, + endColumn: 22 } ] } diff --git a/tests/lib/rules/key-spacing.js b/tests/lib/rules/key-spacing.js index 0e13216dc..c8a5a9ddd 100644 --- a/tests/lib/rules/key-spacing.js +++ b/tests/lib/rules/key-spacing.js @@ -24,8 +24,20 @@ tester.run('key-spacing', rule, { code: '', output: '', errors: [ - "Extra space after key 'a'.", - "Missing space before value for key 'a'." + { + message: "Extra space after key 'a'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + }, + { + message: "Missing space before value for key 'a'.", + line: 1, + column: 27, + endLine: 1, + endColumn: 28 + } ] }, { @@ -33,8 +45,20 @@ tester.run('key-spacing', rule, { output: '', options: [{ beforeColon: true }], errors: [ - "Missing space after key 'a'.", - "Missing space before value for key 'a'." + { + message: "Missing space after key 'a'.", + line: 1, + column: 32, + endLine: 1, + endColumn: 33 + }, + { + message: "Missing space before value for key 'a'.", + line: 1, + column: 34, + endLine: 1, + endColumn: 35 + } ] } ] diff --git a/tests/lib/rules/keyword-spacing.js b/tests/lib/rules/keyword-spacing.js index 3bebe093e..3236a1fa1 100644 --- a/tests/lib/rules/keyword-spacing.js +++ b/tests/lib/rules/keyword-spacing.js @@ -68,23 +68,38 @@ tester.run('keyword-spacing', rule, { errors: [ { message: 'Expected space(s) after "if".', - line: 3 + line: 3, + column: 11, + endLine: 3, + endColumn: 13 }, { message: 'Expected space(s) before "else".', - line: 5 + line: 5, + column: 12, + endLine: 5, + endColumn: 16 }, { message: 'Expected space(s) after "if".', - line: 5 + line: 5, + column: 17, + endLine: 5, + endColumn: 19 }, { message: 'Expected space(s) before "else".', - line: 7 + line: 7, + column: 12, + endLine: 7, + endColumn: 16 }, { message: 'Expected space(s) after "else".', - line: 7 + line: 7, + column: 12, + endLine: 7, + endColumn: 16 } ] }, @@ -115,23 +130,38 @@ tester.run('keyword-spacing', rule, { errors: [ { message: 'Unexpected space(s) after "if".', - line: 3 + line: 3, + column: 13, + endLine: 3, + endColumn: 14 }, { message: 'Unexpected space(s) before "else".', - line: 5 + line: 5, + column: 12, + endLine: 5, + endColumn: 13 }, { message: 'Unexpected space(s) after "if".', - line: 5 + line: 5, + column: 20, + endLine: 5, + endColumn: 21 }, { message: 'Unexpected space(s) before "else".', - line: 7 + line: 7, + column: 12, + endLine: 7, + endColumn: 13 }, { message: 'Unexpected space(s) after "else".', - line: 7 + line: 7, + column: 17, + endLine: 7, + endColumn: 18 } ] }, @@ -145,7 +175,10 @@ tester.run('keyword-spacing', rule, { errors: [ { message: 'Expected space(s) after "return".', - line: 2 + line: 2, + column: 56, + endLine: 2, + endColumn: 62 } ] } diff --git a/tests/lib/rules/match-component-file-name.js b/tests/lib/rules/match-component-file-name.js index a006d2f3c..494c8455a 100644 --- a/tests/lib/rules/match-component-file-name.js +++ b/tests/lib/rules/match-component-file-name.js @@ -596,7 +596,11 @@ ruleTester.run('match-component-file-name', rule, { } ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -624,7 +628,11 @@ ruleTester.run('match-component-file-name', rule, { } ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -652,7 +660,11 @@ ruleTester.run('match-component-file-name', rule, { } ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -680,7 +692,11 @@ ruleTester.run('match-component-file-name', rule, { } ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -717,7 +733,11 @@ ruleTester.run('match-component-file-name', rule, { ` } - ] + ], + line: 4, + column: 19, + endLine: 4, + endColumn: 31 } ] }, @@ -752,7 +772,11 @@ ruleTester.run('match-component-file-name', rule, { ` } - ] + ], + line: 4, + column: 19, + endLine: 4, + endColumn: 31 } ] }, @@ -787,7 +811,11 @@ ruleTester.run('match-component-file-name', rule, { ` } - ] + ], + line: 4, + column: 19, + endLine: 4, + endColumn: 31 } ] }, @@ -817,7 +845,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -845,7 +877,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -873,7 +909,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -899,7 +939,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -925,7 +969,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -951,7 +999,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 29 } ] }, @@ -977,7 +1029,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 2, + column: 23, + endLine: 2, + endColumn: 35 } ] }, @@ -1003,7 +1059,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 2, + column: 23, + endLine: 2, + endColumn: 35 } ] }, @@ -1029,7 +1089,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 2, + column: 23, + endLine: 2, + endColumn: 35 } ] }, @@ -1055,7 +1119,11 @@ ruleTester.run('match-component-file-name', rule, { }) ` } - ] + ], + line: 2, + column: 23, + endLine: 2, + endColumn: 35 } ] }, @@ -1085,7 +1153,11 @@ ruleTester.run('match-component-file-name', rule, { } ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 31 } ] }, @@ -1113,7 +1185,11 @@ ruleTester.run('match-component-file-name', rule, { } ` } - ] + ], + line: 3, + column: 17, + endLine: 3, + endColumn: 30 } ] }, @@ -1134,7 +1210,11 @@ ruleTester.run('match-component-file-name', rule, { desc: 'Rename component to match file name.', output: `` } - ] + ], + line: 1, + column: 37, + endLine: 1, + endColumn: 52 } ] } diff --git a/tests/lib/rules/match-component-import-name.js b/tests/lib/rules/match-component-import-name.js index a6ca5da07..be6f0a1aa 100644 --- a/tests/lib/rules/match-component-import-name.js +++ b/tests/lib/rules/match-component-import-name.js @@ -65,7 +65,9 @@ tester.run('match-component-import-name', rule, { message: 'Component alias InvalidExport should be one of: SomeRandomName, some-random-name.', line: 2, - column: 47 + column: 47, + endLine: 2, + endColumn: 76 } ] } diff --git a/tests/lib/rules/max-attributes-per-line.js b/tests/lib/rules/max-attributes-per-line.js index 7440b05cf..8fd176be2 100644 --- a/tests/lib/rules/max-attributes-per-line.js +++ b/tests/lib/rules/max-attributes-per-line.js @@ -44,43 +44,99 @@ ruleTester.run('max-attributes-per-line', rule, { code: ``, output: ``, - errors: ["'age' should be on a new line."] + errors: [ + { + message: "'age' should be on a new line.", + line: 1, + column: 38, + endLine: 1, + endColumn: 46 + } + ] }, { code: ``, output: ``, - errors: ["':age' should be on a new line."] + errors: [ + { + message: "':age' should be on a new line.", + line: 1, + column: 40, + endLine: 1, + endColumn: 55 + } + ] }, { code: ``, output: ``, - errors: ["'v-bind' should be on a new line."] + errors: [ + { + message: "'v-bind' should be on a new line.", + line: 1, + column: 33, + endLine: 1, + endColumn: 46 + } + ] }, { code: ``, output: ``, - errors: ["'@buy' should be on a new line."] + errors: [ + { + message: "'@buy' should be on a new line.", + line: 1, + column: 40, + endLine: 1, + endColumn: 57 + } + ] }, { code: ``, output: ``, - errors: ["'@click.stop' should be on a new line."] + errors: [ + { + message: "'@click.stop' should be on a new line.", + line: 1, + column: 40, + endLine: 1, + endColumn: 51 + } + ] }, { code: ``, output: ``, - errors: ["'v-if' should be on a new line."] + errors: [ + { + message: "'v-if' should be on a new line.", + line: 1, + column: 40, + endLine: 1, + endColumn: 56 + } + ] }, { code: ``, output: ``, - errors: ["'v-bind:age' should be on a new line."] + errors: [ + { + message: "'v-bind:age' should be on a new line.", + line: 1, + column: 41, + endLine: 1, + endColumn: 62 + } + ] }, { code: ``, @@ -90,8 +146,10 @@ job="Vet">`, errors: [ { message: "'job' should be on a new line.", - type: 'VAttribute', - line: 1 + line: 1, + column: 47, + endLine: 1, + endColumn: 56 } ] }, @@ -111,8 +169,10 @@ age="30" errors: [ { message: "'age' should be on a new line.", - type: 'VAttribute', - line: 2 + line: 2, + column: 25, + endLine: 2, + endColumn: 33 } ] }, @@ -132,8 +192,10 @@ age="30" errors: [ { message: "'age' should be on a new line.", - type: 'VAttribute', - line: 2 + line: 2, + column: 25, + endLine: 2, + endColumn: 33 } ] } diff --git a/tests/lib/rules/max-len.js b/tests/lib/rules/max-len.js index ac634ff75..d2df6e62a 100644 --- a/tests/lib/rules/max-len.js +++ b/tests/lib/rules/max-len.js @@ -311,11 +311,13 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 2 + line: 2, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 } ] }, @@ -328,11 +330,13 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 2 + line: 2, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 } ] }, @@ -346,11 +350,13 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 121. Maximum allowed is 120.', - line: 2 + line: 2, + column: 1 }, { message: 'This line has a length of 121. Maximum allowed is 120.', - line: 3 + line: 3, + column: 1 } ] }, @@ -364,11 +370,13 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 121. Maximum allowed is 120.', - line: 2 + line: 2, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 } ] }, @@ -381,7 +389,8 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 121. Maximum allowed is 120.', - line: 2 + line: 2, + column: 1 } ] }, @@ -394,7 +403,8 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 121. Maximum allowed is 120.', - line: 2 + line: 2, + column: 1 } ] }, @@ -417,15 +427,18 @@ export default { name: 'fooooooooooooooooooooooooooooooooooooooooooooooooooooooo errors: [ { message: 'This line has a length of 82. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 84. Maximum allowed is 80.', - line: 5 + line: 5, + column: 1 }, { message: 'This line has a length of 94. Maximum allowed is 80.', - line: 10 + line: 10, + column: 1 } ] }, @@ -453,43 +466,53 @@ var b /* comment */ // trailing comments ....................................... errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 6 + line: 6, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 7 + line: 7, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 8 + line: 8, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 9 + line: 9, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 10 + line: 10, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 11 + line: 11, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 14 + line: 14, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 15 + line: 15, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 16 + line: 16, + column: 1 } ] }, @@ -516,43 +539,53 @@ var b /* comment */ // trailing comments ....................................... errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 5 + line: 5, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 8 + line: 8, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 11 + line: 11, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 12 + line: 12, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 13 + line: 13, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 14 + line: 14, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 15 + line: 15, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 16 + line: 16, + column: 1 } ] }, @@ -581,7 +614,8 @@ var b /* comment */ // trailing comments ....................................... errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 10 + line: 10, + column: 1 } ] }, @@ -609,7 +643,8 @@ var b /* comment */ // trailing comments ....................................... errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 15 + line: 15, + column: 1 } ] }, @@ -638,19 +673,23 @@ var b /* comment */ // trailing comments ....................................... errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 8 + line: 8, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 10 + line: 10, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 16 + line: 16, + column: 1 } ] }, @@ -678,19 +717,23 @@ var b /* comment */ // trailing comments ....................................... errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 5 + line: 5, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 8 + line: 8, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 13 + line: 13, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 15 + line: 15, + column: 1 } ] }, @@ -709,11 +752,13 @@ var a = 'https://www.example.com/long/long/long/long/long/long/long/long/long/lo errors: [ { message: 'This line has a length of 89. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 83. Maximum allowed is 80.', - line: 7 + line: 7, + column: 1 } ] }, @@ -731,11 +776,13 @@ var a = 'https://www.example.com/long/long/long/long/long/long/long/long/long/lo errors: [ { message: 'This line has a length of 83. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 89. Maximum allowed is 80.', - line: 6 + line: 6, + column: 1 } ] }, @@ -760,19 +807,23 @@ var a = 'str-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 6 + line: 6, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 8 + line: 8, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 13 + line: 13, + column: 1 } ] }, @@ -796,19 +847,23 @@ var a = 'str-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 6 + line: 6, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 9 + line: 9, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 11 + line: 11, + column: 1 } ] }, @@ -834,7 +889,8 @@ var a = 'str-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 } ] }, @@ -859,7 +915,8 @@ var a = 'str-loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 6 + line: 6, + column: 1 } ] }, @@ -882,19 +939,23 @@ var b = \`template-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooon errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 5 + line: 5, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 10 + line: 10, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 11 + line: 11, + column: 1 } ] }, @@ -916,19 +977,23 @@ var b = \`template-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooon errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 8 + line: 8, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 9 + line: 9, + column: 1 } ] }, @@ -952,11 +1017,13 @@ var b = \`template-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooon errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 10 + line: 10, + column: 1 } ] }, @@ -979,11 +1046,13 @@ var b = \`template-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooon errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 8 + line: 8, + column: 1 } ] }, @@ -1004,11 +1073,13 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 9 + line: 9, + column: 1 } ] }, @@ -1028,11 +1099,13 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 7 + line: 7, + column: 1 } ] }, @@ -1048,7 +1121,8 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 } ] }, @@ -1066,11 +1140,13 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 }, { message: 'This line has a length of 88. Maximum allowed is 80.', - line: 5 + line: 5, + column: 1 } ] }, @@ -1079,32 +1155,62 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b filename: 'test.vue', code: ``, options: [40], - errors: ['This line has a length of 41. Maximum allowed is 40.'] + errors: [ + { + message: 'This line has a length of 41. Maximum allowed is 40.', + line: 1, + column: 1 + } + ] }, { filename: 'test.vue', code: ``, options: [{ code: 40 }], - errors: ['This line has a length of 41. Maximum allowed is 40.'] + errors: [ + { + message: 'This line has a length of 41. Maximum allowed is 40.', + line: 1, + column: 1 + } + ] }, // tabWidth { filename: 'test.vue', code: ``, options: [40, 4], - errors: ['This line has a length of 45. Maximum allowed is 40.'] + errors: [ + { + message: 'This line has a length of 45. Maximum allowed is 40.', + line: 1, + column: 1 + } + ] }, { filename: 'test.vue', code: ``, options: [{ code: 40, tabWidth: 4 }], - errors: ['This line has a length of 45. Maximum allowed is 40.'] + errors: [ + { + message: 'This line has a length of 45. Maximum allowed is 40.', + line: 1, + column: 1 + } + ] }, { filename: 'test.vue', code: ``, options: [{ code: 40, tabWidth: 3 }], - errors: ['This line has a length of 44. Maximum allowed is 40.'] + errors: [ + { + message: 'This line has a length of 44. Maximum allowed is 40.', + line: 1, + column: 1 + } + ] }, // comments { @@ -1130,27 +1236,32 @@ var a; // 41 cols comment * { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 4 + line: 4, + column: 1 }, { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 9 + line: 9, + column: 1 }, { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 12 + line: 12, + column: 1 }, { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 13 + line: 13, + column: 1 } ] }, @@ -1166,15 +1277,18 @@ var b = \`81 columns errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 2 + line: 2, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 } ] }, @@ -1189,11 +1303,13 @@ var b = \`81 columns errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 4 + line: 4, + column: 1 } ] }, @@ -1208,11 +1324,13 @@ var b = \`81 columns errors: [ { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 2 + line: 2, + column: 1 }, { message: 'This line has a length of 81. Maximum allowed is 80.', - line: 3 + line: 3, + column: 1 } ] }, @@ -1230,17 +1348,20 @@ var b = \`81 columns { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 2 + line: 2, + column: 1 }, { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 3 + line: 3, + column: 1 }, { message: 'This line has a comment length of 41. Maximum allowed is 40.', - line: 4 + line: 4, + column: 1 } ] } diff --git a/tests/lib/rules/max-lines-per-block.js b/tests/lib/rules/max-lines-per-block.js index 2470586fb..415e0197f 100644 --- a/tests/lib/rules/max-lines-per-block.js +++ b/tests/lib/rules/max-lines-per-block.js @@ -59,7 +59,9 @@ tester.run('max-lines-per-block', rule, { { message: 'Block has too many lines (2). Maximum allowed is 1.', line: 2, - column: 7 + column: 7, + endLine: 5, + endColumn: 18 } ] }, @@ -76,7 +78,9 @@ tester.run('max-lines-per-block', rule, { { message: 'Block has too many lines (2). Maximum allowed is 1.', line: 2, - column: 7 + column: 7, + endLine: 6, + endColumn: 16 } ] } diff --git a/tests/lib/rules/max-props.js b/tests/lib/rules/max-props.js index 7d000f363..041a53f4c 100644 --- a/tests/lib/rules/max-props.js +++ b/tests/lib/rules/max-props.js @@ -137,7 +137,9 @@ tester.run('max-props', rule, { { message: 'Component has too many props (2). Maximum allowed is 1.', line: 3, - endLine: 3 + endLine: 3, + column: 7, + endColumn: 44 } ] }, @@ -158,7 +160,9 @@ tester.run('max-props', rule, { { message: 'Component has too many props (2). Maximum allowed is 1.', line: 4, - endLine: 7 + endLine: 7, + column: 9, + endColumn: 10 } ] }, @@ -180,7 +184,9 @@ tester.run('max-props', rule, { { message: 'Component has too many props (3). Maximum allowed is 2.', line: 3, - endLine: 3 + endLine: 3, + column: 7, + endColumn: 69 } ] }, @@ -201,7 +207,9 @@ tester.run('max-props', rule, { { message: 'Component has too many props (3). Maximum allowed is 2.', line: 3, - endLine: 3 + endLine: 3, + column: 7, + endColumn: 85 } ] }, @@ -230,7 +238,9 @@ tester.run('max-props', rule, { { message: 'Component has too many props (3). Maximum allowed is 2.', line: 3, - endLine: 11 + endLine: 11, + column: 7, + endColumn: 11 } ] } diff --git a/tests/lib/rules/max-template-depth.js b/tests/lib/rules/max-template-depth.js index 4ef9e95d1..b5fc4cb91 100644 --- a/tests/lib/rules/max-template-depth.js +++ b/tests/lib/rules/max-template-depth.js @@ -95,7 +95,10 @@ tester.run('max-template-depth', rule, { { message: 'Element is nested too deeply (depth of 4, maximum allowed is 3).', - line: 6 + line: 6, + column: 13, + endLine: 6, + endColumn: 20 } ] }, @@ -120,7 +123,10 @@ tester.run('max-template-depth', rule, { { message: 'Element is nested too deeply (depth of 4, maximum allowed is 3).', - line: 9 + line: 9, + column: 13, + endLine: 9, + endColumn: 19 } ] }, @@ -148,19 +154,25 @@ tester.run('max-template-depth', rule, { message: 'Element is nested too deeply (depth of 4, maximum allowed is 3).', line: 9, - endLine: 12 + endLine: 12, + column: 13, + endColumn: 11 }, { message: 'Element is nested too deeply (depth of 5, maximum allowed is 3).', line: 10, - endLine: 10 + endLine: 10, + column: 15, + endColumn: 22 }, { message: 'Element is nested too deeply (depth of 5, maximum allowed is 3).', line: 11, - endLine: 12 + endLine: 12, + column: 13, + endColumn: 11 } ] } diff --git a/tests/lib/rules/multi-word-component-names.js b/tests/lib/rules/multi-word-component-names.js index 70dc3fef3..8ad8865d8 100644 --- a/tests/lib/rules/multi-word-component-names.js +++ b/tests/lib/rules/multi-word-component-names.js @@ -230,7 +230,8 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "test" should always be multi-word.', - line: 1 + line: 1, + column: 1 } ] }, @@ -243,7 +244,10 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "test" should always be multi-word.', - line: 3 + line: 3, + column: 32, + endLine: 3, + endColumn: 38 } ] }, @@ -256,7 +260,10 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "test" should always be multi-word.', - line: 3 + line: 3, + column: 23, + endLine: 3, + endColumn: 29 } ] }, @@ -269,7 +276,10 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "invalid" should always be multi-word.', - line: 3 + line: 3, + column: 32, + endLine: 3, + endColumn: 41 } ] }, @@ -282,7 +292,10 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "invalid" should always be multi-word.', - line: 3 + line: 3, + column: 23, + endLine: 3, + endColumn: 32 } ] }, @@ -295,7 +308,8 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "invalid" should always be multi-word.', - line: 1 + line: 1, + column: 1 } ] }, @@ -308,7 +322,10 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "" should always be multi-word.', - line: 3 + line: 3, + column: 23, + endLine: 3, + endColumn: 25 } ] }, @@ -325,7 +342,10 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "Item" should always be multi-word.', - line: 4 + line: 4, + column: 15, + endLine: 4, + endColumn: 21 } ] }, @@ -338,7 +358,8 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "test" should always be multi-word.', - line: 1 + line: 1, + column: 1 } ] }, @@ -352,7 +373,10 @@ tester.run('multi-word-component-names', rule, { errors: [ { message: 'Component name "Single" should always be multi-word.', - line: 3 + line: 3, + column: 28, + endLine: 3, + endColumn: 36 } ] } diff --git a/tests/lib/rules/multiline-html-element-content-newline.js b/tests/lib/rules/multiline-html-element-content-newline.js index 36aa9cfe4..8d7d648c4 100644 --- a/tests/lib/rules/multiline-html-element-content-newline.js +++ b/tests/lib/rules/multiline-html-element-content-newline.js @@ -282,7 +282,6 @@ content 'Expected 1 line break after opening tag (`
`), but no line breaks found.', line: 5, column: 12, - type: 'HTMLTagClose', endLine: 5, endColumn: 12 }, @@ -291,7 +290,6 @@ content 'Expected 1 line break before closing tag (`
`), but no line breaks found.', line: 5, column: 19, - type: 'HTMLEndTagOpen', endLine: 5, endColumn: 19 } @@ -384,8 +382,22 @@ multiline
`, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 3, + column: 16, + endLine: 3, + endColumn: 16 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 4, + column: 20, + endLine: 4, + endColumn: 20 + } ] }, { @@ -401,7 +413,14 @@ multiline content
`, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 3, + column: 16, + endLine: 3, + endColumn: 16 + } ] }, { @@ -417,7 +436,14 @@ multiline content
`, errors: [ - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 4, + column: 30, + endLine: 4, + endColumn: 30 + } ] }, // comments @@ -437,8 +463,22 @@ multiline content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 3, + column: 16, + endLine: 3, + endColumn: 16 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 4, + column: 25, + endLine: 4, + endColumn: 25 + } ] }, { @@ -457,8 +497,22 @@ multiline content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 3, + column: 16, + endLine: 3, + endColumn: 16 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 4, + column: 23, + endLine: 4, + endColumn: 23 + } ] }, // one error @@ -479,7 +533,14 @@ content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 3, + column: 16, + endLine: 3, + endColumn: 16 + } ] }, { @@ -499,7 +560,14 @@ content `, errors: [ - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 5, + column: 18, + endLine: 5, + endColumn: 18 + } ] }, // multi @@ -519,12 +587,54 @@ content `, errors: [ - 'Expected 1 line break after opening tag (``), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (``), but no line breaks found.', + line: 3, + column: 35, + endLine: 3, + endColumn: 35 + } ] }, // multi line breaks @@ -548,8 +658,22 @@ content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but 2 line breaks found.', - 'Expected 1 line break before closing tag (`
`), but 2 line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but 2 line breaks found.', + line: 3, + column: 16, + endLine: 5, + endColumn: 13 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but 2 line breaks found.', + line: 6, + column: 20, + endLine: 8, + endColumn: 11 + } ] }, // allowEmptyLines @@ -575,7 +699,14 @@ content `, options: [{ allowEmptyLines: true, ignoreWhenEmpty: false }], errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 8, + column: 27, + endLine: 8, + endColumn: 27 + } ] }, { @@ -607,8 +738,22 @@ content `, options: [{ allowEmptyLines: true }], errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 9, + column: 16, + endLine: 9, + endColumn: 16 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 10, + column: 20, + endLine: 10, + endColumn: 20 + } ] }, // mustache @@ -628,8 +773,22 @@ content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 3, + column: 16, + endLine: 3, + endColumn: 16 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 4, + column: 23, + endLine: 4, + endColumn: 23 + } ] }, // mix @@ -651,8 +810,22 @@ content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 3, + column: 16, + endLine: 3, + endColumn: 16 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 5, + column: 27, + endLine: 5, + endColumn: 27 + } ] }, // start tag @@ -672,8 +845,22 @@ content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 4, + column: 14, + endLine: 4, + endColumn: 14 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 4, + column: 21, + endLine: 4, + endColumn: 21 + } ] }, { @@ -692,8 +879,22 @@ content `, errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.', - 'Expected 1 line break before closing tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 4, + column: 18, + endLine: 4, + endColumn: 18 + }, + { + message: + 'Expected 1 line break before closing tag (`
`), but no line breaks found.', + line: 4, + column: 25, + endLine: 4, + endColumn: 25 + } ] }, { @@ -712,7 +913,14 @@ content `, options: [{ ignoreWhenEmpty: false }], errors: [ - 'Expected 1 line break after opening tag (`
`), but no line breaks found.' + { + message: + 'Expected 1 line break after opening tag (`
`), but no line breaks found.', + line: 4, + column: 14, + endLine: 4, + endColumn: 14 + } ] } ] diff --git a/tests/lib/rules/multiline-ternary.js b/tests/lib/rules/multiline-ternary.js index 87e3fe485..118cf6353 100644 --- a/tests/lib/rules/multiline-ternary.js +++ b/tests/lib/rules/multiline-ternary.js @@ -4,9 +4,8 @@ */ 'use strict' -const { RuleTester, ESLint } = require('../../eslint-compat') +const { RuleTester } = require('../../eslint-compat') const rule = require('../../../lib/rules/multiline-ternary') -const semver = require('semver') const tester = new RuleTester({ languageOptions: { @@ -80,8 +79,7 @@ tester.run('multiline-ternary', rule, {
`, - output: semver.gte(ESLint.version, '7.1.0') - ? ` + output: ` - ` - : null, + `, options: ['always-multiline'], errors: [ { message: 'Expected newline between consequent and alternate of ternary expression.', line: 5, - column: 15 + column: 15, + endLine: 5, + endColumn: 30 } ] }, @@ -113,23 +112,23 @@ tester.run('multiline-ternary', rule, {
`, - output: semver.gte(ESLint.version, '7.1.0') - ? ` + output: ` - ` - : null, + `, options: ['never'], errors: [ { message: 'Unexpected newline between test and consequent of ternary expression.', line: 4, - column: 21 + column: 21, + endLine: 4, + endColumn: 44 } ] }, @@ -143,8 +142,7 @@ tester.run('multiline-ternary', rule, {
`, - output: semver.gte(ESLint.version, '7.1.0') - ? ` + output: ` - ` - : null, + `, errors: [ { message: 'Expected newline between test and consequent of ternary expression.', line: 4, - column: 21 + column: 21, + endLine: 4, + endColumn: 44 }, { message: 'Expected newline between consequent and alternate of ternary expression.', line: 4, - column: 47 + column: 47, + endLine: 4, + endColumn: 62 } ] }, @@ -180,8 +181,7 @@ tester.run('multiline-ternary', rule, {
`, - output: semver.gte(ESLint.version, '7.1.0') - ? ` + output: ` - ` - : null, + `, errors: [ { message: 'Expected newline between test and consequent of ternary expression.', line: 4, - column: 21 + column: 21, + endLine: 4, + endColumn: 44 }, { message: 'Expected newline between consequent and alternate of ternary expression.', line: 4, - column: 47 + column: 47, + endLine: 4, + endColumn: 62 } ] }, @@ -220,8 +223,7 @@ tester.run('multiline-ternary', rule, { } `, - output: semver.gte(ESLint.version, '7.1.0') - ? ` + output: ` `, options: [{ ignore: ['/one/', '/^Two$/i', '/^my-.*/i'] }] + }, + { + code: ``, + options: [{ ignoreParents: ['LinkList'] }] + }, + { + code: ``, + options: [{ ignoreParents: ['/^Link/'] }] } ], invalid: [ @@ -86,7 +110,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 25 } ] }, @@ -106,7 +133,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 25 } ] }, @@ -126,7 +156,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 25 } ] }, @@ -146,7 +179,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 25 } ] }, @@ -166,7 +202,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 25 } ] }, @@ -185,23 +224,38 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 25 }, { message: '`slot` attributes are deprecated.', - line: 5 + line: 5, + column: 21, + endLine: 5, + endColumn: 25 }, { message: '`slot` attributes are deprecated.', - line: 6 + line: 6, + column: 21, + endLine: 6, + endColumn: 25 }, { message: '`slot` attributes are deprecated.', - line: 7 + line: 7, + column: 21, + endLine: 7, + endColumn: 25 }, { message: '`slot` attributes are deprecated.', - line: 8 + line: 8, + column: 21, + endLine: 8, + endColumn: 25 } ] }, @@ -221,7 +275,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 32 } ] }, @@ -236,7 +293,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -256,7 +316,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -271,7 +334,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -286,7 +352,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -301,7 +370,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -316,7 +388,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -336,7 +411,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -356,7 +434,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 14, + endLine: 4, + endColumn: 18 } ] }, @@ -376,7 +457,10 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 14, + endLine: 4, + endColumn: 19 } ] }, @@ -397,7 +481,15 @@ tester.run('no-deprecated-slot-attribute', rule, { `, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 21, + endLine: 4, + endColumn: 25 + } + ] }, { code: ` @@ -416,7 +508,15 @@ tester.run('no-deprecated-slot-attribute', rule, { `, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 21, + endLine: 4, + endColumn: 25 + } + ] }, { code: ` @@ -435,7 +535,15 @@ tester.run('no-deprecated-slot-attribute', rule, { `, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 21, + endLine: 4, + endColumn: 25 + } + ] }, { // https://github.com/vuejs/eslint-plugin-vue/issues/1499 @@ -470,11 +578,17 @@ tester.run('no-deprecated-slot-attribute', rule, { errors: [ { message: '`slot` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 25 }, { message: '`slot` attributes are deprecated.', - line: 9 + line: 9, + column: 23, + endLine: 9, + endColumn: 27 } ] }, @@ -502,8 +616,20 @@ tester.run('no-deprecated-slot-attribute', rule, { `, errors: [ - '`slot` attributes are deprecated.', - '`slot` attributes are deprecated.' + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 37, + endLine: 4, + endColumn: 41 + }, + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 37, + endLine: 7, + endColumn: 42 + } ] }, { @@ -520,8 +646,20 @@ tester.run('no-deprecated-slot-attribute', rule, { `, output: null, errors: [ - '`slot` attributes are deprecated.', - '`slot` attributes are deprecated.' + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 21, + endLine: 4, + endColumn: 25 + }, + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 21, + endLine: 7, + endColumn: 25 + } ] }, { @@ -548,8 +686,20 @@ tester.run('no-deprecated-slot-attribute', rule, { `, errors: [ - '`slot` attributes are deprecated.', - '`slot` attributes are deprecated.' + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 30, + endLine: 4, + endColumn: 34 + }, + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 28, + endLine: 7, + endColumn: 32 + } ] }, { @@ -566,8 +716,20 @@ tester.run('no-deprecated-slot-attribute', rule, { `, output: null, errors: [ - '`slot` attributes are deprecated.', - '`slot` attributes are deprecated.' + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 37, + endLine: 4, + endColumn: 42 + }, + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 37, + endLine: 7, + endColumn: 42 + } ] }, { @@ -594,8 +756,20 @@ tester.run('no-deprecated-slot-attribute', rule, { `, errors: [ - '`slot` attributes are deprecated.', - '`slot` attributes are deprecated.' + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 37, + endLine: 4, + endColumn: 42 + }, + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 37, + endLine: 7, + endColumn: 42 + } ] }, { @@ -622,8 +796,20 @@ tester.run('no-deprecated-slot-attribute', rule, { `, errors: [ - '`slot` attributes are deprecated.', - '`slot` attributes are deprecated.' + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 41, + endLine: 4, + endColumn: 46 + }, + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 37, + endLine: 7, + endColumn: 42 + } ] }, { @@ -654,7 +840,15 @@ tester.run('no-deprecated-slot-attribute', rule, { ignore: ['one'] } ], - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 7, + column: 16, + endLine: 7, + endColumn: 20 + } + ] }, { code: ` @@ -732,6 +926,90 @@ tester.run('no-deprecated-slot-attribute', rule, { } ] }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignoreParents: ['my-component'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 9, + column: 16, + endLine: 9, + endColumn: 20 + } + ] + }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignoreParents: ['/component$/'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 9, + column: 16, + endLine: 9, + endColumn: 20 + } + ] + }, { code: ` `, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 6, + column: 13, + endLine: 6, + endColumn: 18 + } + ] }, { code: ` @@ -768,7 +1054,15 @@ tester.run('no-deprecated-slot-attribute', rule, { `, output: null, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 4, + column: 16, + endLine: 4, + endColumn: 20 + } + ] } ] }) diff --git a/tests/lib/rules/no-deprecated-slot-scope-attribute.js b/tests/lib/rules/no-deprecated-slot-scope-attribute.js index 078f004ef..7b9eb870b 100644 --- a/tests/lib/rules/no-deprecated-slot-scope-attribute.js +++ b/tests/lib/rules/no-deprecated-slot-scope-attribute.js @@ -66,7 +66,10 @@ tester.run('no-deprecated-slot-scope-attribute', rule, { errors: [ { message: '`slot-scope` are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 31 } ] }, @@ -86,7 +89,10 @@ tester.run('no-deprecated-slot-scope-attribute', rule, { errors: [ { message: '`slot-scope` are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 31 } ] }, @@ -106,7 +112,10 @@ tester.run('no-deprecated-slot-scope-attribute', rule, { errors: [ { message: '`slot-scope` are deprecated.', - line: 4 + line: 4, + column: 14, + endLine: 4, + endColumn: 24 } ] }, @@ -121,7 +130,10 @@ tester.run('no-deprecated-slot-scope-attribute', rule, { errors: [ { message: '`slot-scope` are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 31 } ] }, @@ -136,7 +148,10 @@ tester.run('no-deprecated-slot-scope-attribute', rule, { errors: [ { message: '`slot-scope` are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 31 } ] }, @@ -150,7 +165,15 @@ tester.run('no-deprecated-slot-scope-attribute', rule, { `, output: null, - errors: ['`slot-scope` are deprecated.'] + errors: [ + { + message: '`slot-scope` are deprecated.', + line: 4, + column: 37, + endLine: 4, + endColumn: 47 + } + ] }, { code: ` @@ -163,7 +186,15 @@ tester.run('no-deprecated-slot-scope-attribute', rule, { `, output: null, - errors: ['`slot-scope` are deprecated.'] + errors: [ + { + message: '`slot-scope` are deprecated.', + line: 4, + column: 21, + endLine: 4, + endColumn: 31 + } + ] } ] }) diff --git a/tests/lib/rules/no-deprecated-v-bind-sync.js b/tests/lib/rules/no-deprecated-v-bind-sync.js index 3d775d975..355d1a86c 100644 --- a/tests/lib/rules/no-deprecated-v-bind-sync.js +++ b/tests/lib/rules/no-deprecated-v-bind-sync.js @@ -37,7 +37,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { code: "", output: "", errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 24, + endLine: 1, + endColumn: 45 + } ] }, { @@ -45,7 +52,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { code: "", output: "", errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 24, + endLine: 1, + endColumn: 39 + } ] }, { @@ -53,7 +67,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { code: "", output: "", errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 24, + endLine: 1, + endColumn: 54 + } ] }, { @@ -61,7 +82,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { code: "", output: "", errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 24, + endLine: 1, + endColumn: 48 + } ] }, { @@ -69,7 +97,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { code: "", output: null, errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 24, + endLine: 1, + endColumn: 41 + } ] }, { @@ -77,7 +112,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { code: '', output: null, errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 24, + endLine: 1, + endColumn: 47 + } ] }, { @@ -85,7 +127,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { code: '', output: null, errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 24, + endLine: 1, + endColumn: 56 + } ] }, { @@ -94,7 +143,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 69 + } ] }, { @@ -103,7 +159,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 70 + } ] }, { @@ -112,7 +175,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 74 + } ] }, { @@ -121,7 +191,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 75 + } ] }, { @@ -130,7 +207,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 82 + } ] }, { @@ -139,7 +223,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 80 + } ] }, { @@ -148,7 +239,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 77 + } ] }, { @@ -157,7 +255,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 72 + } ] }, { @@ -166,7 +271,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 89 + } ] }, { @@ -175,7 +287,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 77 + } ] }, { @@ -184,7 +303,14 @@ ruleTester.run('no-deprecated-v-bind-sync', rule, { output: '', errors: [ - "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead." + { + message: + "'.sync' modifier on 'v-bind' directive is deprecated. Use 'v-model:propName' instead.", + line: 1, + column: 52, + endLine: 1, + endColumn: 78 + } ] } ] diff --git a/tests/lib/rules/no-deprecated-v-is.js b/tests/lib/rules/no-deprecated-v-is.js index 8dd07a478..3935c9b39 100644 --- a/tests/lib/rules/no-deprecated-v-is.js +++ b/tests/lib/rules/no-deprecated-v-is.js @@ -25,7 +25,10 @@ tester.run('no-deprecated-v-is', rule, { errors: [ { message: '`v-is` directive is deprecated.', - line: 3 + line: 3, + column: 14, + endLine: 3, + endColumn: 18 } ] } diff --git a/tests/lib/rules/no-deprecated-v-on-number-modifiers.js b/tests/lib/rules/no-deprecated-v-on-number-modifiers.js index 4fd4bfb8e..f039d1162 100644 --- a/tests/lib/rules/no-deprecated-v-on-number-modifiers.js +++ b/tests/lib/rules/no-deprecated-v-on-number-modifiers.js @@ -69,7 +69,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { code: "", output: "", errors: [ - "'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: 1, + column: 29, + endLine: 1, + endColumn: 31 + } ] }, { @@ -78,7 +85,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 29, + endLine: 1, + endColumn: 31 + } ] }, { @@ -87,7 +101,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 37, + endLine: 1, + endColumn: 39 + } ] }, { @@ -96,7 +117,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 36, + endLine: 1, + endColumn: 38 + } ] }, { @@ -105,7 +133,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 44, + endLine: 1, + endColumn: 46 + } ] }, { @@ -114,7 +149,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 36, + endLine: 1, + endColumn: 38 + } ] }, { @@ -122,7 +164,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { code: "", output: "", errors: [ - "'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: 1, + column: 25, + endLine: 1, + endColumn: 27 + } ] }, { @@ -131,7 +180,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 25, + endLine: 1, + endColumn: 27 + } ] }, { @@ -140,7 +196,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 33, + endLine: 1, + endColumn: 35 + } ] }, { @@ -149,7 +212,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 32, + endLine: 1, + endColumn: 34 + } ] }, { @@ -158,7 +228,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 40, + endLine: 1, + endColumn: 42 + } ] }, { @@ -167,7 +244,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { output: "", errors: [ - "'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: 1, + column: 32, + endLine: 1, + endColumn: 34 + } ] }, { @@ -175,7 +259,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { code: "", output: null, errors: [ - "'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: 1, + column: 25, + endLine: 1, + endColumn: 27 + } ] }, { @@ -183,7 +274,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { code: "", output: null, errors: [ - "'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: 1, + column: 25, + endLine: 1, + endColumn: 27 + } ] }, { @@ -191,7 +289,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { code: "", output: null, errors: [ - "'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: 1, + column: 33, + endLine: 1, + endColumn: 35 + } ] }, { @@ -199,7 +304,14 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { code: "", output: null, errors: [ - "'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: 1, + column: 40, + endLine: 1, + endColumn: 42 + } ] }, { @@ -216,13 +328,62 @@ ruleTester.run('no-deprecated-v-on-number-modifiers', rule, { `, 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..b0494f24d 100644 --- a/tests/lib/rules/no-deprecated-vue-config-keycodes.js +++ b/tests/lib/rules/no-deprecated-vue-config-keycodes.js @@ -36,7 +36,6 @@ ruleTester.run('no-deprecated-vue-config-keycodes', rule, { message: '`Vue.config.keyCodes` are deprecated.', line: 1, column: 1, - type: 'MemberExpression', // messageId: 'unexpected', endLine: 1, endColumn: 20 @@ -46,12 +45,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..e4ca1e8ec 100644 --- a/tests/lib/rules/no-dupe-keys.js +++ b/tests/lib/rules/no-dupe-keys.js @@ -6,6 +6,9 @@ const rule = require('../../../lib/rules/no-dupe-keys') const RuleTester = require('../../eslint-compat').RuleTester +const { + getTypeScriptFixtureTestOptions +} = require('../../test-utils/typescript') const ruleTester = new RuleTester({ languageOptions: { @@ -511,6 +514,20 @@ ruleTester.run('no-dupe-keys', rule, { `, languageOptions: { parser: require('vue-eslint-parser') } + }, + { + code: ` + + `, + ...getTypeScriptFixtureTestOptions() } ], @@ -546,22 +563,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 +625,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 +678,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 +734,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 +782,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 +811,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 +838,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 +863,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 +888,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 +913,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 +938,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 +962,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 +986,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 +1014,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 +1038,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 +1061,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 +1085,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 +1109,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 +1131,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 +1162,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 +1206,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 +1235,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,9 +1256,36 @@ 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 } ] + }, + { + code: ` + + `, + errors: [ + { + message: + "Duplicate key 'foo'. May cause name collision in script or template tag.", + line: 7, + column: 13, + endLine: 9, + endColumn: 9 + } + ], + ...getTypeScriptFixtureTestOptions() } ] }) 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-duplicate-class-names.js b/tests/lib/rules/no-duplicate-class-names.js new file mode 100644 index 000000000..4935bb81c --- /dev/null +++ b/tests/lib/rules/no-duplicate-class-names.js @@ -0,0 +1,574 @@ +/** + * @author Yizack Rangel + * See LICENSE file in root directory for full license. + */ +'use strict' + +const RuleTester = require('../../eslint-compat').RuleTester +const rule = require('../../../lib/rules/no-duplicate-class-names') + +const tester = new RuleTester({ + languageOptions: { + parser: require('vue-eslint-parser'), + ecmaVersion: 2020, + sourceType: 'module' + } +}) + +tester.run('no-duplicate-class-names', rule, { + valid: [ + { + filename: 'no-classes.vue', + code: '' + }, + { + filename: 'one-class.vue', + code: '' + }, + { + filename: 'multiple-different-classes.vue', + code: '' + }, + { + filename: 'no-duplicate-class-in-directive-string.vue', + code: `` + }, + { + filename: 'no-duplicate-class-in-directive-literal.vue', + code: '' + }, + { + filename: 'no-duplicate-class-in-directive-object.vue', + code: `` + }, + { + filename: 'duplicate-class-in-different-directive-object-keys.vue', + code: `` + }, + { + filename: 'class-conditional-expression.vue', + code: `` + }, + { + filename: 'class-conditional-duplicate-expression-value.vue', + code: `` + }, + { + filename: 'class-object-duplicate-value.vue', + code: `
` + }, + { + filename: 'class-non-intersecting-conditions.vue', + code: `` + }, + { + filename: 'class-multiple-logical-non-intersecting.vue', + code: `` + }, + { + filename: 'class-binary-in-logical-non-intersecting.vue', + code: `` + } + ], + invalid: [ + { + filename: 'duplicate-class.vue', + code: '', + output: '', + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 22, + endLine: 1, + endColumn: 31 + } + ] + }, + { + filename: 'multiple-duplicate-classes.vue', + code: '', + output: '', + errors: [ + { + message: "Duplicate class names 'foo', 'bar'.", + line: 1, + column: 22, + endLine: 1, + endColumn: 43 + } + ] + }, + { + filename: 'duplicate-class-in-directive-string.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 24, + endLine: 1, + endColumn: 33 + } + ] + }, + { + filename: 'duplicate-class-in-directive-literal.vue', + code: '', + output: '', + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 24, + endLine: 1, + endColumn: 33 + } + ] + }, + { + filename: 'duplicate-class-directive-object-key.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 35 + } + ] + }, + { + filename: 'multiple-duplicate-class-directive-object-keys.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 39 + }, + { + message: "Duplicate class name 'bar'.", + line: 1, + column: 47, + endLine: 1, + endColumn: 60 + } + ] + }, + { + filename: 'duplicate-class-directive-array-item.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 34 + } + ] + }, + { + filename: 'multiple-duplicate-classes-directive-array-items.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 34 + }, + { + message: "Duplicate class name 'bar'.", + line: 1, + column: 36, + endLine: 1, + endColumn: 49 + } + ] + }, + { + filename: 'duplicate-class-in-mixed-directive.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 34 + }, + { + message: "Duplicate class name 'bar'.", + line: 1, + column: 38, + endLine: 1, + endColumn: 51 + } + ] + }, + { + filename: 'duplicate-class-conditional-expression.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 35, + endLine: 1, + endColumn: 44 + } + ] + }, + { + filename: 'duplicate-class-binary-expression.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 24, + endLine: 1, + endColumn: 34 + } + ] + }, + { + filename: 'duplicate-class-preserved-spaces-1.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 22, + endLine: 1, + endColumn: 39 + } + ] + }, + { + filename: 'duplicate-class-preserved-spaces-2.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 22, + endLine: 1, + endColumn: 42 + } + ] + }, + { + filename: 'duplicate-class-preserved-spaces-3.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 22, + endLine: 1, + endColumn: 43 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-string.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 43 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-literal.vue', + code: '', + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 43 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 47 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-multiple-duplicates.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class names 'foo', 'bar'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 51 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-array.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 52 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-object.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 53 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-mixed.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 62 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-binary.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 52 + } + ] + }, + { + filename: 'duplicate-class-cross-attribute-conditional.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 11, + endLine: 1, + endColumn: 62 + } + ] + }, + { + filename: 'duplicate-class-cross-node-array.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 24, + endLine: 1, + endColumn: 38 + } + ] + }, + { + filename: 'duplicate-class-cross-node-binary.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 24, + endLine: 1, + endColumn: 38 + } + ] + }, + { + filename: 'duplicate-class-cross-node-mixed.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 24, + endLine: 1, + endColumn: 48 + } + ] + }, + { + filename: 'duplicate-class-logical-expression-and.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 36, + endLine: 1, + endColumn: 45 + } + ] + }, + { + filename: 'duplicate-class-logical-expression-or.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 36, + endLine: 1, + endColumn: 45 + } + ] + }, + { + filename: 'duplicate-class-logical-expression-nullish-coalescing.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 36, + endLine: 1, + endColumn: 45 + } + ] + }, + { + filename: 'duplicate-class-nested-logical-expression.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 55, + endLine: 1, + endColumn: 64 + } + ] + }, + { + filename: 'duplicate-class-logical-expression-in-array.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'bar'.", + line: 1, + column: 44, + endLine: 1, + endColumn: 53 + } + ] + }, + { + filename: 'duplicate-class-logical-expression-in-conditional.vue', + code: ``, + output: ``, + errors: [ + { + message: "Duplicate class name 'foo'.", + line: 1, + column: 54, + endLine: 1, + endColumn: 63 + } + ] + }, + { + filename: 'duplicate-class-binary-in-logical-expression.vue', + code: ``, + output: null, + errors: [ + { + message: "Duplicate class name 'bar'.", + type: 'BinaryExpression', + line: 1, + column: 36, + endLine: 1, + endColumn: 50 + } + ] + }, + { + filename: 'duplicate-class-template-literal-in-logical-expression.vue', + code: '', + output: null, + errors: [ + { + message: "Duplicate class name 'foo'.", + type: 'TemplateLiteral', + line: 1, + column: 36, + endLine: 1, + endColumn: 52 + } + ] + } + ] +}) 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: '`