From 0b55cdee4e8d13c434f78d921a773a2b25f67480 Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Wed, 14 May 2025 14:22:30 +0900 Subject: [PATCH 001/134] chore: introduce changesets (#2740) --- .changeset/README.md | 8 ++++++++ .changeset/config.json | 15 +++++++++++++++ .github/workflows/Release.yml | 35 +++++++++++++++++++++++++++++++++++ package.json | 9 +++++++-- 4 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 .changeset/README.md create mode 100644 .changeset/config.json create mode 100644 .github/workflows/Release.yml diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 000000000..e5b6d8d6a --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 000000000..43b72b358 --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://unpkg.com/@changesets/config/schema.json", + "changelog": [ + "@svitejs/changesets-changelog-github-compact", + { + "repo": "vuejs/eslint-plugin-vue" + } + ], + "commit": false, + "linked": [], + "access": "public", + "baseBranch": "master", + "bumpVersionsWithWorkspaceProtocolOnly": true, + "ignore": [] +} diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml new file mode 100644 index 000000000..260b73582 --- /dev/null +++ b/.github/workflows/Release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + push: + branches: + - master + +permissions: {} + +jobs: + release: + # prevents this action from running on forks + if: github.repository == 'vuejs/eslint-plugin-vue' + permissions: + contents: write # to create release (changesets/action) + pull-requests: write # to create pull request (changesets/action) + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + - name: Install Dependencies + run: npm install -f + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + version: npm run changeset:version + publish: npm run changeset:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 7e44aeb84..ff0a4b00a 100644 --- a/package.json +++ b/package.json @@ -18,12 +18,15 @@ "lint:fix": "eslint . --fix && markdownlint \"**/*.md\" --fix", "tsc": "tsc", "preversion": "npm test && git add .", - "version": "env-cmd -e version npm run update && npm run lint -- --fix && git add .", + "version": "npm run generate:version && git add .", "update": "node ./tools/update.js", "update-resources": "node ./tools/update-resources.js", "docs:watch": "vitepress dev docs", "predocs:build": "npm run update", - "docs:build": "vitepress build docs" + "docs:build": "vitepress build docs", + "generate:version": "env-cmd -e version npm run update && npm run lint -- --fix", + "changeset:version": "changeset version && npm run generate:version && git add --all", + "changeset:publish": "changeset publish" }, "files": [ "lib" @@ -66,8 +69,10 @@ "xml-name-validator": "^4.0.0" }, "devDependencies": { + "@changesets/cli": "^2.29.2", "@ota-meshi/site-kit-eslint-editor-vue": "^0.2.4", "@stylistic/eslint-plugin": "^2.12.1", + "@svitejs/changesets-changelog-github-compact": "^1.2.0", "@types/eslint": "^8.56.2", "@types/natural-compare": "^1.4.3", "@types/node": "^14.18.63", From 87793a579d80c8127e1e272a7ab9e33126550a4f Mon Sep 17 00:00:00 2001 From: Yosuke Ota Date: Wed, 14 May 2025 14:36:01 +0900 Subject: [PATCH 002/134] chore: fix ci error in eqeqeq (#2743) --- tests/lib/rules/eqeqeq.js | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/tests/lib/rules/eqeqeq.js b/tests/lib/rules/eqeqeq.js index afd458248..8089ebaaa 100644 --- a/tests/lib/rules/eqeqeq.js +++ b/tests/lib/rules/eqeqeq.js @@ -3,7 +3,8 @@ */ 'use strict' -const RuleTester = require('../../eslint-compat').RuleTester +const semver = require('semver') +const { RuleTester, ESLint } = require('../../eslint-compat') const rule = require('../../../lib/rules/eqeqeq') const tester = new RuleTester({ @@ -24,7 +25,19 @@ tester.run('eqeqeq', rule, { invalid: [ { code: '', - errors: ["Expected '===' and instead saw '=='."] + errors: [ + { + message: "Expected '===' and instead saw '=='.", + suggestions: semver.gte(ESLint.version, '9.26.0') + ? [ + { + desc: "Use '===' instead of '=='.", + output: `` + } + ] + : null + } + ] }, // CSS vars injection { @@ -34,7 +47,24 @@ tester.run('eqeqeq', rule, { color: v-bind(a == 1 ? 'red' : 'blue') } `, - errors: ["Expected '===' and instead saw '=='."] + errors: [ + { + message: "Expected '===' and instead saw '=='.", + suggestions: semver.gte(ESLint.version, '9.26.0') + ? [ + { + desc: "Use '===' instead of '=='.", + output: ` + ` + } + ] + : null + } + ] } ] }) From 31b30c4b08c829d9e431fb916feb6aa5fc16c9ef Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 18 May 2025 13:59:17 +0900 Subject: [PATCH 003/134] Updates resources (#2747) Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com> Co-authored-by: Yosuke Ota --- .changeset/grumpy-humans-tickle.md | 5 +++++ lib/utils/vue3-export-names.json | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/grumpy-humans-tickle.md diff --git a/.changeset/grumpy-humans-tickle.md b/.changeset/grumpy-humans-tickle.md new file mode 100644 index 000000000..e5f3a14a8 --- /dev/null +++ b/.changeset/grumpy-humans-tickle.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": patch +--- + +Updates resources diff --git a/lib/utils/vue3-export-names.json b/lib/utils/vue3-export-names.json index 349779da1..395090026 100644 --- a/lib/utils/vue3-export-names.json +++ b/lib/utils/vue3-export-names.json @@ -235,6 +235,7 @@ "AsyncComponentOptions", "defineAsyncComponent", "useModel", + "TemplateRef", "useTemplateRef", "useId", "h", @@ -263,8 +264,8 @@ "devtools", "setDevtoolsHook", "DeprecationTypes", - "WatchOptionsBase", "createElementVNode", + "WatchOptionsBase", "TransitionProps", "Transition", "TransitionGroupProps", From cf261fbf554368791f7eb4fc4aae30c36991e45a Mon Sep 17 00:00:00 2001 From: Shayan Zamani Date: Fri, 6 Jun 2025 06:20:09 +0330 Subject: [PATCH 004/134] feat(no-restricted-html-elements): support array of elements (#2750) --- .changeset/crazy-impalas-pick.md | 5 ++++ docs/rules/no-restricted-html-elements.md | 18 ++++++------- lib/rules/no-restricted-html-elements.js | 16 ++++++++--- .../lib/rules/no-restricted-html-elements.js | 27 +++++++++++++++++++ 4 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 .changeset/crazy-impalas-pick.md diff --git a/.changeset/crazy-impalas-pick.md b/.changeset/crazy-impalas-pick.md new file mode 100644 index 000000000..834a6ec8f --- /dev/null +++ b/.changeset/crazy-impalas-pick.md @@ -0,0 +1,5 @@ +--- +'eslint-plugin-vue': minor +--- + +[vue/no-restricted-html-elements](https://eslint.vuejs.org/rules/no-restricted-html-elements.html) now accepts multiple elements in each entry. diff --git a/docs/rules/no-restricted-html-elements.md b/docs/rules/no-restricted-html-elements.md index 2a6d6c997..fef08aeb2 100644 --- a/docs/rules/no-restricted-html-elements.md +++ b/docs/rules/no-restricted-html-elements.md @@ -37,16 +37,16 @@ This rule takes a list of strings, where each string is an HTML element name to ```json { - "vue/no-restricted-html-elements": ["error", "button", "marquee"] + "vue/no-restricted-html-elements": ["error", "a", "marquee"] } ``` - + ```vue ``` @@ -60,8 +60,8 @@ Alternatively, the rule also accepts objects. "vue/no-restricted-html-elements": [ "error", { - "element": "button", - "message": "Prefer use of our custom component" + "element": ["a", "RouterLink"], + "message": "Prefer the use of component" }, { "element": "marquee", @@ -73,18 +73,18 @@ Alternatively, the rule also accepts objects. The following properties can be specified for the object. -- `element` ... Specify the html element. +- `element` ... Specify the HTML element or an array of HTML elements. - `message` ... Specify an optional custom message. -### `{ "element": "marquee" }, { "element": "button" }` +### `{ "element": "marquee" }, { "element": "a" }` - + ```vue ``` diff --git a/lib/rules/no-restricted-html-elements.js b/lib/rules/no-restricted-html-elements.js index e906d86f2..8d5f3c300 100644 --- a/lib/rules/no-restricted-html-elements.js +++ b/lib/rules/no-restricted-html-elements.js @@ -23,7 +23,12 @@ module.exports = { { type: 'object', properties: { - element: { type: 'string' }, + element: { + oneOf: [ + { type: 'string' }, + { type: 'array', items: { type: 'string' } } + ] + }, message: { type: 'string', minLength: 1 } }, required: ['element'], @@ -55,9 +60,12 @@ module.exports = { } for (const option of context.options) { - const element = option.element || option + const restrictedItem = option.element || option + const elementsToRestrict = Array.isArray(restrictedItem) + ? restrictedItem + : [restrictedItem] - if (element === node.rawName) { + if (elementsToRestrict.includes(node.rawName)) { context.report({ messageId: option.message ? 'customMessage' : 'forbiddenElement', data: { @@ -66,6 +74,8 @@ module.exports = { }, node: node.startTag }) + + return } } } diff --git a/tests/lib/rules/no-restricted-html-elements.js b/tests/lib/rules/no-restricted-html-elements.js index c3e3e9eeb..6180b046b 100644 --- a/tests/lib/rules/no-restricted-html-elements.js +++ b/tests/lib/rules/no-restricted-html-elements.js @@ -31,6 +31,11 @@ tester.run('no-restricted-html-elements', rule, { filename: 'test.vue', code: '', options: ['button'] + }, + { + filename: 'test.vue', + code: '', + options: [{ element: ['div', 'span'] }] } ], invalid: [ @@ -69,6 +74,28 @@ tester.run('no-restricted-html-elements', rule, { column: 11 } ] + }, + { + filename: 'test.vue', + code: '', + options: [ + { + element: ['a', 'RouterLink'], + message: 'Prefer the use of component' + } + ], + errors: [ + { + message: 'Prefer the use of component', + line: 1, + column: 11 + }, + { + message: 'Prefer the use of component', + line: 1, + column: 18 + } + ] } ] }) From 2a4336b1f9365b30045304fb5c966db865fba870 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 12:07:30 +0900 Subject: [PATCH 005/134] Version Packages (#2748) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/crazy-impalas-pick.md | 5 ----- .changeset/grumpy-humans-tickle.md | 5 ----- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 .changeset/crazy-impalas-pick.md delete mode 100644 .changeset/grumpy-humans-tickle.md create mode 100644 CHANGELOG.md diff --git a/.changeset/crazy-impalas-pick.md b/.changeset/crazy-impalas-pick.md deleted file mode 100644 index 834a6ec8f..000000000 --- a/.changeset/crazy-impalas-pick.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'eslint-plugin-vue': minor ---- - -[vue/no-restricted-html-elements](https://eslint.vuejs.org/rules/no-restricted-html-elements.html) now accepts multiple elements in each entry. diff --git a/.changeset/grumpy-humans-tickle.md b/.changeset/grumpy-humans-tickle.md deleted file mode 100644 index e5f3a14a8..000000000 --- a/.changeset/grumpy-humans-tickle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"eslint-plugin-vue": patch ---- - -Updates resources diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..b21ab6f6f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# eslint-plugin-vue + +## 10.2.0 + +### Minor Changes + +- [vue/no-restricted-html-elements](https://eslint.vuejs.org/rules/no-restricted-html-elements.html) now accepts multiple elements in each entry. ([#2750](https://github.com/vuejs/eslint-plugin-vue/pull/2750)) + +### Patch Changes + +- Updates resources ([#2747](https://github.com/vuejs/eslint-plugin-vue/pull/2747)) diff --git a/package.json b/package.json index ff0a4b00a..da1053c00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-vue", - "version": "10.1.0", + "version": "10.2.0", "description": "Official ESLint plugin for Vue.js", "main": "lib/index.js", "types": "lib/index.d.ts", From aeef72c8d2d0dec637e33e5df8fa6178bae89d74 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Jun 2025 11:36:58 +0900 Subject: [PATCH 006/134] Updates resources (#2752) Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com> Co-authored-by: Yosuke Ota --- .changeset/smooth-jokes-eat.md | 5 +++++ lib/utils/svg-elements.json | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changeset/smooth-jokes-eat.md diff --git a/.changeset/smooth-jokes-eat.md b/.changeset/smooth-jokes-eat.md new file mode 100644 index 000000000..e5f3a14a8 --- /dev/null +++ b/.changeset/smooth-jokes-eat.md @@ -0,0 +1,5 @@ +--- +"eslint-plugin-vue": patch +--- + +Updates resources diff --git a/lib/utils/svg-elements.json b/lib/utils/svg-elements.json index eedbf0d07..f214aad24 100644 --- a/lib/utils/svg-elements.json +++ b/lib/utils/svg-elements.json @@ -7,7 +7,6 @@ "clipPath", "defs", "desc", - "discard", "ellipse", "feBlend", "feColorMatrix", From 66dab39a878b77a1884633b78bcaec6d3a5c3820 Mon Sep 17 00:00:00 2001 From: yosuke ota Date: Sun, 8 Jun 2025 14:24:34 +0900 Subject: [PATCH 007/134] chore: ignore CHANGELOG.md from markdownlint --- .markdownlintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.markdownlintignore b/.markdownlintignore index 3c3629e64..e7becf85b 100644 --- a/.markdownlintignore +++ b/.markdownlintignore @@ -1 +1,2 @@ node_modules +CHANGELOG.md From ca973010b511755488eeac2851ffd6597f23ccb2 Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Tue, 10 Jun 2025 20:41:24 +0800 Subject: [PATCH 008/134] feat(no-restricted-html-elements): support all element types (#2755) --- .changeset/true-oranges-heal.md | 5 ++ docs/rules/index.md | 2 +- docs/rules/no-restricted-html-elements.md | 10 +-- lib/rules/no-restricted-html-elements.js | 10 ++- .../lib/rules/no-restricted-html-elements.js | 73 ++++++++++++++++++- 5 files changed, 89 insertions(+), 11 deletions(-) create mode 100644 .changeset/true-oranges-heal.md diff --git a/.changeset/true-oranges-heal.md b/.changeset/true-oranges-heal.md new file mode 100644 index 000000000..eba8b9a99 --- /dev/null +++ b/.changeset/true-oranges-heal.md @@ -0,0 +1,5 @@ +--- +'eslint-plugin-vue': patch +--- + +[vue/no-restricted-html-elements](https://eslint.vuejs.org/rules/no-restricted-html-elements.html) now also checks SVG and MathML elements. diff --git a/docs/rules/index.md b/docs/rules/index.md index 7828b58bb..149f877ad 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -245,7 +245,7 @@ For example: | [vue/no-restricted-component-names] | disallow specific component names | :bulb: | :hammer: | | [vue/no-restricted-component-options] | disallow specific component option | | :hammer: | | [vue/no-restricted-custom-event] | disallow specific custom event | :bulb: | :hammer: | -| [vue/no-restricted-html-elements] | disallow specific HTML elements | | :hammer: | +| [vue/no-restricted-html-elements] | disallow specific elements | | :hammer: | | [vue/no-restricted-props] | disallow specific props | :bulb: | :hammer: | | [vue/no-restricted-static-attribute] | disallow specific attribute | | :hammer: | | [vue/no-restricted-v-bind] | disallow specific argument in `v-bind` | | :hammer: | diff --git a/docs/rules/no-restricted-html-elements.md b/docs/rules/no-restricted-html-elements.md index fef08aeb2..9adc7a6ab 100644 --- a/docs/rules/no-restricted-html-elements.md +++ b/docs/rules/no-restricted-html-elements.md @@ -2,17 +2,17 @@ pageClass: rule-details sidebarDepth: 0 title: vue/no-restricted-html-elements -description: disallow specific HTML elements +description: disallow specific elements since: v8.6.0 --- # vue/no-restricted-html-elements -> disallow specific HTML elements +> disallow specific elements ## :book: Rule Details -This rule allows you to specify HTML elements that you don't want to use in your application. +This rule allows you to specify HTML, SVG, and MathML elements that you don't want to use in your application. @@ -33,7 +33,7 @@ This rule allows you to specify HTML elements that you don't want to use in your ## :wrench: Options -This rule takes a list of strings, where each string is an HTML element name to be restricted: +This rule takes a list of strings, where each string is an element name to be restricted: ```json { @@ -73,7 +73,7 @@ Alternatively, the rule also accepts objects. The following properties can be specified for the object. -- `element` ... Specify the HTML element or an array of HTML elements. +- `element` ... Specify the element name or an array of element names. - `message` ... Specify an optional custom message. ### `{ "element": "marquee" }, { "element": "a" }` diff --git a/lib/rules/no-restricted-html-elements.js b/lib/rules/no-restricted-html-elements.js index 8d5f3c300..ab52abde3 100644 --- a/lib/rules/no-restricted-html-elements.js +++ b/lib/rules/no-restricted-html-elements.js @@ -10,7 +10,7 @@ module.exports = { meta: { type: 'suggestion', docs: { - description: 'disallow specific HTML elements', + description: 'disallow specific elements', categories: undefined, url: 'https://eslint.vuejs.org/rules/no-restricted-html-elements.html' }, @@ -40,7 +40,7 @@ module.exports = { minItems: 0 }, messages: { - forbiddenElement: 'Unexpected use of forbidden HTML element {{name}}.', + forbiddenElement: 'Unexpected use of forbidden element {{name}}.', // eslint-disable-next-line eslint-plugin/report-message-format customMessage: '{{message}}' } @@ -55,7 +55,11 @@ module.exports = { * @param {VElement} node */ VElement(node) { - if (!utils.isHtmlElementNode(node)) { + if ( + !utils.isHtmlElementNode(node) && + !utils.isSvgElementNode(node) && + !utils.isMathElementNode(node) + ) { return } diff --git a/tests/lib/rules/no-restricted-html-elements.js b/tests/lib/rules/no-restricted-html-elements.js index 6180b046b..f89f58a11 100644 --- a/tests/lib/rules/no-restricted-html-elements.js +++ b/tests/lib/rules/no-restricted-html-elements.js @@ -36,6 +36,18 @@ tester.run('no-restricted-html-elements', rule, { filename: 'test.vue', code: '', options: [{ element: ['div', 'span'] }] + }, + // SVG + { + filename: 'test.vue', + code: '', + options: ['circle'] + }, + // Math + { + filename: 'test.vue', + code: '', + options: ['mi'] } ], invalid: [ @@ -45,7 +57,7 @@ tester.run('no-restricted-html-elements', rule, { options: ['button'], errors: [ { - message: 'Unexpected use of forbidden HTML element button.', + message: 'Unexpected use of forbidden element button.', line: 1, column: 16 } @@ -57,7 +69,7 @@ tester.run('no-restricted-html-elements', rule, { options: ['div'], errors: [ { - message: 'Unexpected use of forbidden HTML element div.', + message: 'Unexpected use of forbidden element div.', line: 1, column: 11 } @@ -96,6 +108,63 @@ tester.run('no-restricted-html-elements', rule, { column: 18 } ] + }, + // SVG + { + filename: 'test.vue', + code: '', + options: ['circle'], + errors: [ + { + message: 'Unexpected use of forbidden element circle.', + line: 1, + column: 16 + } + ] + }, + { + filename: 'test.vue', + code: '', + options: [ + { element: ['rect', 'path'], message: 'Use simplified shapes instead' } + ], + errors: [ + { + message: 'Use simplified shapes instead', + line: 1, + column: 16 + }, + { + message: 'Use simplified shapes instead', + line: 1, + column: 54 + } + ] + }, + // Math + { + filename: 'test.vue', + code: '', + options: ['mfrac'], + errors: [ + { + message: 'Unexpected use of forbidden element mfrac.', + line: 1, + column: 17 + } + ] + }, + { + filename: 'test.vue', + code: '', + options: [{ element: 'mo', message: 'Avoid using operators directly' }], + errors: [ + { + message: 'Avoid using operators directly', + line: 1, + column: 27 + } + ] } ] }) From fb4c1c0559d8b026c92ed28f759e2f4a74de0e47 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 1 Jul 2025 17:40:45 +0200 Subject: [PATCH 009/134] feat(no-deprecated-slot-attribute): regex ignore patterns (#2773) Co-authored-by: waynzh Co-authored-by: Flo Edelmann --- .changeset/tangy-eagles-start.md | 5 ++ docs/rules/no-deprecated-slot-attribute.md | 2 +- lib/rules/syntaxes/slot-attribute.js | 19 ++-- .../lib/rules/no-deprecated-slot-attribute.js | 88 +++++++++++++++++++ 4 files changed, 108 insertions(+), 6 deletions(-) create mode 100644 .changeset/tangy-eagles-start.md diff --git a/.changeset/tangy-eagles-start.md b/.changeset/tangy-eagles-start.md new file mode 100644 index 000000000..1a8deb530 --- /dev/null +++ b/.changeset/tangy-eagles-start.md @@ -0,0 +1,5 @@ +--- +'eslint-plugin-vue': minor +--- + +[`vue/no-deprecated-slot-attribute`](https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html) `ignore` option now supports regex patterns. diff --git a/docs/rules/no-deprecated-slot-attribute.md b/docs/rules/no-deprecated-slot-attribute.md index 64f2c5e00..df4575cc4 100644 --- a/docs/rules/no-deprecated-slot-attribute.md +++ b/docs/rules/no-deprecated-slot-attribute.md @@ -48,7 +48,7 @@ This rule reports deprecated `slot` attribute in Vue.js v2.6.0+. } ``` -- `"ignore"` (`string[]`) An array of tags that ignore this rules. This option will check both kebab-case and PascalCase versions of the given tag names. Default is empty. +- `"ignore"` (`string[]`) An array of tags or regular expression patterns (e.g. `/^custom-/`) that ignore these rules. This option will check both kebab-case and PascalCase versions of the given tag names. Default is empty. ### `"ignore": ["my-component"]` diff --git a/lib/rules/syntaxes/slot-attribute.js b/lib/rules/syntaxes/slot-attribute.js index 27087cb37..b77fc6c20 100644 --- a/lib/rules/syntaxes/slot-attribute.js +++ b/lib/rules/syntaxes/slot-attribute.js @@ -5,6 +5,7 @@ 'use strict' const canConvertToVSlot = require('./utils/can-convert-to-v-slot') +const regexp = require('../../utils/regexp') const casing = require('../../utils/casing') module.exports = { @@ -12,9 +13,11 @@ module.exports = { supported: '<3.0.0', /** @param {RuleContext} context @returns {TemplateListener} */ createTemplateBodyVisitor(context) { + /** @type {{ ignore: string[] }} */ const options = context.options[0] || {} - /** @type {Set} */ - const ignore = new Set(options.ignore) + const { ignore = [] } = options + /** @type {RegExp[]} */ + const ignorePatterns = ignore.map(regexp.toRegExp) const sourceCode = context.getSourceCode() const tokenStore = @@ -122,10 +125,16 @@ module.exports = { */ function reportSlot(slotAttr) { const componentName = slotAttr.parent.parent.rawName + const componentNamePascalCase = casing.pascalCase(componentName) + const componentNameKebabCase = casing.kebabCase(componentName) + if ( - ignore.has(componentName) || - ignore.has(casing.pascalCase(componentName)) || - ignore.has(casing.kebabCase(componentName)) + ignorePatterns.some( + (pattern) => + pattern.test(componentName) || + pattern.test(componentNamePascalCase) || + pattern.test(componentNameKebabCase) + ) ) { return } diff --git a/tests/lib/rules/no-deprecated-slot-attribute.js b/tests/lib/rules/no-deprecated-slot-attribute.js index 2fd5fa401..e420788ce 100644 --- a/tests/lib/rules/no-deprecated-slot-attribute.js +++ b/tests/lib/rules/no-deprecated-slot-attribute.js @@ -55,6 +55,18 @@ tester.run('no-deprecated-slot-attribute', rule, { `, options: [{ ignore: ['one', 'two', 'my-component'] }] + }, + { + code: ``, + options: [{ ignore: ['/one/', '/^Two$/i', '/^my-.*/i'] }] } ], invalid: [ @@ -644,6 +656,82 @@ tester.run('no-deprecated-slot-attribute', rule, { ], errors: ['`slot` attributes are deprecated.'] }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignore: ['/one/'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 7, + endLine: 7, + column: 16, + endColumn: 20 + } + ] + }, + { + code: ` + `, + output: ` + `, + options: [ + { + ignore: ['/^one$/'] + } + ], + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 7, + endLine: 7, + column: 16, + endColumn: 20 + } + ] + }, { code: ` `, 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 + } ] }, { @@ -678,7 +828,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: ` @@ -863,7 +1021,15 @@ tester.run('no-deprecated-slot-attribute', rule, { `, - errors: ['`slot` attributes are deprecated.'] + errors: [ + { + message: '`slot` attributes are deprecated.', + line: 6, + column: 13, + endLine: 6, + endColumn: 18 + } + ] }, { code: ` @@ -876,7 +1042,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 + } + ] } ] }) From cf3c4eb97e83d7190a035275b3e2f339e2ade8af Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 09:04:24 +0200 Subject: [PATCH 022/134] test(array-bracket-newline): make tests more strict (#2799) --- tests/lib/rules/array-bracket-newline.js | 124 ++++++++++++++++++++--- 1 file changed, 110 insertions(+), 14 deletions(-) diff --git a/tests/lib/rules/array-bracket-newline.js b/tests/lib/rules/array-bracket-newline.js index 380f61e4f..0334d2942 100644 --- a/tests/lib/rules/array-bracket-newline.js +++ b/tests/lib/rules/array-bracket-newline.js @@ -40,61 +40,145 @@ tester.run('array-bracket-newline', rule, { { code: '', output: '', - errors: ["There should be no linebreak after '['."] + errors: [ + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', - errors: ["There should be no linebreak before ']'."] + errors: [ + { + message: "There should be no linebreak before ']'.", + line: 2, + column: 1, + endLine: 2, + endColumn: 2 + } + ] }, { code: '', output: '', errors: [ - "There should be no linebreak after '['.", - "There should be no linebreak before ']'." + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "There should be no linebreak before ']'.", + line: 3, + column: 1, + endLine: 3, + endColumn: 2 + } ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no linebreak after '['."] + errors: [ + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no linebreak before ']'."] + errors: [ + { + message: "There should be no linebreak before ']'.", + line: 2, + column: 1, + endLine: 2, + endColumn: 2 + } + ] }, { code: '', output: '', options: ['never'], errors: [ - "There should be no linebreak after '['.", - "There should be no linebreak before ']'." + { + message: "There should be no linebreak after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "There should be no linebreak before ']'.", + line: 3, + column: 1, + endLine: 3, + endColumn: 2 + } ] }, { code: '', output: '', options: ['always'], - errors: ["A linebreak is required before ']'."] + errors: [ + { + message: "A linebreak is required before ']'.", + line: 2, + column: 2, + endLine: 2, + endColumn: 3 + } + ] }, { code: '', output: '', options: ['always'], - errors: ["A linebreak is required after '['."] + errors: [ + { + message: "A linebreak is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', options: ['always'], errors: [ - "A linebreak is required after '['.", - "A linebreak is required before ']'." + { + message: "A linebreak is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "A linebreak is required before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } ] }, { @@ -102,8 +186,20 @@ tester.run('array-bracket-newline', rule, { output: '', options: ['always'], errors: [ - "A linebreak is required after '['.", - "A linebreak is required before ']'." + { + message: "A linebreak is required after '['.", + line: 1, + column: 27, + endLine: 1, + endColumn: 28 + }, + { + message: "A linebreak is required before ']'.", + line: 1, + column: 29, + endLine: 1, + endColumn: 30 + } ] } ] From 5bde25ae9995461bd75e29457573d63ea21b63ee Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 11:23:11 +0200 Subject: [PATCH 023/134] test(array-bracket-spacing): make tests more strict (#2800) --- tests/lib/rules/array-bracket-spacing.js | 124 ++++++++++++++++++++--- 1 file changed, 110 insertions(+), 14 deletions(-) diff --git a/tests/lib/rules/array-bracket-spacing.js b/tests/lib/rules/array-bracket-spacing.js index 1eea108e6..6218d232e 100644 --- a/tests/lib/rules/array-bracket-spacing.js +++ b/tests/lib/rules/array-bracket-spacing.js @@ -39,61 +39,145 @@ tester.run('array-bracket-spacing', rule, { { code: '', output: '', - errors: ["There should be no space after '['."] + errors: [ + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + } + ] }, { code: '', output: '', - errors: ["There should be no space before ']'."] + errors: [ + { + message: "There should be no space before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } + ] }, { code: '', output: '', errors: [ - "There should be no space after '['.", - "There should be no space before ']'." + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + }, + { + message: "There should be no space before ']'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 27 + } ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no space after '['."] + errors: [ + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + } + ] }, { code: '', output: '', options: ['never'], - errors: ["There should be no space before ']'."] + errors: [ + { + message: "There should be no space before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } + ] }, { code: '', output: '', options: ['never'], errors: [ - "There should be no space after '['.", - "There should be no space before ']'." + { + message: "There should be no space after '['.", + line: 1, + column: 24, + endLine: 1, + endColumn: 25 + }, + { + message: "There should be no space before ']'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 27 + } ] }, { code: '', output: '', options: ['always'], - errors: ["A space is required before ']'."] + errors: [ + { + message: "A space is required before ']'.", + line: 1, + column: 26, + endLine: 1, + endColumn: 27 + } + ] }, { code: '', output: '', options: ['always'], - errors: ["A space is required after '['."] + errors: [ + { + message: "A space is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + } + ] }, { code: '', output: '', options: ['always'], errors: [ - "A space is required after '['.", - "A space is required before ']'." + { + message: "A space is required after '['.", + line: 1, + column: 23, + endLine: 1, + endColumn: 24 + }, + { + message: "A space is required before ']'.", + line: 1, + column: 25, + endLine: 1, + endColumn: 26 + } ] }, { @@ -101,8 +185,20 @@ tester.run('array-bracket-spacing', rule, { output: '', options: ['always'], errors: [ - "A space is required after '['.", - "A space is required before ']'." + { + message: "A space is required after '['.", + line: 1, + column: 27, + endLine: 1, + endColumn: 28 + }, + { + message: "A space is required before ']'.", + line: 1, + column: 29, + endLine: 1, + endColumn: 30 + } ] } ] From 468789bfbf67691d4163f5808ce960d7b16f3f83 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 15:04:17 +0200 Subject: [PATCH 024/134] test(arrow-spacing): make tests more strict (#2801) --- tests/lib/rules/arrow-spacing.js | 40 +++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/tests/lib/rules/arrow-spacing.js b/tests/lib/rules/arrow-spacing.js index d80c255e8..d05c9f269 100644 --- a/tests/lib/rules/arrow-spacing.js +++ b/tests/lib/rules/arrow-spacing.js @@ -48,11 +48,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Missing space before =>.', - line: 3 + line: 3, + column: 24, + endLine: 3, + endColumn: 25 }, { message: 'Missing space after =>.', - line: 3 + line: 3, + column: 27, + endLine: 3, + endColumn: 28 } ] }, @@ -68,11 +74,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Missing space before =>.', - line: 3 + line: 3, + column: 25, + endLine: 3, + endColumn: 26 }, { message: 'Missing space after =>.', - line: 3 + line: 3, + column: 28, + endLine: 3, + endColumn: 29 } ] }, @@ -94,11 +106,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Missing space before =>.', - line: 4 + line: 4, + column: 25, + endLine: 4, + endColumn: 26 }, { message: 'Missing space after =>.', - line: 4 + line: 4, + column: 28, + endLine: 4, + endColumn: 29 } ] }, @@ -115,11 +133,17 @@ tester.run('arrow-spacing', rule, { errors: [ { message: 'Unexpected space before =>.', - line: 3 + line: 3, + column: 24, + endLine: 3, + endColumn: 25 }, { message: 'Unexpected space after =>.', - line: 3 + line: 3, + column: 29, + endLine: 3, + endColumn: 30 } ] } From f75a0030657c49fda257c720fcf9bf43852291a8 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 15:06:54 +0200 Subject: [PATCH 025/134] test(attribute-hyphenation): make tests more strict (#2802) --- tests/lib/rules/attribute-hyphenation.js | 138 ++++++++++++++++++----- 1 file changed, 110 insertions(+), 28 deletions(-) diff --git a/tests/lib/rules/attribute-hyphenation.js b/tests/lib/rules/attribute-hyphenation.js index 738d59ae9..eac974e4e 100644 --- a/tests/lib/rules/attribute-hyphenation.js +++ b/tests/lib/rules/attribute-hyphenation.js @@ -118,7 +118,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'my-prop' can't be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 37 } ] }, @@ -131,7 +134,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'MyProp' must be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 36 } ] }, @@ -145,7 +151,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':my-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -158,7 +167,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 38 } ] }, @@ -172,7 +184,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:my-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 45 } ] }, @@ -185,7 +200,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -198,7 +216,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -212,7 +233,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':second-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 46, + endLine: 1, + endColumn: 65 } ] }, @@ -226,7 +250,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:myProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -240,7 +267,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-bind:propID' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 44 } ] }, @@ -255,7 +285,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-model:my-prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 46 } ] }, @@ -269,7 +302,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-model:myProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 45 } ] }, @@ -282,7 +318,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'v-model:MyProp' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 45 } ] }, @@ -307,7 +346,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'third-custom' can't be hyphenated.", type: 'VIdentifier', - line: 3 + line: 3, + column: 111, + endLine: 3, + endColumn: 129 } ] }, @@ -332,12 +374,18 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'custom-hyphen' can't be hyphenated.", type: 'VIdentifier', - line: 3 + line: 3, + column: 71, + endLine: 3, + endColumn: 90 }, { message: "Attribute 'second-custom' can't be hyphenated.", type: 'VIdentifier', - line: 3 + line: 3, + column: 91, + endLine: 3, + endColumn: 110 } ] }, @@ -350,7 +398,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'my-prop' can't be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 22, + endLine: 1, + endColumn: 35 } ] }, @@ -363,7 +414,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute 'MyProp' must be hyphenated.", type: 'VIdentifier', - line: 1 + line: 1, + column: 22, + endLine: 1, + endColumn: 34 } ] }, @@ -376,7 +430,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':attr_Gg' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -389,7 +446,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':Attr_Hh' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -402,7 +462,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':_attr_Jj' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 40 } ] }, @@ -415,7 +478,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':_attrKk' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -428,7 +494,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':_AttrLl' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 39 } ] }, @@ -441,7 +510,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':my-custom_prop' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 46 } ] }, @@ -454,7 +526,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':myAge.sync' must be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 42 } ] }, @@ -467,7 +542,10 @@ ruleTester.run('attribute-hyphenation', rule, { { message: "Attribute ':my-age.sync' can't be hyphenated.", type: 'VDirectiveKey', - line: 1 + line: 1, + column: 24, + endLine: 1, + endColumn: 43 } ] }, @@ -490,7 +568,9 @@ ruleTester.run('attribute-hyphenation', rule, { message: "Attribute 'my-prop' can't be hyphenated.", type: 'VIdentifier', line: 3, - column: 17 + column: 17, + endLine: 3, + endColumn: 24 } ] }, @@ -513,7 +593,9 @@ ruleTester.run('attribute-hyphenation', rule, { message: "Attribute 'myProp' must be hyphenated.", type: 'VIdentifier', line: 3, - column: 17 + column: 17, + endLine: 3, + endColumn: 23 } ] } From c66d6b641d8dd79596d9b31d9223640827c0f870 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 18 Jul 2025 16:35:14 +0200 Subject: [PATCH 026/134] test(block-lang): make tests more strict (#2804) --- tests/lib/rules/block-lang.js | 52 ++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/tests/lib/rules/block-lang.js b/tests/lib/rules/block-lang.js index 5f7851b54..ad1b9842c 100644 --- a/tests/lib/rules/block-lang.js +++ b/tests/lib/rules/block-lang.js @@ -44,7 +44,9 @@ tester.run('block-lang', rule, { { message: `Only "ts" can be used for the 'lang' attribute of ''.", line: 4, - column: 6 + column: 6, + endLine: 4, + endColumn: 6 } ] }, @@ -86,22 +94,30 @@ tester.run('block-tag-newline', rule, { { message: "A line break is required after ''.", line: 2, - column: 7 + column: 7, + endLine: 2, + endColumn: 7 }, { message: "A line break is required after ''.", line: 4, - column: 6 + column: 6, + endLine: 4, + endColumn: 6 } ] }, @@ -113,22 +129,30 @@ tester.run('block-tag-newline', rule, { { message: "There should be no line break after ' `, errors: [ - 'Expected no line breaks before closing bracket, but 1 line break found.', - 'Expected no line breaks before closing bracket, but 2 line breaks found.' + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 3, + column: 15, + endLine: 4, + endColumn: 11 + }, + { + message: + 'Expected no line breaks before closing bracket, but 2 line breaks found.', + line: 4, + column: 17, + endLine: 6, + endColumn: 11 + } ] }, { @@ -195,7 +209,14 @@ tester.run('html-closing-bracket-newline', rule, { `, errors: [ - 'Expected 1 line break before closing bracket, but no line breaks found.' + { + message: + 'Expected 1 line break before closing bracket, but no line breaks found.', + line: 4, + column: 18, + endLine: 4, + endColumn: 18 + } ] }, { @@ -219,8 +240,22 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected no line breaks before closing bracket, but 1 line break found.', - 'Expected no line breaks before closing bracket, but 2 line breaks found.' + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 3, + column: 15, + endLine: 4, + endColumn: 11 + }, + { + message: + 'Expected no line breaks before closing bracket, but 2 line breaks found.', + line: 4, + column: 17, + endLine: 6, + endColumn: 11 + } ] }, { @@ -246,7 +281,14 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected no line breaks before closing bracket, but 1 line break found.' + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 4, + column: 18, + endLine: 5, + endColumn: 13 + } ] }, { @@ -272,7 +314,14 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected 1 line break before closing bracket, but no line breaks found.' + { + message: + 'Expected 1 line break before closing bracket, but no line breaks found.', + line: 4, + column: 18, + endLine: 4, + endColumn: 18 + } ] }, { @@ -297,8 +346,22 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected no line breaks before closing bracket, but 1 line break found.', - 'Expected no line breaks before closing bracket, but 1 line break found.' + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 3, + column: 21, + endLine: 4, + endColumn: 11 + }, + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 5, + column: 16, + endLine: 6, + endColumn: 11 + } ] }, { @@ -329,8 +392,22 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected no line breaks before closing bracket, but 1 line break found.', - 'Expected 1 line break before closing bracket, but no line breaks found.' + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 5, + column: 18, + endLine: 6, + endColumn: 13 + }, + { + message: + 'Expected 1 line break before closing bracket, but no line breaks found.', + line: 7, + column: 16, + endLine: 7, + endColumn: 16 + } ] }, { @@ -359,8 +436,22 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected 1 line break before closing bracket, but no line breaks found.', - 'Expected 1 line break before closing bracket, but no line breaks found.' + { + message: + 'Expected 1 line break before closing bracket, but no line breaks found.', + line: 4, + column: 21, + endLine: 4, + endColumn: 21 + }, + { + message: + 'Expected 1 line break before closing bracket, but no line breaks found.', + line: 5, + column: 16, + endLine: 5, + endColumn: 16 + } ] }, { @@ -474,42 +565,48 @@ tester.run('html-closing-bracket-newline', rule, { 'Expected 1 line break before closing bracket, but no line breaks found.', line: 2, column: 18, - endColumn: 18 + endColumn: 18, + endLine: 2 }, { message: 'Expected 1 line break before closing bracket, but no line breaks found.', line: 3, column: 19, - endColumn: 19 + endColumn: 19, + endLine: 3 }, { message: 'Expected 1 line break before closing bracket, but no line breaks found.', line: 4, column: 16, - endColumn: 16 + endColumn: 16, + endLine: 4 }, { message: 'Expected 1 line break before closing bracket, but no line breaks found.', line: 5, column: 17, - endColumn: 17 + endColumn: 17, + endLine: 5 }, { message: 'Expected 1 line break before closing bracket, but no line breaks found.', line: 6, column: 15, - endColumn: 15 + endColumn: 15, + endLine: 6 }, { message: 'Expected 1 line break before closing bracket, but no line breaks found.', line: 6, column: 23, - endColumn: 23 + endColumn: 23, + endLine: 6 } ] }, @@ -534,7 +631,14 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected no line breaks before closing bracket, but 1 line break found.' + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 3, + column: 18, + endLine: 4, + endColumn: 11 + } ] }, { @@ -560,7 +664,14 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected 1 line break before closing bracket, but no line breaks found.' + { + message: + 'Expected 1 line break before closing bracket, but no line breaks found.', + line: 4, + column: 23, + endLine: 4, + endColumn: 23 + } ] }, { @@ -584,7 +695,14 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected 1 line break before closing bracket, but no line breaks found.' + { + message: + 'Expected 1 line break before closing bracket, but no line breaks found.', + line: 3, + column: 29, + endLine: 3, + endColumn: 29 + } ] }, { @@ -610,7 +728,14 @@ tester.run('html-closing-bracket-newline', rule, { } ], errors: [ - 'Expected no line breaks before closing bracket, but 1 line break found.' + { + message: + 'Expected no line breaks before closing bracket, but 1 line break found.', + line: 4, + column: 23, + endLine: 5, + endColumn: 11 + } ] } ] From dca0477c721025c83b419141cb001deb12159e9f Mon Sep 17 00:00:00 2001 From: 2nofa11 <47783146+2nofa11@users.noreply.github.com> Date: Mon, 28 Jul 2025 15:05:56 +0900 Subject: [PATCH 053/134] docs: fix typo 'identifer' to 'identifier' (#2855) --- docs/rules/match-component-import-name.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rules/match-component-import-name.md b/docs/rules/match-component-import-name.md index 522b90a02..5ba837f41 100644 --- a/docs/rules/match-component-import-name.md +++ b/docs/rules/match-component-import-name.md @@ -12,7 +12,7 @@ since: v8.7.0 ## :book: Rule Details -By default, this rule will validate that the imported name matches the name of the components object property identifer. Note that "matches" means that the imported name matches either the PascalCase or kebab-case version of the components object property identifer. If you would like to enforce that it must match only one of PascalCase or kebab-case, use this rule in conjunction with the rule [vue/component-definition-name-casing](./component-definition-name-casing.md). +By default, this rule will validate that the imported name matches the name of the components object property identifier. Note that "matches" means that the imported name matches either the PascalCase or kebab-case version of the components object property identifier. If you would like to enforce that it must match only one of PascalCase or kebab-case, use this rule in conjunction with the rule [vue/component-definition-name-casing](./component-definition-name-casing.md). From 1243d23e93b7bf80bffaddd80c1171a41d6e327b Mon Sep 17 00:00:00 2001 From: Flo Edelmann Date: Mon, 28 Jul 2025 16:34:26 +0200 Subject: [PATCH 054/134] docs: fix link formatting in `vue/require-explicit-slots` docs --- docs/rules/require-explicit-slots.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rules/require-explicit-slots.md b/docs/rules/require-explicit-slots.md index 4d40be209..2737e7e6a 100644 --- a/docs/rules/require-explicit-slots.md +++ b/docs/rules/require-explicit-slots.md @@ -12,7 +12,7 @@ since: v9.21.0 ## :book: Rule Details -This rule enforces all slots used in the template to be defined once either in the `script setup` block with the [`defineSlots`](https://vuejs.org/api/sfc-script-setup.html#defineslots) macro, or with the [`slots property`](https://vuejs.org/api/options-rendering.html#slots) in the Options API. +This rule enforces all slots used in the template to be defined once either in the `script setup` block with the [`defineSlots` macro](https://vuejs.org/api/sfc-script-setup.html#defineslots), or with the [`slots` property](https://vuejs.org/api/options-rendering.html#slots) in the Options API. From 1bd95d3b342239fc53a02fc099ea162e28e6deaf Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 29 Jul 2025 06:35:54 +0200 Subject: [PATCH 055/134] test(mustache-interpolation-spacing): make tests more strict (#2854) --- .../rules/mustache-interpolation-spacing.js | 88 ++++++++++++++++--- 1 file changed, 78 insertions(+), 10 deletions(-) diff --git a/tests/lib/rules/mustache-interpolation-spacing.js b/tests/lib/rules/mustache-interpolation-spacing.js index 421b5a0d1..6f390b1ae 100644 --- a/tests/lib/rules/mustache-interpolation-spacing.js +++ b/tests/lib/rules/mustache-interpolation-spacing.js @@ -80,28 +80,60 @@ ruleTester.run('mustache-interpolation-spacing', rule, { code: '', output: '', options: ['always'], - errors: ["Expected 1 space before '}}', but not found."] + errors: [ + { + message: "Expected 1 space before '}}', but not found.", + line: 1, + column: 23, + endLine: 1, + endColumn: 25 + } + ] }, { filename: 'test.vue', code: '', output: '', options: ['always'], - errors: ["Expected 1 space after '{{', but not found."] + errors: [ + { + message: "Expected 1 space after '{{', but not found.", + line: 1, + column: 16, + endLine: 1, + endColumn: 18 + } + ] }, { filename: 'test.vue', code: '', output: '', options: ['never'], - errors: ["Expected no space after '{{', but found."] + errors: [ + { + message: "Expected no space after '{{', but found.", + line: 1, + column: 16, + endLine: 1, + endColumn: 19 + } + ] }, { filename: 'test.vue', code: '', output: '', options: ['never'], - errors: ["Expected no space before '}}', but found."] + errors: [ + { + message: "Expected no space before '}}', but found.", + line: 1, + column: 22, + endLine: 1, + endColumn: 25 + } + ] }, { filename: 'test.vue', @@ -109,8 +141,20 @@ ruleTester.run('mustache-interpolation-spacing', rule, { output: '', options: ['always'], errors: [ - "Expected 1 space after '{{', but not found.", - "Expected 1 space before '}}', but not found." + { + message: "Expected 1 space after '{{', but not found.", + line: 1, + column: 16, + endLine: 1, + endColumn: 18 + }, + { + message: "Expected 1 space before '}}', but not found.", + line: 1, + column: 22, + endLine: 1, + endColumn: 24 + } ] }, { @@ -119,8 +163,20 @@ ruleTester.run('mustache-interpolation-spacing', rule, { output: '', options: ['never'], errors: [ - "Expected no space after '{{', but found.", - "Expected no space before '}}', but found." + { + message: "Expected no space after '{{', but found.", + line: 1, + column: 16, + endLine: 1, + endColumn: 19 + }, + { + message: "Expected no space before '}}', but found.", + line: 1, + column: 23, + endLine: 1, + endColumn: 26 + } ] }, { @@ -129,8 +185,20 @@ ruleTester.run('mustache-interpolation-spacing', rule, { output: '', options: ['never'], errors: [ - "Expected no space after '{{', but found.", - "Expected no space before '}}', but found." + { + message: "Expected no space after '{{', but found.", + line: 1, + column: 16, + endLine: 1, + endColumn: 21 + }, + { + message: "Expected no space before '}}', but found.", + line: 1, + column: 25, + endLine: 1, + endColumn: 30 + } ] } ] From 9ca49034b6f1d89d0e3808b1fee2990cec97b1ce Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 29 Jul 2025 06:37:42 +0200 Subject: [PATCH 056/134] test(multiline-ternary): make tests more strict (#2853) --- tests/lib/rules/multiline-ternary.js | 79 +++++++++++++++------------- 1 file changed, 43 insertions(+), 36 deletions(-) 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: [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 +196,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 +223,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 +248,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 +274,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 +300,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 +323,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 +348,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 +375,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 +400,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 } ] } From 6f1fae345ce5f8265822d8addf7fee2398f68b69 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Tue, 29 Jul 2025 06:45:12 +0200 Subject: [PATCH 069/134] test(html-quotes): make tests more strict (#2839) --- tests/lib/rules/html-quotes.js | 210 +++++++++++++++++++++++++++++---- 1 file changed, 189 insertions(+), 21 deletions(-) diff --git a/tests/lib/rules/html-quotes.js b/tests/lib/rules/html-quotes.js index 1c57f0a26..f6931f552 100644 --- a/tests/lib/rules/html-quotes.js +++ b/tests/lib/rules/html-quotes.js @@ -82,101 +82,221 @@ tester.run('html-quotes', rule, { filename: 'test.vue', code: '', output: '', - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 22, + endLine: 1, + endColumn: 25 + } + ] }, { filename: 'test.vue', code: "", output: '', - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 22, + endLine: 1, + endColumn: 27 + } + ] }, { filename: 'test.vue', code: '', output: '', - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 26 + } + ] }, { filename: 'test.vue', code: "", output: '', - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 28 + } + ] }, { filename: 'test.vue', code: '', output: '', - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 32 + } + ] }, { filename: 'test.vue', code: '', output: '', options: ['double'], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 22, + endLine: 1, + endColumn: 25 + } + ] }, { filename: 'test.vue', code: "", output: '', options: ['double'], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 22, + endLine: 1, + endColumn: 27 + } + ] }, { filename: 'test.vue', code: '', output: '', options: ['double'], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 26 + } + ] }, { filename: 'test.vue', code: "", output: '', options: ['double'], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 28 + } + ] }, { filename: 'test.vue', code: '', output: '', options: ['double'], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 32 + } + ] }, { filename: 'test.vue', code: '', output: "", options: ['single'], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 22, + endLine: 1, + endColumn: 25 + } + ] }, { filename: 'test.vue', code: '', output: "", options: ['single'], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 22, + endLine: 1, + endColumn: 27 + } + ] }, { filename: 'test.vue', code: '', output: "", options: ['single'], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 26 + } + ] }, { filename: 'test.vue', code: '', output: "", options: ['single'], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 28 + } + ] }, { filename: 'test.vue', code: "", output: "", options: ['single'], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 23, + endLine: 1, + endColumn: 32 + } + ] }, // avoidEscape { @@ -184,42 +304,90 @@ tester.run('html-quotes', rule, { code: "", output: '', options: ['double', { avoidEscape: true }], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 21, + endLine: 1, + endColumn: 26 + } + ] }, { filename: 'test.vue', code: '', output: "", options: ['single', { avoidEscape: true }], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 21, + endLine: 1, + endColumn: 26 + } + ] }, { filename: 'test.vue', code: '', output: "", options: ['double', { avoidEscape: true }], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 21, + endLine: 1, + endColumn: 28 + } + ] }, { filename: 'test.vue', code: "", output: '', options: ['single', { avoidEscape: true }], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 21, + endLine: 1, + endColumn: 28 + } + ] }, { filename: 'test.vue', code: '', output: '', options: ['double', { avoidEscape: true }], - errors: ['Expected to be enclosed by double quotes.'] + errors: [ + { + message: 'Expected to be enclosed by double quotes.', + line: 1, + column: 21, + endLine: 1, + endColumn: 32 + } + ] }, { filename: 'test.vue', code: '', output: "", options: ['single', { avoidEscape: true }], - errors: ['Expected to be enclosed by single quotes.'] + errors: [ + { + message: 'Expected to be enclosed by single quotes.', + line: 1, + column: 21, + endLine: 1, + endColumn: 32 + } + ] } ] }) From 1c3b24efadd452d02a121e446378146a378efadc Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 30 Jul 2025 04:33:47 +0200 Subject: [PATCH 070/134] test(html-closing-bracket-spacing): make tests more strict (#2833) --- .../lib/rules/html-closing-bracket-spacing.js | 66 ++++++++++++------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/tests/lib/rules/html-closing-bracket-spacing.js b/tests/lib/rules/html-closing-bracket-spacing.js index 09e2702e0..26139b225 100644 --- a/tests/lib/rules/html-closing-bracket-spacing.js +++ b/tests/lib/rules/html-closing-bracket-spacing.js @@ -50,19 +50,22 @@ ruleTester.run('html-closing-bracket-spacing', rule, { message: "Expected no space before '>', but found.", line: 2, column: 7, - endColumn: 9 + endColumn: 9, + endLine: 2 }, { message: "Expected no space before '>', but found.", line: 3, column: 8, - endColumn: 10 + endColumn: 10, + endLine: 3 }, { message: "Expected a space before '/>', but not found.", line: 4, column: 7, - endColumn: 9 + endColumn: 9, + endLine: 4 } ] }, @@ -74,13 +77,15 @@ ruleTester.run('html-closing-bracket-spacing', rule, { message: "Expected no space before '>', but found.", line: 2, column: 11, - endColumn: 13 + endColumn: 13, + endLine: 2 }, { message: "Expected a space before '/>', but not found.", line: 3, column: 11, - endColumn: 13 + endColumn: 13, + endLine: 3 } ] }, @@ -93,13 +98,15 @@ ruleTester.run('html-closing-bracket-spacing', rule, { message: "Expected no space before '>', but found.", line: 2, column: 15, - endColumn: 17 + endColumn: 17, + endLine: 2 }, { message: "Expected a space before '/>', but not found.", line: 3, column: 15, - endColumn: 17 + endColumn: 17, + endLine: 3 } ] }, @@ -119,37 +126,43 @@ ruleTester.run('html-closing-bracket-spacing', rule, { message: "Expected no space before '>', but found.", line: 2, column: 18, - endColumn: 20 + endColumn: 20, + endLine: 2 }, { message: "Expected no space before '>', but found.", line: 2, column: 30, - endColumn: 32 + endColumn: 32, + endLine: 2 }, { message: "Expected no space before '>', but found.", line: 3, column: 16, - endColumn: 18 + endColumn: 18, + endLine: 3 }, { message: "Expected no space before '>', but found.", line: 3, column: 26, - endColumn: 28 + endColumn: 28, + endLine: 3 }, { message: "Expected no space before '>', but found.", line: 4, column: 15, - endColumn: 17 + endColumn: 17, + endLine: 4 }, { message: "Expected no space before '>', but found.", line: 4, column: 24, - endColumn: 26 + endColumn: 26, + endLine: 4 } ] }, @@ -168,19 +181,22 @@ ruleTester.run('html-closing-bracket-spacing', rule, { message: "Expected a space before '>', but not found.", line: 2, column: 7, - endColumn: 8 + endColumn: 8, + endLine: 2 }, { message: "Expected a space before '>', but not found.", line: 3, column: 8, - endColumn: 9 + endColumn: 9, + endLine: 3 }, { message: "Expected no space before '/>', but found.", line: 4, column: 7, - endColumn: 10 + endColumn: 10, + endLine: 4 } ] }, @@ -207,37 +223,43 @@ ruleTester.run('html-closing-bracket-spacing', rule, { message: "Expected a space before '>', but not found.", line: 2, column: 18, - endColumn: 19 + endColumn: 19, + endLine: 2 }, { message: "Expected a space before '>', but not found.", line: 2, column: 29, - endColumn: 30 + endColumn: 30, + endLine: 2 }, { message: "Expected a space before '>', but not found.", line: 3, column: 16, - endColumn: 17 + endColumn: 17, + endLine: 3 }, { message: "Expected a space before '>', but not found.", line: 3, column: 25, - endColumn: 26 + endColumn: 26, + endLine: 3 }, { message: "Expected a space before '>', but not found.", line: 4, column: 15, - endColumn: 16 + endColumn: 16, + endLine: 4 }, { message: "Expected a space before '>', but not found.", line: 4, column: 23, - endColumn: 24 + endColumn: 24, + endLine: 4 } ] } From dce79ae0a33979e132ffef21424749bc4054317b Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 30 Jul 2025 04:34:14 +0200 Subject: [PATCH 071/134] test(html-comment-content-newline): make tests more strict (#2834) --- .../lib/rules/html-comment-content-newline.js | 96 +++++++++++++++---- 1 file changed, 78 insertions(+), 18 deletions(-) diff --git a/tests/lib/rules/html-comment-content-newline.js b/tests/lib/rules/html-comment-content-newline.js index 362e27adf..6d1c28279 100644 --- a/tests/lib/rules/html-comment-content-newline.js +++ b/tests/lib/rules/html-comment-content-newline.js @@ -264,13 +264,15 @@ tester.run('html-comment-content-newline', rule, { message: "Expected line break after ''.", line: 7, column: 20, - endColumn: 21 + endColumn: 21, + endLine: 7 } ] }, @@ -293,25 +295,29 @@ tester.run('html-comment-content-newline', rule, { message: "Expected line break after ''.", line: 3, column: 22, - endColumn: 22 + endColumn: 22, + endLine: 3 }, { message: "Expected line break after ''.", line: 4, column: 24, - endColumn: 26 + endColumn: 26, + endLine: 4 } ] }, @@ -363,13 +369,15 @@ comment message: "Expected line break after ''.", line: 3, column: 30, - endColumn: 38 + endColumn: 38, + endLine: 3 } ] }, @@ -383,8 +391,20 @@ comment output: null, options: ['always', { exceptions: ['+'] }], errors: [ - 'Expected line break after exception block.', - 'Expected line break before exception block.' + { + message: 'Expected line break after exception block.', + line: 3, + column: 31, + endLine: 3, + endColumn: 31 + }, + { + message: 'Expected line break before exception block.', + line: 3, + column: 38, + endLine: 3, + endColumn: 38 + } ] }, { @@ -396,8 +416,20 @@ comment output: null, options: ['always', { exceptions: ['*'] }], errors: [ - 'Expected line break after exception block.', - 'Expected line break before exception block.' + { + message: 'Expected line break after exception block.', + line: 3, + column: 20, + endLine: 3, + endColumn: 20 + }, + { + message: 'Expected line break before exception block.', + line: 3, + column: 27, + endLine: 3, + endColumn: 27 + } ] }, { @@ -413,8 +445,20 @@ comment `, options: ['always', { exceptions: ['#+#-'] }], errors: [ - 'Expected line break after exception block.', - "Expected line break before '-->'." + { + message: 'Expected line break after exception block.', + line: 3, + column: 27, + endLine: 3, + endColumn: 27 + }, + { + message: "Expected line break before '-->'.", + line: 3, + column: 38, + endLine: 3, + endColumn: 38 + } ] }, { @@ -426,11 +470,19 @@ comment output: null, options: ['always', { exceptions: ['*', '++'] }], errors: [ - 'Expected line break after exception block.', + { + message: 'Expected line break after exception block.', + line: 3, + column: 20, + endLine: 3, + endColumn: 20 + }, { message: 'Expected line break before exception block.', line: 3, - column: 27 + column: 27, + endLine: 3, + endColumn: 27 } ] }, @@ -443,11 +495,19 @@ comment output: null, options: ['always', { exceptions: ['*', '++'] }], errors: [ - 'Expected line break after exception block.', + { + message: 'Expected line break after exception block.', + line: 3, + column: 20, + endLine: 3, + endColumn: 20 + }, { message: 'Expected line break before exception block.', line: 3, - column: 28 + column: 28, + endLine: 3, + endColumn: 28 } ] } From 769cf78de6043496c316032df3aecc3b2f1bddae Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 30 Jul 2025 04:34:41 +0200 Subject: [PATCH 072/134] test(html-comment-content-spacing): make tests more strict (#2835) --- .../lib/rules/html-comment-content-spacing.js | 90 +++++++++++++++---- 1 file changed, 74 insertions(+), 16 deletions(-) diff --git a/tests/lib/rules/html-comment-content-spacing.js b/tests/lib/rules/html-comment-content-spacing.js index 1036555e8..754271d10 100644 --- a/tests/lib/rules/html-comment-content-spacing.js +++ b/tests/lib/rules/html-comment-content-spacing.js @@ -207,13 +207,15 @@ tester.run('html-comment-content-spacing', rule, { message: "Expected space after ''.", line: 3, column: 22, - endColumn: 22 + endColumn: 22, + endLine: 3 } ] }, @@ -234,13 +236,15 @@ tester.run('html-comment-content-spacing', rule, { message: "Unexpected space after ''.", line: 3, column: 23, - endColumn: 24 + endColumn: 24, + endLine: 3 } ] }, @@ -261,13 +265,15 @@ tester.run('html-comment-content-spacing', rule, { message: "Unexpected space after ''.", line: 3, column: 30, - endColumn: 38 + endColumn: 38, + endLine: 3 } ] }, @@ -281,8 +287,20 @@ tester.run('html-comment-content-spacing', rule, { output: null, options: ['always', { exceptions: ['+'] }], errors: [ - 'Expected space after exception block.', - 'Expected space before exception block.' + { + message: 'Expected space after exception block.', + line: 3, + column: 31, + endLine: 3, + endColumn: 31 + }, + { + message: 'Expected space before exception block.', + line: 3, + column: 38, + endLine: 3, + endColumn: 38 + } ] }, { @@ -294,8 +312,20 @@ tester.run('html-comment-content-spacing', rule, { output: null, options: ['always', { exceptions: ['*'] }], errors: [ - 'Expected space after exception block.', - 'Expected space before exception block.' + { + message: 'Expected space after exception block.', + line: 3, + column: 20, + endLine: 3, + endColumn: 20 + }, + { + message: 'Expected space before exception block.', + line: 3, + column: 27, + endLine: 3, + endColumn: 27 + } ] }, { @@ -311,8 +341,20 @@ tester.run('html-comment-content-spacing', rule, { `, options: ['always', { exceptions: ['#+#-'] }], errors: [ - 'Expected space after exception block.', - "Expected space before '-->'." + { + message: 'Expected space after exception block.', + line: 3, + column: 27, + endLine: 3, + endColumn: 27 + }, + { + message: "Expected space before '-->'.", + line: 3, + column: 38, + endLine: 3, + endColumn: 38 + } ] }, { @@ -324,11 +366,19 @@ tester.run('html-comment-content-spacing', rule, { output: null, options: ['always', { exceptions: ['*', '++'] }], errors: [ - 'Expected space after exception block.', + { + message: 'Expected space after exception block.', + line: 3, + column: 20, + endLine: 3, + endColumn: 20 + }, { message: 'Expected space before exception block.', line: 3, - column: 27 + column: 27, + endLine: 3, + endColumn: 27 } ] }, @@ -341,11 +391,19 @@ tester.run('html-comment-content-spacing', rule, { output: null, options: ['always', { exceptions: ['*', '++'] }], errors: [ - 'Expected space after exception block.', + { + message: 'Expected space after exception block.', + line: 3, + column: 20, + endLine: 3, + endColumn: 20 + }, { message: 'Expected space before exception block.', line: 3, - column: 28 + column: 28, + endLine: 3, + endColumn: 28 } ] } From e9015383b6503cdd428794e38adbfaa48401982b Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 30 Jul 2025 04:35:05 +0200 Subject: [PATCH 073/134] test(html-comment-indent): make tests more strict (#2836) --- tests/lib/rules/html-comment-indent.js | 80 ++++++++++++++++++++------ 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/tests/lib/rules/html-comment-indent.js b/tests/lib/rules/html-comment-indent.js index 27c93af8e..f90f2cf4c 100644 --- a/tests/lib/rules/html-comment-indent.js +++ b/tests/lib/rules/html-comment-indent.js @@ -504,22 +504,34 @@ tester.run('html-comment-indent', rule, { { message: 'Expected relative indentation of 2 spaces but found 0 spaces.', - line: 5 + line: 5, + column: 11, + endLine: 5, + endColumn: 11 }, { message: 'Expected relative indentation of 2 spaces but found 4 spaces.', - line: 7 + line: 7, + column: 11, + endLine: 7, + endColumn: 15 }, { message: 'Expected relative indentation of 0 spaces but found 2 spaces.', - line: 12 + line: 12, + column: 11, + endLine: 12, + endColumn: 13 }, { message: 'Expected base point indentation of 10 spaces, but found 8 spaces.', - line: 14 + line: 14, + column: 1, + endLine: 14, + endColumn: 9 } ] }, @@ -544,12 +556,18 @@ tester.run('html-comment-indent', rule, { { message: 'Expected relative indentation of 2 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 11, + endLine: 4, + endColumn: 11 }, { message: 'Expected relative indentation of 2 spaces but found 4 spaces.', - line: 6 + line: 6, + column: 11, + endLine: 6, + endColumn: 15 } ] }, @@ -575,15 +593,24 @@ comment --> errors: [ { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 1 }, { message: 'Expected indentation of 0 spaces but found 2 spaces.', - line: 7 + line: 7, + column: 1, + endLine: 7, + endColumn: 3 } ] }, @@ -610,17 +637,26 @@ comment --> { message: 'Expected base point indentation of 2 spaces, but not found.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 }, { message: 'Expected base point indentation of 2 spaces, but not found.', - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 1 }, { message: 'Expected base point indentation of 2 spaces, but not found.', - line: 7 + line: 7, + column: 1, + endLine: 7, + endColumn: 1 } ] }, @@ -643,12 +679,18 @@ comment --> { message: 'Expected relative indentation of 2 spaces but found 1 space.', - line: 4 + line: 4, + column: 11, + endLine: 4, + endColumn: 12 }, { message: 'Expected relative indentation of 0 spaces but found 1 space.', - line: 5 + line: 5, + column: 11, + endLine: 5, + endColumn: 12 } ] }, @@ -670,11 +712,17 @@ comment --> errors: [ { message: String.raw`Expected base point indentation of " \t \t \t ", but found 7 spaces.`, - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 13 }, { message: String.raw`Expected base point indentation of " \t \t \t ", but found 7 spaces.`, - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 11 } ] } From b4ad756778eabcdf1dd873cab664c9961013587d Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 30 Jul 2025 04:35:28 +0200 Subject: [PATCH 074/134] test(html-end-tags): make tests more strict (#2837) --- tests/lib/rules/html-end-tags.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/lib/rules/html-end-tags.js b/tests/lib/rules/html-end-tags.js index ce5979632..42e13dc99 100644 --- a/tests/lib/rules/html-end-tags.js +++ b/tests/lib/rules/html-end-tags.js @@ -80,13 +80,29 @@ tester.run('html-end-tags', rule, { filename: 'test.vue', code: '', output: '', - errors: ["'
' should have end tag."] + errors: [ + { + message: "'
' should have end tag.", + line: 1, + column: 11, + endLine: 1, + endColumn: 16 + } + ] }, { filename: 'test.vue', code: '', output: '', - errors: ["'

' should have end tag."] + errors: [ + { + message: "'

' should have end tag.", + line: 1, + column: 16, + endLine: 1, + endColumn: 19 + } + ] } ] }) From c64ebb217e7cc15fe8d80da3541505ed13f7f745 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 30 Jul 2025 04:35:54 +0200 Subject: [PATCH 075/134] test(html-indent): make tests more strict (#2838) --- tests/lib/rules/html-indent.js | 220 ++++++++++++++++++++++++++------- 1 file changed, 176 insertions(+), 44 deletions(-) diff --git a/tests/lib/rules/html-indent.js b/tests/lib/rules/html-indent.js index 3a4c610cd..78c233f51 100644 --- a/tests/lib/rules/html-indent.js +++ b/tests/lib/rules/html-indent.js @@ -63,7 +63,10 @@ function loadPatterns(additionalValid, additionalInvalid) { message: `Expected indentation of ${line.indentSize} ${kind}${ line.indentSize === 1 ? '' : 's' } but found 0 ${kind}s.`, - line: line.number + 1 + line: line.number + 1, + column: 1, + endLine: line.number + 1, + endColumn: 1 } ) .filter(Boolean) @@ -447,7 +450,10 @@ tester.run( errors: [ { message: 'Expected indentation of 12 spaces but found 10 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 11 } ] }, @@ -472,7 +478,10 @@ tester.run( errors: [ { message: String.raw`Expected " " character, but found "\t" character.`, - line: 3 + line: 3, + column: 3, + endLine: 3, + endColumn: 4 } ] }, @@ -496,7 +505,10 @@ tester.run( errors: [ { message: String.raw`Expected "\t" character, but found " " character.`, - line: 3 + line: 3, + column: 2, + endLine: 3, + endColumn: 3 } ] }, @@ -527,27 +539,45 @@ tester.run( errors: [ { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 2 + line: 2, + column: 1, + endLine: 2, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 6 + line: 6, + column: 1, + endLine: 6, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 7 + line: 7, + column: 1, + endLine: 7, + endColumn: 1 } ] }, @@ -576,11 +606,17 @@ tester.run( errors: [ { message: 'Expected indentation of 4 spaces but found 2 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 3 }, { message: 'Expected indentation of 4 spaces but found 2 spaces.', - line: 6 + line: 6, + column: 1, + endLine: 6, + endColumn: 3 } ] }, @@ -609,23 +645,38 @@ tester.run( errors: [ { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 2 + line: 2, + column: 1, + endLine: 2, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 6 + line: 6, + column: 1, + endLine: 6, + endColumn: 1 } ] }, @@ -654,19 +705,31 @@ tester.run( errors: [ { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 2 + line: 2, + column: 1, + endLine: 2, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 7 + line: 7, + column: 1, + endLine: 7, + endColumn: 1 } ] }, @@ -699,7 +762,10 @@ tester.run( errors: [ { message: 'Expected indentation of 4 spaces but found 8 spaces.', - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 9 } ] }, @@ -735,15 +801,24 @@ tester.run( errors: [ { message: 'Expected indentation of 8 spaces but found 6 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 7 }, { message: 'Expected indentation of 12 spaces but found 8 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 9 }, { message: 'Expected indentation of 12 spaces but found 8 spaces.', - line: 6 + line: 6, + column: 1, + endLine: 6, + endColumn: 9 } ] }, @@ -776,15 +851,24 @@ tester.run( errors: [ { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 2 + line: 2, + column: 1, + endLine: 2, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 } ] }, @@ -823,31 +907,52 @@ tester.run( errors: [ { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 2 + line: 2, + column: 1, + endLine: 2, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 1 }, { message: 'Expected indentation of 6 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 }, { message: 'Expected indentation of 6 spaces but found 0 spaces.', - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 1 }, { message: 'Expected indentation of 6 spaces but found 0 spaces.', - line: 6 + line: 6, + column: 1, + endLine: 6, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 7 + line: 7, + column: 1, + endLine: 7, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 8 + line: 8, + column: 1, + endLine: 8, + endColumn: 1 } ] }, @@ -886,31 +991,52 @@ tester.run( errors: [ { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 2 + line: 2, + column: 1, + endLine: 2, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 3 + line: 3, + column: 1, + endLine: 3, + endColumn: 1 }, { message: 'Expected indentation of 6 spaces but found 0 spaces.', - line: 4 + line: 4, + column: 1, + endLine: 4, + endColumn: 1 }, { message: 'Expected indentation of 6 spaces but found 0 spaces.', - line: 5 + line: 5, + column: 1, + endLine: 5, + endColumn: 1 }, { message: 'Expected indentation of 6 spaces but found 0 spaces.', - line: 6 + line: 6, + column: 1, + endLine: 6, + endColumn: 1 }, { message: 'Expected indentation of 4 spaces but found 0 spaces.', - line: 7 + line: 7, + column: 1, + endLine: 7, + endColumn: 1 }, { message: 'Expected indentation of 2 spaces but found 0 spaces.', - line: 8 + line: 8, + column: 1, + endLine: 8, + endColumn: 1 } ] }, @@ -932,7 +1058,10 @@ tester.run( errors: [ { message: String.raw`Expected "\t" character, but found " " character.`, - line: 2 + line: 2, + column: 2, + endLine: 2, + endColumn: 3 } ] }, @@ -951,7 +1080,10 @@ tester.run( errors: [ { message: 'Expected indentation of 2 spaces but found 4 spaces.', - line: 2 + line: 2, + column: 1, + endLine: 2, + endColumn: 5 } ] } From d2b201a20973c91f0076f443987664045275f744 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 30 Jul 2025 04:39:59 +0200 Subject: [PATCH 076/134] test(max-len): make tests more strict (#2847) --- tests/lib/rules/max-len.js | 313 +++++++++++++++++++++++++------------ 1 file changed, 217 insertions(+), 96 deletions(-) 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 } ] } From 02890f3d2341c42e41df78ff789c5d85fbf4d270 Mon Sep 17 00:00:00 2001 From: Wayne Zhang Date: Thu, 31 Jul 2025 11:10:40 +0800 Subject: [PATCH 077/134] Add `vue/no-negated-v-if-condition` rule (#2794) Co-authored-by: Flo Edelmann --- .changeset/early-worlds-reply.md | 5 + docs/rules/index.md | 2 + docs/rules/no-negated-condition.md | 1 + docs/rules/no-negated-v-if-condition.md | 64 ++++ lib/index.js | 1 + lib/rules/no-negated-v-if-condition.js | 204 ++++++++++++ tests/lib/rules/no-negated-v-if-condition.js | 327 +++++++++++++++++++ 7 files changed, 604 insertions(+) create mode 100644 .changeset/early-worlds-reply.md create mode 100644 docs/rules/no-negated-v-if-condition.md create mode 100644 lib/rules/no-negated-v-if-condition.js create mode 100644 tests/lib/rules/no-negated-v-if-condition.js diff --git a/.changeset/early-worlds-reply.md b/.changeset/early-worlds-reply.md new file mode 100644 index 000000000..8a269de33 --- /dev/null +++ b/.changeset/early-worlds-reply.md @@ -0,0 +1,5 @@ +--- +'eslint-plugin-vue': minor +--- + +Added new [`vue/no-negated-v-if-condition`](https://eslint.vuejs.org/rules/no-negated-v-if-condition.html) rule diff --git a/docs/rules/index.md b/docs/rules/index.md index 34462fba0..26542db38 100644 --- a/docs/rules/index.md +++ b/docs/rules/index.md @@ -237,6 +237,7 @@ For example: | [vue/no-empty-component-block] | disallow the ``, 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 + } + ] } ] }) From cb2ae5b9c09f366d54240ad1e6a710b0aaee720a Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:36:49 +0200 Subject: [PATCH 098/134] test(no-deprecated-slot-attribute): make tests more strict (#2880) --- tests/lib/rules/no-deprecated-slot-attribute.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/lib/rules/no-deprecated-slot-attribute.js b/tests/lib/rules/no-deprecated-slot-attribute.js index 01b8f31df..61f8f25d7 100644 --- a/tests/lib/rules/no-deprecated-slot-attribute.js +++ b/tests/lib/rules/no-deprecated-slot-attribute.js @@ -686,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 + } ] }, { From 1f59ac97f5769653510a5748875a42bb4c19a106 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:37:07 +0200 Subject: [PATCH 099/134] test(no-deprecated-scope-attribute): make tests more strict (#2879) --- tests/lib/rules/no-deprecated-scope-attribute.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/lib/rules/no-deprecated-scope-attribute.js b/tests/lib/rules/no-deprecated-scope-attribute.js index f823a6878..845447cf6 100644 --- a/tests/lib/rules/no-deprecated-scope-attribute.js +++ b/tests/lib/rules/no-deprecated-scope-attribute.js @@ -66,7 +66,10 @@ tester.run('no-deprecated-scope-attribute', rule, { errors: [ { message: '`scope` attributes are deprecated.', - line: 4 + line: 4, + column: 21, + endLine: 4, + endColumn: 26 } ] }, @@ -90,7 +93,10 @@ tester.run('no-deprecated-scope-attribute', rule, { errors: [ { message: '`scope` attributes are deprecated.', - line: 4 + line: 4, + column: 33, + endLine: 4, + endColumn: 38 } ] } From d3498816a35260adc566b103091dbc90e64400d0 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:40:18 +0200 Subject: [PATCH 100/134] test(no-deprecated-inline-template): make tests more strict (#2877) --- .../rules/no-deprecated-inline-template.js | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/lib/rules/no-deprecated-inline-template.js b/tests/lib/rules/no-deprecated-inline-template.js index fad9c77a7..4c278d5a1 100644 --- a/tests/lib/rules/no-deprecated-inline-template.js +++ b/tests/lib/rules/no-deprecated-inline-template.js @@ -48,12 +48,28 @@ ruleTester.run('no-deprecated-inline-template', rule, { { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 25, + endLine: 1, + endColumn: 40 + } + ] }, { filename: 'test.vue', code: '', - errors: [{ messageId: 'unexpected' }] + errors: [ + { + messageId: 'unexpected', + line: 1, + column: 25, + endLine: 1, + endColumn: 40 + } + ] } ] }) From fe5692dcb5ba2b7fede1d5319586ed6edc93c6fb Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:40:42 +0200 Subject: [PATCH 101/134] test(no-deprecated-props-default-this): make tests more strict (#2878) --- .../rules/no-deprecated-props-default-this.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/lib/rules/no-deprecated-props-default-this.js b/tests/lib/rules/no-deprecated-props-default-this.js index b887868d5..ed0b2005d 100644 --- a/tests/lib/rules/no-deprecated-props-default-this.js +++ b/tests/lib/rules/no-deprecated-props-default-this.js @@ -199,8 +199,22 @@ ruleTester.run('no-deprecated-props-default-this', rule, { `, errors: [ - 'Props default value factory functions no longer have access to `this`.', - 'Props default value factory functions no longer have access to `this`.' + { + message: + 'Props default value factory functions no longer have access to `this`.', + line: 9, + column: 24, + endLine: 9, + endColumn: 28 + }, + { + message: + 'Props default value factory functions no longer have access to `this`.', + line: 14, + column: 24, + endLine: 14, + endColumn: 28 + } ] } ] From aca04e5c07c7631b80b6165cb01d834e4fb16975 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:41:00 +0200 Subject: [PATCH 102/134] test(no-deprecated-dollar-scopedslots-api): make tests more strict (#2872) Co-authored-by: Flo Edelmann --- .../no-deprecated-dollar-scopedslots-api.js | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/tests/lib/rules/no-deprecated-dollar-scopedslots-api.js b/tests/lib/rules/no-deprecated-dollar-scopedslots-api.js index 7dea6146e..c235698f8 100644 --- a/tests/lib/rules/no-deprecated-dollar-scopedslots-api.js +++ b/tests/lib/rules/no-deprecated-dollar-scopedslots-api.js @@ -142,16 +142,16 @@ ruleTester.run('no-deprecated-dollar-scopedslots-api', rule, { `, errors: [ { + messageId: 'deprecated', line: 3, column: 22, - messageId: 'deprecated', endLine: 3, endColumn: 34 }, { + messageId: 'deprecated', line: 8, column: 25, - messageId: 'deprecated', endLine: 8, endColumn: 37 } @@ -191,23 +191,23 @@ ruleTester.run('no-deprecated-dollar-scopedslots-api', rule, { `, errors: [ { + messageId: 'deprecated', line: 3, column: 31, - messageId: 'deprecated', endLine: 3, endColumn: 43 }, { + messageId: 'deprecated', line: 4, column: 22, - messageId: 'deprecated', endLine: 4, endColumn: 34 }, { + messageId: 'deprecated', line: 10, column: 23, - messageId: 'deprecated', endLine: 10, endColumn: 35 } @@ -237,9 +237,11 @@ ruleTester.run('no-deprecated-dollar-scopedslots-api', rule, { `, errors: [ { + messageId: 'deprecated', line: 6, column: 23, - messageId: 'deprecated' + endLine: 6, + endColumn: 35 } ] }, @@ -273,9 +275,11 @@ ruleTester.run('no-deprecated-dollar-scopedslots-api', rule, { `, errors: [ { + messageId: 'deprecated', line: 7, column: 25, - messageId: 'deprecated' + endLine: 7, + endColumn: 37 } ] }, @@ -307,10 +311,18 @@ ruleTester.run('no-deprecated-dollar-scopedslots-api', rule, { `, errors: [ { - messageId: 'deprecated' + messageId: 'deprecated', + line: 6, + column: 27, + endLine: 6, + endColumn: 39 }, { - messageId: 'deprecated' + messageId: 'deprecated', + line: 7, + column: 29, + endLine: 7, + endColumn: 41 } ] } From e0683fd012a9170b359b00ccefd8d85bc615bcea Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:42:51 +0200 Subject: [PATCH 103/134] test(no-deprecated-html-element-is): make tests more strict (#2876) Co-authored-by: Flo Edelmann --- tests/lib/rules/no-deprecated-html-element-is.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/lib/rules/no-deprecated-html-element-is.js b/tests/lib/rules/no-deprecated-html-element-is.js index be8ea3e71..a108f224f 100644 --- a/tests/lib/rules/no-deprecated-html-element-is.js +++ b/tests/lib/rules/no-deprecated-html-element-is.js @@ -43,9 +43,9 @@ ruleTester.run('no-deprecated-html-element-is', rule, { code: '', errors: [ { + messageId: 'unexpected', line: 1, column: 16, - messageId: 'unexpected', endLine: 1, endColumn: 24 } @@ -56,9 +56,11 @@ ruleTester.run('no-deprecated-html-element-is', rule, { code: '', errors: [ { + messageId: 'unexpected', line: 1, column: 16, - messageId: 'unexpected' + endLine: 1, + endColumn: 25 } ] } From 0701213ee766599f4d42c5ef523a209ca116b91f Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:43:12 +0200 Subject: [PATCH 104/134] test(no-deprecated-functional-template): make tests more strict (#2875) Co-authored-by: Flo Edelmann --- tests/lib/rules/no-deprecated-functional-template.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/lib/rules/no-deprecated-functional-template.js b/tests/lib/rules/no-deprecated-functional-template.js index 00cf539ff..fae03fdb7 100644 --- a/tests/lib/rules/no-deprecated-functional-template.js +++ b/tests/lib/rules/no-deprecated-functional-template.js @@ -33,9 +33,9 @@ ruleTester.run('no-deprecated-functional-template', rule, { code: '', errors: [ { + messageId: 'unexpected', line: 1, column: 11, - messageId: 'unexpected', endLine: 1, endColumn: 21 } @@ -46,9 +46,11 @@ ruleTester.run('no-deprecated-functional-template', rule, { code: '', errors: [ { + messageId: 'unexpected', line: 1, column: 11, - messageId: 'unexpected' + endLine: 1, + endColumn: 21 } ] } From 87c7d8315c78868a31368afdc912f52e4a40c1d1 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Thu, 31 Jul 2025 09:49:02 +0200 Subject: [PATCH 105/134] test(func-call-spacing): remove obsolete compatibility code (#2830) --- tests/lib/rules/func-call-spacing.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/lib/rules/func-call-spacing.js b/tests/lib/rules/func-call-spacing.js index 6c219e372..7f06f72fc 100644 --- a/tests/lib/rules/func-call-spacing.js +++ b/tests/lib/rules/func-call-spacing.js @@ -3,8 +3,7 @@ */ 'use strict' -const { RuleTester, ESLint } = require('../../eslint-compat') -const semver = require('semver') +const { RuleTester } = require('../../eslint-compat') const rule = require('../../../lib/rules/func-call-spacing') const tester = new RuleTester({ @@ -61,9 +60,7 @@ tester.run('func-call-spacing', rule, { `, errors: [ { - message: semver.lt(ESLint.version, '7.0.0') - ? 'Unexpected newline between function name and paren.' - : 'Unexpected whitespace between function name and paren.', + message: 'Unexpected whitespace between function name and paren.', line: 3 } ] @@ -104,9 +101,7 @@ tester.run('func-call-spacing', rule, { `, errors: [ { - message: semver.lt(ESLint.version, '7.0.0') - ? 'Unexpected newline between function name and paren.' - : 'Unexpected whitespace between function name and paren.', + message: 'Unexpected whitespace between function name and paren.', line: 4 } ] From 15185f5924978b8db0b8bae8ecaa963874deb0ca Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 31 Jul 2025 15:55:14 +0800 Subject: [PATCH 106/134] Version Packages (#2792) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/beige-teams-camp.md | 5 ----- .changeset/early-worlds-reply.md | 5 ----- .changeset/eight-camels-refuse.md | 5 ----- .changeset/strong-masks-fetch.md | 5 ----- .changeset/true-pumas-open.md | 5 ----- CHANGELOG.md | 16 ++++++++++++++++ docs/rules/no-negated-condition.md | 7 +++++-- docs/rules/no-negated-v-if-condition.md | 6 +++++- package.json | 2 +- 9 files changed, 27 insertions(+), 29 deletions(-) delete mode 100644 .changeset/beige-teams-camp.md delete mode 100644 .changeset/early-worlds-reply.md delete mode 100644 .changeset/eight-camels-refuse.md delete mode 100644 .changeset/strong-masks-fetch.md delete mode 100644 .changeset/true-pumas-open.md diff --git a/.changeset/beige-teams-camp.md b/.changeset/beige-teams-camp.md deleted file mode 100644 index 49c2a317b..000000000 --- a/.changeset/beige-teams-camp.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'eslint-plugin-vue': minor ---- - -Added `ignoreParents` option to [`vue/no-deprecated-slot-attribute`](https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html) diff --git a/.changeset/early-worlds-reply.md b/.changeset/early-worlds-reply.md deleted file mode 100644 index 8a269de33..000000000 --- a/.changeset/early-worlds-reply.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'eslint-plugin-vue': minor ---- - -Added new [`vue/no-negated-v-if-condition`](https://eslint.vuejs.org/rules/no-negated-v-if-condition.html) rule diff --git a/.changeset/eight-camels-refuse.md b/.changeset/eight-camels-refuse.md deleted file mode 100644 index 527b123e4..000000000 --- a/.changeset/eight-camels-refuse.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"eslint-plugin-vue": patch ---- - -Resolved TypeScript compatibility issues introduced by eslint-typegen diff --git a/.changeset/strong-masks-fetch.md b/.changeset/strong-masks-fetch.md deleted file mode 100644 index b7b3b22a0..000000000 --- a/.changeset/strong-masks-fetch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'eslint-plugin-vue': patch ---- - -Fixed inconsistent quotes in [`vue/block-lang`](https://eslint.vuejs.org/rules/block-lang.html) error messages diff --git a/.changeset/true-pumas-open.md b/.changeset/true-pumas-open.md deleted file mode 100644 index 7a49b0f25..000000000 --- a/.changeset/true-pumas-open.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'eslint-plugin-vue': minor ---- - -Added new [`vue/no-negated-condition`](https://eslint.vuejs.org/rules/no-negated-condition.html) rule diff --git a/CHANGELOG.md b/CHANGELOG.md index d48439d99..fa7a29427 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # eslint-plugin-vue +## 10.4.0 + +### Minor Changes + +- Added `ignoreParents` option to [`vue/no-deprecated-slot-attribute`](https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html) ([#2784](https://github.com/vuejs/eslint-plugin-vue/pull/2784)) + +- Added new [`vue/no-negated-v-if-condition`](https://eslint.vuejs.org/rules/no-negated-v-if-condition.html) rule ([#2794](https://github.com/vuejs/eslint-plugin-vue/pull/2794)) + +- Added new [`vue/no-negated-condition`](https://eslint.vuejs.org/rules/no-negated-condition.html) rule ([#2795](https://github.com/vuejs/eslint-plugin-vue/pull/2795)) + +### Patch Changes + +- Resolved TypeScript compatibility issues introduced by eslint-typegen ([#2790](https://github.com/vuejs/eslint-plugin-vue/pull/2790)) + +- Fixed inconsistent quotes in [`vue/block-lang`](https://eslint.vuejs.org/rules/block-lang.html) error messages ([#2805](https://github.com/vuejs/eslint-plugin-vue/pull/2805)) + ## 10.3.0 ### Minor Changes diff --git a/docs/rules/no-negated-condition.md b/docs/rules/no-negated-condition.md index fa183bee7..17ffdba5d 100644 --- a/docs/rules/no-negated-condition.md +++ b/docs/rules/no-negated-condition.md @@ -3,14 +3,13 @@ pageClass: rule-details sidebarDepth: 0 title: vue/no-negated-condition description: Disallow negated conditions in ``, options: ['first', { exceptions: { ArrowFunctionExpression: false } }] }, - ` - - `, { code: `