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/.changeset/great-ravens-happen.md b/.changeset/great-ravens-happen.md
new file mode 100644
index 000000000..eea070fd5
--- /dev/null
+++ b/.changeset/great-ravens-happen.md
@@ -0,0 +1,5 @@
+---
+"eslint-plugin-vue": minor
+---
+
+Added [`@stylistic/eslint-plugin`](https://eslint.style/) as optional peer dependency
diff --git a/.changeset/purple-lights-invite.md b/.changeset/purple-lights-invite.md
new file mode 100644
index 000000000..80aa90b8d
--- /dev/null
+++ b/.changeset/purple-lights-invite.md
@@ -0,0 +1,5 @@
+---
+'eslint-plugin-vue': minor
+---
+
+Added `ignorePattern` option to [`vue/no-v-html`](https://eslint.vuejs.org/rules/no-v-html.html)
diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index cd2a71931..000000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,133 +0,0 @@
-workflows:
- version: 2
- node-multi-build:
- jobs:
- - eslint-v6
- - eslint-v7
- - ts-eslint-v4
- - node-v14
- - node-v16
- - lint
-
-version: 2
-jobs:
- node-base: &node-base
- docker:
- - image: node
- steps:
- - run:
- name: Versions
- command: npm version
- - checkout
- # - restore_cache:
- # keys:
- # - v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }}
- - run:
- name: Install dependencies
- command: npm install --legacy-peer-deps
- - run:
- name: Test
- command: npm test
- # - save_cache:
- # key: v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }}
- # paths:
- # - node_modules
-
- eslint-v6:
- docker:
- - image: node:14
- steps:
- - run:
- name: Versions
- command: npm version
- - checkout
- - run:
- name: Install eslint@6
- command: |
- npm install --save-exact eslint@6.8.0 @typescript-eslint/parser@5
- - run:
- name: Install dependencies
- command: npm install
- - run:
- name: Test
- command: npm test
- eslint-v7:
- docker:
- - image: node:14
- steps:
- - run:
- name: Versions
- command: npm version
- - checkout
- - run:
- name: Install eslint@7
- command: |
- npm install eslint@7 @typescript-eslint/parser@5
- - run:
- name: Install dependencies
- command: npm install
- - run:
- name: Test
- command: npm test
- ts-eslint-v4:
- docker:
- - image: node:14
- steps:
- - run:
- name: Versions
- command: npm version
- - checkout
- - run:
- name: Install @typescript-eslint/parser@4 eslint@7 typescript@4.7
- command: |
- npm install @typescript-eslint/parser@4 eslint@7 typescript@4.7 --save-exact
- - run:
- name: Install dependencies
- command: npm install
- - run:
- name: Test
- command: npm test
- node-v14:
- docker:
- - image: node:14
- steps:
- - run:
- name: Versions
- command: npm version
- - checkout
- - run:
- name: Install @typescript-eslint/parser@5
- command: |
- npm install @typescript-eslint/parser@5 --save-exact
- - run:
- name: Install dependencies
- command: npm install
- - run:
- name: Test
- command: npm test
- node-v16:
- <<: *node-base
- docker:
- - image: node:16
-
- lint:
- docker:
- - image: node:16
- steps:
- - run:
- name: Versions
- command: npm version
- - checkout
- - restore_cache:
- keys:
- - v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }}
- - run:
- name: Install dependencies
- command: npm install
- - save_cache:
- key: v2-npm-lock-{{ .Branch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }}
- paths:
- - node_modules
- - run:
- name: Lint
- command: npm run lint
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 1e7f59ac7..c4d031e9c 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,3 +1,3 @@
github:
-- ota-meshi
-- FloEdelmann
+ - ota-meshi
+ - FloEdelmann
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index f1169f466..08d755127 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -26,6 +26,7 @@ about: Create a report to help us improve
- **ESLint version:**
- **eslint-plugin-vue version:**
+- **Vue version:**
- **Node version:**
- **Operating System:**
diff --git a/.github/ISSUE_TEMPLATE/change.md b/.github/ISSUE_TEMPLATE/change.md
index a6a4a7dc0..02397f6cd 100644
--- a/.github/ISSUE_TEMPLATE/change.md
+++ b/.github/ISSUE_TEMPLATE/change.md
@@ -13,6 +13,7 @@ about: Request a change that is not a bug fix, rule change, or new rule
- **ESLint version:**
- **eslint-plugin-vue version:**
+- **Vue version:**
- **Node version:**
**The problem you want to solve.**
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index afb8b9ad4..fede1a47a 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -1,9 +1,13 @@
name: CI
on:
push:
- branches: [master]
+ branches:
+ - 'master'
pull_request:
- branches: [master]
+ types:
+ - 'opened'
+ - 'synchronize'
+ - 'reopened'
permissions:
contents: read
@@ -13,48 +17,94 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Install Node.js
- uses: actions/setup-node@v3
- - name: Install Packages
- run: npm install --legacy-peer-deps
- - name: Lint
- run: npm run lint
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install Node.js
+ uses: actions/setup-node@v4
+ - name: Install Packages
+ run: npm install --legacy-peer-deps
+ - name: Lint
+ run: npm run lint
test:
name: Test
strategy:
matrix:
- node: [17, 18, 20]
- os: [ubuntu-latest]
+ node: [18, 20, 21, 'lts/*']
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install Node.js v${{ matrix.node }}
+ uses: actions/setup-node@v4
+ with:
+ node-version: ${{ matrix.node }}
+ - name: Install Packages
+ run: npm install
+ - name: Test
+ run: npm test
- runs-on: ${{ matrix.os }}
+ test-with-eslint-v8:
+ name: Test with ESLint v8
+ runs-on: ubuntu-latest
steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Install Node.js v${{ matrix.node }}
- uses: actions/setup-node@v3
- with:
- node-version: ${{ matrix.node }}
- - name: Install Packages
- run: npm install --legacy-peer-deps
- - name: Test
- run: npm test
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install Node.js v18
+ uses: actions/setup-node@v4
+ with:
+ node-version: 18
+ - name: Install Packages
+ run: npm install
+ - name: Install ESLint v8
+ run: npm install --save-dev eslint@8 --force
+ - name: Test
+ run: npm test
- test-for-ts-eslint-v5:
- name: Test
+ test-without-eslint-stylistic:
+ name: Test without ESLint Stylistic
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install Node.js
+ uses: actions/setup-node@v4
+ - name: Install Packages
+ run: npm install
+ - name: Uninstall @stylistic/eslint-plugin
+ run: npm uninstall @stylistic/eslint-plugin
+ - name: Test
+ run: npm test
+
+ test-with-old-eslint-stylistic:
+ name: Test with old ESLint Stylistic
+ strategy:
+ matrix:
+ stylistic: [2, 3, 4]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install Node.js
+ uses: actions/setup-node@v4
+ - name: Install Packages
+ run: npm install
+ - name: Install @stylistic/eslint-plugin v${{ matrix.stylistic }}
+ run: npm install -D @stylistic/eslint-plugin@${{ matrix.stylistic }} --force
+ - name: Test
+ run: npm test
+
+ test-with-typescript-eslint-v7:
+ name: Test with typescript-eslint v7
runs-on: ubuntu-latest
steps:
- - name: Checkout
- uses: actions/checkout@v3
- - name: Install Node.js v${{ matrix.node }}
- uses: actions/setup-node@v3
- with:
- node-version: 18
- - name: Install Packages
- run: npm install --legacy-peer-deps
- - name: Install typescript-eslint v5
- run: npm install -D @typescript-eslint/parser
- - name: Test
- run: npm test
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install Node.js
+ uses: actions/setup-node@v4
+ - name: Install Packages
+ run: npm install
+ - name: Install @typescript-eslint/parser v7
+ run: npm install -D @typescript-eslint/parser@7 --force
+ - name: Test
+ run: npm test
diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml
new file mode 100644
index 000000000..3653780d5
--- /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
+
+ - 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/.github/workflows/check-for-resources-update.yml b/.github/workflows/check-for-resources-update.yml
new file mode 100644
index 000000000..31f881b1d
--- /dev/null
+++ b/.github/workflows/check-for-resources-update.yml
@@ -0,0 +1,31 @@
+name: Check for utils resources update
+on:
+ workflow_dispatch: null
+ schedule:
+ - cron: 0 0 * * 0 # At 00:00 on Sunday, see https://crontab.guru/#0_0_*_*_0
+
+permissions:
+ contents: write
+ pull-requests: write
+
+jobs:
+ check-for-resources-update:
+ runs-on: ubuntu-latest
+ if: ${{ github.repository == 'vuejs/eslint-plugin-vue' }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Install Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 18
+ - name: Install Packages
+ run: npm install
+ - name: Update
+ run: npm run update-resources
+ - uses: peter-evans/create-pull-request@v7
+ with:
+ commit-message: Updates resources
+ branch: update-resources
+ branch-suffix: timestamp
+ title: Updates resources
diff --git a/.gitignore b/.gitignore
index 797d0cbcd..d6fadf92c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,8 +8,9 @@
yarn.lock
yarn-error.log
/docs/.vitepress/dist
-/docs/.vitepress/build-system/shim/eslint.mjs
-/docs/.vitepress/build-system/shim/assert.mjs
+/docs/.vitepress/build-system/shim/vue-eslint-parser.mjs
+/docs/.vitepress/build-system/shim/@typescript-eslint/parser.mjs
/docs/.vitepress/.temp
/docs/.vitepress/cache
typings/eslint/lib/rules
+eslint-typegen.d.ts
diff --git a/.markdownlint.yml b/.markdownlint.yml
index 42e207971..6591a3543 100644
--- a/.markdownlint.yml
+++ b/.markdownlint.yml
@@ -15,7 +15,7 @@ code-block-style:
code-fence-style:
style: backtick
emphasis-style:
- style: asterisk
+ style: underscore
heading-style:
style: atx
hr-style:
diff --git a/.markdownlintignore b/.markdownlintignore
index 3c3629e64..e7becf85b 100644
--- a/.markdownlintignore
+++ b/.markdownlintignore
@@ -1 +1,2 @@
node_modules
+CHANGELOG.md
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 000000000..d341f1772
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,2 @@
+tests/fixtures/
+.github/ISSUE_TEMPLATE/*.md
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 324a79864..171c80066 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -5,12 +5,17 @@
"type": "node",
"request": "launch",
"name": "Start testing",
- "program": "${workspaceFolder}/node_modules/.bin/mocha",
- "args": [
- "${file}",
- "--watch"
- ],
+ "program": "${workspaceFolder}/node_modules/.bin/vitest",
+ "args": ["run", "${file}", "--reporter=verbose"],
+ "console": "integratedTerminal"
+ },
+ {
+ "type": "node",
+ "request": "launch",
+ "name": "Start testing (watch)",
+ "program": "${workspaceFolder}/node_modules/.bin/vitest",
+ "args": ["${file}", "--reporter=verbose"],
"console": "integratedTerminal"
}
]
-}
+}
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 3c179f5a7..8c7be0b23 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,21 +1,14 @@
{
- "editor.tabSize": 2,
- "eslint.experimental.useFlatConfig": true,
- "eslint.validate": [
- "javascript",
- "javascriptreact",
- "vue",
- "json",
- "jsonc"
- ],
- "typescript.tsdk": "./node_modules/typescript/lib",
- "vetur.validation.script": false,
- "[typescript]": {
- "editor.formatOnSave": true,
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- },
- "[javascript]": {
- "editor.formatOnSave": true,
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- },
+ "editor.tabSize": 2,
+ "eslint.validate": ["javascript", "javascriptreact", "vue", "json", "jsonc", "markdown"],
+ "typescript.tsdk": "./node_modules/typescript/lib",
+ "vetur.validation.script": false,
+ "[typescript]": {
+ "editor.formatOnSave": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[javascript]": {
+ "editor.formatOnSave": true,
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ }
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 000000000..71932ee19
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,45 @@
+# 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](https://github.com/antfu/eslint-typegen) ([#2790](https://github.com/vuejs/eslint-plugin-vue/pull/2790))
+
+- Fixed inconsistent quotes in [`vue/block-lang`](https://eslint.vuejs.org/rules/block-lang.html) error messages ([#2805](https://github.com/vuejs/eslint-plugin-vue/pull/2805))
+
+## 10.3.0
+
+### Minor Changes
+
+- Added [`@typescript-eslint/parser`](https://typescript-eslint.io/packages/parser) as an optional peer dependency ([#2775](https://github.com/vuejs/eslint-plugin-vue/pull/2775))
+
+- Add TypeScript IntelliSense support via [eslint-typegen](https://github.com/antfu/eslint-typegen) ([#2770](https://github.com/vuejs/eslint-plugin-vue/pull/2770))
+
+- [`vue/no-deprecated-slot-attribute`](https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html) `ignore` option now supports regex patterns ([#2773](https://github.com/vuejs/eslint-plugin-vue/pull/2773))
+
+### Patch Changes
+
+- Fixed false negatives when using typescript-eslint v8 in [`vue/script-indent`](https://eslint.vuejs.org/rules/script-indent.html) rule ([#2775](https://github.com/vuejs/eslint-plugin-vue/pull/2775))
+
+- Update resources ([#2752](https://github.com/vuejs/eslint-plugin-vue/pull/2752))
+
+- [`vue/no-restricted-html-elements`](https://eslint.vuejs.org/rules/no-restricted-html-elements.html) now also checks SVG and MathML elements ([#2755](https://github.com/vuejs/eslint-plugin-vue/pull/2755))
+
+## 10.2.0
+
+### 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/README.md b/README.md
index cacd80209..01bc6b687 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
[](https://npmjs.org/package/eslint-plugin-vue)
[](https://npmjs.org/package/eslint-plugin-vue)
-[](https://circleci.com/gh/vuejs/eslint-plugin-vue)
+[](https://github.com/vuejs/eslint-plugin-vue/actions/workflows/CI.yml)
[](https://github.com/vuejs/eslint-plugin-vue/blob/master/LICENSE)
> Official ESLint plugin for Vue.js
@@ -13,7 +13,14 @@ Please refer to the [official website](https://eslint.vuejs.org).
## :anchor: Versioning Policy
-This plugin follows [Semantic Versioning](https://semver.org) and [ESLint's Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy).
+This plugin follows [Semantic Versioning].
+However, please note that we do not follow [ESLint's Semantic Versioning Policy].
+In minor version releases, this plugin may change the sharable configs provided by the plugin or the default behavior of the plugin's rules in order to add features to the plugin. Because we want to add many features to the plugin soon, so that users can easily take advantage of new features in Vue and Nuxt.
+
+According to our policy, any minor update may report more linting errors than the previous release. As such, we recommend using the [tilde (`~`)](https://semver.npmjs.com/#syntax-examples) in `package.json` to guarantee the results of your builds.
+
+[Semantic Versioning]: https://semver.org/
+[ESLint's Semantic Versioning Policy]: https://github.com/eslint/eslint#semantic-versioning-policy
## :newspaper: Releases
@@ -27,13 +34,13 @@ Contributing is welcome! See the [ESLint Vue Plugin Developer Guide](https://esl
Be sure to read the [official ESLint guide](https://eslint.org/docs/developer-guide/working-with-rules) before you start writing a new rule.
-To see what an abstract syntax tree (AST) of your code looks like, you may use [AST Explorer](https://astexplorer.net). After opening [AST Explorer](https://astexplorer.net), select `Vue` as the syntax and `vue-eslint-parser` as the parser.
+To see what an abstract syntax tree (AST) of your code looks like, you may use [AST Explorer](https://astexplorer.net). After opening [AST Explorer](https://astexplorer.net), select `Vue` as the syntax and [`vue-eslint-parser`](https://github.com/vuejs/vue-eslint-parser) as the parser.
The default JavaScript parser must be replaced because [Vue.js single file components](https://vuejs.org/guide/scaling-up/sfc.html) are not plain JavaScript, but a custom file format. [`vue-eslint-parser`](https://github.com/vuejs/vue-eslint-parser) is a replacement parser that generates an enhanced AST with nodes that represent specific parts of the template syntax, as well as the contents of the `
@@ -107,7 +108,7 @@ export default {
-
+
@@ -130,11 +131,11 @@ export default {
```vue
-
+
-
+
@@ -150,7 +151,7 @@ export default {
-
+
diff --git a/docs/rules/component-options-name-casing.md b/docs/rules/component-options-name-casing.md
index d37ee9fce..469865478 100644
--- a/docs/rules/component-options-name-casing.md
+++ b/docs/rules/component-options-name-casing.md
@@ -5,11 +5,12 @@ title: vue/component-options-name-casing
description: enforce the casing of component name in `components` options
since: v8.2.0
---
+
# vue/component-options-name-casing
> enforce the casing of component name in `components` options
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
## :book: Rule Details
diff --git a/docs/rules/component-tags-order.md b/docs/rules/component-tags-order.md
index 22b161aa0..a5037cdee 100644
--- a/docs/rules/component-tags-order.md
+++ b/docs/rules/component-tags-order.md
@@ -5,13 +5,12 @@ title: vue/component-tags-order
description: enforce order of component top-level elements
since: v6.1.0
---
+
# vue/component-tags-order
> enforce order of component top-level elements
-- :no_entry_sign: This rule was **deprecated** and replaced by [vue/block-order](block-order.md) rule.
-- :gear: This rule is included in `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :no_entry: This rule was **removed** in eslint-plugin-vue v10.0.0 and replaced by [vue/block-order](block-order.md) rule.
## :book: Rule Details
diff --git a/docs/rules/custom-event-name-casing.md b/docs/rules/custom-event-name-casing.md
index 29afde056..a57e0eb80 100644
--- a/docs/rules/custom-event-name-casing.md
+++ b/docs/rules/custom-event-name-casing.md
@@ -5,6 +5,7 @@ title: vue/custom-event-name-casing
description: enforce specific casing for custom event name
since: v7.0.0
---
+
# vue/custom-event-name-casing
> enforce specific casing for custom event name
@@ -42,7 +43,7 @@ This rule enforces camelCase by default.
+```
+
+
+
## :couple: Related Rules
- [vue/define-props-declaration](./define-props-declaration.md)
diff --git a/docs/rules/define-macros-order.md b/docs/rules/define-macros-order.md
index 37074f05c..14729f991 100644
--- a/docs/rules/define-macros-order.md
+++ b/docs/rules/define-macros-order.md
@@ -2,30 +2,34 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/define-macros-order
-description: enforce order of `defineEmits` and `defineProps` compiler macros
+description: enforce order of compiler macros (`defineProps`, `defineEmits`, etc.)
since: v8.7.0
---
+
# vue/define-macros-order
-> enforce order of `defineEmits` and `defineProps` compiler macros
+> enforce order of compiler macros (`defineProps`, `defineEmits`, etc.)
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
## :book: Rule Details
-This rule reports the `defineProps` and `defineEmits` compiler macros when they are not the first statements in `
```
-
+
```vue
+```
+
+
+
+### `{ "order": ["definePage", "defineModel", "defineCustom", "defineEmits", "defineSlots"] }`
+
+
+
+```vue
+
+
+```
+
+
+
+
+
+```vue
+
+
+```
+
+
+
+### `{ "defineExposeLast": true }`
+
+
+
+```vue
+
+
+```
+
+
+
+
+
+```vue
+
+
```
diff --git a/docs/rules/define-props-declaration.md b/docs/rules/define-props-declaration.md
index 8b88f1ce5..40c5ea0b0 100644
--- a/docs/rules/define-props-declaration.md
+++ b/docs/rules/define-props-declaration.md
@@ -5,6 +5,7 @@ title: vue/define-props-declaration
description: enforce declaration style of `defineProps`
since: v9.5.0
---
+
# vue/define-props-declaration
> enforce declaration style of `defineProps`
@@ -21,7 +22,7 @@ This rule only works in setup script and `lang="ts"`.
diff --git a/docs/rules/define-props-destructuring.md b/docs/rules/define-props-destructuring.md
new file mode 100644
index 000000000..e3c2b2745
--- /dev/null
+++ b/docs/rules/define-props-destructuring.md
@@ -0,0 +1,98 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/define-props-destructuring
+description: enforce consistent style for props destructuring
+since: v10.1.0
+---
+
+# vue/define-props-destructuring
+
+> enforce consistent style for props destructuring
+
+## :book: Rule Details
+
+This rule enforces a consistent style for handling Vue 3 Composition API props, allowing you to choose between requiring destructuring or prohibiting it.
+
+By default, the rule requires you to use destructuring syntax when using `defineProps` instead of storing props in a variable and warns against combining `withDefaults` with destructuring.
+
+
+
+```vue
+
+```
+
+
+
+The rule applies to both JavaScript and TypeScript props:
+
+
+
+```vue
+
+```
+
+
+
+## :wrench: Options
+
+```js
+{
+ "vue/define-props-destructuring": ["error", {
+ "destructure": "always" | "never"
+ }]
+}
+```
+
+- `destructure` - Sets the destructuring preference for props
+ - `"always"` (default) - Requires destructuring when using `defineProps` and warns against using `withDefaults` with destructuring
+ - `"never"` - Requires using a variable to store props and prohibits destructuring
+
+### `"destructure": "never"`
+
+
+
+```vue
+
+```
+
+
+
+## :books: Further Reading
+
+- [Reactive Props Destructure](https://vuejs.org/guide/components/props.html#reactive-props-destructure)
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v10.1.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/define-props-destructuring.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/define-props-destructuring.js)
diff --git a/docs/rules/dot-location.md b/docs/rules/dot-location.md
index cf4095d77..101b58776 100644
--- a/docs/rules/dot-location.md
+++ b/docs/rules/dot-location.md
@@ -5,18 +5,26 @@ title: vue/dot-location
description: Enforce consistent newlines before and after dots in ``
since: v6.0.0
---
+
# vue/dot-location
> Enforce consistent newlines before and after dots in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+
+This rule is the same rule as [@stylistic/dot-location] rule but it applies to the expressions in ``.
+
+This rule extends the rule that [@stylistic/eslint-plugin] has, but if [@stylistic/eslint-plugin] is not installed, this rule extracts and extends the same rule from ESLint core.
+However, if neither is found, the rule cannot be used.
-This rule is the same rule as core [dot-location] rule but it applies to the expressions in ``.
+[@stylistic/eslint-plugin]: https://eslint.style/packages/default
## :books: Further Reading
+- [@stylistic/dot-location]
- [dot-location]
+[@stylistic/dot-location]: https://eslint.style/rules/dot-location
[dot-location]: https://eslint.org/docs/rules/dot-location
## :rocket: Version
@@ -28,4 +36,4 @@ This rule was introduced in eslint-plugin-vue v6.0.0
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/dot-location.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/dot-location.js)
-Taken with ❤️ [from ESLint core](https://eslint.org/docs/latest/rules/dot-location)
+Taken with ❤️ [from ESLint Stylistic](https://eslint.style/rules/dot-location)
diff --git a/docs/rules/dot-notation.md b/docs/rules/dot-notation.md
index 2fc253bae..101caf5cf 100644
--- a/docs/rules/dot-notation.md
+++ b/docs/rules/dot-notation.md
@@ -5,11 +5,12 @@ title: vue/dot-notation
description: Enforce dot notation whenever possible in ``
since: v7.0.0
---
+
# vue/dot-notation
> Enforce dot notation whenever possible in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
This rule is the same rule as core [dot-notation] rule but it applies to the expressions in ``.
diff --git a/docs/rules/enforce-style-attribute.md b/docs/rules/enforce-style-attribute.md
new file mode 100644
index 000000000..fcffefbae
--- /dev/null
+++ b/docs/rules/enforce-style-attribute.md
@@ -0,0 +1,89 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/enforce-style-attribute
+description: enforce or forbid the use of the `scoped` and `module` attributes in SFC top level style tags
+since: v9.20.0
+---
+
+# vue/enforce-style-attribute
+
+> enforce or forbid the use of the `scoped` and `module` attributes in SFC top level style tags
+
+## :book: Rule Details
+
+This rule allows you to explicitly allow the use of the `scoped` and `module` attributes on your top level style tags.
+
+### `"scoped"`
+
+
+
+```vue
+
+
+
+
+
+
+
+
+
+```
+
+
+
+### `"module"`
+
+
+
+```vue
+
+
+
+
+
+
+
+
+```
+
+
+
+### `"plain"`
+
+
+
+```vue
+
+
+
+
+
+
+
+
+```
+
+
+
+## :wrench: Options
+
+```json
+{
+ "vue/enforce-style-attribute": [
+ "error",
+ { "allow": ["scoped", "module", "plain"] }
+ ]
+}
+```
+
+- `"allow"` (`["scoped" | "module" | "plain"]`) Array of attributes to allow on a top level style tag. The option `plain` is used to allow style tags that have neither the `scoped` nor `module` attributes. Default: `["scoped"]`
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.20.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/enforce-style-attribute.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/enforce-style-attribute.js)
diff --git a/docs/rules/eqeqeq.md b/docs/rules/eqeqeq.md
index eeecfc56a..fb0133251 100644
--- a/docs/rules/eqeqeq.md
+++ b/docs/rules/eqeqeq.md
@@ -5,11 +5,13 @@ title: vue/eqeqeq
description: Require the use of `===` and `!==` in ``
since: v5.2.0
---
+
# vue/eqeqeq
> Require the use of `===` and `!==` in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
This rule is the same rule as core [eqeqeq] rule but it applies to the expressions in ``.
diff --git a/docs/rules/experimental-script-setup-vars.md b/docs/rules/experimental-script-setup-vars.md
index e0455b1d4..82e7de884 100644
--- a/docs/rules/experimental-script-setup-vars.md
+++ b/docs/rules/experimental-script-setup-vars.md
@@ -5,6 +5,7 @@ title: vue/experimental-script-setup-vars
description: prevent variables defined in `
```
@@ -130,11 +131,11 @@ export default {
```vue
```
@@ -145,11 +146,11 @@ export default {
```vue
```
@@ -160,10 +161,10 @@ export default {
```vue
```
diff --git a/docs/rules/match-component-import-name.md b/docs/rules/match-component-import-name.md
index fd88f9ff2..5ba837f41 100644
--- a/docs/rules/match-component-import-name.md
+++ b/docs/rules/match-component-import-name.md
@@ -5,13 +5,14 @@ title: vue/match-component-import-name
description: require the registered component name to match the imported component name
since: v8.7.0
---
+
# vue/match-component-import-name
> require the registered component name to match the imported component name
## :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).
diff --git a/docs/rules/max-attributes-per-line.md b/docs/rules/max-attributes-per-line.md
index 13b13cd05..141b136e0 100644
--- a/docs/rules/max-attributes-per-line.md
+++ b/docs/rules/max-attributes-per-line.md
@@ -5,12 +5,13 @@ title: vue/max-attributes-per-line
description: enforce the maximum number of attributes per line
since: v3.12.0
---
+
# vue/max-attributes-per-line
> enforce the maximum number of attributes per line
-- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
Limits the maximum number of attributes/properties per line to improve readability.
diff --git a/docs/rules/max-len.md b/docs/rules/max-len.md
index deca2e721..0816000ee 100644
--- a/docs/rules/max-len.md
+++ b/docs/rules/max-len.md
@@ -5,6 +5,7 @@ title: vue/max-len
description: enforce a maximum line length in `.vue` files
since: v6.1.0
---
+
# vue/max-len
> enforce a maximum line length in `.vue` files
diff --git a/docs/rules/max-lines-per-block.md b/docs/rules/max-lines-per-block.md
index bebc00570..a65be3bb9 100644
--- a/docs/rules/max-lines-per-block.md
+++ b/docs/rules/max-lines-per-block.md
@@ -5,6 +5,7 @@ title: vue/max-lines-per-block
description: enforce maximum number of lines in Vue SFC blocks
since: v9.15.0
---
+
# vue/max-lines-per-block
> enforce maximum number of lines in Vue SFC blocks
diff --git a/docs/rules/max-props.md b/docs/rules/max-props.md
new file mode 100644
index 000000000..918c67294
--- /dev/null
+++ b/docs/rules/max-props.md
@@ -0,0 +1,65 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/max-props
+description: enforce maximum number of props in Vue component
+since: v9.28.0
+---
+
+# vue/max-props
+
+> enforce maximum number of props in Vue component
+
+## :book: Rule Details
+
+This rule enforces a maximum number of props in a Vue SFC, in order to aid in maintainability and reduce complexity.
+
+## :wrench: Options
+
+This rule takes an object, where you can specify the maximum number of props allowed in a Vue SFC.
+There is one property that can be specified for the object.
+
+- `maxProps` ... Specify the maximum number of props in the `script` block.
+
+### `{ maxProps: 1 }`
+
+
+
+```vue
+
+
+
+
+
+```
+
+
+
+### `{ maxProps: 5 }`
+
+
+
+```vue
+
+
+```
+
+
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.28.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/max-props.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/max-props.js)
diff --git a/docs/rules/max-template-depth.md b/docs/rules/max-template-depth.md
new file mode 100644
index 000000000..42ee4da88
--- /dev/null
+++ b/docs/rules/max-template-depth.md
@@ -0,0 +1,70 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/max-template-depth
+description: enforce maximum depth of template
+since: v9.28.0
+---
+
+# vue/max-template-depth
+
+> enforce maximum depth of template
+
+## :book: Rule Details
+
+This rule enforces a maximum depth of the template in a Vue SFC, in order to aid in maintainability and reduce complexity.
+
+## :wrench: Options
+
+This rule takes an object, where you can specify the maximum depth allowed in a Vue SFC template block.
+There is one property that can be specified for the object.
+
+- `maxDepth` ... Specify the maximum template depth `template` block.
+
+### `{ maxDepth: 3 }`
+
+
+
+```vue
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+
+
+
+
+```vue
+
+
+
+
+
+
+
+
+```
+
+
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.28.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/max-template-depth.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/max-template-depth.js)
diff --git a/docs/rules/multi-word-component-names.md b/docs/rules/multi-word-component-names.md
index c54d199e9..08539dddb 100644
--- a/docs/rules/multi-word-component-names.md
+++ b/docs/rules/multi-word-component-names.md
@@ -5,11 +5,12 @@ title: vue/multi-word-component-names
description: require component names to be always multi-word
since: v7.20.0
---
+
# vue/multi-word-component-names
> require component names to be always multi-word
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -82,7 +83,7 @@ export default {
```
@@ -94,7 +95,7 @@ export default {
```
@@ -106,7 +107,7 @@ export default {
```
diff --git a/docs/rules/multiline-html-element-content-newline.md b/docs/rules/multiline-html-element-content-newline.md
index 9813113ee..5a5af3dc4 100644
--- a/docs/rules/multiline-html-element-content-newline.md
+++ b/docs/rules/multiline-html-element-content-newline.md
@@ -5,12 +5,13 @@ title: vue/multiline-html-element-content-newline
description: require a line break before and after the contents of a multiline element
since: v5.0.0
---
+
# vue/multiline-html-element-content-newline
> require a line break before and after the contents of a multiline element
-- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
@@ -90,7 +91,7 @@ This rule enforces a line break before and after the contents of a multiline ele
default `true`
- `ignores` ... the configuration for element names to ignore line breaks style.
default `["pre", "textarea", ...INLINE_ELEMENTS]`.
-- `allowEmptyLines` ... if `true`, it allows empty lines around content. If you want to disallow multiple empty lines, use [no-multiple-empty-lines] in combination.
+- `allowEmptyLines` ... if `true`, it allows empty lines around content. If you want to disallow multiple empty lines, use [no-multiple-empty-lines] in combination.\
default `false`
::: info
@@ -142,8 +143,9 @@ This rule enforces a line break before and after the contents of a multiline ele
-## :books: Further Reading
+## :couple: Related Rules
+- [vue/singleline-html-element-content-newline](./singleline-html-element-content-newline.md)
- [no-multiple-empty-lines]
[no-multiple-empty-lines]: https://eslint.org/docs/rules/no-multiple-empty-lines
diff --git a/docs/rules/multiline-ternary.md b/docs/rules/multiline-ternary.md
index d9d9d2083..687138e77 100644
--- a/docs/rules/multiline-ternary.md
+++ b/docs/rules/multiline-ternary.md
@@ -5,13 +5,19 @@ title: vue/multiline-ternary
description: Enforce newlines between operands of ternary expressions in ``
since: v9.7.0
---
+
# vue/multiline-ternary
> Enforce newlines between operands of ternary expressions in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+
+This rule is the same rule as [@stylistic/multiline-ternary] rule but it applies to the expressions in `` and `
@@ -43,7 +46,6 @@ See [Vue Single-File Component (SFC) Spec](https://vue-loader.vuejs.org/spec.htm
-
diff --git a/docs/rules/no-empty-pattern.md b/docs/rules/no-empty-pattern.md
index 8f788ad2a..6434a7bff 100644
--- a/docs/rules/no-empty-pattern.md
+++ b/docs/rules/no-empty-pattern.md
@@ -5,6 +5,7 @@ title: vue/no-empty-pattern
description: Disallow empty destructuring patterns in ``
since: v6.0.0
---
+
# vue/no-empty-pattern
> Disallow empty destructuring patterns in ``
diff --git a/docs/rules/no-export-in-script-setup.md b/docs/rules/no-export-in-script-setup.md
index c16899c80..08166596b 100644
--- a/docs/rules/no-export-in-script-setup.md
+++ b/docs/rules/no-export-in-script-setup.md
@@ -5,11 +5,12 @@ title: vue/no-export-in-script-setup
description: disallow `export` in `
+```
+
+
+
+
+
+```vue
+
+```
+
+
+
+## :wrench: Options
+
+Nothing.
+
+## :books: Further Reading
+
+- [defineProps() & defineEmits()]
+
+[defineProps() & defineEmits()]: https://vuejs.org/api/sfc-script-setup.html#defineprops-defineemits
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v10.0.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-import-compiler-macros.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-import-compiler-macros.js)
diff --git a/docs/rules/no-invalid-model-keys.md b/docs/rules/no-invalid-model-keys.md
index 720d23b8d..e93c79db4 100644
--- a/docs/rules/no-invalid-model-keys.md
+++ b/docs/rules/no-invalid-model-keys.md
@@ -5,11 +5,12 @@ title: vue/no-invalid-model-keys
description: require valid keys in model option
since: v7.9.0
---
+
# vue/no-invalid-model-keys
> require valid keys in model option
-- :no_entry_sign: This rule was **deprecated** and replaced by [vue/valid-model-definition](valid-model-definition.md) rule.
+- :no_entry: This rule was **removed** in eslint-plugin-vue v10.0.0 and replaced by [vue/valid-model-definition](valid-model-definition.md) rule.
## :book: Rule Details
diff --git a/docs/rules/no-irregular-whitespace.md b/docs/rules/no-irregular-whitespace.md
index a38de0330..615f2294a 100644
--- a/docs/rules/no-irregular-whitespace.md
+++ b/docs/rules/no-irregular-whitespace.md
@@ -5,6 +5,7 @@ title: vue/no-irregular-whitespace
description: disallow irregular whitespace in `.vue` files
since: v6.1.0
---
+
# vue/no-irregular-whitespace
> disallow irregular whitespace in `.vue` files
diff --git a/docs/rules/no-lifecycle-after-await.md b/docs/rules/no-lifecycle-after-await.md
index 87141aa18..4516e2fd3 100644
--- a/docs/rules/no-lifecycle-after-await.md
+++ b/docs/rules/no-lifecycle-after-await.md
@@ -5,15 +5,16 @@ title: vue/no-lifecycle-after-await
description: disallow asynchronously registered lifecycle hooks
since: v7.0.0
---
+
# vue/no-lifecycle-after-await
> disallow asynchronously registered lifecycle hooks
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/recommended"` and `*.configs["flat/recommended"]`.
## :book: Rule Details
-This rule reports the lifecycle hooks after `await` expression.
+This rule reports the lifecycle hooks after `await` expression.\
In `setup()` function, `onXXX` lifecycle hooks should be registered synchronously.
diff --git a/docs/rules/no-lone-template.md b/docs/rules/no-lone-template.md
index 0c3904e3c..2d05a77c6 100644
--- a/docs/rules/no-lone-template.md
+++ b/docs/rules/no-lone-template.md
@@ -5,16 +5,17 @@ title: vue/no-lone-template
description: disallow unnecessary ``
since: v7.0.0
---
+
# vue/no-lone-template
> disallow unnecessary ``
-- :gear: This rule is included in `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
-This rule aims to eliminate unnecessary and potentially confusing ``.
-In Vue.js 2.x, the `` elements that have no specific directives have no effect.
+This rule aims to eliminate unnecessary and potentially confusing ``.\
+In Vue.js 2.x, the `` elements that have no specific directives have no effect.\
In Vue.js 3.x, the `` elements that have no specific directives render the `` elements as is, but in most cases this may not be what you intended.
@@ -46,7 +47,7 @@ In Vue.js 3.x, the `` elements that have no specific directives render
}
```
-- `ignoreAccessible` ... If `true`, ignore accessible `` elements. default `false`.
+- `ignoreAccessible` ... If `true`, ignore accessible `` elements. default `false`.\
Note: this option is useless if you are using Vue.js 2.x.
### `"ignoreAccessible": true`
diff --git a/docs/rules/no-loss-of-precision.md b/docs/rules/no-loss-of-precision.md
index b8ada172c..c9b88ce63 100644
--- a/docs/rules/no-loss-of-precision.md
+++ b/docs/rules/no-loss-of-precision.md
@@ -5,6 +5,7 @@ title: vue/no-loss-of-precision
description: Disallow literal numbers that lose precision in ``
since: v8.0.0
---
+
# vue/no-loss-of-precision
> Disallow literal numbers that lose precision in ``
diff --git a/docs/rules/no-multi-spaces.md b/docs/rules/no-multi-spaces.md
index 065b799b7..66c6a81d7 100644
--- a/docs/rules/no-multi-spaces.md
+++ b/docs/rules/no-multi-spaces.md
@@ -5,12 +5,13 @@ title: vue/no-multi-spaces
description: disallow multiple spaces
since: v3.12.0
---
+
# vue/no-multi-spaces
> disallow multiple spaces
-- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
diff --git a/docs/rules/no-multiple-objects-in-class.md b/docs/rules/no-multiple-objects-in-class.md
index 9e1508b8b..13f1f591b 100644
--- a/docs/rules/no-multiple-objects-in-class.md
+++ b/docs/rules/no-multiple-objects-in-class.md
@@ -2,16 +2,17 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/no-multiple-objects-in-class
-description: disallow to pass multiple objects into array to class
+description: disallow passing multiple objects in an array to class
since: v7.0.0
---
+
# vue/no-multiple-objects-in-class
-> disallow to pass multiple objects into array to class
+> disallow passing multiple objects in an array to class
## :book: Rule Details
-This rule disallows to pass multiple objects into array to class.
+This rule disallows to pass multiple objects into array to class.
@@ -19,10 +20,10 @@ This rule disallows to pass multiple objects into array to class.
-
+
-
+
```
diff --git a/docs/rules/no-multiple-slot-args.md b/docs/rules/no-multiple-slot-args.md
index c73be9007..17ba69b02 100644
--- a/docs/rules/no-multiple-slot-args.md
+++ b/docs/rules/no-multiple-slot-args.md
@@ -2,18 +2,19 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/no-multiple-slot-args
-description: disallow to pass multiple arguments to scoped slots
+description: disallow passing multiple arguments to scoped slots
since: v7.0.0
---
+
# vue/no-multiple-slot-args
-> disallow to pass multiple arguments to scoped slots
+> disallow passing multiple arguments to scoped slots
-- :gear: This rule is included in `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
-This rule disallows to pass multiple arguments to scoped slots.
+This rule disallows to pass multiple arguments to scoped slots.\
In details, it reports call expressions if a call of `this.$scopedSlots` members has 2 or more arguments.
diff --git a/docs/rules/no-multiple-template-root.md b/docs/rules/no-multiple-template-root.md
index e5130faab..8a85c9201 100644
--- a/docs/rules/no-multiple-template-root.md
+++ b/docs/rules/no-multiple-template-root.md
@@ -5,11 +5,12 @@ title: vue/no-multiple-template-root
description: disallow adding multiple root nodes to the template
since: v7.0.0
---
+
# vue/no-multiple-template-root
> disallow adding multiple root nodes to the template
-- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -41,7 +42,7 @@ This rule checks whether template contains single root element valid for Vue 2.
```vue
-
+
```
@@ -60,7 +61,32 @@ This rule checks whether template contains single root element valid for Vue 2.
## :wrench: Options
-Nothing.
+```json
+{
+ "vue/no-multiple-template-root": ["error", {
+ "disallowComments": false
+ }]
+}
+```
+
+- "disallowComments" (`boolean`) Enables there should not be any comments in the template root. Default is `false`.
+
+### "disallowComments": true
+
+
+
+```vue
+/* ✗ BAD */
+
+
+
+ vue eslint plugin
+
+
+
+```
+
+
## :rocket: Version
diff --git a/docs/rules/no-mutating-props.md b/docs/rules/no-mutating-props.md
index 62c76680d..3ddee4cc2 100644
--- a/docs/rules/no-mutating-props.md
+++ b/docs/rules/no-mutating-props.md
@@ -5,11 +5,12 @@ title: vue/no-mutating-props
description: disallow mutation of component props
since: v7.0.0
---
+
# vue/no-mutating-props
> disallow mutation of component props
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -27,33 +28,33 @@ This rule reports mutation of component props.
```
@@ -71,33 +72,33 @@ This rule reports mutation of component props.
```
@@ -107,12 +108,12 @@ This rule reports mutation of component props.
```vue
```
diff --git a/docs/rules/no-negated-condition.md b/docs/rules/no-negated-condition.md
new file mode 100644
index 000000000..17ffdba5d
--- /dev/null
+++ b/docs/rules/no-negated-condition.md
@@ -0,0 +1,37 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/no-negated-condition
+description: Disallow negated conditions in ``
+since: v10.4.0
+---
+
+# vue/no-negated-condition
+
+> Disallow negated conditions in ``
+
+## :book: Rule Details
+
+This rule is the same rule as core [no-negated-condition] rule but it applies to the expressions in ``.
+
+## :couple: Related Rules
+
+- [`vue/no-negated-v-if-condition`](https://eslint.vuejs.org/rules/no-negated-v-if-condition.html)
+- [unicorn/no-negated-condition](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md)
+
+## :books: Further Reading
+
+- [no-negated-condition]
+
+[no-negated-condition]: https://eslint.org/docs/rules/no-negated-condition
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v10.4.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-negated-condition.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-negated-condition.js)
+
+Taken with ❤️ [from ESLint core](https://eslint.org/docs/latest/rules/no-negated-condition)
diff --git a/docs/rules/no-negated-v-if-condition.md b/docs/rules/no-negated-v-if-condition.md
new file mode 100644
index 000000000..21592793d
--- /dev/null
+++ b/docs/rules/no-negated-v-if-condition.md
@@ -0,0 +1,68 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/no-negated-v-if-condition
+description: disallow negated conditions in v-if/v-else
+since: v10.4.0
+---
+
+# vue/no-negated-v-if-condition
+
+> disallow negated conditions in v-if/v-else
+
+- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
+
+## :book: Rule Details
+
+This rule disallows negated conditions in `v-if` and `v-else-if` directives which have an `v-else` branch.
+
+Negated conditions make the code less readable. When there's an `else` clause, it's better to use a positive condition and switch the branches.
+
+
+
+```vue
+
+
+
First
+
Second
+
+
First
+
Second
+
+
Content
+
+
Not equal
+
+
+
First
+
Second
+
+
First
+
Second
+
+
First
+
Second
+
Third
+
+```
+
+
+
+## :wrench: Options
+
+Nothing.
+
+## :couple: Related Rules
+
+- [no-negated-condition](https://eslint.org/docs/latest/rules/no-negated-condition)
+- [vue/no-negated-condition](https://eslint.vuejs.org/rules/no-negated-condition.html)
+- [unicorn/no-negated-condition](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negated-condition.md)
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v10.4.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-negated-v-if-condition.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-negated-v-if-condition.js)
diff --git a/docs/rules/no-parsing-error.md b/docs/rules/no-parsing-error.md
index 61832037f..a6fcf2908 100644
--- a/docs/rules/no-parsing-error.md
+++ b/docs/rules/no-parsing-error.md
@@ -5,11 +5,12 @@ title: vue/no-parsing-error
description: disallow parsing errors in ``
since: v3.0.0
---
+
# vue/no-parsing-error
> disallow parsing errors in ``
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
This rule reports syntax errors in ``. For example:
diff --git a/docs/rules/no-potential-component-option-typo.md b/docs/rules/no-potential-component-option-typo.md
index 871af5de2..17e21c818 100644
--- a/docs/rules/no-potential-component-option-typo.md
+++ b/docs/rules/no-potential-component-option-typo.md
@@ -5,6 +5,7 @@ title: vue/no-potential-component-option-typo
description: disallow a potential typo in your component property
since: v7.0.0
---
+
# vue/no-potential-component-option-typo
> disallow a potential typo in your component property
diff --git a/docs/rules/no-ref-as-operand.md b/docs/rules/no-ref-as-operand.md
index df3549dc6..870a784e2 100644
--- a/docs/rules/no-ref-as-operand.md
+++ b/docs/rules/no-ref-as-operand.md
@@ -5,16 +5,17 @@ title: vue/no-ref-as-operand
description: disallow use of value wrapped by `ref()` (Composition API) as an operand
since: v7.0.0
---
+
# vue/no-ref-as-operand
> disallow use of value wrapped by `ref()` (Composition API) as an operand
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
-This rule reports cases where a ref is used incorrectly as an operand.
+This rule reports cases where a ref is used incorrectly as an operand.\
You must use `.value` to access the `Ref` value.
@@ -24,7 +25,7 @@ You must use `.value` to access the `Ref` value.
import { ref } from 'vue'
export default {
- setup () {
+ setup(_props, { emit }) {
const count = ref(0)
const ok = ref(true)
@@ -33,12 +34,14 @@ export default {
count.value + 1
1 + count.value
var msg = ok.value ? 'yes' : 'no'
+ emit('increment', count.value)
/* ✗ BAD */
count++
count + 1
1 + count
var msg = ok ? 'yes' : 'no'
+ emit('increment', count)
return {
count
diff --git a/docs/rules/no-ref-object-destructure.md b/docs/rules/no-ref-object-destructure.md
index fd3534c6f..7733768ea 100644
--- a/docs/rules/no-ref-object-destructure.md
+++ b/docs/rules/no-ref-object-destructure.md
@@ -5,11 +5,12 @@ title: vue/no-ref-object-destructure
description: disallow usages of ref objects that can lead to loss of reactivity
since: v9.5.0
---
+
# vue/no-ref-object-destructure
> disallow usages of ref objects that can lead to loss of reactivity
-- :no_entry_sign: This rule was **deprecated** and replaced by [vue/no-ref-object-reactivity-loss](no-ref-object-reactivity-loss.md) rule.
+- :no_entry: This rule was **removed** in eslint-plugin-vue v10.0.0 and replaced by [vue/no-ref-object-reactivity-loss](no-ref-object-reactivity-loss.md) rule.
## :book: Rule Details
@@ -30,7 +31,7 @@ const v6 = computed(() => fn(count.value) /* ✓ GOOD */)
-This rule also supports Reactivity Transform, but Reactivity Transform is an experimental feature and may have false positives due to future Vue changes.
+This rule also supports Reactivity Transform, but Reactivity Transform is an experimental feature and may have false positives due to future Vue changes.\
See the [RFC](https://github.com/vuejs/rfcs/pull/420) for more information on Reactivity Transform.
diff --git a/docs/rules/no-ref-object-reactivity-loss.md b/docs/rules/no-ref-object-reactivity-loss.md
index 5f70a8303..3f13174e1 100644
--- a/docs/rules/no-ref-object-reactivity-loss.md
+++ b/docs/rules/no-ref-object-reactivity-loss.md
@@ -5,6 +5,7 @@ title: vue/no-ref-object-reactivity-loss
description: disallow usages of ref objects that can lead to loss of reactivity
since: v9.17.0
---
+
# vue/no-ref-object-reactivity-loss
> disallow usages of ref objects that can lead to loss of reactivity
@@ -28,7 +29,7 @@ const v6 = computed(() => fn(count.value) /* ✓ GOOD */)
-This rule also supports Reactivity Transform, but Reactivity Transform is an experimental feature and may have false positives due to future Vue changes.
+This rule also supports Reactivity Transform, but Reactivity Transform is an experimental feature and may have false positives due to future Vue changes.\
See the [RFC](https://github.com/vuejs/rfcs/pull/420) for more information on Reactivity Transform.
diff --git a/docs/rules/no-required-prop-with-default.md b/docs/rules/no-required-prop-with-default.md
index 9a604a812..8308e4d8c 100644
--- a/docs/rules/no-required-prop-with-default.md
+++ b/docs/rules/no-required-prop-with-default.md
@@ -5,11 +5,13 @@ title: vue/no-required-prop-with-default
description: enforce props with default values to be optional
since: v9.6.0
---
+
# vue/no-required-prop-with-default
> enforce props with default values to be optional
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/vue2-recommended"`, `*.configs["flat/vue2-recommended"]`, `"plugin:vue/recommended"` and `*.configs["flat/recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
## :book: Rule Details
@@ -22,27 +24,27 @@ This rule enforces all props with default values to be optional.
```vue
```
@@ -52,23 +54,23 @@ This rule enforces all props with default values to be optional.
```vue
```
diff --git a/docs/rules/no-reserved-component-names.md b/docs/rules/no-reserved-component-names.md
index 80e430813..c99191872 100644
--- a/docs/rules/no-reserved-component-names.md
+++ b/docs/rules/no-reserved-component-names.md
@@ -5,11 +5,12 @@ title: vue/no-reserved-component-names
description: disallow the use of reserved names in component definitions
since: v6.1.0
---
+
# vue/no-reserved-component-names
> disallow the use of reserved names in component definitions
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -34,13 +35,15 @@ export default {
{
"vue/no-reserved-component-names": ["error", {
"disallowVueBuiltInComponents": false,
- "disallowVue3BuiltInComponents": false
+ "disallowVue3BuiltInComponents": false,
+ "htmlElementCaseSensitive": false,
}]
}
```
- `disallowVueBuiltInComponents` (`boolean`) ... If `true`, disallow Vue.js 2.x built-in component names. Default is `false`.
- `disallowVue3BuiltInComponents` (`boolean`) ... If `true`, disallow Vue.js 3.x built-in component names. Default is `false`.
+- `htmlElementCaseSensitive` (`boolean`) ... If `true`, component names must exactly match the case of an HTML element to be considered conflicting. Default is `false` (i.e. case-insensitve comparison).
### `"disallowVueBuiltInComponents": true`
@@ -72,6 +75,34 @@ export default {
+### `"htmlElementCaseSensitive": true`
+
+
+
+```vue
+
+```
+
+
+
+
+
+```vue
+
+```
+
+
+
## :couple: Related Rules
- [vue/multi-word-component-names](./multi-word-component-names.md)
diff --git a/docs/rules/no-reserved-keys.md b/docs/rules/no-reserved-keys.md
index 36535c5b5..9244ee0b7 100644
--- a/docs/rules/no-reserved-keys.md
+++ b/docs/rules/no-reserved-keys.md
@@ -5,11 +5,12 @@ title: vue/no-reserved-keys
description: disallow overwriting reserved keys
since: v3.9.0
---
+
# vue/no-reserved-keys
> disallow overwriting reserved keys
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -26,14 +27,14 @@ export default {
},
computed: {
$on: {
- get () {}
+ get() {}
}
},
data: {
_foo: null
},
methods: {
- $nextTick () {}
+ $nextTick() {}
}
}
@@ -64,10 +65,10 @@ export default {
/* ✗ BAD */
export default {
computed: {
- foo () {}
+ foo() {}
},
firebase: {
- foo2 () {}
+ foo2() {}
}
}
diff --git a/docs/rules/no-reserved-props.md b/docs/rules/no-reserved-props.md
index 3c9ac1044..982ddb947 100644
--- a/docs/rules/no-reserved-props.md
+++ b/docs/rules/no-reserved-props.md
@@ -5,11 +5,12 @@ title: vue/no-reserved-props
description: disallow reserved names in props
since: v8.0.0
---
+
# vue/no-reserved-props
> disallow reserved names in props
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
diff --git a/docs/rules/no-restricted-block.md b/docs/rules/no-restricted-block.md
index cb6ab788b..0a96a64a4 100644
--- a/docs/rules/no-restricted-block.md
+++ b/docs/rules/no-restricted-block.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-block
description: disallow specific block
since: v7.4.0
---
+
# vue/no-restricted-block
> disallow specific block
diff --git a/docs/rules/no-restricted-call-after-await.md b/docs/rules/no-restricted-call-after-await.md
index f880f8f12..0082bb881 100644
--- a/docs/rules/no-restricted-call-after-await.md
+++ b/docs/rules/no-restricted-call-after-await.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-call-after-await
description: disallow asynchronously called restricted methods
since: v7.4.0
---
+
# vue/no-restricted-call-after-await
> disallow asynchronously called restricted methods
diff --git a/docs/rules/no-restricted-class.md b/docs/rules/no-restricted-class.md
index b6fa69b3a..a69f28d55 100644
--- a/docs/rules/no-restricted-class.md
+++ b/docs/rules/no-restricted-class.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-class
description: disallow specific classes in Vue components
since: v7.19.0
---
+
# vue/no-restricted-class
> disallow specific classes in Vue components
@@ -30,7 +31,7 @@ in the rule configuration.
-
+
@@ -64,7 +65,7 @@ variables, like below, will not be detected by this rule.
export default {
data() {
return {
- classes: "forbidden"
+ classes: 'forbidden'
}
}
}
diff --git a/docs/rules/no-restricted-component-names.md b/docs/rules/no-restricted-component-names.md
index e093b496a..689c73aa1 100644
--- a/docs/rules/no-restricted-component-names.md
+++ b/docs/rules/no-restricted-component-names.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-component-names
description: disallow specific component names
since: v9.15.0
---
+
# vue/no-restricted-component-names
> disallow specific component names
@@ -52,23 +53,23 @@ This rule takes a list of strings, where each string is a component name or patt
```
Alternatively, you can specify an object with a `name` property and an optional `message` and `suggest` property:
-
+
```json
- {
- "vue/no-restricted-component-names": [
- "error",
- {
- "name": "Disallow",
- "message": "Please do not use `Disallow` as a component name",
- "suggest": "allow"
- },
- {
- "name": "/^custom/",
- "message": "Please do not use component names starting with 'custom'"
- }
- ]
- }
- ```
+{
+ "vue/no-restricted-component-names": [
+ "error",
+ {
+ "name": "Disallow",
+ "message": "Please do not use `Disallow` as a component name",
+ "suggest": "allow"
+ },
+ {
+ "name": "/^custom/",
+ "message": "Please do not use component names starting with 'custom'"
+ }
+ ]
+}
+```
@@ -83,6 +84,10 @@ export default {
+## :couple: Related Rules
+
+- [vue/restricted-component-names](./restricted-component-names.md)
+
## :rocket: Version
This rule was introduced in eslint-plugin-vue v9.15.0
diff --git a/docs/rules/no-restricted-component-options.md b/docs/rules/no-restricted-component-options.md
index a11570945..57d736ae3 100644
--- a/docs/rules/no-restricted-component-options.md
+++ b/docs/rules/no-restricted-component-options.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-component-options
description: disallow specific component option
since: v7.0.0
---
+
# vue/no-restricted-component-options
> disallow specific component option
diff --git a/docs/rules/no-restricted-custom-event.md b/docs/rules/no-restricted-custom-event.md
index b77feac14..88a3eb424 100644
--- a/docs/rules/no-restricted-custom-event.md
+++ b/docs/rules/no-restricted-custom-event.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-custom-event
description: disallow specific custom event
since: v7.3.0
---
+
# vue/no-restricted-custom-event
> disallow specific custom event
diff --git a/docs/rules/no-restricted-html-elements.md b/docs/rules/no-restricted-html-elements.md
index 15a62447f..9adc7a6ab 100644
--- a/docs/rules/no-restricted-html-elements.md
+++ b/docs/rules/no-restricted-html-elements.md
@@ -2,16 +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.
@@ -32,20 +33,20 @@ 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
{
- "vue/no-restricted-html-elements": ["error", "button", "marquee"]
+ "vue/no-restricted-html-elements": ["error", "a", "marquee"]
}
```
-
+
```vue
-
+
```
@@ -59,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",
@@ -72,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 element name or an array of element names.
- `message` ... Specify an optional custom message.
-### `{ "element": "marquee" }, { "element": "button" }`
+### `{ "element": "marquee" }, { "element": "a" }`
-
+
```vue
-
+
```
diff --git a/docs/rules/no-restricted-props.md b/docs/rules/no-restricted-props.md
index beecaaa8b..454923ae3 100644
--- a/docs/rules/no-restricted-props.md
+++ b/docs/rules/no-restricted-props.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-props
description: disallow specific props
since: v7.3.0
---
+
# vue/no-restricted-props
> disallow specific props
diff --git a/docs/rules/no-restricted-static-attribute.md b/docs/rules/no-restricted-static-attribute.md
index 428590506..a0534f563 100644
--- a/docs/rules/no-restricted-static-attribute.md
+++ b/docs/rules/no-restricted-static-attribute.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-static-attribute
description: disallow specific attribute
since: v7.0.0
---
+
# vue/no-restricted-static-attribute
> disallow specific attribute
@@ -39,7 +40,8 @@ Alternatively, the rule also accepts objects.
```json
{
- "vue/no-restricted-static-attribute": ["error",
+ "vue/no-restricted-static-attribute": [
+ "error",
{
"key": "stlye",
"message": "Using \"stlye\" is not allowed. Use \"style\" instead."
@@ -95,8 +97,10 @@ The following properties can be specified for the object.
## :couple: Related Rules
- [vue/no-restricted-v-bind]
+- [vue/no-restricted-v-on]
[vue/no-restricted-v-bind]: ./no-restricted-v-bind.md
+[vue/no-restricted-v-on]: ./no-restricted-v-on.md
## :rocket: Version
diff --git a/docs/rules/no-restricted-syntax.md b/docs/rules/no-restricted-syntax.md
index 8058ecf5b..d16cebcf3 100644
--- a/docs/rules/no-restricted-syntax.md
+++ b/docs/rules/no-restricted-syntax.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-syntax
description: Disallow specified syntax in ``
since: v5.2.0
---
+
# vue/no-restricted-syntax
> Disallow specified syntax in ``
diff --git a/docs/rules/no-restricted-v-bind.md b/docs/rules/no-restricted-v-bind.md
index 8b9332f6e..4c1495f4e 100644
--- a/docs/rules/no-restricted-v-bind.md
+++ b/docs/rules/no-restricted-v-bind.md
@@ -5,6 +5,7 @@ title: vue/no-restricted-v-bind
description: disallow specific argument in `v-bind`
since: v7.0.0
---
+
# vue/no-restricted-v-bind
> disallow specific argument in `v-bind`
@@ -53,7 +54,8 @@ Alternatively, the rule also accepts objects.
```json
{
- "vue/no-restricted-v-bind": ["error",
+ "vue/no-restricted-v-bind": [
+ "error",
{
"argument": "/^v-/",
"message": "Using `:v-xxx` is not allowed. Instead, remove `:` and use it as directive."
@@ -112,8 +114,10 @@ The following properties can be specified for the object.
## :couple: Related Rules
- [vue/no-restricted-static-attribute]
+- [vue/no-restricted-v-on]
[vue/no-restricted-static-attribute]: ./no-restricted-static-attribute.md
+[vue/no-restricted-v-on]: ./no-restricted-v-on.md
## :rocket: Version
diff --git a/docs/rules/no-restricted-v-on.md b/docs/rules/no-restricted-v-on.md
new file mode 100644
index 000000000..be32147a0
--- /dev/null
+++ b/docs/rules/no-restricted-v-on.md
@@ -0,0 +1,115 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/no-restricted-v-on
+description: disallow specific argument in `v-on`
+since: v9.21.0
+---
+
+# vue/no-restricted-v-on
+
+> disallow specific argument in `v-on`
+
+## :book: Rule Details
+
+This rule allows you to specify `v-on` argument names that you don't want to use in your application.
+
+## :wrench: Options
+
+This rule takes a list of strings, where each string is a argument name or pattern to be restricted:
+
+```json
+{
+ "vue/no-restricted-v-on": ["error", "foo", "/^bar/"]
+}
+```
+
+
+
+```vue
+
+
+
+
+
+
+
+
+
+```
+
+
+
+Alternatively, the rule also accepts objects.
+
+```json
+{
+ "vue/no-restricted-v-on": [
+ "error",
+ {
+ "argument": "foo",
+ "message": "Use \"v-on:x\" instead."
+ },
+ {
+ "argument": "bar",
+ "message": "\"@bar\" is deprecated."
+ }
+ ]
+}
+```
+
+The following properties can be specified for the object.
+
+- `argument` ... Specify the argument name or pattern or `null`. If `null` is specified, it matches `v-on=`.
+- `modifiers` ... Specifies an array of the modifier names. If specified, it will only be reported if the specified modifier is used.
+- `element` ... Specify the element name or pattern. If specified, it will only be reported if used on the specified element.
+- `message` ... Specify an optional custom message.
+
+### `{ "argument": "foo", "modifiers": ["prevent"] }`
+
+
+
+```vue
+
+
+
+
+
+
+
+```
+
+
+
+### `{ "argument": "foo", "element": "MyButton" }`
+
+
+
+```vue
+
+
+
+
+
+
+
+```
+
+
+
+## :couple: Related Rules
+
+- [vue/no-restricted-static-attribute]
+- [vue/no-restricted-v-bind]
+
+[vue/no-restricted-static-attribute]: ./no-restricted-static-attribute.md
+[vue/no-restricted-v-bind]: ./no-restricted-v-bind.md
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.21.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-restricted-v-on.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-restricted-v-on.js)
diff --git a/docs/rules/no-root-v-if.md b/docs/rules/no-root-v-if.md
index bf32003a3..c65ac564a 100644
--- a/docs/rules/no-root-v-if.md
+++ b/docs/rules/no-root-v-if.md
@@ -5,6 +5,7 @@ title: vue/no-root-v-if
description: disallow `v-if` directives on root element
since: v9.12.0
---
+
# vue/no-root-v-if
> disallow `v-if` directives on root element
diff --git a/docs/rules/no-setup-props-destructure.md b/docs/rules/no-setup-props-destructure.md
index 37fdcf8b5..66fa784c7 100644
--- a/docs/rules/no-setup-props-destructure.md
+++ b/docs/rules/no-setup-props-destructure.md
@@ -5,11 +5,12 @@ title: vue/no-setup-props-destructure
description: disallow usages that lose the reactivity of `props` passed to `setup`
since: v7.0.0
---
+
# vue/no-setup-props-destructure
> disallow usages that lose the reactivity of `props` passed to `setup`
-- :no_entry_sign: This rule was **deprecated** and replaced by [vue/no-setup-props-reactivity-loss](no-setup-props-reactivity-loss.md) rule.
+- :no_entry: This rule was **removed** in eslint-plugin-vue v10.0.0 and replaced by [vue/no-setup-props-reactivity-loss](no-setup-props-reactivity-loss.md) rule.
## :book: Rule Details
diff --git a/docs/rules/no-setup-props-reactivity-loss.md b/docs/rules/no-setup-props-reactivity-loss.md
index ade3ee62c..b950ce3f7 100644
--- a/docs/rules/no-setup-props-reactivity-loss.md
+++ b/docs/rules/no-setup-props-reactivity-loss.md
@@ -5,6 +5,7 @@ title: vue/no-setup-props-reactivity-loss
description: disallow usages that lose the reactivity of `props` passed to `setup`
since: v9.17.0
---
+
# vue/no-setup-props-reactivity-loss
> disallow usages that lose the reactivity of `props` passed to `setup`
diff --git a/docs/rules/no-shared-component-data.md b/docs/rules/no-shared-component-data.md
index ce4f693e0..1a96cf89f 100644
--- a/docs/rules/no-shared-component-data.md
+++ b/docs/rules/no-shared-component-data.md
@@ -5,12 +5,13 @@ title: vue/no-shared-component-data
description: enforce component's data property to be a function
since: v3.8.0
---
+
# vue/no-shared-component-data
> enforce component's data property to be a function
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
When using the data property on a component (i.e. anywhere except on `new Vue`), the value must be a function that returns an object.
@@ -32,7 +33,7 @@ Vue.component('some-comp', {
})
export default {
- data () {
+ data() {
return {
foo: 'bar'
}
diff --git a/docs/rules/no-side-effects-in-computed-properties.md b/docs/rules/no-side-effects-in-computed-properties.md
index f677f8d72..970299537 100644
--- a/docs/rules/no-side-effects-in-computed-properties.md
+++ b/docs/rules/no-side-effects-in-computed-properties.md
@@ -5,11 +5,12 @@ title: vue/no-side-effects-in-computed-properties
description: disallow side effects in computed properties
since: v3.6.0
---
+
# vue/no-side-effects-in-computed-properties
> disallow side effects in computed properties
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -24,10 +25,10 @@ It is considered a very bad practice to introduce side effects inside computed p
/* ✓ GOOD */
export default {
computed: {
- fullName () {
+ fullName() {
return `${this.firstName} ${this.lastName}`
},
- reversedArray () {
+ reversedArray() {
return this.array.slice(0).reverse() // .slice makes a copy of the array, instead of mutating the orginal
}
}
@@ -44,11 +45,11 @@ export default {
/* ✗ BAD */
export default {
computed: {
- fullName () {
+ fullName() {
this.firstName = 'lorem' // <- side effect
return `${this.firstName} ${this.lastName}`
},
- reversedArray () {
+ reversedArray() {
return this.array.reverse() // <- side effect - orginal array is being mutated
}
}
@@ -62,7 +63,7 @@ export default {
```vue
```
@@ -50,7 +51,37 @@ This rule aims to eliminate shadowed variable declarations of v-for directives o
## :wrench: Options
-Nothing.
+This rule takes one optional object option, with the property `"allow"`.
+
+```json
+{
+ "vue/no-template-shadow": ["error", { "allow": [] }]
+}
+```
+
+- `"allow"` (`[string]`) Array of identifier names for which shadowing is allowed.
+
+Examples of correct code for the `{ "allow": ["i"] }` option:
+
+
+
+```vue
+
+
+
+
+
+```
+
+
## :rocket: Version
diff --git a/docs/rules/no-template-target-blank.md b/docs/rules/no-template-target-blank.md
index 90bc286eb..d2a8fc006 100644
--- a/docs/rules/no-template-target-blank.md
+++ b/docs/rules/no-template-target-blank.md
@@ -5,9 +5,10 @@ title: vue/no-template-target-blank
description: disallow target="_blank" attribute without rel="noopener noreferrer"
since: v7.0.0
---
+
# vue/no-template-target-blank
-> disallow target="_blank" attribute without rel="noopener noreferrer"
+> disallow target="\_blank" attribute without rel="noopener noreferrer"
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
diff --git a/docs/rules/no-textarea-mustache.md b/docs/rules/no-textarea-mustache.md
index 35aafc167..0db4aff4f 100644
--- a/docs/rules/no-textarea-mustache.md
+++ b/docs/rules/no-textarea-mustache.md
@@ -5,11 +5,12 @@ title: vue/no-textarea-mustache
description: disallow mustaches in `
```
@@ -96,12 +97,12 @@ watch(() => prop.undef, () => console.log('Updated!'))
{{ $t('foo') }}
```
diff --git a/docs/rules/no-unregistered-components.md b/docs/rules/no-unregistered-components.md
index 3f373d480..dd8977bc6 100644
--- a/docs/rules/no-unregistered-components.md
+++ b/docs/rules/no-unregistered-components.md
@@ -5,6 +5,7 @@ title: vue/no-unregistered-components
description: disallow using components that are not registered inside templates
since: v7.0.0
---
+
# vue/no-unregistered-components
> disallow using components that are not registered inside templates
@@ -37,19 +38,19 @@ are ignored by default.
```
@@ -67,11 +68,9 @@ are ignored by default.
```
@@ -103,11 +102,9 @@ are ignored by default.
```
@@ -125,11 +122,9 @@ are ignored by default.
```
diff --git a/docs/rules/no-unsupported-features.md b/docs/rules/no-unsupported-features.md
index 2e7d67501..d77fdbdaa 100644
--- a/docs/rules/no-unsupported-features.md
+++ b/docs/rules/no-unsupported-features.md
@@ -5,11 +5,12 @@ title: vue/no-unsupported-features
description: disallow unsupported Vue.js syntax on the specified version
since: v6.1.0
---
+
# vue/no-unsupported-features
> disallow unsupported Vue.js syntax on the specified version
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
@@ -28,7 +29,10 @@ This rule reports unsupported Vue.js syntax on the specified version.
- `version` ... The `version` option accepts [the valid version range of `node-semver`](https://github.com/npm/node-semver#range-grammar). Set the version of Vue.js you are using. This option is required.
- `ignores` ... You can use this `ignores` option to ignore the given features.
-The `"ignores"` option accepts an array of the following strings.
+ The `"ignores"` option accepts an array of the following strings.
+ - Vue.js 3.4.0+
+ - `"define-model"` ... `defineModel()` macro.
+ - `"v-bind-same-name-shorthand"` ... `v-bind` same-name shorthand.
- Vue.js 3.3.0+
- `"define-slots"` ... `defineSlots()` macro.
- `"define-options"` ... `defineOptions()` macro.
diff --git a/docs/rules/no-unused-components.md b/docs/rules/no-unused-components.md
index 6f70e9291..8bc27abcc 100644
--- a/docs/rules/no-unused-components.md
+++ b/docs/rules/no-unused-components.md
@@ -5,11 +5,12 @@ title: vue/no-unused-components
description: disallow registering components that are not used inside templates
since: v7.0.0
---
+
# vue/no-unused-components
> disallow registering components that are not used inside templates
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -31,19 +32,19 @@ This rule reports components that haven't been used in the template.
```
@@ -61,15 +62,15 @@ This rule reports components that haven't been used in the template.
```
@@ -108,17 +109,17 @@ Components registered under `PascalCase` or `camelCase` names have may be called
```
@@ -136,21 +137,20 @@ Components registered under `PascalCase` or `camelCase` names have may be called
```
diff --git a/docs/rules/no-unused-emit-declarations.md b/docs/rules/no-unused-emit-declarations.md
new file mode 100644
index 000000000..54abc81d1
--- /dev/null
+++ b/docs/rules/no-unused-emit-declarations.md
@@ -0,0 +1,63 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/no-unused-emit-declarations
+description: disallow unused emit declarations
+since: v9.19.0
+---
+
+# vue/no-unused-emit-declarations
+
+> disallow unused emit declarations
+
+## :book: Rule Details
+
+This rule is aimed at eliminating unused emit declarations.
+
+
+
+```vue
+
+
+```
+
+
+
+
+
+```vue
+
+
+```
+
+
+
+## :wrench: Options
+
+Nothing.
+
+## :couple: Related Rules
+
+- [vue/require-explicit-emits](./require-explicit-emits.md)
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.19.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-unused-emit-declarations.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-unused-emit-declarations.js)
diff --git a/docs/rules/no-unused-properties.md b/docs/rules/no-unused-properties.md
index 4c8300923..e0e14416a 100644
--- a/docs/rules/no-unused-properties.md
+++ b/docs/rules/no-unused-properties.md
@@ -5,6 +5,7 @@ title: vue/no-unused-properties
description: disallow unused properties
since: v7.0.0
---
+
# vue/no-unused-properties
> disallow unused properties
@@ -25,9 +26,9 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
{{ count }}
```
@@ -41,9 +42,9 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
{{ cnt }}
```
@@ -79,16 +80,16 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
```vue
```
@@ -99,16 +100,16 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
```vue
```
@@ -150,18 +151,18 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
{{ reversedMessage }}
```
@@ -175,18 +176,18 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
{{ message }}
```
@@ -202,19 +203,19 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
```
@@ -225,29 +226,27 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
```vue
-
-
-
+
```
@@ -258,28 +257,26 @@ This rule cannot check for use of properties by other components (e.g. `mixins`,
```vue
-
-
-
+
```
diff --git a/docs/rules/no-unused-refs.md b/docs/rules/no-unused-refs.md
index 7abf43e28..06383d93e 100644
--- a/docs/rules/no-unused-refs.md
+++ b/docs/rules/no-unused-refs.md
@@ -5,6 +5,7 @@ title: vue/no-unused-refs
description: disallow unused refs
since: v7.9.0
---
+
# vue/no-unused-refs
> disallow unused refs
diff --git a/docs/rules/no-unused-vars.md b/docs/rules/no-unused-vars.md
index be0b1fcc1..eedfc7250 100644
--- a/docs/rules/no-unused-vars.md
+++ b/docs/rules/no-unused-vars.md
@@ -5,11 +5,12 @@ title: vue/no-unused-vars
description: disallow unused variable definitions of v-for directives or scope attributes
since: v3.14.0
---
+
# vue/no-unused-vars
> disallow unused variable definitions of v-for directives or scope attributes
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
## :book: Rule Details
diff --git a/docs/rules/no-use-computed-property-like-method.md b/docs/rules/no-use-computed-property-like-method.md
index 6e267697c..3dc4dbc54 100644
--- a/docs/rules/no-use-computed-property-like-method.md
+++ b/docs/rules/no-use-computed-property-like-method.md
@@ -5,11 +5,12 @@ title: vue/no-use-computed-property-like-method
description: disallow use computed property like method
since: v7.15.0
---
+
# vue/no-use-computed-property-like-method
> disallow use computed property like method
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
diff --git a/docs/rules/no-use-v-else-with-v-for.md b/docs/rules/no-use-v-else-with-v-for.md
index 7cfbf762d..203775ad8 100644
--- a/docs/rules/no-use-v-else-with-v-for.md
+++ b/docs/rules/no-use-v-else-with-v-for.md
@@ -5,6 +5,7 @@ title: vue/no-use-v-else-with-v-for
description: disallow using `v-else-if`/`v-else` on the same element as `v-for`
since: v9.16.0
---
+
# vue/no-use-v-else-with-v-for
> disallow using `v-else-if`/`v-else` on the same element as `v-for`
diff --git a/docs/rules/no-use-v-if-with-v-for.md b/docs/rules/no-use-v-if-with-v-for.md
index 49535f2c1..faf1c62b2 100644
--- a/docs/rules/no-use-v-if-with-v-for.md
+++ b/docs/rules/no-use-v-if-with-v-for.md
@@ -5,11 +5,12 @@ title: vue/no-use-v-if-with-v-for
description: disallow using `v-if` on the same element as `v-for`
since: v4.6.0
---
+
# vue/no-use-v-if-with-v-for
> disallow using `v-if` on the same element as `v-for`
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
diff --git a/docs/rules/no-useless-concat.md b/docs/rules/no-useless-concat.md
index 647cd7c31..bd74f475d 100644
--- a/docs/rules/no-useless-concat.md
+++ b/docs/rules/no-useless-concat.md
@@ -5,6 +5,7 @@ title: vue/no-useless-concat
description: Disallow unnecessary concatenation of literals or template literals in ``
since: v7.0.0
---
+
# vue/no-useless-concat
> Disallow unnecessary concatenation of literals or template literals in ``
diff --git a/docs/rules/no-useless-mustaches.md b/docs/rules/no-useless-mustaches.md
index 205371a86..4bfb714f2 100644
--- a/docs/rules/no-useless-mustaches.md
+++ b/docs/rules/no-useless-mustaches.md
@@ -5,15 +5,16 @@ title: vue/no-useless-mustaches
description: disallow unnecessary mustache interpolations
since: v7.0.0
---
+
# vue/no-useless-mustaches
> disallow unnecessary mustache interpolations
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
-This rule reports mustache interpolation with a string literal value.
+This rule reports mustache interpolation with a string literal value.\
The mustache interpolation with a string literal value can be changed to a static contents.
diff --git a/docs/rules/no-useless-template-attributes.md b/docs/rules/no-useless-template-attributes.md
index b309897f7..d8eb20a98 100644
--- a/docs/rules/no-useless-template-attributes.md
+++ b/docs/rules/no-useless-template-attributes.md
@@ -5,11 +5,12 @@ title: vue/no-useless-template-attributes
description: disallow useless attribute on ``
since: v7.19.0
---
+
# vue/no-useless-template-attributes
> disallow useless attribute on ``
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
diff --git a/docs/rules/no-useless-v-bind.md b/docs/rules/no-useless-v-bind.md
index 303f15871..f1bde1726 100644
--- a/docs/rules/no-useless-v-bind.md
+++ b/docs/rules/no-useless-v-bind.md
@@ -5,15 +5,16 @@ title: vue/no-useless-v-bind
description: disallow unnecessary `v-bind` directives
since: v7.0.0
---
+
# vue/no-useless-v-bind
> disallow unnecessary `v-bind` directives
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
-This rule reports `v-bind` with a string literal value.
+This rule reports `v-bind` with a string literal value.\
The `v-bind` with a string literal value can be changed to a static attribute definition.
@@ -21,12 +22,12 @@ The `v-bind` with a string literal value can be changed to a static attribute de
```vue
-
-
+
+
-
-
+
+
```
@@ -53,10 +54,10 @@ The `v-bind` with a string literal value can be changed to a static attribute de
```vue
-
+
-
+
```
@@ -69,7 +70,7 @@ The `v-bind` with a string literal value can be changed to a static attribute de
```vue
-
+
```
diff --git a/docs/rules/no-v-for-template-key-on-child.md b/docs/rules/no-v-for-template-key-on-child.md
index 559793cbb..4e6ddd0c3 100644
--- a/docs/rules/no-v-for-template-key-on-child.md
+++ b/docs/rules/no-v-for-template-key-on-child.md
@@ -5,17 +5,18 @@ title: vue/no-v-for-template-key-on-child
description: disallow key of `` placed on child elements
since: v7.0.0
---
+
# vue/no-v-for-template-key-on-child
> disallow key of `` placed on child elements
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/recommended"` and `*.configs["flat/recommended"]`.
## :book: Rule Details
This rule reports the key of the `` placed on the child elements.
-In Vue.js 3.x, with the support for fragments, the `` key can be placed on the `` tag.
+In Vue.js 3.x, with the support for fragments, the `` key can be placed on the `` tag.
See [Migration Guide - `key` attribute > With ``](https://v3-migration.vuejs.org/breaking-changes/key-attribute.html#with-template-v-for) for more details.
diff --git a/docs/rules/no-v-for-template-key.md b/docs/rules/no-v-for-template-key.md
index 2325281c2..5dbe15471 100644
--- a/docs/rules/no-v-for-template-key.md
+++ b/docs/rules/no-v-for-template-key.md
@@ -5,11 +5,13 @@ title: vue/no-v-for-template-key
description: disallow `key` attribute on ``
since: v7.0.0
---
+
# vue/no-v-for-template-key
> disallow `key` attribute on ``
-- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
+- :no_entry_sign: This rule was **deprecated**.
+- :gear: This rule is included in all of `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
diff --git a/docs/rules/no-v-html.md b/docs/rules/no-v-html.md
index cb390eca1..507eaf9b4 100644
--- a/docs/rules/no-v-html.md
+++ b/docs/rules/no-v-html.md
@@ -5,11 +5,12 @@ title: vue/no-v-html
description: disallow use of v-html to prevent XSS attack
since: v4.7.0
---
+
# vue/no-v-html
> disallow use of v-html to prevent XSS attack
-- :gear: This rule is included in `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -31,15 +32,41 @@ This rule reports all uses of `v-html` directive in order to reduce the risk of
## :wrench: Options
-Nothing.
+```json
+{
+ "vue/no-v-html": ["error", {
+ "ignorePattern": "^html"
+ }]
+}
+```
+
+- `ignorePattern` ... disables reporting when the `v-html` directive references a variable matching this pattern. By default, all `v-html` uses are forbidden.
+
+### `{ "ignorePattern": "^html" }`
+
+
+
+```vue
+
+
+
{{ userName }}
+
+
+
+
+
+```
+
+
## :mute: When Not To Use It
If you are certain the content passed to `v-html` is sanitized HTML you can disable this rule.
-## :books: Further Reading
+## :couple: Related Rules
-- [XSS in Vue.js](https://blog.sqreen.io/xss-in-vue-js/)
+- [vue/no-v-text](./no-v-text.md)
+- [vue/no-v-text-v-html-on-component](./no-v-text-v-html-on-component.md)
## :rocket: Version
diff --git a/docs/rules/no-v-model-argument.md b/docs/rules/no-v-model-argument.md
index d020bbbab..6856c5e6c 100644
--- a/docs/rules/no-v-model-argument.md
+++ b/docs/rules/no-v-model-argument.md
@@ -5,11 +5,13 @@ title: vue/no-v-model-argument
description: disallow adding an argument to `v-model` used in custom component
since: v7.0.0
---
+
# vue/no-v-model-argument
> disallow adding an argument to `v-model` used in custom component
-- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/strongly-recommended"` and `"plugin:vue/recommended"`.
+- :no_entry_sign: This rule was **deprecated**.
+- :gear: This rule is included in all of `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
This rule checks whether `v-model` used on custom component do not have an argument.
@@ -26,7 +28,6 @@ This rule reports `v-model` directives in the following cases:
-
diff --git a/docs/rules/no-v-text-v-html-on-component.md b/docs/rules/no-v-text-v-html-on-component.md
index 420eefda6..aa1aceff6 100644
--- a/docs/rules/no-v-text-v-html-on-component.md
+++ b/docs/rules/no-v-text-v-html-on-component.md
@@ -5,11 +5,12 @@ title: vue/no-v-text-v-html-on-component
description: disallow v-text / v-html on component
since: v8.4.0
---
+
# vue/no-v-text-v-html-on-component
> disallow v-text / v-html on component
-- :gear: This rule is included in all of `"plugin:vue/essential"`, `"plugin:vue/vue3-essential"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/recommended"` and `"plugin:vue/vue3-recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-recommended"`, `*.configs["flat/vue2-recommended"]`, `"plugin:vue/recommended"` and `*.configs["flat/recommended"]`.
## :book: Rule Details
@@ -24,11 +25,15 @@ If you use v-text / v-html on a component, it will overwrite the component's con
- {{content}}
+
+
+ {{ content }}
+
+
```
@@ -36,7 +41,53 @@ If you use v-text / v-html on a component, it will overwrite the component's con
## :wrench: Options
-Nothing.
+```json
+{
+ "vue/no-v-text-v-html-on-component": ["error", {
+ "allow": ["router-link", "nuxt-link"],
+ "ignoreElementNamespaces": false
+ }]
+}
+```
+
+- `allow` (`string[]`) ... Specify a list of custom components for which the rule should not apply.
+- `ignoreElementNamespaces` (`boolean`) ... If `true`, always treat SVG and MathML tag names as HTML elements, even if they are not used inside a SVG/MathML root element. Default is `false`.
+
+### `{ "allow": ["router-link", "nuxt-link"] }`
+
+
+
+```vue
+
+
+
+
+
+
+
+
+```
+
+
+
+### `{ "ignoreElementNamespaces": true }`
+
+
+
+```vue
+
+
+
+
+
+```
+
+
+
+## :couple: Related Rules
+
+- [vue/no-v-text](./no-v-text.md)
+- [vue/no-v-html](./no-v-html.md)
## :rocket: Version
diff --git a/docs/rules/no-v-text.md b/docs/rules/no-v-text.md
index 84cece3a4..3fcd6811b 100644
--- a/docs/rules/no-v-text.md
+++ b/docs/rules/no-v-text.md
@@ -5,6 +5,7 @@ title: vue/no-v-text
description: disallow use of v-text
since: v7.17.0
---
+
# vue/no-v-text
> disallow use of v-text
@@ -31,6 +32,11 @@ This rule reports all uses of `v-text` directive.
Nothing.
+## :couple: Related Rules
+
+- [vue/no-v-html](./no-v-html.md)
+- [vue/no-v-text-v-html-on-component](./no-v-text-v-html-on-component.md)
+
## :rocket: Version
This rule was introduced in eslint-plugin-vue v7.17.0
diff --git a/docs/rules/no-watch-after-await.md b/docs/rules/no-watch-after-await.md
index a5c2a5e9f..b0cf5345d 100644
--- a/docs/rules/no-watch-after-await.md
+++ b/docs/rules/no-watch-after-await.md
@@ -5,15 +5,16 @@ title: vue/no-watch-after-await
description: disallow asynchronously registered `watch`
since: v7.0.0
---
+
# vue/no-watch-after-await
> disallow asynchronously registered `watch`
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/recommended"` and `*.configs["flat/recommended"]`.
## :book: Rule Details
-This rule reports the `watch()` after `await` expression.
+This rule reports the `watch()` after `await` expression.\
In `setup()` function, `watch()` should be registered synchronously.
diff --git a/docs/rules/object-curly-newline.md b/docs/rules/object-curly-newline.md
index cf98b0922..1b9d99cfe 100644
--- a/docs/rules/object-curly-newline.md
+++ b/docs/rules/object-curly-newline.md
@@ -5,18 +5,26 @@ title: vue/object-curly-newline
description: Enforce consistent line breaks after opening and before closing braces in ``
since: v7.0.0
---
+
# vue/object-curly-newline
> Enforce consistent line breaks after opening and before closing braces in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+
+This rule is the same rule as [@stylistic/object-curly-newline] rule but it applies to the expressions in ``.
+
+This rule extends the rule that [@stylistic/eslint-plugin] has, but if [@stylistic/eslint-plugin] is not installed, this rule extracts and extends the same rule from ESLint core.
+However, if neither is found, the rule cannot be used.
-This rule is the same rule as core [object-curly-newline] rule but it applies to the expressions in ``.
+[@stylistic/eslint-plugin]: https://eslint.style/packages/default
## :books: Further Reading
+- [@stylistic/object-curly-newline]
- [object-curly-newline]
+[@stylistic/object-curly-newline]: https://eslint.style/rules/object-curly-newline
[object-curly-newline]: https://eslint.org/docs/rules/object-curly-newline
## :rocket: Version
@@ -28,4 +36,4 @@ This rule was introduced in eslint-plugin-vue v7.0.0
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/object-curly-newline.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/object-curly-newline.js)
-Taken with ❤️ [from ESLint core](https://eslint.org/docs/latest/rules/object-curly-newline)
+Taken with ❤️ [from ESLint Stylistic](https://eslint.style/rules/object-curly-newline)
diff --git a/docs/rules/object-curly-spacing.md b/docs/rules/object-curly-spacing.md
index 926ebfb73..c3c744987 100644
--- a/docs/rules/object-curly-spacing.md
+++ b/docs/rules/object-curly-spacing.md
@@ -5,18 +5,26 @@ title: vue/object-curly-spacing
description: Enforce consistent spacing inside braces in ``
since: v5.2.0
---
+
# vue/object-curly-spacing
> Enforce consistent spacing inside braces in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+
+This rule is the same rule as [@stylistic/object-curly-spacing] rule but it applies to the expressions in ``.
+
+This rule extends the rule that [@stylistic/eslint-plugin] has, but if [@stylistic/eslint-plugin] is not installed, this rule extracts and extends the same rule from ESLint core.
+However, if neither is found, the rule cannot be used.
-This rule is the same rule as core [object-curly-spacing] rule but it applies to the expressions in ``.
+[@stylistic/eslint-plugin]: https://eslint.style/packages/default
## :books: Further Reading
+- [@stylistic/object-curly-spacing]
- [object-curly-spacing]
+[@stylistic/object-curly-spacing]: https://eslint.style/rules/object-curly-spacing
[object-curly-spacing]: https://eslint.org/docs/rules/object-curly-spacing
## :rocket: Version
@@ -28,4 +36,4 @@ This rule was introduced in eslint-plugin-vue v5.2.0
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/object-curly-spacing.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/object-curly-spacing.js)
-Taken with ❤️ [from ESLint core](https://eslint.org/docs/latest/rules/object-curly-spacing)
+Taken with ❤️ [from ESLint Stylistic](https://eslint.style/rules/object-curly-spacing)
diff --git a/docs/rules/object-property-newline.md b/docs/rules/object-property-newline.md
index b294c3fc4..8a9cbf6ea 100644
--- a/docs/rules/object-property-newline.md
+++ b/docs/rules/object-property-newline.md
@@ -5,18 +5,26 @@ title: vue/object-property-newline
description: Enforce placing object properties on separate lines in ``
since: v7.0.0
---
+
# vue/object-property-newline
> Enforce placing object properties on separate lines in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+
+This rule is the same rule as [@stylistic/object-property-newline] rule but it applies to the expressions in ``.
+
+This rule extends the rule that [@stylistic/eslint-plugin] has, but if [@stylistic/eslint-plugin] is not installed, this rule extracts and extends the same rule from ESLint core.
+However, if neither is found, the rule cannot be used.
-This rule is the same rule as core [object-property-newline] rule but it applies to the expressions in ``.
+[@stylistic/eslint-plugin]: https://eslint.style/packages/default
## :books: Further Reading
+- [@stylistic/object-property-newline]
- [object-property-newline]
+[@stylistic/object-property-newline]: https://eslint.style/rules/object-property-newline
[object-property-newline]: https://eslint.org/docs/rules/object-property-newline
## :rocket: Version
@@ -28,4 +36,4 @@ This rule was introduced in eslint-plugin-vue v7.0.0
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/object-property-newline.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/object-property-newline.js)
-Taken with ❤️ [from ESLint core](https://eslint.org/docs/latest/rules/object-property-newline)
+Taken with ❤️ [from ESLint Stylistic](https://eslint.style/rules/object-property-newline)
diff --git a/docs/rules/object-shorthand.md b/docs/rules/object-shorthand.md
index d51ea65c8..8b4365b19 100644
--- a/docs/rules/object-shorthand.md
+++ b/docs/rules/object-shorthand.md
@@ -5,11 +5,12 @@ title: vue/object-shorthand
description: Require or disallow method and property shorthand syntax for object literals in ``
since: v8.4.0
---
+
# vue/object-shorthand
> Require or disallow method and property shorthand syntax for object literals in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
This rule is the same rule as core [object-shorthand] rule but it applies to the expressions in ``.
diff --git a/docs/rules/one-component-per-file.md b/docs/rules/one-component-per-file.md
index 5e4fed2c4..8d31a0875 100644
--- a/docs/rules/one-component-per-file.md
+++ b/docs/rules/one-component-per-file.md
@@ -5,11 +5,12 @@ title: vue/one-component-per-file
description: enforce that each component should be in its own file
since: v7.0.0
---
+
# vue/one-component-per-file
> enforce that each component should be in its own file
-- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -48,6 +49,10 @@ export default {
Nothing.
+## :couple: Related Rules
+
+- [vue/require-default-export](./require-default-export.md)
+
## :books: Further Reading
- [Style guide - Component files](https://vuejs.org/style-guide/rules-strongly-recommended.html#component-files)
diff --git a/docs/rules/operator-linebreak.md b/docs/rules/operator-linebreak.md
index a10765f9a..7d27b1438 100644
--- a/docs/rules/operator-linebreak.md
+++ b/docs/rules/operator-linebreak.md
@@ -5,18 +5,26 @@ title: vue/operator-linebreak
description: Enforce consistent linebreak style for operators in ``
since: v7.0.0
---
+
# vue/operator-linebreak
> Enforce consistent linebreak style for operators in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+
+This rule is the same rule as [@stylistic/operator-linebreak] rule but it applies to the expressions in ``.
+
+This rule extends the rule that [@stylistic/eslint-plugin] has, but if [@stylistic/eslint-plugin] is not installed, this rule extracts and extends the same rule from ESLint core.
+However, if neither is found, the rule cannot be used.
-This rule is the same rule as core [operator-linebreak] rule but it applies to the expressions in ``.
+[@stylistic/eslint-plugin]: https://eslint.style/packages/default
## :books: Further Reading
+- [@stylistic/operator-linebreak]
- [operator-linebreak]
+[@stylistic/operator-linebreak]: https://eslint.style/rules/operator-linebreak
[operator-linebreak]: https://eslint.org/docs/rules/operator-linebreak
## :rocket: Version
@@ -28,4 +36,4 @@ This rule was introduced in eslint-plugin-vue v7.0.0
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/operator-linebreak.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/operator-linebreak.js)
-Taken with ❤️ [from ESLint core](https://eslint.org/docs/latest/rules/operator-linebreak)
+Taken with ❤️ [from ESLint Stylistic](https://eslint.style/rules/operator-linebreak)
diff --git a/docs/rules/order-in-components.md b/docs/rules/order-in-components.md
index 8068a34d6..29d3eda1c 100644
--- a/docs/rules/order-in-components.md
+++ b/docs/rules/order-in-components.md
@@ -5,12 +5,14 @@ title: vue/order-in-components
description: enforce order of properties in components
since: v3.2.0
---
+
# vue/order-in-components
> enforce order of properties in components
-- :gear: This rule is included in `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
## :book: Rule Details
@@ -27,7 +29,7 @@ export default {
props: {
propA: Number
},
- data () {
+ data() {
return {
msg: 'Welcome to Your Vue.js App'
}
@@ -45,7 +47,7 @@ export default {
/* ✗ BAD */
export default {
name: 'app',
- data () {
+ data() {
return {
msg: 'Welcome to Your Vue.js App'
}
@@ -86,6 +88,8 @@ export default {
"model",
["props", "propsData"],
"emits",
+ "slots",
+ "expose",
"setup",
"asyncData",
"data",
diff --git a/docs/rules/padding-line-between-blocks.md b/docs/rules/padding-line-between-blocks.md
index 636308956..645efeac7 100644
--- a/docs/rules/padding-line-between-blocks.md
+++ b/docs/rules/padding-line-between-blocks.md
@@ -5,15 +5,16 @@ title: vue/padding-line-between-blocks
description: require or disallow padding lines between blocks
since: v6.2.0
---
+
# vue/padding-line-between-blocks
> require or disallow padding lines between blocks
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
-This rule requires or disallows blank lines between the given 2 blocks. Properly blank lines help developers to understand the code.
+This rule requires or disallows blank lines between blocks. Properly placed blank lines help developers understand the code.
diff --git a/docs/rules/padding-line-between-tags.md b/docs/rules/padding-line-between-tags.md
index 15f87753e..e5b5c4b41 100644
--- a/docs/rules/padding-line-between-tags.md
+++ b/docs/rules/padding-line-between-tags.md
@@ -5,11 +5,12 @@ title: vue/padding-line-between-tags
description: require or disallow newlines between sibling tags in template
since: v9.5.0
---
+
# vue/padding-line-between-tags
> require or disallow newlines between sibling tags in template
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
diff --git a/docs/rules/padding-lines-in-component-definition.md b/docs/rules/padding-lines-in-component-definition.md
index 78b23b326..eef694e14 100644
--- a/docs/rules/padding-lines-in-component-definition.md
+++ b/docs/rules/padding-lines-in-component-definition.md
@@ -5,11 +5,12 @@ title: vue/padding-lines-in-component-definition
description: require or disallow padding lines in component definition
since: v9.9.0
---
+
# vue/padding-lines-in-component-definition
> require or disallow padding lines in component definition
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
@@ -68,21 +69,21 @@ export default {
{
"vue/padding-lines-in-component-definition": ["error", {
"betweenOptions": "always" | "never",
-
- "withinOption": {
+
+ "withinOption": {
"props": {
"betweenItems": "always" | "never" | "ignore",
"withinEach": "always" | "never" | "ignore",
} | "always" | "never" | "ignore", // shortcut to set both
-
+
"data": {
"betweenItems": "always" | "never" | "ignore",
"withinEach": "always" | "never" | "ignore",
} | "always" | "never" | "ignore" // shortcut to set both
-
+
// ... all options
} | "always" | "never" | "ignore",
-
+
"groupSingleLineProperties": true | false
}]
}
@@ -104,14 +105,14 @@ export default {
export default {
name: 'GroupSingleLineProperties',
inheritAttrs: false,
-
+
props: {
modelValue: {
type: String,
default: '',
},
},
-
+
data() {
return {
count: 0,
@@ -135,18 +136,18 @@ export default {
type: String,
default: '',
},
-
+
isActive: {
type: Boolean,
default: false,
},
},
-
+
customOption: {
foo: () => {
return 'foo'
},
-
+
bar: () => {
return 'bar'
}
diff --git a/docs/rules/prefer-define-options.md b/docs/rules/prefer-define-options.md
index bb0357e94..110c1426a 100644
--- a/docs/rules/prefer-define-options.md
+++ b/docs/rules/prefer-define-options.md
@@ -2,14 +2,15 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/prefer-define-options
-description: enforce use of `defineOptions` instead of default export.
+description: enforce use of `defineOptions` instead of default export
since: v9.13.0
---
+
# vue/prefer-define-options
-> enforce use of `defineOptions` instead of default export.
+> enforce use of `defineOptions` instead of default export
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
diff --git a/docs/rules/prefer-import-from-vue.md b/docs/rules/prefer-import-from-vue.md
index f1cab9f08..2da6700f9 100644
--- a/docs/rules/prefer-import-from-vue.md
+++ b/docs/rules/prefer-import-from-vue.md
@@ -5,12 +5,13 @@ title: vue/prefer-import-from-vue
description: enforce import from 'vue' instead of import from '@vue/*'
since: v8.5.0
---
+
# vue/prefer-import-from-vue
-> enforce import from 'vue' instead of import from '@vue/*'
+> enforce import from 'vue' instead of import from '@vue/\*'
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/recommended"` and `*.configs["flat/recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
diff --git a/docs/rules/prefer-prop-type-boolean-first.md b/docs/rules/prefer-prop-type-boolean-first.md
index 1b652fafd..8282e32ba 100644
--- a/docs/rules/prefer-prop-type-boolean-first.md
+++ b/docs/rules/prefer-prop-type-boolean-first.md
@@ -5,6 +5,7 @@ title: vue/prefer-prop-type-boolean-first
description: enforce `Boolean` comes first in component prop types
since: v8.6.0
---
+
# vue/prefer-prop-type-boolean-first
> enforce `Boolean` comes first in component prop types
diff --git a/docs/rules/prefer-separate-static-class.md b/docs/rules/prefer-separate-static-class.md
index 22df25e19..610e3f2b8 100644
--- a/docs/rules/prefer-separate-static-class.md
+++ b/docs/rules/prefer-separate-static-class.md
@@ -5,11 +5,12 @@ title: vue/prefer-separate-static-class
description: require static class names in template to be in a separate `class` attribute
since: v8.2.0
---
+
# vue/prefer-separate-static-class
> require static class names in template to be in a separate `class` attribute
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
@@ -21,12 +22,12 @@ This rule reports static class names in dynamic class attributes.
-
+
-
+
```
diff --git a/docs/rules/prefer-template.md b/docs/rules/prefer-template.md
index bdd46315a..ae4d3fc29 100644
--- a/docs/rules/prefer-template.md
+++ b/docs/rules/prefer-template.md
@@ -5,11 +5,12 @@ title: vue/prefer-template
description: Require template literals instead of string concatenation in ``
since: v7.0.0
---
+
# vue/prefer-template
> Require template literals instead of string concatenation in ``
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
This rule is the same rule as core [prefer-template] rule but it applies to the expressions in ``.
diff --git a/docs/rules/prefer-true-attribute-shorthand.md b/docs/rules/prefer-true-attribute-shorthand.md
index 07e566d34..700921ce1 100644
--- a/docs/rules/prefer-true-attribute-shorthand.md
+++ b/docs/rules/prefer-true-attribute-shorthand.md
@@ -5,6 +5,7 @@ title: vue/prefer-true-attribute-shorthand
description: require shorthand form attribute when `v-bind` value is `true`
since: v8.5.0
---
+
# vue/prefer-true-attribute-shorthand
> require shorthand form attribute when `v-bind` value is `true`
@@ -80,12 +81,18 @@ Default options is `"always"`.
```json
{
- "vue/prefer-true-attribute-shorthand": ["error", "always" | "never"]
+ "vue/prefer-true-attribute-shorthand": ["error",
+ "always" | "never",
+ {
+ except: []
+ }
+ ]
}
```
- `"always"` (default) ... requires shorthand form.
- `"never"` ... requires long form.
+- `except` (`string[]`) ... specifies a list of attribute names that should be treated differently.
### `"never"`
@@ -104,6 +111,26 @@ Default options is `"always"`.
+### `"never", { 'except': ['value', '/^foo-/'] }`
+
+
+
+```vue
+
+
+
+
+
+
+
+
+
+
+
+```
+
+
+
## :couple: Related Rules
- [vue/no-boolean-default](./no-boolean-default.md)
diff --git a/docs/rules/prefer-use-template-ref.md b/docs/rules/prefer-use-template-ref.md
new file mode 100644
index 000000000..1b1b40385
--- /dev/null
+++ b/docs/rules/prefer-use-template-ref.md
@@ -0,0 +1,78 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/prefer-use-template-ref
+description: require using `useTemplateRef` instead of `ref`/`shallowRef` for template refs
+since: v9.31.0
+---
+
+# vue/prefer-use-template-ref
+
+> require using `useTemplateRef` instead of `ref`/`shallowRef` for template refs
+
+## :book: Rule Details
+
+Vue 3.5 introduced a new way of obtaining template refs via
+the [`useTemplateRef()`](https://vuejs.org/guide/essentials/template-refs.html#accessing-the-refs) API.
+
+This rule enforces using the new `useTemplateRef` function instead of `ref`/`shallowRef` for template refs.
+
+
+
+```vue
+
+
+
+
+
+
+
+```
+
+
+
+This rule skips `ref` template function refs as these should be used to allow custom implementation of storing `ref`. If you prefer
+`useTemplateRef`, you have to change the value of the template `ref` to a string.
+
+
+
+```vue
+
+
+
+
+
+
+```
+
+
+
+## :wrench: Options
+
+Nothing.
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.31.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/prefer-use-template-ref.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/prefer-use-template-ref.js)
diff --git a/docs/rules/prop-name-casing.md b/docs/rules/prop-name-casing.md
index 4f32bfa17..32681643c 100644
--- a/docs/rules/prop-name-casing.md
+++ b/docs/rules/prop-name-casing.md
@@ -5,11 +5,12 @@ title: vue/prop-name-casing
description: enforce specific casing for the Prop name in Vue components
since: v4.3.0
---
+
# vue/prop-name-casing
> enforce specific casing for the Prop name in Vue components
-- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -38,12 +39,18 @@ export default {
```json
{
- "vue/prop-name-casing": ["error", "camelCase" | "snake_case"]
+ "vue/prop-name-casing": ["error",
+ "camelCase" | "snake_case",
+ {
+ "ignoreProps": []
+ }
+ ]
}
```
- `"camelCase"` (default) ... Enforce property names in `props` to camel case.
- `"snake_case"` ... Enforce property names in `props` to snake case.
+- `ignoreProps` (`string[]`) ... An array of prop names (or patterns) that don't need to follow the specified casing.
### `"snake_case"`
@@ -66,6 +73,31 @@ export default {
+### `"ignoreProps": ["foo-bar", "/^_[a-z]+/u"]`
+
+
+
+```vue
+
+```
+
+
+
## :couple: Related Rules
- [vue/attribute-hyphenation](./attribute-hyphenation.md)
diff --git a/docs/rules/quote-props.md b/docs/rules/quote-props.md
index 7c280a6e1..9e2a91e79 100644
--- a/docs/rules/quote-props.md
+++ b/docs/rules/quote-props.md
@@ -2,21 +2,29 @@
pageClass: rule-details
sidebarDepth: 0
title: vue/quote-props
-description: Require quotes around object literal property names in ``
+description: Require quotes around object literal, type literal, interfaces and enums property names in ``
since: v8.4.0
---
+
# vue/quote-props
-> Require quotes around object literal property names in ``
+> Require quotes around object literal, type literal, interfaces and enums property names in ``
+
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
+
+This rule is the same rule as [@stylistic/quote-props] rule but it applies to the expressions in ``.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+This rule extends the rule that [@stylistic/eslint-plugin] has, but if [@stylistic/eslint-plugin] is not installed, this rule extracts and extends the same rule from ESLint core.
+However, if neither is found, the rule cannot be used.
-This rule is the same rule as core [quote-props] rule but it applies to the expressions in ``.
+[@stylistic/eslint-plugin]: https://eslint.style/packages/default
## :books: Further Reading
+- [@stylistic/quote-props]
- [quote-props]
+[@stylistic/quote-props]: https://eslint.style/rules/quote-props
[quote-props]: https://eslint.org/docs/rules/quote-props
## :rocket: Version
@@ -28,4 +36,4 @@ This rule was introduced in eslint-plugin-vue v8.4.0
- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/quote-props.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/quote-props.js)
-Taken with ❤️ [from ESLint core](https://eslint.org/docs/latest/rules/quote-props)
+Taken with ❤️ [from ESLint Stylistic](https://eslint.style/rules/quote-props)
diff --git a/docs/rules/require-component-is.md b/docs/rules/require-component-is.md
index 8d376aa65..40280a975 100644
--- a/docs/rules/require-component-is.md
+++ b/docs/rules/require-component-is.md
@@ -5,11 +5,12 @@ title: vue/require-component-is
description: require `v-bind:is` of `` elements
since: v3.0.0
---
+
# vue/require-component-is
> require `v-bind:is` of `` elements
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -20,12 +21,12 @@ This rule reports the `` elements which do not have `v-bind:is` attri
```vue
-
-
+
+
-
-
+
+
```
diff --git a/docs/rules/require-default-export.md b/docs/rules/require-default-export.md
new file mode 100644
index 000000000..9266eee89
--- /dev/null
+++ b/docs/rules/require-default-export.md
@@ -0,0 +1,60 @@
+---
+pageClass: rule-details
+sidebarDepth: 0
+title: vue/require-default-export
+description: require components to be the default export
+since: v9.28.0
+---
+
+# vue/require-default-export
+
+> require components to be the default export
+
+## :book: Rule Details
+
+This rule reports when a Vue component does not have a default export, if the component is not defined as `
+```
+
+
+
+
+
+```vue
+
+
+```
+
+
+
+## :wrench: Options
+
+Nothing.
+
+## :couple: Related Rules
+
+- [vue/one-component-per-file](./one-component-per-file.md)
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.28.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/require-default-export.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/require-default-export.js)
diff --git a/docs/rules/require-default-prop.md b/docs/rules/require-default-prop.md
index 44fba0f29..c96edc24e 100644
--- a/docs/rules/require-default-prop.md
+++ b/docs/rules/require-default-prop.md
@@ -5,11 +5,12 @@ title: vue/require-default-prop
description: require default value for props
since: v3.13.0
---
+
# vue/require-default-prop
> require default value for props
-- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
diff --git a/docs/rules/require-direct-export.md b/docs/rules/require-direct-export.md
index 52661b7c1..4f2e37650 100644
--- a/docs/rules/require-direct-export.md
+++ b/docs/rules/require-direct-export.md
@@ -5,6 +5,7 @@ title: vue/require-direct-export
description: require the component to be directly exported
since: v5.2.0
---
+
# vue/require-direct-export
> require the component to be directly exported
@@ -70,7 +71,7 @@ export default ComponentA
```vue
```
@@ -83,7 +84,7 @@ export default props => h('div', props.msg)
```vue
```
diff --git a/docs/rules/require-emit-validator.md b/docs/rules/require-emit-validator.md
index 6f0e209b2..34b674bf5 100644
--- a/docs/rules/require-emit-validator.md
+++ b/docs/rules/require-emit-validator.md
@@ -5,6 +5,7 @@ title: vue/require-emit-validator
description: require type definitions in emits
since: v7.10.0
---
+
# vue/require-emit-validator
> require type definitions in emits
diff --git a/docs/rules/require-explicit-emits.md b/docs/rules/require-explicit-emits.md
index 6d681c551..5c5d3f8a9 100644
--- a/docs/rules/require-explicit-emits.md
+++ b/docs/rules/require-explicit-emits.md
@@ -5,11 +5,12 @@ title: vue/require-explicit-emits
description: require `emits` option with name triggered by `$emit()`
since: v7.0.0
---
+
# vue/require-explicit-emits
> require `emits` option with name triggered by `$emit()`
-- :gear: This rule is included in `"plugin:vue/vue3-strongly-recommended"` and `"plugin:vue/vue3-recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/recommended"` and `*.configs["flat/recommended"]`.
- :bulb: Some problems reported by this rule are manually fixable by editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).
## :book: Rule Details
@@ -17,16 +18,16 @@ since: v7.0.0
This rule reports event triggers not declared with the `emits` option. (The `emits` option is a new in Vue.js 3.0.0+)
Explicit `emits` declaration serves as self-documenting code. This can be useful for other developers to instantly understand what events the component is supposed to emit.
-Also, with attribute fallthrough changes in Vue.js 3.0.0+, `v-on` listeners on components will fallthrough as native listeners by default. Declare it as a component-only event in `emits` to avoid unnecessary registration of native listeners.
+Also, with attribute fallthrough changes in Vue.js 3.0.0+, `v-on` listeners on components will fallthrough as native listeners by default. Declare it as a component-only event in `emits` to avoid unnecessary registration of native listeners.
```vue
-
+
-
+
+```
+
+
+
+
+
+```vue
+
+
+
+
+
+
+
+
+
+
+```
+
+
+
+## :wrench: Options
+
+Nothing.
+
+## :rocket: Version
+
+This rule was introduced in eslint-plugin-vue v9.21.0
+
+## :mag: Implementation
+
+- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/require-explicit-slots.js)
+- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/require-explicit-slots.js)
diff --git a/docs/rules/require-expose.md b/docs/rules/require-expose.md
index d6b27c7fc..98762a8c9 100644
--- a/docs/rules/require-expose.md
+++ b/docs/rules/require-expose.md
@@ -5,6 +5,7 @@ title: vue/require-expose
description: require declare public properties using `expose`
since: v7.14.0
---
+
# vue/require-expose
> require declare public properties using `expose`
diff --git a/docs/rules/require-macro-variable-name.md b/docs/rules/require-macro-variable-name.md
index 75b90a299..af6db1733 100644
--- a/docs/rules/require-macro-variable-name.md
+++ b/docs/rules/require-macro-variable-name.md
@@ -5,6 +5,7 @@ title: vue/require-macro-variable-name
description: require a certain macro variable name
since: v9.15.0
---
+
# vue/require-macro-variable-name
> require a certain macro variable name
diff --git a/docs/rules/require-name-property.md b/docs/rules/require-name-property.md
index d7653b4b5..6d9974fc4 100644
--- a/docs/rules/require-name-property.md
+++ b/docs/rules/require-name-property.md
@@ -5,6 +5,7 @@ title: vue/require-name-property
description: require a name property in Vue components
since: v6.1.0
---
+
# vue/require-name-property
> require a name property in Vue components
@@ -33,8 +34,7 @@ export default {
```vue
```
diff --git a/docs/rules/require-prop-comment.md b/docs/rules/require-prop-comment.md
index 5cd29c375..25b78c346 100644
--- a/docs/rules/require-prop-comment.md
+++ b/docs/rules/require-prop-comment.md
@@ -5,6 +5,7 @@ title: vue/require-prop-comment
description: require props to have a comment
since: v9.8.0
---
+
# vue/require-prop-comment
> require props to have a comment
diff --git a/docs/rules/require-prop-type-constructor.md b/docs/rules/require-prop-type-constructor.md
index b67d49478..e872fc5d4 100644
--- a/docs/rules/require-prop-type-constructor.md
+++ b/docs/rules/require-prop-type-constructor.md
@@ -5,12 +5,13 @@ title: vue/require-prop-type-constructor
description: require prop type to be a constructor
since: v5.0.0
---
+
# vue/require-prop-type-constructor
> require prop type to be a constructor
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
-- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) can automatically fix some of the problems reported by this rule.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
+- :wrench: The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fix-problems) can automatically fix some of the problems reported by this rule.
## :book: Rule Details
@@ -38,7 +39,7 @@ export default {
anotherProp: [Number, String],
myFieldWithBadType: {
type: Object,
- default: function() {
+ default: function () {
return {}
},
},
@@ -47,16 +48,16 @@ export default {
default: 1,
},
/* ✗ BAD */
- myProp: "Number",
- anotherProp: ["Number", "String"],
+ myProp: 'Number',
+ anotherProp: ['Number', 'String'],
myFieldWithBadType: {
- type: "Object",
- default: function() {
+ type: 'Object',
+ default: function () {
return {}
},
},
myOtherFieldWithBadType: {
- type: "Number",
+ type: 'Number',
default: 1,
},
}
diff --git a/docs/rules/require-prop-types.md b/docs/rules/require-prop-types.md
index df9a0945a..20e46453f 100644
--- a/docs/rules/require-prop-types.md
+++ b/docs/rules/require-prop-types.md
@@ -5,11 +5,12 @@ title: vue/require-prop-types
description: require type definitions in props
since: v3.9.0
---
+
# vue/require-prop-types
> require type definitions in props
-- :gear: This rule is included in all of `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
diff --git a/docs/rules/require-render-return.md b/docs/rules/require-render-return.md
index 9de913bdf..88cbf1efb 100644
--- a/docs/rules/require-render-return.md
+++ b/docs/rules/require-render-return.md
@@ -5,11 +5,12 @@ title: vue/require-render-return
description: enforce render function to always return value
since: v3.10.0
---
+
# vue/require-render-return
> enforce render function to always return value
-- :gear: This rule is included in all of `"plugin:vue/vue3-essential"`, `"plugin:vue/essential"`, `"plugin:vue/vue3-strongly-recommended"`, `"plugin:vue/strongly-recommended"`, `"plugin:vue/vue3-recommended"` and `"plugin:vue/recommended"`.
+- :gear: This rule is included in all of `"plugin:vue/essential"`, `*.configs["flat/essential"]`, `"plugin:vue/vue2-essential"`, `*.configs["flat/vue2-essential"]`, `"plugin:vue/strongly-recommended"`, `*.configs["flat/strongly-recommended"]`, `"plugin:vue/vue2-strongly-recommended"`, `*.configs["flat/vue2-strongly-recommended"]`, `"plugin:vue/recommended"`, `*.configs["flat/recommended"]`, `"plugin:vue/vue2-recommended"` and `*.configs["flat/vue2-recommended"]`.
## :book: Rule Details
@@ -21,7 +22,7 @@ This rule aims to enforce render function to always return value
@@ -55,7 +56,7 @@ After turning on, `Foo` is being marked as used and `no-unused-vars` rule doesn'
You can disable this rule in any of the following cases:
-- You are using `vue-eslint-parser` v9.0.0 or later.
+- You are using [`vue-eslint-parser`](https://github.com/vuejs/vue-eslint-parser) v9.0.0 or later.
- You are not using `
diff --git a/tests/fixtures/script-indent/ts-declare-function-04.vue b/tests/fixtures/script-indent/ts-declare-function-04.vue
index 3a62cc896..7ae12d894 100644
--- a/tests/fixtures/script-indent/ts-declare-function-04.vue
+++ b/tests/fixtures/script-indent/ts-declare-function-04.vue
@@ -1,7 +1,6 @@
-
+
diff --git a/tests/fixtures/utils/ref-object-references/ref-objects/defineModel01/source.vue b/tests/fixtures/utils/ref-object-references/ref-objects/defineModel01/source.vue
new file mode 100644
index 000000000..7cca9156c
--- /dev/null
+++ b/tests/fixtures/utils/ref-object-references/ref-objects/defineModel01/source.vue
@@ -0,0 +1,24 @@
+
diff --git a/tests/fixtures/utils/ref-object-references/ref-objects/defineModel02/result.vue b/tests/fixtures/utils/ref-object-references/ref-objects/defineModel02/result.vue
new file mode 100644
index 000000000..c2903d01f
--- /dev/null
+++ b/tests/fixtures/utils/ref-object-references/ref-objects/defineModel02/result.vue
@@ -0,0 +1,16 @@
+
diff --git a/tests/fixtures/utils/ref-object-references/ref-objects/defineModel02/source.vue b/tests/fixtures/utils/ref-object-references/ref-objects/defineModel02/source.vue
new file mode 100644
index 000000000..012cb9349
--- /dev/null
+++ b/tests/fixtures/utils/ref-object-references/ref-objects/defineModel02/source.vue
@@ -0,0 +1,16 @@
+
diff --git a/tests/fixtures/utils/ts-utils/tsconfig.json b/tests/fixtures/utils/ts-utils/tsconfig.json
index c13ef64e3..f35717b90 100644
--- a/tests/fixtures/utils/ts-utils/tsconfig.json
+++ b/tests/fixtures/utils/ts-utils/tsconfig.json
@@ -1,6 +1,9 @@
{
"compilerOptions": {
"strict": true,
- "skipLibCheck": true
- }
+ "skipLibCheck": true,
+ "module": "Node16",
+ "moduleResolution": "Node16",
+ },
+ "include": ["./src/*.ts","./src/*.vue"],
}
diff --git a/tests/integrations/eslint-plugin-import.js b/tests/integrations/eslint-plugin-import.js
index a408fdcdd..6f4be7acf 100644
--- a/tests/integrations/eslint-plugin-import.js
+++ b/tests/integrations/eslint-plugin-import.js
@@ -9,18 +9,12 @@ const cp = require('child_process')
const path = require('path')
const semver = require('semver')
+const PLUGIN_DIR = path.join(__dirname, 'eslint-plugin-import')
const ESLINT = `.${path.sep}node_modules${path.sep}.bin${path.sep}eslint`
describe('Integration with eslint-plugin-import', () => {
- let originalCwd
-
- before(() => {
- originalCwd = process.cwd()
- process.chdir(path.join(__dirname, 'eslint-plugin-import'))
- cp.execSync('npm i', { stdio: 'inherit' })
- })
- after(() => {
- process.chdir(originalCwd)
+ beforeAll(() => {
+ cp.execSync('npm i', { cwd: PLUGIN_DIR, stdio: 'inherit' })
})
// https://github.com/vuejs/eslint-plugin-vue/issues/21#issuecomment-308957697
@@ -30,15 +24,17 @@ describe('Integration with eslint-plugin-import', () => {
if (
!semver.satisfies(
process.version,
- require(path.join(
- __dirname,
- 'eslint-plugin-import/node_modules/eslint/package.json'
- )).engines.node
+ require(
+ path.join(
+ __dirname,
+ 'eslint-plugin-import/node_modules/eslint/package.json'
+ )
+ ).engines.node
)
) {
return
}
- cp.execSync(`${ESLINT} a.vue`, { stdio: 'inherit' })
+ cp.execSync(`${ESLINT} a.vue`, { cwd: PLUGIN_DIR, stdio: 'inherit' })
})
})
diff --git a/tests/integrations/eslint-plugin-import/.eslintrc.json b/tests/integrations/eslint-plugin-import/.eslintrc.json
index bd240b24b..20585a5fd 100644
--- a/tests/integrations/eslint-plugin-import/.eslintrc.json
+++ b/tests/integrations/eslint-plugin-import/.eslintrc.json
@@ -1,22 +1,16 @@
{
- "root": true,
- "parserOptions": {
- "sourceType": "module",
- "ecmaVersion": 2015
- },
- "parser": "vue-eslint-parser",
- "plugins": [
- "import",
- "vue"
- ],
- "rules": {
- "import/default": "warn",
- "import/namespace": "warn"
- },
- "settings": {
- "import/extensions": [
- ".js",
- ".vue"
- ]
- }
+ "root": true,
+ "parserOptions": {
+ "sourceType": "module",
+ "ecmaVersion": 2015
+ },
+ "parser": "vue-eslint-parser",
+ "plugins": ["import", "vue"],
+ "rules": {
+ "import/default": "warn",
+ "import/namespace": "warn"
+ },
+ "settings": {
+ "import/extensions": [".js", ".vue"]
+ }
}
diff --git a/tests/integrations/eslint-plugin-import/a.vue b/tests/integrations/eslint-plugin-import/a.vue
index ce4b66e14..58a29d388 100644
--- a/tests/integrations/eslint-plugin-import/a.vue
+++ b/tests/integrations/eslint-plugin-import/a.vue
@@ -1,10 +1,10 @@
-
+
diff --git a/tests/integrations/eslint-plugin-import/b.vue b/tests/integrations/eslint-plugin-import/b.vue
index 488aa4466..9cd9ffff4 100644
--- a/tests/integrations/eslint-plugin-import/b.vue
+++ b/tests/integrations/eslint-plugin-import/b.vue
@@ -1,5 +1,5 @@
-
).', 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
}
]
}
diff --git a/tests/lib/rules/jsx-uses-vars.js b/tests/lib/rules/jsx-uses-vars.js
index 3a2c7e82b..0f7c71146 100644
--- a/tests/lib/rules/jsx-uses-vars.js
+++ b/tests/lib/rules/jsx-uses-vars.js
@@ -4,31 +4,53 @@
*/
'use strict'
-const eslint = require('eslint')
+const semver = require('semver')
+const { RuleTester, ESLint } = require('../../eslint-compat')
const rule = require('../../../lib/rules/jsx-uses-vars')
-const ruleNoUnusedVars = new (require('eslint').Linter)()
- .getRules()
- .get('no-unused-vars')
+const { getCoreRule } = require('../../../lib/utils')
+const ruleNoUnusedVars = getCoreRule('no-unused-vars')
-const RuleTester = eslint.RuleTester
const ruleTester = new RuleTester({
- parserOptions: {
+ languageOptions: {
ecmaVersion: 6,
sourceType: 'module',
- ecmaFeatures: {
- jsx: true
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true
+ }
+ }
+ },
+ plugins: {
+ vue: {
+ rules: {
+ 'jsx-uses-vars': rule
+ }
}
}
})
-const linter = ruleTester.linter || eslint.linter
-linter.defineRule('jsx-uses-vars', rule)
+ruleTester.run('jsx-uses-vars', rule, {
+ // Visually check that there are no warnings in the console.
+ valid: [
+ `
+ import SomeComponent from './SomeComponent.jsx';
+ export default {
+ render () {
+ return (
+
+ )
+ },
+ };
+ `
+ ],
+ invalid: []
+})
describe('jsx-uses-vars', () => {
ruleTester.run('no-unused-vars', ruleNoUnusedVars, {
valid: [
`
- /* eslint jsx-uses-vars: 1 */
+ /* eslint vue/jsx-uses-vars: 1 */
import SomeComponent from './SomeComponent.jsx';
export default {
render () {
@@ -39,7 +61,7 @@ describe('jsx-uses-vars', () => {
};
`,
`
- /* eslint jsx-uses-vars: 1 */
+ /* eslint vue/jsx-uses-vars: 1 */
import SomeComponent from './SomeComponent.vue';
import OtherComponent from './OtherComponent.vue';
@@ -62,7 +84,7 @@ describe('jsx-uses-vars', () => {
}
`,
`
- /* eslint jsx-uses-vars: 1 */
+ /* eslint vue/jsx-uses-vars: 1 */
export default {
render () {
return (
@@ -76,7 +98,7 @@ describe('jsx-uses-vars', () => {
invalid: [
{
code: `
- /* eslint jsx-uses-vars: 1 */
+ /* eslint vue/jsx-uses-vars: 1 */
import SomeComponent from './SomeComponent.jsx';
export default {
render () {
@@ -86,13 +108,33 @@ describe('jsx-uses-vars', () => {
`,
errors: [
{
- message: "'SomeComponent' is defined but never used."
+ message: "'SomeComponent' is defined but never used.",
+ suggestions: semver.gte(ESLint.version, '9.17.0')
+ ? [
+ {
+ desc: "Remove unused variable 'SomeComponent'.",
+ output: `
+ /* eslint vue/jsx-uses-vars: 1 */
+ import './SomeComponent.jsx';
+ export default {
+ render () {
+ return ;
+ },
+ };
+ `
+ }
+ ]
+ : null,
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 29
}
]
},
{
code: `
- /* eslint jsx-uses-vars: 1 */
+ /* eslint vue/jsx-uses-vars: 1 */
import SomeComponent from './SomeComponent.jsx';
const wrapper = {
something: SomeComponent,
@@ -106,7 +148,29 @@ describe('jsx-uses-vars', () => {
`,
errors: [
{
- message: "'wrapper' is assigned a value but never used."
+ message: "'wrapper' is assigned a value but never used.",
+ suggestions: semver.gte(ESLint.version, '9.17.0')
+ ? [
+ {
+ desc: "Remove unused variable 'wrapper'.",
+ output: `
+ /* eslint vue/jsx-uses-vars: 1 */
+ import SomeComponent from './SomeComponent.jsx';
+
+
+ export default {
+ render () {
+ return ;
+ },
+ };
+ `
+ }
+ ]
+ : null,
+ line: 4,
+ column: 15,
+ endLine: 4,
+ endColumn: 22
}
]
}
diff --git a/tests/lib/rules/key-spacing.js b/tests/lib/rules/key-spacing.js
index 3d8d48a22..c8a5a9ddd 100644
--- a/tests/lib/rules/key-spacing.js
+++ b/tests/lib/rules/key-spacing.js
@@ -3,12 +3,11 @@
*/
'use strict'
-const RuleTester = require('eslint').RuleTester
+const RuleTester = require('../../eslint-compat').RuleTester
const rule = require('../../../lib/rules/key-spacing')
const tester = new RuleTester({
- parser: require.resolve('vue-eslint-parser'),
- parserOptions: { ecmaVersion: 2015 }
+ languageOptions: { parser: require('vue-eslint-parser'), ecmaVersion: 2015 }
})
tester.run('key-spacing', rule, {
@@ -25,8 +24,20 @@ tester.run('key-spacing', rule, {
code: '',
output: '',
errors: [
- "Extra space after key 'a'.",
- "Missing space before value for key 'a'."
+ {
+ message: "Extra space after key 'a'.",
+ line: 1,
+ column: 25,
+ endLine: 1,
+ endColumn: 26
+ },
+ {
+ message: "Missing space before value for key 'a'.",
+ line: 1,
+ column: 27,
+ endLine: 1,
+ endColumn: 28
+ }
]
},
{
@@ -34,8 +45,20 @@ tester.run('key-spacing', rule, {
output: '',
options: [{ beforeColon: true }],
errors: [
- "Missing space after key 'a'.",
- "Missing space before value for key 'a'."
+ {
+ message: "Missing space after key 'a'.",
+ line: 1,
+ column: 32,
+ endLine: 1,
+ endColumn: 33
+ },
+ {
+ message: "Missing space before value for key 'a'.",
+ line: 1,
+ column: 34,
+ endLine: 1,
+ endColumn: 35
+ }
]
}
]
diff --git a/tests/lib/rules/keyword-spacing.js b/tests/lib/rules/keyword-spacing.js
index dadd553b7..3236a1fa1 100644
--- a/tests/lib/rules/keyword-spacing.js
+++ b/tests/lib/rules/keyword-spacing.js
@@ -3,12 +3,11 @@
*/
'use strict'
-const RuleTester = require('eslint').RuleTester
+const RuleTester = require('../../eslint-compat').RuleTester
const rule = require('../../../lib/rules/keyword-spacing')
const tester = new RuleTester({
- parser: require.resolve('vue-eslint-parser'),
- parserOptions: { ecmaVersion: 2015 }
+ languageOptions: { parser: require('vue-eslint-parser'), ecmaVersion: 2015 }
})
tester.run('keyword-spacing', rule, {
@@ -69,23 +68,38 @@ tester.run('keyword-spacing', rule, {
errors: [
{
message: 'Expected space(s) after "if".',
- line: 3
+ line: 3,
+ column: 11,
+ endLine: 3,
+ endColumn: 13
},
{
message: 'Expected space(s) before "else".',
- line: 5
+ line: 5,
+ column: 12,
+ endLine: 5,
+ endColumn: 16
},
{
message: 'Expected space(s) after "if".',
- line: 5
+ line: 5,
+ column: 17,
+ endLine: 5,
+ endColumn: 19
},
{
message: 'Expected space(s) before "else".',
- line: 7
+ line: 7,
+ column: 12,
+ endLine: 7,
+ endColumn: 16
},
{
message: 'Expected space(s) after "else".',
- line: 7
+ line: 7,
+ column: 12,
+ endLine: 7,
+ endColumn: 16
}
]
},
@@ -116,23 +130,38 @@ tester.run('keyword-spacing', rule, {
errors: [
{
message: 'Unexpected space(s) after "if".',
- line: 3
+ line: 3,
+ column: 13,
+ endLine: 3,
+ endColumn: 14
},
{
message: 'Unexpected space(s) before "else".',
- line: 5
+ line: 5,
+ column: 12,
+ endLine: 5,
+ endColumn: 13
},
{
message: 'Unexpected space(s) after "if".',
- line: 5
+ line: 5,
+ column: 20,
+ endLine: 5,
+ endColumn: 21
},
{
message: 'Unexpected space(s) before "else".',
- line: 7
+ line: 7,
+ column: 12,
+ endLine: 7,
+ endColumn: 13
},
{
message: 'Unexpected space(s) after "else".',
- line: 7
+ line: 7,
+ column: 17,
+ endLine: 7,
+ endColumn: 18
}
]
},
@@ -146,7 +175,10 @@ tester.run('keyword-spacing', rule, {
errors: [
{
message: 'Expected space(s) after "return".',
- line: 2
+ line: 2,
+ column: 56,
+ endLine: 2,
+ endColumn: 62
}
]
}
diff --git a/tests/lib/rules/match-component-file-name.js b/tests/lib/rules/match-component-file-name.js
index 82c75ccc6..494c8455a 100644
--- a/tests/lib/rules/match-component-file-name.js
+++ b/tests/lib/rules/match-component-file-name.js
@@ -5,15 +5,17 @@
'use strict'
const rule = require('../../../lib/rules/match-component-file-name')
-const RuleTester = require('eslint').RuleTester
+const RuleTester = require('../../eslint-compat').RuleTester
-const jsxParserOptions = {
+const jsxLanguageOptions = {
ecmaVersion: 2018,
sourceType: 'module',
- ecmaFeatures: { jsx: true }
+ parserOptions: {
+ ecmaFeatures: { jsx: true }
+ }
}
-const parserOptions = {
+const languageOptions = {
ecmaVersion: 2018,
sourceType: 'module'
}
@@ -30,7 +32,7 @@ ruleTester.run('match-component-file-name', rule, {
render() { return }
}
`,
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -40,7 +42,7 @@ ruleTester.run('match-component-file-name', rule, {
render() { return }
}
`,
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -51,7 +53,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -62,7 +64,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -73,7 +75,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -84,7 +86,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -95,7 +97,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -106,7 +108,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['vue'] }], // missing jsx in options
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
// .vue
@@ -120,8 +122,10 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
- parser: require.resolve('vue-eslint-parser'),
- parserOptions // options default to [['jsx']]
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -134,8 +138,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['jsx'] }], // missing jsx in options
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -147,8 +153,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -158,8 +166,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -172,8 +182,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -186,8 +198,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -200,8 +214,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -214,8 +230,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
{
filename: 'MyComponent.vue',
@@ -228,8 +246,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
},
// .js
@@ -241,14 +261,14 @@ ruleTester.run('match-component-file-name', rule, {
template: ''
})
`,
- parserOptions // options default to [['jsx']]
+ languageOptions // options default to [['jsx']]
},
{
filename: 'MyComponent.js',
code: `
Vue.mixin({})
`,
- parserOptions // options default to [['jsx']]
+ languageOptions // options default to [['jsx']]
},
{
filename: 'MyComponent.js',
@@ -257,7 +277,7 @@ ruleTester.run('match-component-file-name', rule, {
template: ''
})
`,
- parserOptions // options default to [['jsx']]
+ languageOptions // options default to [['jsx']]
},
{
filename: 'MyComponent.js',
@@ -268,7 +288,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['vue'] }], // missing 'js' in options
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -276,7 +296,7 @@ ruleTester.run('match-component-file-name', rule, {
Vue.mixin({})
`,
options: [{ extensions: ['vue'] }], // missing 'js' in options
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -286,7 +306,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['vue'] }], // missing 'js' in options
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -296,7 +316,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -307,7 +327,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -318,7 +338,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -329,7 +349,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -340,7 +360,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -351,7 +371,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -359,7 +379,7 @@ ruleTester.run('match-component-file-name', rule, {
Vue.mixin({})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -369,7 +389,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -379,7 +399,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -389,7 +409,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -399,7 +419,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -409,7 +429,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -419,7 +439,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -429,7 +449,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -439,7 +459,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -449,7 +469,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.js',
@@ -459,7 +479,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
{
filename: 'index.js',
@@ -478,7 +498,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions
+ languageOptions
},
// casing
@@ -490,7 +510,7 @@ ruleTester.run('match-component-file-name', rule, {
render() { return }
}
`,
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'my-component.jsx',
@@ -500,7 +520,7 @@ ruleTester.run('match-component-file-name', rule, {
render() { return }
}
`,
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -510,7 +530,7 @@ ruleTester.run('match-component-file-name', rule, {
render() { return }
}
`,
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'my-component.jsx',
@@ -521,7 +541,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ shouldMatchCase: true }],
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
{
filename: 'MyComponent.jsx',
@@ -532,20 +552,22 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ shouldMatchCase: true }],
- parserOptions: jsxParserOptions
+ languageOptions: jsxLanguageOptions
},
// https://github.com/vuejs/eslint-plugin-vue/issues/1018
{
filename: 'test.jsx',
code: `fn1(component.data)`,
- parserOptions
+ languageOptions
},
{
filename: 'MyComponent.vue',
code: ``,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ }
}
],
@@ -559,7 +581,7 @@ ruleTester.run('match-component-file-name', rule, {
render() { return }
}
`,
- parserOptions: jsxParserOptions,
+ languageOptions: jsxLanguageOptions,
errors: [
{
message:
@@ -574,7 +596,11 @@ ruleTester.run('match-component-file-name', rule, {
}
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -587,7 +613,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions,
+ languageOptions: jsxLanguageOptions,
errors: [
{
message:
@@ -602,7 +628,11 @@ ruleTester.run('match-component-file-name', rule, {
}
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -615,7 +645,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions,
+ languageOptions: jsxLanguageOptions,
errors: [
{
message:
@@ -630,7 +660,11 @@ ruleTester.run('match-component-file-name', rule, {
}
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -643,7 +677,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ extensions: ['jsx'] }],
- parserOptions: jsxParserOptions,
+ languageOptions: jsxLanguageOptions,
errors: [
{
message:
@@ -658,7 +692,11 @@ ruleTester.run('match-component-file-name', rule, {
}
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -675,8 +713,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions,
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ },
errors: [
{
message:
@@ -693,7 +733,11 @@ ruleTester.run('match-component-file-name', rule, {
`
}
- ]
+ ],
+ line: 4,
+ column: 19,
+ endLine: 4,
+ endColumn: 31
}
]
},
@@ -708,8 +752,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions,
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ },
errors: [
{
message:
@@ -726,7 +772,11 @@ ruleTester.run('match-component-file-name', rule, {
`
}
- ]
+ ],
+ line: 4,
+ column: 19,
+ endLine: 4,
+ endColumn: 31
}
]
},
@@ -741,8 +791,10 @@ ruleTester.run('match-component-file-name', rule, {
`,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions,
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ },
errors: [
{
message:
@@ -759,7 +811,11 @@ ruleTester.run('match-component-file-name', rule, {
`
}
- ]
+ ],
+ line: 4,
+ column: 19,
+ endLine: 4,
+ endColumn: 31
}
]
},
@@ -774,7 +830,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -789,7 +845,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -802,7 +862,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -817,7 +877,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -830,7 +894,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -845,7 +909,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -857,7 +925,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -871,7 +939,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -883,7 +955,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -897,7 +969,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -909,7 +985,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -923,7 +999,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 29
}
]
},
@@ -935,7 +1015,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -949,7 +1029,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 2,
+ column: 23,
+ endLine: 2,
+ endColumn: 35
}
]
},
@@ -961,7 +1045,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -975,7 +1059,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 2,
+ column: 23,
+ endLine: 2,
+ endColumn: 35
}
]
},
@@ -987,7 +1075,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -1001,7 +1089,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 2,
+ column: 23,
+ endLine: 2,
+ endColumn: 35
}
]
},
@@ -1013,7 +1105,7 @@ ruleTester.run('match-component-file-name', rule, {
})
`,
options: [{ extensions: ['js'] }],
- parserOptions,
+ languageOptions,
errors: [
{
message:
@@ -1027,7 +1119,11 @@ ruleTester.run('match-component-file-name', rule, {
})
`
}
- ]
+ ],
+ line: 2,
+ column: 23,
+ endLine: 2,
+ endColumn: 35
}
]
},
@@ -1042,7 +1138,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ shouldMatchCase: true }],
- parserOptions: jsxParserOptions,
+ languageOptions: jsxLanguageOptions,
errors: [
{
message:
@@ -1057,7 +1153,11 @@ ruleTester.run('match-component-file-name', rule, {
}
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 31
}
]
},
@@ -1070,7 +1170,7 @@ ruleTester.run('match-component-file-name', rule, {
}
`,
options: [{ shouldMatchCase: true }],
- parserOptions: jsxParserOptions,
+ languageOptions: jsxLanguageOptions,
errors: [
{
message:
@@ -1085,7 +1185,11 @@ ruleTester.run('match-component-file-name', rule, {
}
`
}
- ]
+ ],
+ line: 3,
+ column: 17,
+ endLine: 3,
+ endColumn: 30
}
]
},
@@ -1093,8 +1197,10 @@ ruleTester.run('match-component-file-name', rule, {
filename: 'MyComponent.vue',
code: ``,
options: [{ extensions: ['vue'] }],
- parser: require.resolve('vue-eslint-parser'),
- parserOptions,
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ...languageOptions
+ },
errors: [
{
message:
@@ -1104,7 +1210,11 @@ ruleTester.run('match-component-file-name', rule, {
desc: 'Rename component to match file name.',
output: ``
}
- ]
+ ],
+ line: 1,
+ column: 37,
+ endLine: 1,
+ endColumn: 52
}
]
}
diff --git a/tests/lib/rules/match-component-import-name.js b/tests/lib/rules/match-component-import-name.js
index a05bfec1a..be6f0a1aa 100644
--- a/tests/lib/rules/match-component-import-name.js
+++ b/tests/lib/rules/match-component-import-name.js
@@ -4,12 +4,12 @@
*/
'use strict'
-const RuleTester = require('eslint').RuleTester
+const RuleTester = require('../../eslint-compat').RuleTester
const rule = require('../../../lib/rules/match-component-import-name')
const tester = new RuleTester({
- parser: require.resolve('vue-eslint-parser'),
- parserOptions: {
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
ecmaVersion: 2020,
sourceType: 'module'
}
@@ -65,7 +65,9 @@ tester.run('match-component-import-name', rule, {
message:
'Component alias InvalidExport should be one of: SomeRandomName, some-random-name.',
line: 2,
- column: 47
+ column: 47,
+ endLine: 2,
+ endColumn: 76
}
]
}
diff --git a/tests/lib/rules/max-attributes-per-line.js b/tests/lib/rules/max-attributes-per-line.js
index fdee711e7..5b88f7857 100644
--- a/tests/lib/rules/max-attributes-per-line.js
+++ b/tests/lib/rules/max-attributes-per-line.js
@@ -4,12 +4,11 @@
*/
'use strict'
-const RuleTester = require('eslint').RuleTester
+const RuleTester = require('../../eslint-compat').RuleTester
const rule = require('../../../lib/rules/max-attributes-per-line')
const ruleTester = new RuleTester({
- parser: require.resolve('vue-eslint-parser'),
- parserOptions: { ecmaVersion: 2015 }
+ languageOptions: { parser: require('vue-eslint-parser'), ecmaVersion: 2015 }
})
ruleTester.run('max-attributes-per-line', rule, {
@@ -45,43 +44,99 @@ ruleTester.run('max-attributes-per-line', rule, {
code: ``,
output: ``,
- errors: ["'age' should be on a new line."]
+ errors: [
+ {
+ message: "'age' should be on a new line.",
+ line: 1,
+ column: 38,
+ endLine: 1,
+ endColumn: 46
+ }
+ ]
},
{
code: ``,
output: ``,
- errors: ["':age' should be on a new line."]
+ errors: [
+ {
+ message: "':age' should be on a new line.",
+ line: 1,
+ column: 40,
+ endLine: 1,
+ endColumn: 55
+ }
+ ]
},
{
code: ``,
output: ``,
- errors: ["'v-bind' should be on a new line."]
+ errors: [
+ {
+ message: "'v-bind' should be on a new line.",
+ line: 1,
+ column: 33,
+ endLine: 1,
+ endColumn: 46
+ }
+ ]
},
{
code: ``,
output: ``,
- errors: ["'@buy' should be on a new line."]
+ errors: [
+ {
+ message: "'@buy' should be on a new line.",
+ line: 1,
+ column: 40,
+ endLine: 1,
+ endColumn: 57
+ }
+ ]
},
{
code: ``,
output: ``,
- errors: ["'@click.stop' should be on a new line."]
+ errors: [
+ {
+ message: "'@click.stop' should be on a new line.",
+ line: 1,
+ column: 40,
+ endLine: 1,
+ endColumn: 51
+ }
+ ]
},
{
code: ``,
output: ``,
- errors: ["'v-if' should be on a new line."]
+ errors: [
+ {
+ message: "'v-if' should be on a new line.",
+ line: 1,
+ column: 40,
+ endLine: 1,
+ endColumn: 56
+ }
+ ]
},
{
code: ``,
output: ``,
- errors: ["'v-bind:age' should be on a new line."]
+ errors: [
+ {
+ message: "'v-bind:age' should be on a new line.",
+ line: 1,
+ column: 41,
+ endLine: 1,
+ endColumn: 62
+ }
+ ]
},
{
code: ``,
@@ -92,7 +147,10 @@ job="Vet">`,
{
message: "'job' should be on a new line.",
type: 'VAttribute',
- line: 1
+ line: 1,
+ column: 47,
+ endLine: 1,
+ endColumn: 56
}
]
},
@@ -113,7 +171,10 @@ age="30"
{
message: "'age' should be on a new line.",
type: 'VAttribute',
- line: 2
+ line: 2,
+ column: 25,
+ endLine: 2,
+ endColumn: 33
}
]
},
@@ -134,7 +195,10 @@ age="30"
{
message: "'age' should be on a new line.",
type: 'VAttribute',
- line: 2
+ line: 2,
+ column: 25,
+ endLine: 2,
+ endColumn: 33
}
]
}
diff --git a/tests/lib/rules/max-len.js b/tests/lib/rules/max-len.js
index a1141ec22..d2df6e62a 100644
--- a/tests/lib/rules/max-len.js
+++ b/tests/lib/rules/max-len.js
@@ -3,12 +3,15 @@
*/
'use strict'
-const RuleTester = require('eslint').RuleTester
+const RuleTester = require('../../eslint-compat').RuleTester
const rule = require('../../../lib/rules/max-len')
const tester = new RuleTester({
- parser: require.resolve('vue-eslint-parser'),
- parserOptions: { ecmaVersion: 2017, sourceType: 'module' }
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ecmaVersion: 2017,
+ sourceType: 'module'
+ }
})
tester.run('max-len', rule, {
@@ -308,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
}
]
},
@@ -325,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
}
]
},
@@ -343,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
}
]
},
@@ -361,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
}
]
},
@@ -378,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
}
]
},
@@ -391,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
}
]
},
@@ -414,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
}
]
},
@@ -450,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
}
]
},
@@ -513,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
}
]
},
@@ -578,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
}
]
},
@@ -606,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
}
]
},
@@ -635,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
}
]
},
@@ -675,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
}
]
},
@@ -706,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
}
]
},
@@ -728,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
}
]
},
@@ -757,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
}
]
},
@@ -793,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
}
]
},
@@ -831,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
}
]
},
@@ -856,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
}
]
},
@@ -879,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
}
]
},
@@ -913,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
}
]
},
@@ -949,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
}
]
},
@@ -976,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
}
]
},
@@ -1001,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
}
]
},
@@ -1025,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
}
]
},
@@ -1045,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
}
]
},
@@ -1063,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
}
]
},
@@ -1076,32 +1155,62 @@ var a = /regexploooooooooooooooooooooooooooooooooooooooooooooooooooooong/.test(b
filename: 'test.vue',
code: `
41 cols
`,
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: `
41 cols
`,
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: `
\t41\tcols\t
`,
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: `
\t41\tcols\t
`,
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: `
\t41\tcols\t
`,
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
{
@@ -1127,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
}
]
},
@@ -1163,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
}
]
},
@@ -1186,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
}
]
},
@@ -1205,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
}
]
},
@@ -1227,17 +1348,20 @@ var b = \`81 columns
{
message:
'This line has a comment length of 41. Maximum allowed is 40.',
- line: 2
+ line: 2,
+ column: 1
},
{
message:
'This line has a comment length of 41. Maximum allowed is 40.',
- line: 3
+ line: 3,
+ column: 1
},
{
message:
'This line has a comment length of 41. Maximum allowed is 40.',
- line: 4
+ line: 4,
+ column: 1
}
]
}
diff --git a/tests/lib/rules/max-lines-per-block.js b/tests/lib/rules/max-lines-per-block.js
index 01d868e62..415e0197f 100644
--- a/tests/lib/rules/max-lines-per-block.js
+++ b/tests/lib/rules/max-lines-per-block.js
@@ -3,12 +3,12 @@
*/
'use strict'
-const RuleTester = require('eslint').RuleTester
+const RuleTester = require('../../eslint-compat').RuleTester
const rule = require('../../../lib/rules/max-lines-per-block')
const tester = new RuleTester({
- parser: require.resolve('vue-eslint-parser'),
- parserOptions: {
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
ecmaVersion: 2020,
sourceType: 'module'
}
@@ -59,7 +59,9 @@ tester.run('max-lines-per-block', rule, {
{
message: 'Block has too many lines (2). Maximum allowed is 1.',
line: 2,
- column: 7
+ column: 7,
+ endLine: 5,
+ endColumn: 18
}
]
},
@@ -76,7 +78,9 @@ tester.run('max-lines-per-block', rule, {
{
message: 'Block has too many lines (2). Maximum allowed is 1.',
line: 2,
- column: 7
+ column: 7,
+ endLine: 6,
+ endColumn: 16
}
]
}
diff --git a/tests/lib/rules/max-props.js b/tests/lib/rules/max-props.js
new file mode 100644
index 000000000..041a53f4c
--- /dev/null
+++ b/tests/lib/rules/max-props.js
@@ -0,0 +1,248 @@
+/**
+ * @author kevsommer Kevin Sommer
+ * See LICENSE file in root directory for full license.
+ */
+'use strict'
+
+const RuleTester = require('../../eslint-compat').RuleTester
+const rule = require('../../../lib/rules/max-props')
+
+const tester = new RuleTester({
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ecmaVersion: 2020,
+ sourceType: 'module'
+ }
+})
+
+tester.run('max-props', rule, {
+ valid: [
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 5 }],
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ parserOptions: {
+ parser: require.resolve('@typescript-eslint/parser')
+ }
+ }
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 2 }],
+ languageOptions: {
+ parserOptions: {
+ parser: require.resolve('@typescript-eslint/parser')
+ }
+ }
+ }
+ ],
+ invalid: [
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 1 }],
+ errors: [
+ {
+ message: 'Component has too many props (2). Maximum allowed is 1.',
+ line: 3,
+ endLine: 3,
+ column: 7,
+ endColumn: 44
+ }
+ ]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 1 }],
+ errors: [
+ {
+ message: 'Component has too many props (2). Maximum allowed is 1.',
+ line: 4,
+ endLine: 7,
+ column: 9,
+ endColumn: 10
+ }
+ ]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 2 }],
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ parserOptions: {
+ parser: require.resolve('@typescript-eslint/parser')
+ }
+ },
+ errors: [
+ {
+ message: 'Component has too many props (3). Maximum allowed is 2.',
+ line: 3,
+ endLine: 3,
+ column: 7,
+ endColumn: 69
+ }
+ ]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 2 }],
+ languageOptions: {
+ parserOptions: {
+ parser: require.resolve('@typescript-eslint/parser')
+ }
+ },
+ errors: [
+ {
+ message: 'Component has too many props (3). Maximum allowed is 2.',
+ line: 3,
+ endLine: 3,
+ column: 7,
+ endColumn: 85
+ }
+ ]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: [{ maxProps: 2 }],
+ languageOptions: {
+ parserOptions: {
+ parser: require.resolve('@typescript-eslint/parser')
+ }
+ },
+ errors: [
+ {
+ message: 'Component has too many props (3). Maximum allowed is 2.',
+ line: 3,
+ endLine: 11,
+ column: 7,
+ endColumn: 11
+ }
+ ]
+ }
+ ]
+})
diff --git a/tests/lib/rules/max-template-depth.js b/tests/lib/rules/max-template-depth.js
new file mode 100644
index 000000000..b5fc4cb91
--- /dev/null
+++ b/tests/lib/rules/max-template-depth.js
@@ -0,0 +1,180 @@
+/**
+ * @author kevsommer Kevin Sommer
+ * See LICENSE file in root directory for full license.
+ */
+'use strict'
+
+const RuleTester = require('../../eslint-compat').RuleTester
+const rule = require('../../../lib/rules/max-template-depth')
+
+const tester = new RuleTester({
+ languageOptions: {
+ parser: require('vue-eslint-parser'),
+ ecmaVersion: 2020,
+ sourceType: 'module'
+ }
+})
+
+tester.run('max-template-depth', rule, {
+ valid: [
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+
+
+
+ `,
+ options: [{ maxDepth: 3 }]
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 20,
+ endLine: 4,
+ endColumn: 20
+ }
]
},
{
@@ -404,7 +415,14 @@ multiline content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ }
]
},
{
@@ -420,7 +438,14 @@ multiline content
`,
errors: [
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 30,
+ endLine: 4,
+ endColumn: 30
+ }
]
},
// comments
@@ -440,8 +465,22 @@ multiline content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 25,
+ endLine: 4,
+ endColumn: 25
+ }
]
},
{
@@ -460,8 +499,22 @@ multiline content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 23,
+ endLine: 4,
+ endColumn: 23
+ }
]
},
// one error
@@ -482,7 +535,14 @@ content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ }
]
},
{
@@ -502,7 +562,14 @@ content
`,
errors: [
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 5,
+ column: 18,
+ endLine: 5,
+ endColumn: 18
+ }
]
},
// multi
@@ -522,12 +589,54 @@ content
`,
errors: [
- 'Expected 1 line break after opening tag (``), but no line breaks found.',
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (``), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (``), but no line breaks found.',
+ line: 2,
+ column: 19,
+ endLine: 2,
+ endColumn: 19
+ },
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 2,
+ column: 24,
+ endLine: 2,
+ endColumn: 24
+ },
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 2,
+ column: 36,
+ endLine: 2,
+ endColumn: 36
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 29,
+ endLine: 3,
+ endColumn: 29
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (``), but no line breaks found.',
+ line: 3,
+ column: 35,
+ endLine: 3,
+ endColumn: 35
+ }
]
},
// multi line breaks
@@ -551,8 +660,22 @@ content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but 2 line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but 2 line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but 2 line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 5,
+ endColumn: 13
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but 2 line breaks found.',
+ line: 6,
+ column: 20,
+ endLine: 8,
+ endColumn: 11
+ }
]
},
// allowEmptyLines
@@ -578,7 +701,14 @@ content
`,
options: [{ allowEmptyLines: true, ignoreWhenEmpty: false }],
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 8,
+ column: 27,
+ endLine: 8,
+ endColumn: 27
+ }
]
},
{
@@ -610,8 +740,22 @@ content
`,
options: [{ allowEmptyLines: true }],
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 9,
+ column: 16,
+ endLine: 9,
+ endColumn: 16
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 10,
+ column: 20,
+ endLine: 10,
+ endColumn: 20
+ }
]
},
// mustache
@@ -631,8 +775,22 @@ content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 23,
+ endLine: 4,
+ endColumn: 23
+ }
]
},
// mix
@@ -654,8 +812,22 @@ content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 3,
+ column: 16,
+ endLine: 3,
+ endColumn: 16
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 5,
+ column: 27,
+ endLine: 5,
+ endColumn: 27
+ }
]
},
// start tag
@@ -675,8 +847,22 @@ content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 14,
+ endLine: 4,
+ endColumn: 14
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 21,
+ endLine: 4,
+ endColumn: 21
+ }
]
},
{
@@ -695,8 +881,22 @@ content
`,
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
- 'Expected 1 line break before closing tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 18,
+ endLine: 4,
+ endColumn: 18
+ },
+ {
+ message:
+ 'Expected 1 line break before closing tag (`
`), but no line breaks found.',
+ line: 4,
+ column: 25,
+ endLine: 4,
+ endColumn: 25
+ }
]
},
{
@@ -715,7 +915,14 @@ content
`,
options: [{ ignoreWhenEmpty: false }],
errors: [
- 'Expected 1 line break after opening tag (`
`), but no line breaks found.'
+ {
+ message:
+ 'Expected 1 line break after opening tag (`
-
- `,
- options: allOptions
+ `
},
-
- // computed property used in v-html
{
filename: 'test.vue',
code: `
-
-
-
- `,
- options: allOptions
+ `
},
-
- // computed property used in v-model
+ // default options
{
filename: 'test.vue',
code: `
-
-
-
- `,
- options: allOptions
+ `
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `
},
- // computed property passed in a component
+ // a property being watched
+ {
+ filename: 'test.vue',
+ code: `
+
+ `
+ },
+
+ // a property used as a template identifier
{
filename: 'test.vue',
code: `
-
+
{{ count }}
- `,
- options: allOptions
+ `
},
-
- // async data passed in a component
+ // a property used as a template $props member expression
{
filename: 'test.vue',
code: `
-
+
{{ $props.count }}
- `,
- options: allOptions
+ `
},
-
- // ignores unused data when marked with eslint-disable
+ // a property used as a template $props expression
{
filename: 'test.vue',
code: `
-
{{ cont }}
+
{{ $props }}
- `,
- options: allOptions
+ `
},
- // trace this
+ // properties used in a template expression
{
filename: 'test.vue',
code: `
+
+
{{ count1 + count2 }}
+
`
},
+ // properties used in a template expression as $props member expression
{
filename: 'test.vue',
code: `
+
+
{{ $props.count1 + $props.count2 }}
+
`
},
+
+ // a property used in v-if
{
filename: 'test.vue',
code: `
+
+
+
`
},
- // use rest
+ // a property used in v-if as $props member expression
{
filename: 'test.vue',
code: `
-
{{ foo }}
+
`
},
+ // a property used in v-for as $props member expression
{
filename: 'test.vue',
code: `
+
+
{{ color }}
+
`
},
- // render & functional
+ // a property used in v-html
{
- filename: 'test.js',
+ filename: 'test.vue',
code: `
- Vue.component('smart-list', {
- functional: true,
- props: {
- items: {
- type: Array,
- required: true
- },
- isOrdered: Boolean
- },
- render: function (createElement, context) {
- function appropriateListComponent () {
- var items = context.props.items
-
- if (items.length === 0) return EmptyList
- if (typeof items[0] === 'object') return TableList
- if (context.props.isOrdered) return OrderedList
-
- return UnorderedList
- }
-
- return createElement(
- appropriateListComponent(),
- context.data,
- context.children
- )
- }
- })
+
+
+
+
`
},
+ // a property used in v-html as $props member expression
{
- filename: 'test.js',
+ filename: 'test.vue',
code: `
- Vue.component('MyButton', {
- functional: true,
- props: ['foo'],
- render: function (createElement, {props}) {
- return createElement('button', props.foo)
- }
- })
+
+
+
+
`
},
- {
- filename: 'test.js',
- code: `
- Vue.component('MyButton', {
- functional: true,
- props: ['foo'],
- render: function (createElement, ctx) {
- return createElement('button', fn(ctx.props))
- }
- })
- function fn(props) {
- return props.foo
- }
- `
- },
+ // a property passed in a component
{
- filename: 'test.js',
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `
+ },
+ // a property passed in a component as $props member expression
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `
+ },
+
+ // a property used in v-on
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `
+ },
+ // a property used in v-on as $props member expression
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `
+ },
+ // a property used in v-on as $props expression
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `
+ },
+
+ // data used in a script expression
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: allOptions
+ },
+
+ // data being watched
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: allOptions
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `
+ },
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: allOptions
+ },
+
+ // data used as a template identifier
+ {
+ filename: 'test.vue',
+ code: `
+
+
{{ count }}
+
+
+ `,
+ options: allOptions
+ },
+
+ // data used in a template expression
+ {
+ filename: 'test.vue',
+ code: `
+
+
{{ count1 + count2 }}
+
+
+ `,
+ options: allOptions
+ },
+
+ // data used in v-if
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `,
+ options: allOptions
+ },
+
+ // data used in v-for
+ {
+ filename: 'test.vue',
+ code: `
+
+
{{ color }}
+
+
+ `,
+ options: allOptions
+ },
+
+ // data used in v-html
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `,
+ options: allOptions
+ },
+
+ // data used in v-model
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `,
+ options: allOptions
+ },
+
+ // data passed in a component
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `,
+ options: allOptions
+ },
+
+ // data used in v-on
+ {
+ filename: 'test.vue',
+ code: `
+
+
+
+
+ `,
+ options: allOptions
+ },
+
+ // computed property used in a script expression
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: allOptions
+ },
+
+ // computed property being watched
+ {
+ filename: 'test.vue',
+ code: `
+
+ `,
+ options: allOptions
+ },
+
+ // computed property used as a template identifier
+ {
+ filename: 'test.vue',
+ code: `
+
+
{{ count }}
+
+
+ `,
+ options: allOptions
+ },
+
+ // computed properties used in a template expression
+ {
+ filename: 'test.vue',
+ code: `
+
+