You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
4.2 KiB

3 years ago
  1. /*
  2. * @Author: your name
  3. * @Date: 2021-05-27 13:35:45
  4. * @LastEditTime: 2021-06-04 14:06:08
  5. * @LastEditors: your name
  6. * @Description: In User Settings Edit
  7. * @FilePath: \hz_ordersystem-lite\.eslintrc.js
  8. */
  9. module.exports = {
  10. // https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
  11. // This option interrupts the configuration hierarchy at this file
  12. // Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
  13. root: true,
  14. parserOptions: {
  15. parser: 'babel-eslint',
  16. ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
  17. sourceType: 'module' // Allows for the use of imports
  18. },
  19. env: {
  20. browser: true
  21. },
  22. // Rules order is important, please avoid shuffling them
  23. extends: [
  24. // Base ESLint recommended rules
  25. // 'eslint:recommended',
  26. // Uncomment any of the lines below to choose desired strictness,
  27. // but leave only one uncommented!
  28. // See https://eslint.vuejs.org/rules/#available-rules
  29. 'plugin:vue/strongly-recommended', // Priority A: Essential (Error Prevention) vue/essential
  30. // 'plugin:vue/strongly-recommended' // Priority B: Strongly Recommended (Improving Readability)
  31. // 'plugin:vue/recommended' // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
  32. 'standard'
  33. ],
  34. plugins: [
  35. // https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
  36. // required to lint *.vue files
  37. 'vue'
  38. ],
  39. globals: {
  40. ga: true, // Google Analytics
  41. cordova: true,
  42. __statics: true,
  43. process: true,
  44. Capacitor: true,
  45. chrome: true
  46. },
  47. // add your custom rules here
  48. rules: {
  49. // ECMAScript 6
  50. 'arrow-spacing': ['error', { // 强制箭头函数的箭头前后使用一致的空格
  51. before: true,
  52. after: true
  53. }
  54. ],
  55. indent: ['error', 2], // 缩进
  56. 'no-undef': 0, // 0允许未定义变量,1不允许未定义变量
  57. 'require-await': 'error', // 禁止使用不带 await 表达式的 async 函数
  58. // allow async-await
  59. 'generator-star-spacing': 'off',
  60. // allow paren-less arrow functions 要求箭头函数的参数使用圆括号
  61. 'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
  62. 'one-var': 'off',
  63. 'no-void': 'off',
  64. 'multiline-ternary': 'off',
  65. 'import/first': 'off',
  66. 'import/named': 'error',
  67. 'import/namespace': 'error',
  68. 'import/default': 'error',
  69. 'import/export': 'error',
  70. 'import/extensions': 'off',
  71. 'import/no-unresolved': 'off',
  72. 'import/no-extraneous-dependencies': 'off',
  73. 'prefer-promise-reject-errors': 'off',
  74. 'space-before-function-paren': ['error', 'never'], // 函数括号前不需要空格
  75. 'vue/max-attributes-per-line': ['error', { // 强制每行的最大属性数
  76. singleline: 7,
  77. multiline: {
  78. max: 5,
  79. allowFirstLine: true
  80. }
  81. }],
  82. 'vue/singleline-html-element-content-newline': ['error', { // 允许在单行元素的内容之前和之后不需要换行
  83. ignoreWhenNoAttributes: false,
  84. ignoreWhenEmpty: true,
  85. ignores: ['div', 'view', 'text', 'button', 'template', 'textarea', 'q-item-section', 'router-link']
  86. }],
  87. curly: ['error', 'multi-or-nest'], // if语句换行格式
  88. 'no-unused-expressions': ['error', {
  89. allowShortCircuit: true,
  90. allowTernary: true
  91. }],
  92. 'no-sequences': 'off',
  93. 'dot-notation': ['off'],
  94. 'eol-last': 'off',
  95. // "vue/multiline-html-element-content-newline": ["error", {
  96. // "ignoreWhenEmpty": true,
  97. // "ignores": ["per",'router-link'],
  98. // "allowEmptyLines": false
  99. // }],
  100. // "vue/singleline-html-element-content-newline": ["error", "never"],//允许在单行元素的内容之前和之后不需要换行
  101. // "semi": ["error", "always"],//要求或禁止使用分号
  102. // "eol-last": ["error", "never"],//在文件末尾要求或禁止换行
  103. // "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }],//禁止多行空行
  104. // "quotes": ["error", "double", { "allowTemplateLiterals": true }],//强制使用反引号,双引号或单引号
  105. // allow debugger during development only
  106. 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
  107. }
  108. }