我在使用 ESLint CLI 时遇到问题--rule
option.
# This is what I tried
eslint --rule "{no-console: error}" --fix-dry-run .
导致出现以下错误:
选项“规则”的值无效 - 预期类型对象,收到的值:{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'
}
};