You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -86,8 +86,8 @@ See the [rule list](./rules/index.md) to get the `configs` & `rules` that this p
86
86
87
87
This plugin provides some predefined configs. You can use the following configs by adding them to `eslint.config.[c|m]js`. (All flat configs in this plugin are provided as arrays, so spread syntax is required when combining them with other configs.)
88
88
89
-
-`*.configs["flat/base"]`: Settings and rules to enable correct ESLint parsing.
90
-
-`*.configs["flat/recommended"]`: Above, plus rules to enforce subjective community defaults to ensure consistency.
89
+
-`*.configs.base`: Settings and rules to enable correct ESLint parsing.
90
+
-`*.configs.recommended`: Above, plus rules to enforce subjective community defaults to ensure consistency.
91
91
92
92
### Configuration `.eslintrc.*`
93
93
@@ -102,7 +102,7 @@ module.export = {
102
102
extends: [
103
103
'eslint:recommended',
104
104
// Recommended
105
-
'plugin:@intlify/vue-i18n/recommended'
105
+
'plugin:@intlify/vue-i18n/recommended-legacy'
106
106
],
107
107
rules: {
108
108
// Optional.
@@ -156,8 +156,8 @@ See the [rule list](./rules/index.md) to get the `configs` & `rules` that this p
156
156
157
157
This plugin provides some predefined configs. You can use the following configs by adding them to `.eslintrc.*`.
158
158
159
-
-`"plugin:@intlify/vue-i18n/base"`: Settings and rules to enable correct ESLint parsing.
160
-
-`"plugin:@intlify/vue-i18n/recommended"`: Above, plus rules to enforce subjective community defaults to ensure consistency.
159
+
-`"plugin:@intlify/vue-i18n/base-legacy"`: Settings and rules to enable correct ESLint parsing.
160
+
-`"plugin:@intlify/vue-i18n/recommended-legacy"`: Above, plus rules to enforce subjective community defaults to ensure consistency.
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 `parserOptions.parser` option instead of `parser` option. Because this plugin requires [vue-eslint-parser](https://www.npmjs.com/package/vue-eslint-parser) to parse `.vue` files, so this plugin doesn't work if you overwrote `parser` option.
203
203
204
-
Also, `parserOptions` configured at the top level affect `.json` and `.yaml`. This plugin needs to use special parsers to parse `.json` and `.yaml`, so to correctly parse each extension, use the `overrides` option and overwrite the options again.
205
-
206
204
```diff
207
-
- "parser": "babel-eslint",
208
-
"parserOptions": {
209
-
+ "parser": "babel-eslint",
205
+
import vueEslintParser from "vue-eslint-parser"
206
+
import babelEslint from "babel-eslint"
207
+
208
+
export default {
209
+
"files": ["**/*.vue"],
210
+
"languageOptions": {
211
+
- "parser": babelEslint,
212
+
+ "parser": vueEslintParser,
213
+
"parserOptions": {
214
+
+ "parser": babelEslint,
210
215
"sourceType": "module"
211
-
},
212
-
+ "overrides": [
213
-
+ {
214
-
+ "files": ["*.json", "*.json5"],
215
-
+ "extends": ["plugin:@intlify/vue-i18n/base"],
216
-
+ },
217
-
+ {
218
-
+ "files": ["*.yaml", "*.yml"],
219
-
+ "extends": ["plugin:@intlify/vue-i18n/base"],
220
-
+ }
221
-
+ ]
216
+
},
217
+
}
218
+
}
222
219
```
223
220
224
221
### More lint on JSON and YAML in `<i18n>` block
@@ -233,34 +230,23 @@ You can also use [jsonc/vue-custom-block/no-parsing-error](https://ota-meshi.git
233
230
234
231
The most rules of `eslint-plugin-vue-i18n` require `vue-eslint-parser` to check `<template>` ASTs.
235
232
236
-
Make sure you have one of the following settings in your **.eslintrc**:
233
+
Make sure you have one of the following settings in your **eslint.config.js**:
If you already use other 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:
242
-
243
-
```diff
244
-
- "parser": "babel-eslint",
245
-
"parserOptions": {
246
-
+ "parser": "babel-eslint",
247
-
"ecmaVersion": 2017,
248
-
"sourceType": "module"
249
-
}
250
-
```
251
-
252
-
See also: "[Use together with custom parsers](#use-together-with-custom-parsers)" section.
238
+
See also: "[How to use custom parser](#how-to-use-custom-parser)" section.
253
239
254
240
### Why doesn't it work on .vue file?
255
241
256
242
1. Make sure you don't have `eslint-plugin-html` in your config. The `eslint-plugin-html` extracts the content from `<script>` tags, but `eslint-plugin-vue` requires `<script>` tags and `<template>` tags in order to distinguish template and script in single file components.
257
243
258
-
```diff
259
-
"plugins": [
260
-
"vue",
261
-
- "html"
262
-
]
263
-
```
244
+
```diff
245
+
"plugins": [
246
+
"vue",
247
+
- "html"
248
+
]
249
+
```
264
250
265
251
2. Make sure your tool is set to lint `.vue` and `.json` files.
0 commit comments