mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-15 09:58:18 -07:00
Add sonarjs eslint plugin
This commit is contained in:
parent
0425271b43
commit
52e92d44af
25
.eslintrc.js
25
.eslintrc.js
@ -7,7 +7,8 @@ module.exports = {
|
||||
'react',
|
||||
'promise',
|
||||
'import',
|
||||
'eslint-comments'
|
||||
'eslint-comments',
|
||||
'sonarjs'
|
||||
],
|
||||
env: {
|
||||
node: true,
|
||||
@ -29,7 +30,8 @@ module.exports = {
|
||||
// 'plugin:promise/recommended',
|
||||
'plugin:import/errors',
|
||||
'plugin:eslint-comments/recommended',
|
||||
'plugin:compat/recommended'
|
||||
'plugin:compat/recommended',
|
||||
'plugin:sonarjs/recommended'
|
||||
],
|
||||
rules: {
|
||||
'array-callback-return': ['error'],
|
||||
@ -51,6 +53,7 @@ module.exports = {
|
||||
'no-multiple-empty-lines': ['error', { 'max': 1 }],
|
||||
'no-restricted-globals': ['error'].concat(restrictedGlobals),
|
||||
'no-return-await': ['error'],
|
||||
'no-sequences': ['error', { 'allowInParentheses': false }],
|
||||
'no-trailing-spaces': ['error'],
|
||||
'@babel/no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
|
||||
'no-void': ['error', { 'allowAsStatement': true }],
|
||||
@ -64,9 +67,23 @@ module.exports = {
|
||||
'space-before-blocks': ['error'],
|
||||
'space-infix-ops': 'error',
|
||||
'yoda': 'error',
|
||||
'no-sequences': ['error', { 'allowInParentheses': false }],
|
||||
|
||||
'react/jsx-filename-extension': ['error', { 'extensions': ['.jsx', '.tsx'] }]
|
||||
'react/jsx-filename-extension': ['error', { 'extensions': ['.jsx', '.tsx'] }],
|
||||
|
||||
'sonarjs/cognitive-complexity': ['warn'],
|
||||
// TODO: Enable the following rules and fix issues
|
||||
'sonarjs/max-switch-cases': ['off'],
|
||||
'sonarjs/no-collapsible-if': ['off'],
|
||||
'sonarjs/no-duplicate-string': ['off'],
|
||||
'sonarjs/no-duplicated-branches': ['off'],
|
||||
'sonarjs/no-gratuitous-expressions': ['off'],
|
||||
'sonarjs/no-identical-functions': ['off'],
|
||||
'sonarjs/no-nested-switch': ['off'],
|
||||
'sonarjs/no-redundant-jump': ['off'],
|
||||
'sonarjs/no-small-switch': ['off'],
|
||||
'sonarjs/no-unused-collection': ['off'],
|
||||
'sonarjs/prefer-object-literal': ['off'],
|
||||
'sonarjs/prefer-single-boolean-return': ['off']
|
||||
},
|
||||
settings: {
|
||||
react: {
|
||||
|
20
package-lock.json
generated
20
package-lock.json
generated
@ -85,6 +85,7 @@
|
||||
"eslint-plugin-promise": "6.0.1",
|
||||
"eslint-plugin-react": "7.31.8",
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"eslint-plugin-sonarjs": "0.15.0",
|
||||
"expose-loader": "4.0.0",
|
||||
"html-loader": "4.2.0",
|
||||
"html-webpack-plugin": "5.5.0",
|
||||
@ -6416,6 +6417,18 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-sonarjs": {
|
||||
"version": "0.15.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.15.0.tgz",
|
||||
"integrity": "sha512-LuxHdAe6VqSbi1phsUvNjbmXLuvlobmryQJJNyQYbdubCfz6K8tmgoqNiJPnz0pP2AbYDbtuPm0ajOMgMrC+dQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-rule-composer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz",
|
||||
@ -23343,6 +23356,13 @@
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"eslint-plugin-sonarjs": {
|
||||
"version": "0.15.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.15.0.tgz",
|
||||
"integrity": "sha512-LuxHdAe6VqSbi1phsUvNjbmXLuvlobmryQJJNyQYbdubCfz6K8tmgoqNiJPnz0pP2AbYDbtuPm0ajOMgMrC+dQ==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"eslint-rule-composer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz",
|
||||
|
@ -37,6 +37,7 @@
|
||||
"eslint-plugin-promise": "6.0.1",
|
||||
"eslint-plugin-react": "7.31.8",
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"eslint-plugin-sonarjs": "0.15.0",
|
||||
"expose-loader": "4.0.0",
|
||||
"html-loader": "4.2.0",
|
||||
"html-webpack-plugin": "5.5.0",
|
||||
|
@ -79,8 +79,7 @@ function generateDeviceId() {
|
||||
keys.push(navigator.userAgent);
|
||||
keys.push(new Date().getTime());
|
||||
if (window.btoa) {
|
||||
const result = replaceAll(btoa(keys.join('|')), '=', '1');
|
||||
return result;
|
||||
return replaceAll(btoa(keys.join('|')), '=', '1');
|
||||
}
|
||||
|
||||
return new Date().getTime();
|
||||
|
Loading…
Reference in New Issue
Block a user