Skip to content

Commit 3b1a304

Browse files
slimeearnaudbesnier
authored andcommitted
[+] Technical - Add sonarJS linter for complexity issues. (#278)
1 parent a600892 commit 3b1a304

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

.eslintrc.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ module.exports = {
22
root: true,
33
extends: [
44
'airbnb-base',
5-
'plugin:jest/all'
5+
'plugin:jest/all',
6+
'plugin:sonarjs/recommended',
7+
],
8+
plugins: [
9+
'sonarjs',
610
],
7-
plugins: [],
811
env: {
912
node: true,
1013
},
1114
rules: {
1215
'implicit-arrow-linebreak': 0,
13-
'jest/no-hooks': 0,
14-
'no-param-reassign': 0,
15-
'no-underscore-dangle': 0,
1616
'import/no-extraneous-dependencies': [
1717
'error',
1818
{
@@ -22,6 +22,14 @@ module.exports = {
2222
'test/**/*.js'
2323
]
2424
}
25-
]
25+
],
26+
'jest/no-hooks': 0,
27+
'no-param-reassign': 0,
28+
'no-underscore-dangle': 0,
29+
'sonarjs/cognitive-complexity': 1,
30+
'sonarjs/no-duplicate-string': 0,
31+
'sonarjs/no-duplicated-branches': 1,
32+
'sonarjs/no-identical-functions': 0,
33+
'sonarjs/no-same-line-conditional': 0
2634
},
2735
};

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Change Log
22

33
## [Unreleased]
4+
### Added
5+
- Technical - Add SonarJS linter for complexity issues.
6+
47
### Changed
58
- Technical - Upgrade `mongoose` devDependency to the latest version.
69
- Performance optimization - In a request with no smart fields, do not return fields that are hidden from the UI.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"eslint-config-airbnb-base": "14.0.0",
4444
"eslint-plugin-import": "2.18.2",
4545
"eslint-plugin-jest": "23.0.4",
46+
"eslint-plugin-sonarjs": "0.5.0",
4647
"jest": "24.9.0",
4748
"mongoose": "5.8.1",
4849
"mongoose-fixture-loader": "1.0.2",

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,11 @@ [email protected]:
21462146
dependencies:
21472147
"@typescript-eslint/experimental-utils" "^2.5.0"
21482148

2149+
2150+
version "0.5.0"
2151+
resolved "https://registry.yarnpkg.com/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.5.0.tgz#ce17b2daba65a874c2862213a9e38e8986ad7d7d"
2152+
integrity sha512-XW5MnzlRjhXpIdbULC/qAdJYHWw3rRLws/DyawdlPU/IdVr9AmRK1r2LaCvabwKOAW2XYYSo3kDX58E4MrB7PQ==
2153+
21492154
eslint-scope@^5.0.0:
21502155
version "5.0.0"
21512156
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"

0 commit comments

Comments
 (0)