-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy patheslint.vue.config.mjs
59 lines (55 loc) · 1.67 KB
/
eslint.vue.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import formatjs from "eslint-plugin-formatjs"
import pluginVue from "eslint-plugin-vue"
import { defineConfigWithVueTs, vueTsConfigs} from '@vue/eslint-config-typescript';
import vuePrettierConfig from "@vue/eslint-config-prettier"
import tseslint from 'typescript-eslint';
import { baseConfig } from "./eslint.base.config.mjs"
/**
* @param {string} dirName
* @param {boolean} [forceTS=false]
* @returns {import("eslint").Linter.FlatConfig[]}
*/
export function vueConfig(dirName, forceTS = false) {
const enableTS = !!dirName && (forceTS || process.env["ESLINT_TS"])
return [
...baseConfig(dirName, forceTS),
// ...ts.configs.recommended,
// this should set the vue parser as the parser plus some recommended rules
...pluginVue.configs["flat/recommended"],
...defineConfigWithVueTs(vueTsConfigs.base),
vuePrettierConfig,
{
name: "vue",
files: ["*.vue", "**/*.vue"],
languageOptions: {
parserOptions: {
// set a custom parser to parse <script> tags
parser: {
"<template>": tseslint.parser,
"ts": tseslint.parser,
"js": tseslint.parser,
},
...(enableTS && {
projectService: true,
tsconfigRootDir: dirName,
}),
extraFileExtensions: [".vue"]
}
},
rules: {
"no-undef": "off",
"vue/multi-word-component-names": "warn",
"vue/no-template-shadow": "warn",
"vue/valid-v-slot": [
"error",
{
allowModifiers: true
}
]
},
plugins: {
formatjs // this is for ICU messages, so I'd say we need it here
},
}
]
}