.eslintrc.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. // @ts-check
  2. const { defineConfig } = require('eslint-define-config')
  3. module.exports = defineConfig({
  4. root: true,
  5. env: {
  6. browser: true,
  7. node: true,
  8. es6: true
  9. },
  10. parser: 'vue-eslint-parser',
  11. parserOptions: {
  12. parser: '@typescript-eslint/parser',
  13. ecmaVersion: 2020,
  14. sourceType: 'module',
  15. jsxPragma: 'React',
  16. ecmaFeatures: {
  17. jsx: true
  18. }
  19. },
  20. extends: [
  21. 'plugin:vue/vue3-recommended',
  22. 'plugin:@typescript-eslint/recommended',
  23. 'prettier',
  24. 'plugin:prettier/recommended',
  25. 'plugin:jest/recommended'
  26. ],
  27. rules: {
  28. '@typescript-eslint/ban-ts-ignore': 'off',
  29. '@typescript-eslint/explicit-function-return-type': 'off',
  30. '@typescript-eslint/no-explicit-any': 'off',
  31. '@typescript-eslint/no-var-requires': 'off',
  32. '@typescript-eslint/no-empty-function': 'off',
  33. 'vue/custom-event-name-casing': 'off',
  34. 'no-use-before-define': 'off',
  35. // 'no-use-before-define': [
  36. // 'error',
  37. // {
  38. // functions: false,
  39. // classes: true,
  40. // },
  41. // ],
  42. '@typescript-eslint/no-use-before-define': 'off',
  43. // '@typescript-eslint/no-use-before-define': [
  44. // 'error',
  45. // {
  46. // functions: false,
  47. // classes: true,
  48. // },
  49. // ],
  50. '@typescript-eslint/ban-ts-comment': 'off',
  51. '@typescript-eslint/ban-types': 'off',
  52. '@typescript-eslint/no-non-null-assertion': 'off',
  53. '@typescript-eslint/explicit-module-boundary-types': 'off',
  54. '@typescript-eslint/no-unused-vars': [2],
  55. '@typescript-eslint/no-extra-semi': 'off',
  56. 'no-unused-vars': [2],
  57. 'prefer-rest-params': 'off',
  58. 'prefer-spread': 'off',
  59. 'space-before-function-paren': 'off',
  60. 'vue/html-indent': 'off',
  61. 'vue/html-self-closing': [
  62. 'error',
  63. {
  64. html: {
  65. void: 'always',
  66. normal: 'never',
  67. component: 'always'
  68. },
  69. svg: 'always',
  70. math: 'always'
  71. }
  72. ],
  73. 'vue/max-attributes-per-line': [
  74. 2,
  75. {
  76. singleline: 10,
  77. multiline: {
  78. max: 1,
  79. allowFirstLine: false
  80. }
  81. }
  82. ],
  83. 'vue/singleline-html-element-content-newline': 'off',
  84. 'vue/multiline-html-element-content-newline': 'off',
  85. 'vue/name-property-casing': ['error', 'PascalCase'],
  86. 'vue/no-v-html': 'off',
  87. 'accessor-pairs': 2,
  88. 'jsx-quotes': ['error', 'prefer-double'],
  89. 'arrow-spacing': [
  90. 2,
  91. {
  92. before: true,
  93. after: true
  94. }
  95. ],
  96. 'block-spacing': [2, 'always'],
  97. 'brace-style': [
  98. 2,
  99. '1tbs',
  100. {
  101. allowSingleLine: true
  102. }
  103. ],
  104. camelcase: [
  105. 0,
  106. {
  107. properties: 'always'
  108. }
  109. ],
  110. 'comma-dangle': [2, 'never'],
  111. 'comma-spacing': [
  112. 2,
  113. {
  114. before: false,
  115. after: true
  116. }
  117. ],
  118. 'comma-style': [2, 'last'],
  119. 'constructor-super': 2,
  120. curly: [2, 'multi-line'],
  121. 'dot-location': [2, 'property'],
  122. 'eol-last': 2,
  123. eqeqeq: [
  124. 'error',
  125. 'always',
  126. {
  127. null: 'ignore'
  128. }
  129. ],
  130. 'generator-star-spacing': [
  131. 2,
  132. {
  133. before: true,
  134. after: true
  135. }
  136. ],
  137. 'handle-callback-err': [2, '^(err|error)$'],
  138. indent: [
  139. 'off',
  140. 2,
  141. {
  142. SwitchCase: 1
  143. }
  144. ],
  145. 'key-spacing': [
  146. 2,
  147. {
  148. beforeColon: false,
  149. afterColon: true
  150. }
  151. ],
  152. 'keyword-spacing': [
  153. 2,
  154. {
  155. before: true,
  156. after: true
  157. }
  158. ],
  159. 'new-cap': [
  160. 2,
  161. {
  162. newIsCap: true,
  163. capIsNew: false
  164. }
  165. ],
  166. 'new-parens': 2,
  167. 'no-array-constructor': 2,
  168. 'no-caller': 2,
  169. 'no-console': 'off',
  170. 'no-class-assign': 2,
  171. 'no-cond-assign': 2,
  172. 'no-const-assign': 2,
  173. 'no-control-regex': 0,
  174. 'no-delete-var': 2,
  175. 'no-dupe-args': 2,
  176. 'no-dupe-class-members': 2,
  177. 'no-dupe-keys': 2,
  178. 'no-duplicate-case': 2,
  179. 'no-empty-character-class': 2,
  180. 'no-empty-pattern': 2,
  181. 'no-eval': 2,
  182. 'no-ex-assign': 2,
  183. 'no-extend-native': 2,
  184. 'no-extra-bind': 2,
  185. 'no-extra-boolean-cast': 2,
  186. 'no-extra-parens': [2, 'functions'],
  187. 'no-fallthrough': 2,
  188. 'no-floating-decimal': 2,
  189. 'no-func-assign': 2,
  190. 'no-implied-eval': 2,
  191. 'no-inner-declarations': [2, 'functions'],
  192. 'no-invalid-regexp': 2,
  193. 'no-irregular-whitespace': 2,
  194. 'no-iterator': 2,
  195. 'no-label-var': 2,
  196. 'no-labels': [
  197. 2,
  198. {
  199. allowLoop: false,
  200. allowSwitch: false
  201. }
  202. ],
  203. 'no-lone-blocks': 2,
  204. 'no-mixed-spaces-and-tabs': 2,
  205. 'no-multi-spaces': 2,
  206. 'no-multi-str': 2,
  207. 'no-multiple-empty-lines': [
  208. 2,
  209. {
  210. max: 1
  211. }
  212. ],
  213. 'no-native-reassign': 2,
  214. 'no-negated-in-lhs': 2,
  215. 'no-new-object': 2,
  216. 'no-new-require': 2,
  217. 'no-new-symbol': 2,
  218. 'no-new-wrappers': 2,
  219. 'no-obj-calls': 2,
  220. 'no-octal': 2,
  221. 'no-octal-escape': 2,
  222. 'no-path-concat': 2,
  223. 'no-proto': 2,
  224. 'no-redeclare': 2,
  225. 'no-regex-spaces': 2,
  226. 'no-return-assign': [2, 'except-parens'],
  227. 'no-self-assign': 2,
  228. 'no-self-compare': 2,
  229. 'no-sequences': 2,
  230. 'no-shadow-restricted-names': 2,
  231. 'no-spaced-func': 2,
  232. 'no-sparse-arrays': 2,
  233. 'no-this-before-super': 2,
  234. 'no-throw-literal': 2,
  235. 'no-trailing-spaces': 2,
  236. 'no-undef': 0,
  237. 'no-undef-init': 2,
  238. 'no-unexpected-multiline': 2,
  239. 'no-unmodified-loop-condition': 2,
  240. 'no-unneeded-ternary': [
  241. 2,
  242. {
  243. defaultAssignment: false
  244. }
  245. ],
  246. 'no-unreachable': 2,
  247. 'no-unsafe-finally': 2,
  248. 'no-useless-call': 'off',
  249. 'no-useless-computed-key': 2,
  250. 'no-useless-constructor': 2,
  251. 'no-useless-escape': 0,
  252. 'no-whitespace-before-property': 2,
  253. 'no-with': 2,
  254. 'one-var': [
  255. 2,
  256. {
  257. initialized: 'never'
  258. }
  259. ],
  260. 'operator-linebreak': [
  261. 2,
  262. 'after',
  263. {
  264. overrides: {
  265. '?': 'before',
  266. ':': 'before'
  267. }
  268. }
  269. ],
  270. 'padded-blocks': [2, 'never'],
  271. quotes: [
  272. 2,
  273. 'single',
  274. {
  275. avoidEscape: true,
  276. allowTemplateLiterals: true
  277. }
  278. ],
  279. semi: [2, 'never'],
  280. 'semi-spacing': [
  281. 2,
  282. {
  283. before: false,
  284. after: true
  285. }
  286. ],
  287. 'space-before-blocks': [2, 'always'],
  288. 'space-in-parens': [2, 'never'],
  289. 'space-infix-ops': 2,
  290. 'space-unary-ops': [
  291. 2,
  292. {
  293. words: true,
  294. nonwords: false
  295. }
  296. ],
  297. 'spaced-comment': [
  298. 2,
  299. 'always',
  300. {
  301. markers: ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
  302. }
  303. ],
  304. 'template-curly-spacing': [2, 'never'],
  305. 'use-isnan': 2,
  306. 'valid-typeof': 2,
  307. 'wrap-iife': [2, 'any'],
  308. 'yield-star-spacing': [2, 'both'],
  309. yoda: [2, 'never'],
  310. 'prefer-const': 2,
  311. 'no-debugger': 0,
  312. 'object-curly-spacing': [
  313. 2,
  314. 'always',
  315. {
  316. objectsInObjects: false
  317. }
  318. ],
  319. 'array-bracket-spacing': [2, 'never'],
  320. 'vue/no-use-v-if-with-v-for': 'off'
  321. }
  322. })