Skip to content

Commit

Permalink
enable some eslint sonar rules
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Aug 15, 2024
1 parent 5b69af0 commit 85f3639
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
'use strict';
/* eslint-disable no-undef, no-useless-call, sonar/no-reference-error -- required for testing */
/* eslint-disable es/no-legacy-object-prototype-accessor-methods -- required for testing */
var IS_PURE = require('../internals/is-pure');
var globalThis = require('../internals/global-this');
var fails = require('../internals/fails');
Expand All @@ -11,7 +13,6 @@ module.exports = IS_PURE || !fails(function () {
if (WEBKIT && WEBKIT < 535) return;
var key = Math.random();
// In FF throws only define methods
// eslint-disable-next-line no-undef, no-useless-call, es/no-legacy-object-prototype-accessor-methods -- required for testing
__defineSetter__.call(null, key, function () { /* empty */ });
delete globalThis[key];
});
14 changes: 14 additions & 0 deletions tests/eslint/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,20 @@ const base = {
'sonar/no-misused-promises': ERROR,
// assignments should not be redundant
'sonar/no-redundant-assignments': ERROR,
// redundant pairs of parentheses should be removed
'sonar/no-redundant-parentheses': ERROR,
// variables should be defined before being used
'sonar/no-reference-error': ERROR,
// promise rejections should not be caught by `try` blocks
'sonar/no-try-promise': ERROR,
// `undefined` should not be passed as the value of optional parameters
'sonar/no-undefined-argument': ERROR,
// errors should not be created without being thrown
'sonar/no-unthrown-error': ERROR,
// unused private class members should be removed
'sonar/no-unused-private-class-members': ERROR,
// values should not be uselessly incremented
'sonar/no-useless-increment': ERROR,

// sonarjs
// collection sizes and array length comparisons should make sense
Expand Down

0 comments on commit 85f3639

Please sign in to comment.