Skip to content

Commit aa0f42d

Browse files
committed
Add Vue linting docs
1 parent 2bcbcff commit aa0f42d

File tree

1 file changed

+36
-27
lines changed

1 file changed

+36
-27
lines changed

README.md

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,6 @@ module.exports = {
6767
};
6868
```
6969

70-
### React
71-
72-
This config is meant first and foremost for React projects, where it will detect which rules to apply based on the version of React used on the project. The config can also be used on non-React projects – just make sure to disable the version check by adding: the following in your config:
73-
74-
```js
75-
module.exports = {
76-
// [...]
77-
settings: {
78-
// Manually set the version to disable automated detection of the "react" dependency.
79-
react: { version: 'latest' },
80-
},
81-
};
82-
```
83-
84-
### Experimental syntax
85-
86-
By default, this config uses ESLint’s built-in parser, which doesn’t support [experimental ECMAScript features](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features). If your code uses experimental syntax transpiled with Babel, make sure to set the ESLint parser to [babel-eslint](https://github.com/babel/babel-eslint):
87-
88-
```js
89-
module.exports = {
90-
// See https://github.com/torchbox/eslint-config-torchbox for rules.
91-
extends: 'torchbox',
92-
// Support non-standard, experimental JS features that Babel knows how to process.
93-
parser: 'babel-eslint',
94-
};
95-
```
96-
9770
### TypeScript
9871

9972
This config doesn’t include TypeScript support out of the box. We can install and configure a TypeScript parser and ESLint plugin to make it compatible. Here is how to proceed:
@@ -158,6 +131,42 @@ Note that the TypeScript-friendly rules included in the config above aren’t as
158131
eslint --max-warnings 0 --report-unused-disable-directives --ext .js,.jsx,.ts,.tsx .
159132
```
160133

134+
### React
135+
136+
This config is meant first and foremost for React projects, where it will detect which rules to apply based on the version of React used on the project. The config can also be used on non-React projects – just make sure to disable the version check by adding: the following in your config:
137+
138+
```js
139+
module.exports = {
140+
// [...]
141+
settings: {
142+
// Manually set the version to disable automated detection of the "react" dependency.
143+
react: { version: 'latest' },
144+
},
145+
};
146+
```
147+
148+
### Vue
149+
150+
We do not include linting for Vue out of the box. Have a look at the [eslint-plugin-vue user guide](https://eslint.vuejs.org/user-guide/), in particular:
151+
152+
1. Choose the right predefined configuration based on the Vue version and desired level of strictness
153+
2. Use the `--ext` flag to lint `.vue` files.
154+
3. Make sure pre-commit hooks are configured to run ESLint on `.vue` files.
155+
4. If using a custom parser (for example TypeScript’s), make sure to set it up [alongside `vue-eslint-parser` as documented](https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser).
156+
157+
### Experimental syntax
158+
159+
By default, this config uses ESLint’s built-in parser, which doesn’t support [experimental ECMAScript features](https://github.com/eslint/eslint/blob/a675c89573836adaf108a932696b061946abf1e6/README.md#what-about-experimental-features). If your code uses experimental syntax transpiled with Babel, make sure to set the ESLint parser to [babel-eslint](https://github.com/babel/babel-eslint):
160+
161+
```js
162+
module.exports = {
163+
// See https://github.com/torchbox/eslint-config-torchbox for rules.
164+
extends: 'torchbox',
165+
// Support non-standard, experimental JS features that Babel knows how to process.
166+
parser: 'babel-eslint',
167+
};
168+
```
169+
161170
## What’s included
162171

163172
> See [`config.js`](./config.js) for the config definition, and [`semver.test.js.snap`](./src/__snapshots__/semver.test.js.snap) for the whole set of rules and settings.

0 commit comments

Comments
 (0)