module.exports = {
extends: ['alloy', 'alloy/vue', 'alloy/typescript'],
parser: 'vue-eslint-parser',
parserOptions: {
parser: {
js: '@babel/eslint-parser',
jsx: '@babel/eslint-parser',
ts: '@typescript-eslint/parser',
tsx: '@typescript-eslint/parser',
// Leave the template parser unspecified, so that it could be determined by `<script lang="...">`
},
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
},
overrides: [
{
files: ['*.vue', '*.ts'],
rules: {
'no-undef': 'off', // ts(2304)
},
},
{
files: ['*.cjs'],
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
],
env: {
// Your environments (which contains several predefined global variables)
//
// browser: true,
// node: true,
// mocha: true,
// jest: true,
// jquery: true
},
globals: {
// Your global variables (setting to false means it's not allowed to be reassigned)
//
// myGlobal: false
},
rules: {
// Customize your rules
//
// Please keep this rule off because it requiresTypeChecking
// https://github.com/vuejs/vue-eslint-parser/issues/104
// https://github.com/typescript-eslint/typescript-eslint/pull/5318
'@typescript-eslint/prefer-optional-chain': 0,
'no-param-reassign': 0,
'@typescript-eslint/consistent-type-assertions': 0,
'prefer-object-spread': 0,
'max-params': ['error', 4],
'vue/no-duplicate-attributes': 0,
'vue/no-duplicate-attr-inheritance': 0,
'@typescript-eslint/explicit-member-accessibility': 0,
'spaced-comment': 0,
'@typescript-eslint/naming-convention':[
'error',
{
selector: 'default',
format: ['camelCase'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
{
selector: 'typeLike',
format: ['PascalCase'],
},
]
},
};
错误信息
Oops! Something went wrong! :(
ESLint: 8.22.0
Error: Error while loading rule '@typescript-eslint/naming-convention': 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.
.eslintrc.cjs
错误信息