Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslint-plugin-sonarjs version #4643

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading