Skip to content

Commit

Permalink
Update eslint-plugin-sonarjs version (#4643)
Browse files Browse the repository at this point in the history
  • Loading branch information
zglicz authored Mar 28, 2024
1 parent 9ef95f7 commit c6bcad7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
3 changes: 0 additions & 3 deletions its/ruling/src/test/expected/jsts/ace/javascript-S4030.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"ace:lib/ace/mode/php/php.js": [
1154
],
"ace:lib/ace/mode/yaml/yaml-lint.js": [
3760
],
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-react": "7.34.1",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-sonarjs": "0.24.0",
"eslint-plugin-sonarjs": "0.25.0",
"express": "4.19.2",
"functional-red-black-tree": "1.0.1",
"htmlparser2": "9.1.0",
Expand Down
8 changes: 5 additions & 3 deletions packages/jsts/src/rules/S2004/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Rule } from 'eslint';
import { TSESTree } from '@typescript-eslint/utils';
import { getMainFunctionTokenLocation } from 'eslint-plugin-sonarjs/lib/utils/locations';
import { SONAR_RUNTIME } from '../../linter/parameters';
import { toEncodedMessage } from '../helpers';
import { RuleContext, toEncodedMessage } from '../helpers';

const DEFAULT_THRESHOLD = 4;

Expand All @@ -48,10 +48,12 @@ export const rule: Rule.RuleModule = {
if (nestedStack.length === max + 1) {
const secondaries = nestedStack.slice(0, -1);
context.report({
loc: getMainFunctionTokenLocation(fn, fn.parent, context),
loc: getMainFunctionTokenLocation(fn, fn.parent, context as unknown as RuleContext),
message: toEncodedMessage(
`Refactor this code to not nest functions more than ${max} levels deep.`,
secondaries.map(n => ({ loc: getMainFunctionTokenLocation(n, n.parent, context) })),
secondaries.map(n => ({
loc: getMainFunctionTokenLocation(n, n.parent, context as unknown as RuleContext),
})),
secondaries.map(_ => 'Nesting +1'),
),
});
Expand Down

0 comments on commit c6bcad7

Please sign in to comment.