Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vuejs/eslint-plugin-vue
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.16.0
Choose a base ref
...
head repository: vuejs/eslint-plugin-vue
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.17.0
Choose a head ref
  • 6 commits
  • 38 files changed
  • 3 contributors

Commits on Aug 13, 2021

  1. fix: prepare suggestable rules for ESLint v8 (and update eslint-plugi…

    …n-eslint-plugin to v3) (#1607)
    
    * The upcoming [ESLint v8](https://eslint.org/blog/2021/06/whats-coming-in-eslint-8.0.0#rules-with-suggestions-now-require-the-metahassuggestions-property) release will require rules that provide suggestions to enable `meta.hasSuggestions` so I have autofixed that using the [eslint-plugin/require-meta-has-suggestions](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/blob/master/docs/rules/require-meta-has-suggestions.md) rule
    * A lot of the rules/functionality in `eslint-internal-rules` have been replaced by public rules in [eslint-plugin-eslint-plugin](https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin)
    bmish authored Aug 13, 2021
    Copy the full SHA
    1fc3485 View commit details

Commits on Aug 14, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    730645e View commit details

Commits on Aug 15, 2021

  1. Add vue/no-v-text rule (#1605)

    * feat: add rule no-v-text
    
    * chore: run npm run update
    
    * docs: remove since from header. move attention for fix.
    
    * feat: use utils.getDirective
    
    * feat: remove fix function from this rule
    
    * test: update test case
    tyankatsu0105 authored Aug 15, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    16a4c67 View commit details
  2. Format

    ota-meshi authored Aug 15, 2021
    Copy the full SHA
    80ca3ea View commit details

Commits on Aug 27, 2021

  1. Add support for ESLint v8 (beta). (#1610)

    * Add support for ESLint v8.
    
    * fix CI
    
    * update
    
    * update
    
    * update
    
    * update
    
    * fix
    
    * update
    
    * update doc
    ota-meshi authored Aug 27, 2021
    Copy the full SHA
    c86cc88 View commit details
  2. 7.17.0

    ota-meshi committed Aug 27, 2021
    Copy the full SHA
    f8aa689 View commit details
Showing with 567 additions and 670 deletions.
  1. +38 −0 .circleci/config.yml
  2. +10 −7 .eslintrc.js
  3. +1 −0 docs/rules/README.md
  4. +41 −0 docs/rules/no-v-text.md
  5. +11 −11 docs/user-guide/README.md
  6. +1 −1 eslint-internal-rules/.eslintrc.json
  7. +0 −141 eslint-internal-rules/consistent-docs-description.js
  8. +0 −19 eslint-internal-rules/no-invalid-meta-docs-categories.js
  9. +0 −53 eslint-internal-rules/no-invalid-meta.js
  10. +0 −280 eslint-internal-rules/require-meta-docs-url.js
  11. +1 −0 lib/index.js
  12. +2 −2 lib/rules/comment-directive.js
  13. +1 −1 lib/rules/experimental-script-setup-vars.js
  14. +1 −1 lib/rules/jsx-uses-vars.js
  15. +1 −0 lib/rules/no-potential-component-option-typo.js
  16. +1 −0 lib/rules/no-restricted-custom-event.js
  17. +1 −0 lib/rules/no-restricted-props.js
  18. +1 −0 lib/rules/no-unused-vars.js
  19. +36 −0 lib/rules/no-v-text.js
  20. +1 −0 lib/rules/require-emit-validator.js
  21. +1 −0 lib/rules/require-explicit-emits.js
  22. +1 −0 lib/rules/require-expose.js
  23. +1 −1 lib/rules/script-setup-uses-vars.js
  24. +1 −0 lib/rules/valid-next-tick.js
  25. +1 −1 lib/utils/indent-common.js
  26. +110 −1 lib/utils/index.js
  27. +3 −4 package.json
  28. +71 −0 tests/eslint-compat.js
  29. +1 −4 tests/lib/rules-without-vue-eslint-parser.js
  30. +14 −0 tests/lib/rules/camelcase.js
  31. +157 −131 tests/lib/rules/comment-directive.js
  32. +3 −3 tests/lib/rules/func-call-spacing.js
  33. +3 −1 tests/lib/rules/jsx-uses-vars.js
  34. +45 −0 tests/lib/rules/no-v-text.js
  35. +3 −1 tests/lib/rules/script-setup-uses-vars.js
  36. +2 −2 tests/lib/rules/space-in-parens.js
  37. +2 −2 tests/lib/rules/space-infix-ops.js
  38. +0 −3 typings/eslint/index.d.ts
38 changes: 38 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ workflows:
jobs:
- node-v8
- node-v10
- eslint-v7
- eslint-v8
- node-v12
- node-v14
- lint
@@ -54,6 +56,42 @@ jobs:
<<: *node-base
docker:
- image: node:10
eslint-v7:
docker:
- image: node:10
steps:
- run:
name: Versions
command: npm version
- checkout
- run:
name: Install eslint@7
command: |
npm install --save-exact eslint@7
- run:
name: Install dependencies
command: npm install
- run:
name: Test
command: npm test
eslint-v8:
docker:
- image: node:14
steps:
- run:
name: Versions
command: npm version
- checkout
- run:
name: Install eslint@8
command: |
npm install --save-exact eslint@^8.0.0-0
- run:
name: Install dependencies
command: npm install
- run:
name: Test
command: npm test
node-v12:
<<: *node-base
docker:
17 changes: 10 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -126,18 +126,21 @@ module.exports = {
{
files: ['lib/rules/*.js'],
rules: {
'consistent-docs-description': 'error',
'no-invalid-meta': 'error',
'no-invalid-meta-docs-categories': 'error',
'eslint-plugin/require-meta-type': 'error',
'require-meta-docs-url': [
'eslint-plugin/no-deprecated-context-methods': 'error',
'eslint-plugin/no-only-tests': 'error',
'eslint-plugin/prefer-object-rule': 'error',
'eslint-plugin/require-meta-docs-description': 'error',
'eslint-plugin/require-meta-docs-url': [
'error',
{
pattern: `https://eslint.vuejs.org/rules/{{name}}.html`
}
],

'eslint-plugin/fixer-return': 'off'
'eslint-plugin/require-meta-has-suggestions': 'error',
'eslint-plugin/require-meta-schema': 'error',
'eslint-plugin/require-meta-type': 'error',
'no-invalid-meta': 'error',
'no-invalid-meta-docs-categories': 'error'
}
}
]
1 change: 1 addition & 0 deletions docs/rules/README.md
Original file line number Diff line number Diff line change
@@ -324,6 +324,7 @@ For example:
| [vue/no-use-computed-property-like-method](./no-use-computed-property-like-method.md) | disallow use computed property like method | |
| [vue/no-useless-mustaches](./no-useless-mustaches.md) | disallow unnecessary mustache interpolations | :wrench: |
| [vue/no-useless-v-bind](./no-useless-v-bind.md) | disallow unnecessary `v-bind` directives | :wrench: |
| [vue/no-v-text](./no-v-text.md) | disallow use of v-text | |
| [vue/padding-line-between-blocks](./padding-line-between-blocks.md) | require or disallow padding lines between blocks | :wrench: |
| [vue/require-direct-export](./require-direct-export.md) | require the component to be directly exported | |
| [vue/require-emit-validator](./require-emit-validator.md) | require type definitions in emits | |
41 changes: 41 additions & 0 deletions docs/rules/no-v-text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
pageClass: rule-details
sidebarDepth: 0
title: vue/no-v-text
description: disallow use of v-text
since: v7.17.0
---
# vue/no-v-text

> disallow use of v-text
## :book: Rule Details

This rule reports all uses of `v-text` directive.

<eslint-code-block :rules="{'vue/no-v-text': ['error']}">

```vue
<template>
<!-- ✓ GOOD -->
<div>{{ foobar }}</div>
<!-- ✗ BAD -->
<div v-text="foobar"></div>
</template>
```

</eslint-code-block>

## :wrench: Options

Nothing.

## :rocket: Version

This rule was introduced in eslint-plugin-vue v7.17.0

## :mag: Implementation

- [Rule source](https://github.com/vuejs/eslint-plugin-vue/blob/master/lib/rules/no-v-text.js)
- [Test source](https://github.com/vuejs/eslint-plugin-vue/blob/master/tests/lib/rules/no-v-text.js)
22 changes: 11 additions & 11 deletions docs/user-guide/README.md
Original file line number Diff line number Diff line change
@@ -25,6 +25,8 @@ yarn add -D eslint eslint-plugin-vue
- ESLint v6.2.0 and above
- Node.js v8.10.0 and above

We have started supporting ESLint v8.0.0 beta, but note that beta support will be dropped once the stable version is released.

:::

## :book: Usage
@@ -93,13 +95,13 @@ If you installed [@vue/cli-plugin-eslint](https://github.com/vuejs/vue-cli/tree/

### How to use a custom parser?

If you want to use custom parsers such as [babel-eslint](https://www.npmjs.com/package/babel-eslint) or [@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser), you have to use the `parserOptions.parser` option instead of the `parser` option. Because this plugin requires [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser) to parse `.vue` files, this plugin doesn't work if you overwrite the `parser` option.
If you want to use custom parsers such as [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) or [@typescript-eslint/parser](https://www.npmjs.com/package/@typescript-eslint/parser), you have to use the `parserOptions.parser` option instead of the `parser` option. Because this plugin requires [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser) to parse `.vue` files, this plugin doesn't work if you overwrite the `parser` option.

```diff
- "parser": "babel-eslint",
- "parser": "@typescript-eslint/parser",
+ "parser": "vue-eslint-parser",
"parserOptions": {
+ "parser": "babel-eslint",
+ "parser": "@typescript-eslint/parser",
"sourceType": "module"
}
```
@@ -238,13 +240,13 @@ Make sure you have one of the following settings in your **.eslintrc**:
- `"extends": ["plugin:vue/vue3-recommended"]`
- `"extends": ["plugin:vue/base"]`

If you already use another parser (e.g. `"parser": "babel-eslint"`), please move it into `parserOptions`, so it doesn't collide with the `vue-eslint-parser` used by this plugin's configuration:
If you already use another parser (e.g. `"parser": "@typescript-eslint/parser"`), please move it into `parserOptions`, so it doesn't collide with the `vue-eslint-parser` used by this plugin's configuration:

```diff
- "parser": "babel-eslint",
- "parser": "@typescript-eslint/parser",
+ "parser": "vue-eslint-parser",
"parserOptions": {
+ "parser": "babel-eslint",
+ "parser": "@typescript-eslint/parser",
"ecmaVersion": 2020,
"sourceType": "module"
}
@@ -331,7 +333,7 @@ Note that you cannot use angle-bracket type assertion style (`var x = <foo>bar;`
- Turning off the rule in the ESLint configuration file does not ignore the warning.
- Using the `<!-- eslint-disable -->` comment does not suppress warnings.
- Duplicate warnings are displayed.
- Used `babel-eslint`, but the template still show `vue/no-parsing-error` warnings.
- Used `@babel/eslint-parser`, but the template still show `vue/no-parsing-error` warnings.

You need to turn off Vetur's template validation by adding `vetur.validation.template: false` to your `.vscode/settings.json`.

@@ -398,20 +400,18 @@ module.exports = {

However, note that the AST generated by `espree` v8+ may not work well with some rules of `ESLint` v7.x.

<!--
##### Using ESLint >= v8.x

You need to specify `2022` for `parserOptions.ecmaVersion`.
You need to specify `2022` or `"latest"` for `parserOptions.ecmaVersion`.

```js
module.exports = {
parserOptions: {
ecmaVersion: 2022,
ecmaVersion: 'latest',
sourceType: 'module'
},
}
```
-->

#### Other Problems

2 changes: 1 addition & 1 deletion eslint-internal-rules/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"rules": {
"consistent-docs-description": "error",
"no-invalid-meta-docs-categories": "error",
"no-invalid-meta": "error"
}
}
141 changes: 0 additions & 141 deletions eslint-internal-rules/consistent-docs-description.js

This file was deleted.

19 changes: 0 additions & 19 deletions eslint-internal-rules/no-invalid-meta-docs-categories.js
Original file line number Diff line number Diff line change
@@ -108,16 +108,6 @@ function checkMetaValidity(context, exportsNode) {
}
}

/**
* Whether this node is the correct format for a rule definition or not.
*
* @param {ASTNode} node node that the rule exports.
* @returns {boolean} `true` if the exported node is the correct format for a rule definition
*/
function isCorrectExportsFormat(node) {
return node != null && node.type === 'ObjectExpression'
}

// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
@@ -149,15 +139,6 @@ module.exports = {
},

'Program:exit'(programNode) {
if (!isCorrectExportsFormat(exportsNode)) {
context.report({
node: exportsNode || programNode,
message:
'Rule does not export an Object. Make sure the rule follows the new rule format.'
})
return
}

checkMetaValidity(context, exportsNode)
}
}
Loading