12345678910111213141516171819202122232425262728293031323334353637 |
- /* eslint-env node */
- require('@rushstack/eslint-patch/modern-module-resolution')
- module.exports = {
- root: true,
- 'extends': [
- 'plugin:vue/vue3-essential',
- 'eslint:recommended',
- '@vue/eslint-config-typescript',
- '@vue/eslint-config-prettier/skip-formatting'
- ],
- parserOptions: {
- ecmaVersion: 'latest'
- },
- env: {
- node: true
- },
- /**
- * "off" 或 0 ==> 关闭规则
- * "warn" 或 1 ==> 打开的规则作为警告(不影响代码执行)
- * "error" 或 2 ==> 规则作为一个错误(代码不能执行,界面报错)
- */
- rules: {
- // ===============================>>> eslint (http://eslint.cn/docs/rules)
- 'no-var': 'error', // 要求使用 let 或 const 而不是 var
- 'prefer-const': 'off', // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
- 'eqeqeq': 'warn', // 要求使用 === 和 !==
- // ===============================>>> typeScript (https://typescript-eslint.io/rules)
- 'no-undef': 'off', // 禁止使用未定义的变量
- '@typescript-eslint/no-unused-vars': ['warn', { 'argsIgnorePattern': '^_' }],
- // ===============================>>> vue (https://eslint.vuejs.org/rules)
- 'vue/no-mutating-props': ['error', {
- 'shallowOnly': true // 允许修改prop的值,但保持引用不变
- }],
- 'vue/multi-word-component-names': 'off' // 组件名强制使用短横线连接
- }
- }
|