【发布时间】:2020-11-29 00:10:56
【问题描述】:
我在使用带有 --rule 选项的 ESLint CLI 时遇到问题。
# This is what I tried
eslint --rule "{no-console: error}" --fix-dry-run .
导致以下错误:
选项“规则”的值无效 - 预期类型 Object,接收值:{no-console:.
使用--rule 选项的正确方法是什么?我在本地安装了 ESLint 并使用 npx 运行它。
- Node.js 版本 14.15.0
- ESLint 版本 7.14.0
- 操作系统 Windows 10
.eslintrc.js
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'prettier',
'prettier/vue'
],
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 12,
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off'
}
};
【问题讨论】:
标签: command-line-interface eslint