Skip to content

Commit 251d20b

Browse files
committed
feat: add ESLint 10 compatibility
- Update context.getFilename() to context.filename ?? context.getFilename() across 18 rule files and lib/utils/ember.js - Add error property normalization in eslint-compat.js for ESLint 10's stricter test assertions - Add isESLint10OrLater detection for version-specific handling
1 parent 5fad65a commit 251d20b

147 files changed

Lines changed: 801 additions & 374 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/rules/no-assignment-of-untracked-properties-used-in-tracking-contexts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ module.exports = {
177177
ERROR_MESSAGE,
178178

179179
create(context) {
180-
if (emberUtils.isTestFile(context.getFilename())) {
180+
if (emberUtils.isTestFile(context.filename ?? context.getFilename())) {
181181
// This rule does not apply to test files.
182182
return {};
183183
}

lib/rules/no-empty-attrs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222

2323
create(context) {
2424
const message = 'Supply proper attribute type';
25-
const filePath = context.getFilename();
25+
const filePath = context.filename ?? context.getFilename();
2626

2727
const report = function (node) {
2828
context.report({ node, message });

lib/rules/no-get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ module.exports = {
230230
let importedGetName;
231231
let importedGetPropertiesName;
232232

233-
const filename = context.getFilename();
233+
const filename = context.filename ?? context.getFilename();
234234

235235
const sourceCode = context.sourceCode ?? context.getSourceCode();
236236
const { scopeManager } = sourceCode;

lib/rules/no-pause-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727
ERROR_MESSAGE,
2828

2929
create(context) {
30-
if (!emberUtils.isTestFile(context.getFilename())) {
30+
if (!emberUtils.isTestFile(context.filename ?? context.getFilename())) {
3131
return {};
3232
}
3333

lib/rules/no-replace-test-comments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = {
4242
// Public
4343
//----------------------------------------------------------------------
4444

45-
if (!emberUtils.isTestFile(context.getFilename())) {
45+
if (!emberUtils.isTestFile(context.filename ?? context.getFilename())) {
4646
return {};
4747
}
4848
return {

lib/rules/no-restricted-service-injections.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ module.exports = {
7070
}
7171

7272
// Find matching denylist entries for this file path.
73+
const filename = context.filename ?? context.getFilename();
7374
const denylists = context.options.filter(
74-
(option) => !option.paths || option.paths.some((path) => context.getFilename().match(path))
75+
(option) => !option.paths || option.paths.some((path) => filename.match(path))
7576
);
7677

7778
if (denylists.length === 0) {

lib/rules/no-shadow-route-definition.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ module.exports = {
5151
buildErrorMessage,
5252

5353
create(context) {
54-
if (ember.isTestFile(context.getFilename())) {
54+
const filename = context.filename ?? context.getFilename();
55+
if (ember.isTestFile(filename)) {
5556
// This rule does not apply to test files.
5657
return {};
5758
}

lib/rules/no-test-and-then.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
ERROR_MESSAGE,
2727

2828
create(context) {
29-
if (!emberUtils.isTestFile(context.getFilename())) {
29+
if (!emberUtils.isTestFile(context.filename ?? context.getFilename())) {
3030
return {};
3131
}
3232

lib/rules/no-test-import-export.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ module.exports = {
2828
},
2929

3030
create: function create(context) {
31+
const filename = context.filename ?? context.getFilename();
3132
const noExports = function (node) {
32-
if (
33-
!emberUtils.isTestFile(context.getFilename()) ||
34-
isTestHelperFilename(context.getFilename())
35-
) {
33+
if (!emberUtils.isTestFile(filename) || isTestHelperFilename(filename)) {
3634
return;
3735
}
3836

@@ -48,7 +46,7 @@ module.exports = {
4846

4947
if (
5048
importSource.endsWith('-test') &&
51-
!isTestHelperFilename(path.resolve(path.dirname(context.getFilename()), importSource))
49+
!isTestHelperFilename(path.resolve(path.dirname(filename), importSource))
5250
) {
5351
context.report({
5452
message: NO_IMPORT_MESSAGE,

lib/rules/no-test-module-for.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = {
2828
ERROR_MESSAGE,
2929

3030
create(context) {
31-
const filename = context.getFilename();
31+
const filename = context.filename ?? context.getFilename();
3232
const isTestFile =
3333
emberUtils.isTestFile(filename) ||
3434
(filename.includes('tests') && filename.includes('helpers'));

0 commit comments

Comments
 (0)