Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 3475264

Browse files
[eslint config] [base] Add ignorePropertyModificationsFor
1 parent 772bbb5 commit 3475264

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/eslint-config-airbnb-base/rules/best-practices.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,21 @@ module.exports = {
164164
'no-octal-escape': 'error',
165165

166166
// disallow reassignment of function parameters
167-
// disallow parameter object manipulation
167+
// disallow parameter object manipulation except for specific exclusions
168168
// rule: http://eslint.org/docs/rules/no-param-reassign.html
169-
'no-param-reassign': ['error', { props: true }],
169+
'no-param-reassign': ['error', {
170+
props: true,
171+
ignorePropertyModificationsFor: [
172+
'acc', // for reduce accumulators
173+
'e', // for e.returnvalue
174+
'ctx', // for Koa routing
175+
'req', // for Express requests
176+
'request', // for Express requests
177+
'res', // for Express responses
178+
'response', // for Express responses
179+
'$scope', // for Angular 1 scopes
180+
]
181+
}],
170182

171183
// disallow usage of __proto__ property
172184
'no-proto': 'error',

0 commit comments

Comments
 (0)