diff --git a/its/ruling/src/test/expected/jsts/ace/javascript-S2189.json b/its/ruling/src/test/expected/jsts/ace/javascript-S2189.json index 480ac14e877..97e1032636b 100644 --- a/its/ruling/src/test/expected/jsts/ace/javascript-S2189.json +++ b/its/ruling/src/test/expected/jsts/ace/javascript-S2189.json @@ -1,21 +1,9 @@ { -"ace:lib/ace/mode/css/csslint.js": [ -4691 -], "ace:lib/ace/mode/javascript/jshint.js": [ 6549 ], "ace:lib/ace/mode/json/json_parse.js": [ -117, -117, -123, -123, -134, -134, -194, -194, -242, -270 +194 ], "ace:lib/ace/mode/yaml/yaml-lint.js": [ 1826 diff --git a/packages/jsts/src/rules/S2189/rule.ts b/packages/jsts/src/rules/S2189/rule.ts index 93329f0435b..27e66bdd85f 100644 --- a/packages/jsts/src/rules/S2189/rule.ts +++ b/packages/jsts/src/rules/S2189/rule.ts @@ -42,7 +42,9 @@ export const rule: Rule.RuleModule = { function (context: Rule.RuleContext, descriptor: Rule.ReportDescriptor) { const node = (descriptor as any).node as estree.Node; - const symbol = context.getScope().references.find(v => v.identifier === node)?.resolved; + const symbol = context.sourceCode + .getScope(node) + .references.find(v => v.identifier === node)?.resolved; /** Ignoring symbols that have already been reported */ if (isUndefined(node) || (symbol && alreadyRaisedSymbols.has(symbol))) { return; diff --git a/packages/jsts/src/rules/S2301/rule.ts b/packages/jsts/src/rules/S2301/rule.ts index 85ca9c5f463..913853b9499 100644 --- a/packages/jsts/src/rules/S2301/rule.ts +++ b/packages/jsts/src/rules/S2301/rule.ts @@ -52,7 +52,7 @@ export const S2301: Rule.RuleModule = { true, ), create: context => { - if (!isRequiredParserServices(context.parserServices)) { + if (!isRequiredParserServices(context.sourceCode.parserServices)) { return {}; } @@ -104,13 +104,13 @@ export const S2301: Rule.RuleModule = { return; } - const variable = getVariableFromIdentifier(node, context.getScope()); + const variable = getVariableFromIdentifier(node, context.sourceCode.getScope(node)); if (variable) { const definition = variable.defs[variable.defs.length - 1]; if (definition?.type === 'Parameter') { - const type = getTypeFromTreeNode(definition.name, context.parserServices); + const type = getTypeFromTreeNode(definition.name, context.sourceCode.parserServices); if (isBooleanType(type)) { report(