Skip to content

Commit

Permalink
JS-85 Update usages of old apis (#4821)
Browse files Browse the repository at this point in the history
  • Loading branch information
zglicz committed Sep 18, 2024
1 parent e684f3b commit 696461a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
14 changes: 1 addition & 13 deletions its/ruling/src/test/expected/jsts/ace/javascript-S2189.json
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion packages/jsts/src/rules/S2189/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions packages/jsts/src/rules/S2301/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const S2301: Rule.RuleModule = {
true,
),
create: context => {
if (!isRequiredParserServices(context.parserServices)) {
if (!isRequiredParserServices(context.sourceCode.parserServices)) {
return {};
}

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 696461a

Please sign in to comment.