diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index 772eaf49ea1..2bab38f752d 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -69,7 +69,7 @@ export default util.createRule({ // Check if the node is a readonly class property if ( - typeof node.value === 'number' && + (typeof node.value === 'number' || typeof node.value === 'bigint') && isParentTSReadonlyPropertyDefinition(node) ) { if (options.ignoreReadonlyClassProperties) { diff --git a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts index 0c220805085..2bf16e99796 100644 --- a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts +++ b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts @@ -53,6 +53,7 @@ class Foo { static readonly D = 1; readonly E = -1; readonly F = +1; + private readonly G = 100n; } `, options: [{ ignoreReadonlyClassProperties: true }], @@ -204,6 +205,7 @@ class Foo { static readonly D = 4; readonly E = -5; readonly F = +6; + private readonly G = 100n; } `, options: [{ ignoreReadonlyClassProperties: false }], @@ -256,6 +258,14 @@ class Foo { line: 8, column: 17, }, + { + messageId: 'noMagic', + data: { + raw: '100n', + }, + line: 9, + column: 24, + }, ], }, ],