Skip to content

Commit 980d98b

Browse files
authored
Remove use of deprecated methods (#2173)
1 parent b2d7378 commit 980d98b

9 files changed

+13
-12
lines changed

rules/filename-case.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const create = context => {
144144
return new RegExp(item, 'u');
145145
});
146146
const chosenCasesFunctions = chosenCases.map(case_ => ignoreNumbers(cases[case_].fn));
147-
const filenameWithExtension = context.getPhysicalFilename();
147+
const filenameWithExtension = context.physicalFilename;
148148

149149
if (filenameWithExtension === '<input>' || filenameWithExtension === '<text>') {
150150
return;

rules/no-empty-file.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const hasTripeSlashDirectives = comments =>
1717

1818
/** @param {import('eslint').Rule.RuleContext} context */
1919
const create = context => {
20-
const filename = context.getPhysicalFilename();
20+
const filename = context.physicalFilename;
2121

2222
if (!/\.(?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$/i.test(filename)) {
2323
return;

rules/no-instanceof-array.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const create = context => {
2727
const {left, right} = node;
2828
let tokenStore = sourceCode;
2929
let instanceofToken = tokenStore.getTokenAfter(left, isInstanceofToken);
30-
if (!instanceofToken && context.parserServices.getTemplateBodyTokenStore) {
31-
tokenStore = context.parserServices.getTemplateBodyTokenStore();
30+
if (!instanceofToken && sourceCode.parserServices.getTemplateBodyTokenStore) {
31+
tokenStore = sourceCode.parserServices.getTemplateBodyTokenStore();
3232
instanceofToken = tokenStore.getTokenAfter(left, isInstanceofToken);
3333
}
3434

rules/no-useless-undefined.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const isFunctionBindCall = node =>
8181
&& node.callee.property.name === 'bind';
8282

8383
const isTypeScriptFile = context =>
84-
/\.(?:ts|mts|cts|tsx)$/i.test(context.getPhysicalFilename());
84+
/\.(?:ts|mts|cts|tsx)$/i.test(context.physicalFilename);
8585

8686
/** @param {import('eslint').Rule.RuleContext} context */
8787
const create = context => {

rules/prefer-module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function fixModuleExports(node, sourceCode) {
215215
}
216216

217217
function create(context) {
218-
const filename = context.getFilename().toLowerCase();
218+
const filename = context.filename.toLowerCase();
219219

220220
if (filename.endsWith('.cjs')) {
221221
return;

rules/prefer-top-level-await.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const isInPromiseMethods = node =>
6161

6262
/** @param {import('eslint').Rule.RuleContext} context */
6363
function create(context) {
64-
if (context.getFilename().toLowerCase().endsWith('.cjs')) {
64+
if (context.filename.toLowerCase().endsWith('.cjs')) {
6565
return;
6666
}
6767

rules/prevent-abbreviations.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ const isInternalImport = node => {
338338
/** @param {import('eslint').Rule.RuleContext} context */
339339
const create = context => {
340340
const options = prepareOptions(context.options[0]);
341-
const filenameWithExtension = context.getPhysicalFilename();
341+
const filenameWithExtension = context.physicalFilename;
342342

343343
// A `class` declaration produces two variables in two scopes:
344344
// the inner class scope, and the outer one (wherever the class is declared).

rules/utils/rule.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,13 @@ function checkVueTemplate(create, options) {
137137

138138
const wrapped = context => {
139139
const listeners = create(context);
140+
const {parserServices} = context.sourceCode;
140141

141142
// `vue-eslint-parser`
142-
if (context.parserServices?.defineTemplateBodyVisitor) {
143+
if (parserServices?.defineTemplateBodyVisitor) {
143144
return visitScriptBlock
144-
? context.parserServices.defineTemplateBodyVisitor(listeners, listeners)
145-
: context.parserServices.defineTemplateBodyVisitor(listeners);
145+
? parserServices.defineTemplateBodyVisitor(listeners, listeners)
146+
: parserServices.defineTemplateBodyVisitor(listeners);
146147
}
147148

148149
return listeners;

scripts/internal-rules/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
{
2727
...rule,
2828
create(context) {
29-
const filename = context.getPhysicalFilename();
29+
const filename = context.physicalFilename;
3030
if (directories.every(directory => !isFileInsideDirectory(filename, directory))) {
3131
return {};
3232
}

0 commit comments

Comments
 (0)