.eslintrc.cjs 1.1 KB

12345678910111213141516171819202122232425262728
  1. /* eslint-env node */
  2. require('@rushstack/eslint-patch/modern-module-resolution')
  3. module.exports = {
  4. root: true,
  5. 'extends': [
  6. 'plugin:vue/vue3-essential',
  7. 'eslint:recommended',
  8. '@vue/eslint-config-typescript',
  9. '@vue/eslint-config-prettier/skip-formatting'
  10. ],
  11. parserOptions: {
  12. ecmaVersion: 'latest'
  13. },
  14. rules: {
  15. // ===============================>>> eslint (http://eslint.cn/docs/rules)
  16. 'no-var': 'error', // 要求使用 let 或 const 而不是 var
  17. 'prefer-const': 'off', // 使用 let 关键字声明但在初始分配后从未重新分配的变量,要求使用 const
  18. 'eqeqeq': 'warn', // 要求使用 === 和 !==
  19. // ===============================>>> typeScript (https://typescript-eslint.io/rules)
  20. 'no-undef': 'off', // 禁止使用未定义的变量
  21. // ===============================>>> vue (https://eslint.vuejs.org/rules)
  22. 'vue/no-mutating-props': ['error', {
  23. 'shallowOnly': true // 允许修改prop的值,但保持引用不变
  24. }],
  25. 'vue/multi-word-component-names': 'off' // 组件名强制使用短横线连接
  26. }
  27. }