Skip to content

Commit 6c9a095

Browse files
authored
airbnb lint should not warn on vuex state mutation
close #3954
1 parent b916635 commit 6c9a095

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/@vue/cli-plugin-eslint/eslintOptions.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exports.config = api => {
1+
exports.config = (api, config) => {
22
const config = {
33
root: true,
44
env: { node: true },
@@ -8,6 +8,22 @@ exports.config = api => {
88
'no-debugger': makeJSOnlyValue(`process.env.NODE_ENV === 'production' ? 'error' : 'off'`)
99
}
1010
}
11+
if (config === 'airbnb') {
12+
config.rules['no-param-reassign'] = ['error', {
13+
props: true,
14+
ignorePropertyModificationsFor: [
15+
'state', // for vuex state
16+
'acc', // for reduce accumulators
17+
'e', // for e.returnvalue
18+
'ctx', // for Koa routing
19+
'req', // for Express requests
20+
'request', // for Express requests
21+
'res', // for Express responses
22+
'response', // for Express responses
23+
'$scope', // for Angular 1 scopes
24+
]
25+
}]
26+
}
1127
if (!api.hasPlugin('typescript')) {
1228
config.parserOptions = {
1329
parser: 'babel-eslint'

0 commit comments

Comments
 (0)