Add eslint rules for sonar issues

This commit is contained in:
Bill Thornton 2022-12-16 16:02:11 -05:00
parent 2690b90d84
commit 19f416580c
12 changed files with 45 additions and 30 deletions

View file

@ -56,6 +56,7 @@ module.exports = {
'no-return-assign': ['error'],
'no-return-await': ['error'],
'no-sequences': ['error', { 'allowInParentheses': false }],
'no-shadow': ['error'],
'no-trailing-spaces': ['error'],
'@babel/no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
'no-useless-constructor': ['error'],
@ -70,12 +71,15 @@ module.exports = {
'space-before-blocks': ['error'],
'space-infix-ops': 'error',
'yoda': 'error',
'@typescript-eslint/no-shadow': 'error',
'react/jsx-filename-extension': ['error', { 'extensions': ['.jsx', '.tsx'] }],
'react/jsx-no-bind': ['error'],
'react/jsx-no-constructed-context-values': ['error'],
'react/no-array-index-key': ['error'],
'sonarjs/cognitive-complexity': ['warn'],
'sonarjs/no-inverted-boolean-check': ['error'],
// TODO: Enable the following rules and fix issues
'sonarjs/cognitive-complexity': ['off'],
'sonarjs/no-duplicate-string': ['off']
},
settings: {
@ -255,8 +259,14 @@ module.exports = {
'plugin:jsx-a11y/recommended'
],
rules: {
// Use TypeScript equivalent rules when required
'no-shadow': ['off'],
'@typescript-eslint/no-shadow': ['error'],
'no-useless-constructor': ['off'],
'@typescript-eslint/no-useless-constructor': ['error']
'@typescript-eslint/no-useless-constructor': ['error'],
'max-params': ['error', 7],
'sonarjs/cognitive-complexity': ['warn']
}
}
]