.eslintrc.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. module.exports = {
  2. root: true,
  3. parserOptions: {
  4. parser: 'babel-eslint',
  5. sourceType: 'module',
  6. },
  7. env: {
  8. browser: true,
  9. node: true,
  10. es6: true,
  11. },
  12. extends: ['plugin:vue/recommended', 'eslint:recommended'],
  13. // add your custom rules here
  14. //it is base on https://github.com/vuejs/eslint-config-vue
  15. rules: {
  16. 'vue/max-attributes-per-line': [
  17. 2,
  18. {
  19. singleline: 10,
  20. multiline: {
  21. max: 1,
  22. allowFirstLine: false,
  23. },
  24. },
  25. ],
  26. 'vue/singleline-html-element-content-newline': 'off',
  27. 'vue/multiline-html-element-content-newline': 'off',
  28. 'vue/name-property-casing': ['error', 'PascalCase'],
  29. 'vue/no-v-html': 'off',
  30. 'accessor-pairs': 2,
  31. 'arrow-spacing': [
  32. 2,
  33. {
  34. before: true,
  35. after: true,
  36. },
  37. ],
  38. 'block-spacing': [2, 'always'],
  39. 'brace-style': [
  40. 2,
  41. '1tbs',
  42. {
  43. allowSingleLine: true,
  44. },
  45. ],
  46. camelcase: [
  47. 0,
  48. {
  49. properties: 'always',
  50. },
  51. ],
  52. 'comma-dangle': [2, 'never'],
  53. 'comma-spacing': [
  54. 2,
  55. {
  56. before: false,
  57. after: true,
  58. },
  59. ],
  60. 'comma-style': [2, 'last'],
  61. 'constructor-super': 2,
  62. curly: [2, 'multi-line'],
  63. 'dot-location': [2, 'property'],
  64. 'eol-last': 2,
  65. eqeqeq: ['error', 'always', { null: 'ignore' }],
  66. 'generator-star-spacing': [
  67. 2,
  68. {
  69. before: true,
  70. after: true,
  71. },
  72. ],
  73. 'handle-callback-err': [2, '^(err|error)$'],
  74. indent: [
  75. 2,
  76. 2,
  77. {
  78. SwitchCase: 1,
  79. },
  80. ],
  81. 'jsx-quotes': [2, 'prefer-single'],
  82. 'key-spacing': [
  83. 2,
  84. {
  85. beforeColon: false,
  86. afterColon: true,
  87. },
  88. ],
  89. 'keyword-spacing': [
  90. 2,
  91. {
  92. before: true,
  93. after: true,
  94. },
  95. ],
  96. 'new-cap': [
  97. 2,
  98. {
  99. newIsCap: true,
  100. capIsNew: false,
  101. },
  102. ],
  103. 'new-parens': 2,
  104. 'no-array-constructor': 2,
  105. 'no-caller': 2,
  106. 'no-console': 'off',
  107. 'no-class-assign': 2,
  108. 'no-cond-assign': 2,
  109. 'no-const-assign': 2,
  110. 'no-control-regex': 0,
  111. 'no-delete-var': 2,
  112. 'no-dupe-args': 2,
  113. 'no-dupe-class-members': 2,
  114. 'no-dupe-keys': 2,
  115. 'no-duplicate-case': 2,
  116. 'no-empty-character-class': 2,
  117. 'no-empty-pattern': 2,
  118. 'no-eval': 2,
  119. 'no-ex-assign': 2,
  120. 'no-extend-native': 2,
  121. 'no-extra-bind': 2,
  122. 'no-extra-boolean-cast': 2,
  123. 'no-extra-parens': [2, 'functions'],
  124. 'no-fallthrough': 2,
  125. 'no-floating-decimal': 2,
  126. 'no-func-assign': 2,
  127. 'no-implied-eval': 2,
  128. 'no-inner-declarations': [2, 'functions'],
  129. 'no-invalid-regexp': 2,
  130. 'no-irregular-whitespace': 2,
  131. 'no-iterator': 2,
  132. 'no-label-var': 2,
  133. 'no-labels': [
  134. 2,
  135. {
  136. allowLoop: false,
  137. allowSwitch: false,
  138. },
  139. ],
  140. 'no-lone-blocks': 2,
  141. 'no-mixed-spaces-and-tabs': 2,
  142. 'no-multi-spaces': 2,
  143. 'no-multi-str': 2,
  144. 'no-multiple-empty-lines': [
  145. 2,
  146. {
  147. max: 1,
  148. },
  149. ],
  150. 'no-native-reassign': 2,
  151. 'no-negated-in-lhs': 2,
  152. 'no-new-object': 2,
  153. 'no-new-require': 2,
  154. 'no-new-symbol': 2,
  155. 'no-new-wrappers': 2,
  156. 'no-obj-calls': 2,
  157. 'no-octal': 2,
  158. 'no-octal-escape': 2,
  159. 'no-path-concat': 2,
  160. 'no-proto': 2,
  161. 'no-redeclare': 2,
  162. 'no-regex-spaces': 2,
  163. 'no-return-assign': [2, 'except-parens'],
  164. 'no-self-assign': 2,
  165. 'no-self-compare': 2,
  166. 'no-sequences': 2,
  167. 'no-shadow-restricted-names': 2,
  168. 'no-spaced-func': 2,
  169. 'no-sparse-arrays': 2,
  170. 'no-this-before-super': 2,
  171. 'no-throw-literal': 2,
  172. 'no-trailing-spaces': 2,
  173. 'no-undef': 2,
  174. 'no-undef-init': 2,
  175. 'no-unexpected-multiline': 2,
  176. 'no-unmodified-loop-condition': 2,
  177. 'no-unneeded-ternary': [
  178. 2,
  179. {
  180. defaultAssignment: false,
  181. },
  182. ],
  183. 'no-unreachable': 2,
  184. 'no-unsafe-finally': 2,
  185. 'no-unused-vars': [
  186. 2,
  187. {
  188. vars: 'all',
  189. args: 'none',
  190. },
  191. ],
  192. 'no-useless-call': 2,
  193. 'no-useless-computed-key': 2,
  194. 'no-useless-constructor': 2,
  195. 'no-useless-escape': 0,
  196. 'no-whitespace-before-property': 2,
  197. 'no-with': 2,
  198. 'one-var': [
  199. 2,
  200. {
  201. initialized: 'never',
  202. },
  203. ],
  204. 'operator-linebreak': [
  205. 2,
  206. 'after',
  207. {
  208. overrides: {
  209. '?': 'before',
  210. ':': 'before',
  211. },
  212. },
  213. ],
  214. 'padded-blocks': [2, 'never'],
  215. quotes: [
  216. 2,
  217. 'single',
  218. {
  219. avoidEscape: true,
  220. allowTemplateLiterals: true,
  221. },
  222. ],
  223. semi: [2, 'never'],
  224. 'semi-spacing': [
  225. 2,
  226. {
  227. before: false,
  228. after: true,
  229. },
  230. ],
  231. 'space-before-blocks': [2, 'always'],
  232. 'space-before-function-paren': [2, 'never'],
  233. 'space-in-parens': [2, 'never'],
  234. 'space-infix-ops': 2,
  235. 'space-unary-ops': [
  236. 2,
  237. {
  238. words: true,
  239. nonwords: false,
  240. },
  241. ],
  242. 'spaced-comment': [
  243. 2,
  244. 'always',
  245. {
  246. markers: ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','],
  247. },
  248. ],
  249. 'template-curly-spacing': [2, 'never'],
  250. 'use-isnan': 2,
  251. 'valid-typeof': 2,
  252. 'wrap-iife': [2, 'any'],
  253. 'yield-star-spacing': [2, 'both'],
  254. yoda: [2, 'never'],
  255. 'prefer-const': 2,
  256. 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
  257. 'object-curly-spacing': [
  258. 2,
  259. 'always',
  260. {
  261. objectsInObjects: false,
  262. },
  263. ],
  264. 'array-bracket-spacing': [2, 'never'],
  265. },
  266. };
  267. module.exports = {
  268. root: true,
  269. parserOptions: {
  270. parser: 'babel-eslint',
  271. sourceType: 'module',
  272. },
  273. env: {
  274. browser: true,
  275. node: true,
  276. es6: true,
  277. },
  278. extends: ['plugin:vue/recommended', 'eslint:recommended'],
  279. // add your custom rules here
  280. //it is base on https://github.com/vuejs/eslint-config-vue
  281. rules: {
  282. 'vue/max-attributes-per-line': [
  283. 2,
  284. {
  285. singleline: 10,
  286. multiline: {
  287. max: 1,
  288. allowFirstLine: false,
  289. },
  290. },
  291. ],
  292. 'vue/singleline-html-element-content-newline': 'off',
  293. 'vue/multiline-html-element-content-newline': 'off',
  294. 'vue/name-property-casing': ['error', 'PascalCase'],
  295. 'vue/no-v-html': 'off',
  296. 'accessor-pairs': 2,
  297. 'arrow-spacing': [
  298. 2,
  299. {
  300. before: true,
  301. after: true,
  302. },
  303. ],
  304. 'block-spacing': [2, 'always'],
  305. 'brace-style': [
  306. 2,
  307. '1tbs',
  308. {
  309. allowSingleLine: true,
  310. },
  311. ],
  312. camelcase: [
  313. 0,
  314. {
  315. properties: 'always',
  316. },
  317. ],
  318. 'comma-dangle': [2, 'never'],
  319. 'comma-spacing': [
  320. 2,
  321. {
  322. before: false,
  323. after: true,
  324. },
  325. ],
  326. 'comma-style': [2, 'last'],
  327. 'constructor-super': 2,
  328. curly: [2, 'multi-line'],
  329. 'dot-location': [2, 'property'],
  330. 'eol-last': 2,
  331. eqeqeq: ['error', 'always', { null: 'ignore' }],
  332. 'generator-star-spacing': [
  333. 2,
  334. {
  335. before: true,
  336. after: true,
  337. },
  338. ],
  339. 'handle-callback-err': [2, '^(err|error)$'],
  340. indent: [
  341. 2,
  342. 2,
  343. {
  344. SwitchCase: 1,
  345. },
  346. ],
  347. 'jsx-quotes': [2, 'prefer-single'],
  348. 'key-spacing': [
  349. 2,
  350. {
  351. beforeColon: false,
  352. afterColon: true,
  353. },
  354. ],
  355. 'keyword-spacing': [
  356. 2,
  357. {
  358. before: true,
  359. after: true,
  360. },
  361. ],
  362. 'new-cap': [
  363. 2,
  364. {
  365. newIsCap: true,
  366. capIsNew: false,
  367. },
  368. ],
  369. 'new-parens': 2,
  370. 'no-array-constructor': 2,
  371. 'no-caller': 2,
  372. 'no-console': 'off',
  373. 'no-class-assign': 2,
  374. 'no-cond-assign': 2,
  375. 'no-const-assign': 2,
  376. 'no-control-regex': 0,
  377. 'no-delete-var': 2,
  378. 'no-dupe-args': 2,
  379. 'no-dupe-class-members': 2,
  380. 'no-dupe-keys': 2,
  381. 'no-duplicate-case': 2,
  382. 'no-empty-character-class': 2,
  383. 'no-empty-pattern': 2,
  384. 'no-eval': 2,
  385. 'no-ex-assign': 2,
  386. 'no-extend-native': 2,
  387. 'no-extra-bind': 2,
  388. 'no-extra-boolean-cast': 2,
  389. 'no-extra-parens': [2, 'functions'],
  390. 'no-fallthrough': 2,
  391. 'no-floating-decimal': 2,
  392. 'no-func-assign': 2,
  393. 'no-implied-eval': 2,
  394. 'no-inner-declarations': [2, 'functions'],
  395. 'no-invalid-regexp': 2,
  396. 'no-irregular-whitespace': 2,
  397. 'no-iterator': 2,
  398. 'no-label-var': 2,
  399. 'no-labels': [
  400. 2,
  401. {
  402. allowLoop: false,
  403. allowSwitch: false,
  404. },
  405. ],
  406. 'no-lone-blocks': 2,
  407. 'no-mixed-spaces-and-tabs': 2,
  408. 'no-multi-spaces': 2,
  409. 'no-multi-str': 2,
  410. 'no-multiple-empty-lines': [
  411. 2,
  412. {
  413. max: 1,
  414. },
  415. ],
  416. 'no-native-reassign': 2,
  417. 'no-negated-in-lhs': 2,
  418. 'no-new-object': 2,
  419. 'no-new-require': 2,
  420. 'no-new-symbol': 2,
  421. 'no-new-wrappers': 2,
  422. 'no-obj-calls': 2,
  423. 'no-octal': 2,
  424. 'no-octal-escape': 2,
  425. 'no-path-concat': 2,
  426. 'no-proto': 2,
  427. 'no-redeclare': 2,
  428. 'no-regex-spaces': 2,
  429. 'no-return-assign': [2, 'except-parens'],
  430. 'no-self-assign': 2,
  431. 'no-self-compare': 2,
  432. 'no-sequences': 2,
  433. 'no-shadow-restricted-names': 2,
  434. 'no-spaced-func': 2,
  435. 'no-sparse-arrays': 2,
  436. 'no-this-before-super': 2,
  437. 'no-throw-literal': 2,
  438. 'no-trailing-spaces': 2,
  439. 'no-undef': 2,
  440. 'no-undef-init': 2,
  441. 'no-unexpected-multiline': 2,
  442. 'no-unmodified-loop-condition': 2,
  443. 'no-unneeded-ternary': [
  444. 2,
  445. {
  446. defaultAssignment: false,
  447. },
  448. ],
  449. 'no-unreachable': 2,
  450. 'no-unsafe-finally': 2,
  451. 'no-unused-vars': [
  452. 2,
  453. {
  454. vars: 'all',
  455. args: 'none',
  456. },
  457. ],
  458. 'no-useless-call': 2,
  459. 'no-useless-computed-key': 2,
  460. 'no-useless-constructor': 2,
  461. 'no-useless-escape': 0,
  462. 'no-whitespace-before-property': 2,
  463. 'no-with': 2,
  464. 'one-var': [
  465. 2,
  466. {
  467. initialized: 'never',
  468. },
  469. ],
  470. 'operator-linebreak': [
  471. 2,
  472. 'after',
  473. {
  474. overrides: {
  475. '?': 'before',
  476. ':': 'before',
  477. },
  478. },
  479. ],
  480. 'padded-blocks': [2, 'never'],
  481. quotes: [
  482. 2,
  483. 'single',
  484. {
  485. avoidEscape: true,
  486. allowTemplateLiterals: true,
  487. },
  488. ],
  489. semi: [2, 'never'],
  490. 'semi-spacing': [
  491. 2,
  492. {
  493. before: false,
  494. after: true,
  495. },
  496. ],
  497. 'space-before-blocks': [2, 'always'],
  498. 'space-before-function-paren': [2, 'never'],
  499. 'space-in-parens': [2, 'never'],
  500. 'space-infix-ops': 2,
  501. 'space-unary-ops': [
  502. 2,
  503. {
  504. words: true,
  505. nonwords: false,
  506. },
  507. ],
  508. 'spaced-comment': [
  509. 2,
  510. 'always',
  511. {
  512. markers: ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','],
  513. },
  514. ],
  515. 'template-curly-spacing': [2, 'never'],
  516. 'use-isnan': 2,
  517. 'valid-typeof': 2,
  518. 'wrap-iife': [2, 'any'],
  519. 'yield-star-spacing': [2, 'both'],
  520. yoda: [2, 'never'],
  521. 'prefer-const': 2,
  522. 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
  523. 'object-curly-spacing': [
  524. 2,
  525. 'always',
  526. {
  527. objectsInObjects: false,
  528. },
  529. ],
  530. 'array-bracket-spacing': [2, 'never'],
  531. },
  532. };