Skip to content

Commit ddc5291

Browse files
authored
chore: don't use deprecated context methods in ast-utils tests (#17194)
1 parent 880a431 commit ddc5291

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/lib/rules/utils/ast-utils.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("ast-utils", () => {
6464
linter.defineRule("checker", {
6565
create: mustCall(context => ({
6666
BlockStatement: mustCall(node => {
67-
assert.isFalse(astUtils.isTokenOnSameLine(context.getTokenBefore(node), node));
67+
assert.isFalse(astUtils.isTokenOnSameLine(context.sourceCode.getTokenBefore(node), node));
6868
})
6969
}))
7070
});
@@ -77,7 +77,7 @@ describe("ast-utils", () => {
7777
linter.defineRule("checker", {
7878
create: mustCall(context => ({
7979
BlockStatement: mustCall(node => {
80-
assert.isTrue(astUtils.isTokenOnSameLine(context.getTokenBefore(node), node));
80+
assert.isTrue(astUtils.isTokenOnSameLine(context.sourceCode.getTokenBefore(node), node));
8181
})
8282
}))
8383
});
@@ -123,7 +123,7 @@ describe("ast-utils", () => {
123123
linter.defineRule("checker", {
124124
create: mustCall(context => ({
125125
CatchClause: mustCall(node => {
126-
const variables = context.getDeclaredVariables(node);
126+
const variables = context.sourceCode.getDeclaredVariables(node);
127127

128128
assert.lengthOf(astUtils.getModifyingReferences(variables[0].references), 1);
129129
})
@@ -138,7 +138,7 @@ describe("ast-utils", () => {
138138
linter.defineRule("checker", {
139139
create: mustCall(context => ({
140140
VariableDeclaration: mustCall(node => {
141-
const variables = context.getDeclaredVariables(node);
141+
const variables = context.sourceCode.getDeclaredVariables(node);
142142

143143
assert.lengthOf(astUtils.getModifyingReferences(variables[0].references), 1);
144144
})
@@ -152,7 +152,7 @@ describe("ast-utils", () => {
152152
linter.defineRule("checker", {
153153
create: mustCall(context => ({
154154
VariableDeclaration: mustCall(node => {
155-
const variables = context.getDeclaredVariables(node);
155+
const variables = context.sourceCode.getDeclaredVariables(node);
156156

157157
assert.lengthOf(astUtils.getModifyingReferences(variables[0].references), 0);
158158
})
@@ -167,7 +167,7 @@ describe("ast-utils", () => {
167167
linter.defineRule("checker", {
168168
create: mustCall(context => ({
169169
ClassDeclaration: mustCall(node => {
170-
const variables = context.getDeclaredVariables(node);
170+
const variables = context.sourceCode.getDeclaredVariables(node);
171171

172172
assert.lengthOf(astUtils.getModifyingReferences(variables[0].references), 1);
173173
assert.lengthOf(astUtils.getModifyingReferences(variables[1].references), 0);
@@ -182,7 +182,7 @@ describe("ast-utils", () => {
182182
linter.defineRule("checker", {
183183
create: mustCall(context => ({
184184
ClassDeclaration: mustCall(node => {
185-
const variables = context.getDeclaredVariables(node);
185+
const variables = context.sourceCode.getDeclaredVariables(node);
186186

187187
assert.lengthOf(astUtils.getModifyingReferences(variables[0].references), 0);
188188
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy