Skip to content

Commit 6d226aa

Browse files
committed
Increase the cognitive complexity threshold
React function-based code is naturally +3 to +8 complexity, and is triggering all over the place, without developers having a viable solution. Add `overrides` note to help developers not make terrible decisions.
1 parent dde8f40 commit 6d226aa

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

index.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ module.exports = {
166166
'promise/no-return-in-finally': 'warn',
167167
'promise/valid-params': 'warn',
168168

169-
'sonarjs/cognitive-complexity': ["warn", 15],
169+
'sonarjs/cognitive-complexity': ["warn", 25],
170170
'sonarjs/max-switch-cases': ["warn", 10],
171171
'sonarjs/no-all-duplicated-branches': 'warn',
172172
'sonarjs/no-collapsible-if': 'warn',
@@ -206,4 +206,22 @@ module.exports = {
206206

207207
// See eslint-config-tree/.eslintrc.js for example deprecation rules.
208208
}
209+
/**
210+
* @property {object} overrides - Linting overrides for matched files.
211+
* Sadly, we cannot provide a base `overrides` entry for things like demos, tests, & mocks. Add this with any needed modifications to your own .eslintrc.js files for each project.
212+
*/
213+
// overrides: [
214+
// {
215+
// files: ['*.stories.js', '*.test.js', '**/*mock*/**', '*mock*'],
216+
// rules: {
217+
// 'no-alert': 'off',
218+
// 'no-console': 'off',
219+
// 'no-unused-vars': 'off',
220+
// 'sonarjs/no-duplicate-string': 'off',
221+
// 'sonarjs/no-identical-functions': 'off',
222+
// 'test-selectors/button': 'off',
223+
// 'test-selectors/onChange': 'off',
224+
// },
225+
// },
226+
// ],
209227
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-tree",
3-
"version": "5.0.0",
3+
"version": "5.0.1",
44
"description": "Shared Tree configuration that contains overrides and enhancements on top of the base frontier configuration.",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)