|
| 1 | +// .eslintrc.js |
1 | 2 | module.exports = { |
2 | 3 | root: true, |
3 | | - parserOptions: { |
4 | | - parser: 'babel-eslint', |
5 | | - sourceType: 'module' |
6 | | - }, |
7 | 4 | env: { |
8 | 5 | browser: true, |
9 | 6 | node: true, |
10 | | - es6: true, |
| 7 | + es2021: true |
11 | 8 | }, |
12 | 9 | extends: ['plugin:vue/recommended', 'eslint:recommended'], |
13 | | - |
14 | | - // add your custom rules here |
15 | | - //it is base on https://github.com/vuejs/eslint-config-vue |
| 10 | + parserOptions: { |
| 11 | + parser: '@babel/eslint-parser', |
| 12 | + sourceType: 'module', |
| 13 | + requireConfigFile: false |
| 14 | + }, |
16 | 15 | rules: { |
17 | | - "vue/max-attributes-per-line": [2, { |
18 | | - "singleline": 10, |
19 | | - "multiline": { |
20 | | - "max": 1, |
21 | | - "allowFirstLine": false |
22 | | - } |
23 | | - }], |
24 | | - // "vue/singleline-html-element-content-newline": "off", |
25 | | - // "vue/multiline-html-element-content-newline":"off", |
26 | | - // "vue/name-property-casing": ["error", "PascalCase"], |
27 | | - // "vue/no-v-html": "off", |
28 | | - // 'accessor-pairs': 2, |
29 | | - // 'arrow-spacing': [2, { |
30 | | - // 'before': true, |
31 | | - // 'after': true |
32 | | - // }], |
33 | | - // 'block-spacing': [2, 'always'], |
34 | | - // 'brace-style': [2, '1tbs', { |
35 | | - // 'allowSingleLine': true |
36 | | - // }], |
37 | | - // 'camelcase': [0, { |
38 | | - // 'properties': 'always' |
39 | | - // }], |
40 | | - // // json 最后一个属性是否可以有逗号 |
41 | | - // 'comma-dangle': 0, |
42 | | - // // 'comma-spacing': [2, { |
43 | | - // // 'before': false, |
44 | | - // // 'after': true |
45 | | - // // }], |
46 | | - // 'comma-style': [2, 'last'], |
47 | | - // 'constructor-super': 2, |
48 | | - // 'curly': [2, 'multi-line'], |
49 | | - // 'dot-location': [2, 'property'], |
50 | | - // 'eol-last': 2, |
51 | | - // 'eqeqeq': ["error", "always", {"null": "ignore"}], |
52 | | - // 'generator-star-spacing': [2, { |
53 | | - // 'before': true, |
54 | | - // 'after': true |
55 | | - // }], |
56 | | - // 'handle-callback-err': [2, '^(err|error)$'], |
57 | | - // 'indent': [2, 2, { |
58 | | - // 'SwitchCase': 1 |
59 | | - // }], |
60 | | - // 'jsx-quotes': [2, 'prefer-single'], |
61 | | - // 'key-spacing': [2, { |
62 | | - // 'beforeColon': false, |
63 | | - // 'afterColon': true |
64 | | - // }], |
65 | | - // 'keyword-spacing': [2, { |
66 | | - // 'before': true, |
67 | | - // 'after': true |
68 | | - // }], |
69 | | - // 'new-cap': [2, { |
70 | | - // 'newIsCap': true, |
71 | | - // 'capIsNew': false |
72 | | - // }], |
73 | | - // 'new-parens': 2, |
74 | | - // 'no-array-constructor': 2, |
75 | | - // 'no-caller': 2, |
76 | | - // 'no-console': 'off', |
77 | | - // 'no-class-assign': 2, |
78 | | - // 'no-cond-assign': 2, |
79 | | - // 'no-const-assign': 2, |
80 | | - // 'no-control-regex': 0, |
81 | | - // 'no-delete-var': 2, |
82 | | - // 'no-dupe-args': 2, |
83 | | - // 'no-dupe-class-members': 2, |
84 | | - // 'no-dupe-keys': 2, |
85 | | - // 'no-duplicate-case': 2, |
86 | | - // 'no-empty-character-class': 2, |
87 | | - // 'no-empty-pattern': 2, |
88 | | - // 'no-eval': 2, |
89 | | - // 'no-ex-assign': 2, |
90 | | - // 'no-extend-native': 2, |
91 | | - // 'no-extra-bind': 2, |
92 | | - // 'no-extra-boolean-cast': 2, |
93 | | - // 'no-extra-parens': [2, 'functions'], |
94 | | - // 'no-fallthrough': 2, |
95 | | - // 'no-floating-decimal': 2, |
96 | | - // 'no-func-assign': 2, |
97 | | - // 'no-implied-eval': 2, |
98 | | - // 'no-inner-declarations': [2, 'functions'], |
99 | | - // 'no-invalid-regexp': 2, |
100 | | - // 'no-irregular-whitespace': 2, |
101 | | - // 'no-iterator': 2, |
102 | | - // 'no-label-var': 2, |
103 | | - // 'no-labels': [2, { |
104 | | - // 'allowLoop': false, |
105 | | - // 'allowSwitch': false |
106 | | - // }], |
107 | | - // 'no-lone-blocks': 2, |
108 | | - // 'no-mixed-spaces-and-tabs': 2, |
109 | | - // 'no-multi-spaces': 2, |
110 | | - // 'no-multi-str': 2, |
111 | | - // 'no-multiple-empty-lines': [2, { |
112 | | - // 'max': 1 |
113 | | - // }], |
114 | | - // 'no-native-reassign': 2, |
115 | | - // 'no-negated-in-lhs': 2, |
116 | | - // 'no-new-object': 2, |
117 | | - // 'no-new-require': 2, |
118 | | - // 'no-new-symbol': 2, |
119 | | - // 'no-new-wrappers': 2, |
120 | | - // 'no-obj-calls': 2, |
121 | | - // 'no-octal': 2, |
122 | | - // 'no-octal-escape': 2, |
123 | | - // 'no-path-concat': 2, |
124 | | - // 'no-proto': 2, |
125 | | - // 'no-redeclare': 2, |
126 | | - // 'no-regex-spaces': 2, |
127 | | - // 'no-return-assign': [2, 'except-parens'], |
128 | | - // 'no-self-assign': 2, |
129 | | - // 'no-self-compare': 2, |
130 | | - // 'no-sequences': 2, |
131 | | - // 'no-shadow-restricted-names': 2, |
132 | | - // 'no-spaced-func': 2, |
133 | | - // 'no-sparse-arrays': 2, |
134 | | - // 'no-this-before-super': 2, |
135 | | - // 'no-throw-literal': 2, |
136 | | - // 'no-trailing-spaces': 2, |
137 | | - // 'no-undef': 2, |
138 | | - // 'no-undef-init': 2, |
139 | | - // 'no-unexpected-multiline': 2, |
140 | | - // 'no-unmodified-loop-condition': 2, |
141 | | - // 'no-unneeded-ternary': [2, { |
142 | | - // 'defaultAssignment': false |
143 | | - // }], |
144 | | - // 'no-unreachable': 2, |
145 | | - // 'no-unsafe-finally': 2, |
146 | | - 'no-unused-vars': [2, { |
147 | | - 'vars': 'all', |
148 | | - 'args': 'none' |
149 | | - }], |
150 | | - // 'no-useless-call': 2, |
151 | | - // 'no-useless-computed-key': 2, |
152 | | - // 'no-useless-constructor': 2, |
153 | | - // 'no-useless-escape': 0, |
154 | | - // 'no-whitespace-before-property': 2, |
155 | | - // 'no-with': 2, |
156 | | - // 'one-var': [2, { |
157 | | - // 'initialized': 'never' |
158 | | - // }], |
159 | | - // 'operator-linebreak': [2, 'after', { |
160 | | - // 'overrides': { |
161 | | - // '?': 'before', |
162 | | - // ':': 'before' |
163 | | - // } |
164 | | - // }], |
165 | | - // 'padded-blocks': [2, 'never'], |
166 | | - // // 字符串引号使用规则,单引号,双引号,反引号 |
167 | | - // // 'quotes': [2, 'single', { |
168 | | - // // 'avoidEscape': true, |
169 | | - // // 'allowTemplateLiterals': true |
170 | | - // // }], |
171 | | - // // 结尾不允许使用分号[2, 'never'], 必须使用分号[2, 'always'], 忽略semi:0 |
172 | | - // 'semi': 0, |
173 | | - // 'semi-spacing': [2, { |
174 | | - // 'before': false, |
175 | | - // 'after': true |
176 | | - // }], |
177 | | - // // 代码块,例如大括号,不允许有空格[2, 'never'], 必须有空格[2, 'always'], 忽略0 |
178 | | - // 'space-before-blocks': 0, |
179 | | - // 'space-before-function-paren': [2, 'never'], |
180 | | - // 'space-in-parens': [2, 'never'], |
181 | | - // 'space-infix-ops': 2, |
182 | | - // 'space-unary-ops': [2, { |
183 | | - // 'words': true, |
184 | | - // 'nonwords': false |
185 | | - // }], |
186 | | - // 'spaced-comment': [2, 'always', { |
187 | | - // 'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','] |
188 | | - // }], |
189 | | - // 'template-curly-spacing': [2, 'never'], |
190 | | - // 'use-isnan': 2, |
191 | | - // 'valid-typeof': 2, |
192 | | - // 'wrap-iife': [2, 'any'], |
193 | | - // 'yield-star-spacing': [2, 'both'], |
194 | | - // 'yoda': [2, 'never'], |
195 | | - // 'prefer-const': 2, |
196 | | - // 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, |
197 | | - // 'object-curly-spacing': [2, 'always', { |
198 | | - // objectsInObjects: false |
199 | | - // }], |
200 | | - // 'array-bracket-spacing': [2, 'never'] |
| 16 | + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| 17 | + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' |
201 | 18 | } |
202 | 19 | } |
0 commit comments