-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.eslintrc.js
76 lines (76 loc) · 2.83 KB
/
.eslintrc.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
node: true,
},
parser: 'vue-eslint-parser',
parserOptions: {
parser: {
"ts": "@typescript-eslint/parser",
"<template>": "espree"
},
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
extraFileExtensions: ['.vue'],
},
extends: [
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'airbnb-base',
'plugin:vue/vue3-essential',
'plugin:@typescript-eslint/recommended',
// 暂时注释,经常会报错,还没搞清楚怎么解决
// Error while loading rule '@typescript-eslint/no-implied-eval': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser.
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
'prettier',
],
plugins: ['import', '@typescript-eslint', 'vue', 'prettier'],
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx', '.vue', '.json'],
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},
'import/resolver': {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
// Multiple tsconfigs (Useful for monorepos)
// use an array of glob patterns
project: ['tsconfig.json'],
},
// alias: {
// map: [
// ["@", "./src"],
// ["/static", "./public/static"],
// ],
// extensions: [".js", ".jsx", ".json", ".ts", ".tsx", ".vue"],
// },
},
},
rules: {
indent: ['warn', 4],
'no-console': ['warn', { allow: ['warn', 'error'] }],
'func-names': "off",
"no-underscore-dangle": "off",
"no-nested-ternary": "off",
"no-shadow": "off",
"default-param-last": "off",
"consistent-return": "off",
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'import/no-named-as-default': 'off',
"import/no-extraneous-dependencies": ["error", {"devDependencies": true, "optionalDependencies": true, "peerDependencies": true}],
'vue/multi-word-component-names': 'off',
'prettier/prettier': 'error',
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/await-thenable": "off",
},
overrides: [],
}