From 34752644c395ff1d23dd8ce1a3bd040bf65e2b1f Mon Sep 17 00:00:00 2001 From: Christian Bundy Date: Wed, 15 Mar 2017 14:27:08 +0000 Subject: [PATCH] [eslint config] [base] Add ignorePropertyModificationsFor --- .../rules/best-practices.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/eslint-config-airbnb-base/rules/best-practices.js b/packages/eslint-config-airbnb-base/rules/best-practices.js index 2587bc55e9..a3a9e1eaa6 100644 --- a/packages/eslint-config-airbnb-base/rules/best-practices.js +++ b/packages/eslint-config-airbnb-base/rules/best-practices.js @@ -164,9 +164,21 @@ module.exports = { 'no-octal-escape': 'error', // disallow reassignment of function parameters - // disallow parameter object manipulation + // disallow parameter object manipulation except for specific exclusions // rule: http://eslint.org/docs/rules/no-param-reassign.html - 'no-param-reassign': ['error', { props: true }], + 'no-param-reassign': ['error', { + props: true, + ignorePropertyModificationsFor: [ + 'acc', // for reduce accumulators + 'e', // for e.returnvalue + 'ctx', // for Koa routing + 'req', // for Express requests + 'request', // for Express requests + 'res', // for Express responses + 'response', // for Express responses + '$scope', // for Angular 1 scopes + ] + }], // disallow usage of __proto__ property 'no-proto': 'error',