From 33a4986d37cca668ac9af7d32b7aa7425893de40 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 15:37:59 +0000 Subject: [PATCH 1/6] chore(deps): update dependency eslint-plugin-perfectionist to v3.8.0 --- yarn.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/yarn.lock b/yarn.lock index 644ab11b7b1c..74063a8c9f91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5809,7 +5809,7 @@ __metadata: languageName: unknown linkType: soft -"@typescript-eslint/types@8.8.1, @typescript-eslint/types@^8.3.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": +"@typescript-eslint/types@8.8.1, @typescript-eslint/types@^8.8.0, @typescript-eslint/types@workspace:*, @typescript-eslint/types@workspace:^, @typescript-eslint/types@workspace:packages/types": version: 0.0.0-use.local resolution: "@typescript-eslint/types@workspace:packages/types" dependencies: @@ -5953,7 +5953,7 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@8.8.1, @typescript-eslint/utils@^8.3.0, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": +"@typescript-eslint/utils@8.8.1, @typescript-eslint/utils@^8.8.0, @typescript-eslint/utils@workspace:*, @typescript-eslint/utils@workspace:^, @typescript-eslint/utils@workspace:packages/utils": version: 0.0.0-use.local resolution: "@typescript-eslint/utils@workspace:packages/utils" dependencies: @@ -9862,18 +9862,18 @@ __metadata: linkType: hard "eslint-plugin-perfectionist@npm:^3.2.0": - version: 3.3.0 - resolution: "eslint-plugin-perfectionist@npm:3.3.0" + version: 3.8.0 + resolution: "eslint-plugin-perfectionist@npm:3.8.0" dependencies: - "@typescript-eslint/types": ^8.3.0 - "@typescript-eslint/utils": ^8.3.0 - minimatch: ^10.0.1 + "@typescript-eslint/types": ^8.8.0 + "@typescript-eslint/utils": ^8.8.0 + minimatch: ^9.0.5 natural-compare-lite: ^1.4.0 peerDependencies: astro-eslint-parser: ^1.0.2 eslint: ">=8.0.0" svelte: ">=3.0.0" - svelte-eslint-parser: ^0.41.0 + svelte-eslint-parser: ^0.41.1 vue-eslint-parser: ">=9.0.0" peerDependenciesMeta: astro-eslint-parser: @@ -9884,7 +9884,7 @@ __metadata: optional: true vue-eslint-parser: optional: true - checksum: c1a603d4718a75dc7ff14ba976d01c2d2a0e352f27309c6099b2ed9be54d789ac37242fdd4106015a0a19e797a00a5faac9c12157ff0ae39aadf00df1d2f3cf2 + checksum: dbaa8985ad13a26d68090b57fd973f22248aa62d9d45e655b625c4464e7992a336afdd492ab06b3d3061b851abc683efa40ca706821646fe6dd6e65ccf74ad31 languageName: node linkType: hard @@ -15009,7 +15009,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^10.0.0, minimatch@npm:^10.0.1, minimatch@npm:~10.0.1": +"minimatch@npm:^10.0.0, minimatch@npm:~10.0.1": version: 10.0.1 resolution: "minimatch@npm:10.0.1" dependencies: @@ -15036,12 +15036,12 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.3, minimatch@npm:^9.0.4": - version: 9.0.4 - resolution: "minimatch@npm:9.0.4" +"minimatch@npm:^9.0.3, minimatch@npm:^9.0.4, minimatch@npm:^9.0.5": + version: 9.0.5 + resolution: "minimatch@npm:9.0.5" dependencies: brace-expansion: ^2.0.1 - checksum: cf717f597ec3eed7dabc33153482a2e8d49f4fd3c26e58fd9c71a94c5029a0838728841b93f46bf1263b65a8010e2ee800d0dc9b004ab8ba8b6d1ec07cc115b5 + checksum: 2c035575eda1e50623c731ec6c14f65a85296268f749b9337005210bb2b34e2705f8ef1a358b188f69892286ab99dc42c8fb98a57bde55c8d81b3023c19cea28 languageName: node linkType: hard From 0c33efefc77226da0f5364bdfc88afc4e9915b2c Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 12:33:17 -0400 Subject: [PATCH 2/6] Updated fixes --- .../src/rules/class-methods-use-this.ts | 6 +++--- .../src/rules/no-duplicate-type-constituents.ts | 2 +- .../eslint-plugin/src/rules/no-implied-eval.ts | 4 ++-- packages/eslint-plugin/src/rules/no-redeclare.ts | 4 ++-- .../eslint-plugin/src/rules/no-type-alias.ts | 6 +++--- ...-unnecessary-parameter-property-assignment.ts | 2 +- .../src/rules/no-unnecessary-qualifier.ts | 2 +- .../src/rules/no-unnecessary-type-parameters.ts | 4 +--- .../src/rules/parameter-properties.ts | 6 +++--- .../src/rules/prefer-function-type.ts | 16 ++++++++-------- .../src/rules/restrict-template-expressions.ts | 4 ++-- .../src/util/collectUnusedVariables.ts | 8 ++++---- .../src/util/isArrayMethodCallWithPredicate.ts | 2 +- .../src/util/needsPrecedingSemiColon.ts | 2 +- packages/eslint-plugin/tests/docs.test.ts | 4 ++-- .../rules/no-unnecessary-type-parameters.test.ts | 4 ++-- 16 files changed, 37 insertions(+), 39 deletions(-) diff --git a/packages/eslint-plugin/src/rules/class-methods-use-this.ts b/packages/eslint-plugin/src/rules/class-methods-use-this.ts index bb2c537fcf11..1d3beff94d25 100644 --- a/packages/eslint-plugin/src/rules/class-methods-use-this.ts +++ b/packages/eslint-plugin/src/rules/class-methods-use-this.ts @@ -257,12 +257,12 @@ export default createRule({ /* * Class field value are implicit functions. */ - 'PropertyDefinition > *.key:exit'(): void { - pushContext(); - }, 'PropertyDefinition:exit'(): void { popContext(); }, + 'PropertyDefinition > *.key:exit'(): void { + pushContext(); + }, /* * Class static blocks are implicit functions. They aren't required to use `this`, diff --git a/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts index 7d90dbc42b72..c6b700e27ff7 100644 --- a/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts +++ b/packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts @@ -22,7 +22,7 @@ export type Options = [ export type MessageIds = 'duplicate' | 'unnecessary'; -const astIgnoreKeys = new Set(['range', 'loc', 'parent']); +const astIgnoreKeys = new Set(['loc', 'parent', 'range']); const isSameAstNode = (actualNode: unknown, expectedNode: unknown): boolean => { if (actualNode === expectedNode) { diff --git a/packages/eslint-plugin/src/rules/no-implied-eval.ts b/packages/eslint-plugin/src/rules/no-implied-eval.ts index 0f7d3fd67db5..966c48f793ff 100644 --- a/packages/eslint-plugin/src/rules/no-implied-eval.ts +++ b/packages/eslint-plugin/src/rules/no-implied-eval.ts @@ -12,12 +12,12 @@ import { } from '../util'; const FUNCTION_CONSTRUCTOR = 'Function'; -const GLOBAL_CANDIDATES = new Set(['global', 'window', 'globalThis']); +const GLOBAL_CANDIDATES = new Set(['global', 'globalThis', 'window']); const EVAL_LIKE_METHODS = new Set([ + 'execScript', 'setImmediate', 'setInterval', 'setTimeout', - 'execScript', ]); export default createRule({ diff --git a/packages/eslint-plugin/src/rules/no-redeclare.ts b/packages/eslint-plugin/src/rules/no-redeclare.ts index e13c26b765ff..99051a7b463f 100644 --- a/packages/eslint-plugin/src/rules/no-redeclare.ts +++ b/packages/eslint-plugin/src/rules/no-redeclare.ts @@ -55,13 +55,13 @@ export default createRule({ ], create(context, [options]) { const CLASS_DECLARATION_MERGE_NODES = new Set([ + AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.TSInterfaceDeclaration, AST_NODE_TYPES.TSModuleDeclaration, - AST_NODE_TYPES.ClassDeclaration, ]); const FUNCTION_DECLARATION_MERGE_NODES = new Set([ - AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.FunctionDeclaration, + AST_NODE_TYPES.TSModuleDeclaration, ]); const ENUM_DECLARATION_MERGE_NODES = new Set([ AST_NODE_TYPES.TSEnumDeclaration, diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index 4510eda58bb9..c1b80dde0f05 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -146,11 +146,11 @@ export default createRule({ const aliasTypes = new Set([ AST_NODE_TYPES.TSArrayType, AST_NODE_TYPES.TSImportType, - AST_NODE_TYPES.TSTypeReference, - AST_NODE_TYPES.TSLiteralType, - AST_NODE_TYPES.TSTypeQuery, AST_NODE_TYPES.TSIndexedAccessType, + AST_NODE_TYPES.TSLiteralType, AST_NODE_TYPES.TSTemplateLiteralType, + AST_NODE_TYPES.TSTypeQuery, + AST_NODE_TYPES.TSTypeReference, ]); /** diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts b/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts index ff2bc27ac2b2..3024d4fa0783 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts @@ -5,7 +5,7 @@ import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils'; import { createRule, getStaticStringValue, nullThrows } from '../util'; -const UNNECESSARY_OPERATORS = new Set(['=', '&&=', '||=', '??=']); +const UNNECESSARY_OPERATORS = new Set(['??=', '&&=', '=', '||=']); export default createRule({ name: 'no-unnecessary-parameter-property-assignment', diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts index 7e1a5e9444d9..c8d8e893a383 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts @@ -177,12 +177,12 @@ export default createRule({ }, TSEnumDeclaration: enterDeclaration, 'TSEnumDeclaration:exit': exitDeclaration, + 'TSModuleDeclaration:exit': exitDeclaration, 'TSModuleDeclaration > TSModuleBlock'( node: TSESTree.TSModuleBlock, ): void { enterDeclaration(node.parent); }, - 'TSModuleDeclaration:exit': exitDeclaration, TSQualifiedName(node: TSESTree.TSQualifiedName): void { visitNamespaceAccess(node, node.left, node.right); }, diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-parameters.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-parameters.ts index 6aae956d34c7..e427a17f29e9 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-parameters.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-parameters.ts @@ -52,9 +52,7 @@ export default createRule({ const smTypeParameterVariable = nullThrows( (() => { const variable = scope.set.get(esTypeParameter.name.name); - return variable != null && variable.isTypeVariable - ? variable - : undefined; + return variable?.isTypeVariable ? variable : undefined; })(), "Type parameter should be present in scope's variables.", ); diff --git a/packages/eslint-plugin/src/rules/parameter-properties.ts b/packages/eslint-plugin/src/rules/parameter-properties.ts index 42515d48db1e..227f30abc014 100644 --- a/packages/eslint-plugin/src/rules/parameter-properties.ts +++ b/packages/eslint-plugin/src/rules/parameter-properties.ts @@ -5,12 +5,12 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import { createRule, nullThrows } from '../util'; type Modifier = - | 'private readonly' | 'private' - | 'protected readonly' + | 'private readonly' | 'protected' - | 'public readonly' + | 'protected readonly' | 'public' + | 'public readonly' | 'readonly'; type Prefer = 'class-property' | 'parameter-property'; diff --git a/packages/eslint-plugin/src/rules/prefer-function-type.ts b/packages/eslint-plugin/src/rules/prefer-function-type.ts index 5f714d36d027..4f4435a9ea94 100644 --- a/packages/eslint-plugin/src/rules/prefer-function-type.ts +++ b/packages/eslint-plugin/src/rules/prefer-function-type.ts @@ -194,14 +194,6 @@ export default createRule({ // when entering an interface reset the count of `this`s to empty. tsThisTypes = []; }, - 'TSInterfaceDeclaration TSThisType'(node: TSESTree.TSThisType): void { - // inside an interface keep track of all ThisType references. - // unless it's inside a nested type literal in which case it's invalid code anyway - // we don't want to incorrectly say "it refers to name" while typescript says it's completely invalid. - if (literalNesting === 0 && tsThisTypes != null) { - tsThisTypes.push(node); - } - }, 'TSInterfaceDeclaration:exit'( node: TSESTree.TSInterfaceDeclaration, ): void { @@ -211,6 +203,14 @@ export default createRule({ // on exit check member and reset the array to nothing. tsThisTypes = null; }, + 'TSInterfaceDeclaration TSThisType'(node: TSESTree.TSThisType): void { + // inside an interface keep track of all ThisType references. + // unless it's inside a nested type literal in which case it's invalid code anyway + // we don't want to incorrectly say "it refers to name" while typescript says it's completely invalid. + if (literalNesting === 0 && tsThisTypes != null) { + tsThisTypes.push(node); + } + }, // keep track of nested literals to avoid complaining about invalid `this` uses 'TSInterfaceDeclaration TSTypeLiteral'(): void { literalNesting += 1; diff --git a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts index afd038605ca7..98933d502726 100644 --- a/packages/eslint-plugin/src/rules/restrict-template-expressions.ts +++ b/packages/eslint-plugin/src/rules/restrict-template-expressions.ts @@ -57,9 +57,9 @@ const optionTesters = ( tester, })); type Options = [ - { + { [Type in (typeof optionTesters)[number]['option']]?: boolean } & { allow?: TypeOrValueSpecifier[]; - } & { [Type in (typeof optionTesters)[number]['option']]?: boolean }, + }, ]; type MessageId = 'invalidType'; diff --git a/packages/eslint-plugin/src/util/collectUnusedVariables.ts b/packages/eslint-plugin/src/util/collectUnusedVariables.ts index cd921d392643..2e74a5f6a662 100644 --- a/packages/eslint-plugin/src/util/collectUnusedVariables.ts +++ b/packages/eslint-plugin/src/util/collectUnusedVariables.ts @@ -418,11 +418,11 @@ function isSelfReference( } const MERGABLE_TYPES = new Set([ - AST_NODE_TYPES.TSInterfaceDeclaration, - AST_NODE_TYPES.TSTypeAliasDeclaration, - AST_NODE_TYPES.TSModuleDeclaration, AST_NODE_TYPES.ClassDeclaration, AST_NODE_TYPES.FunctionDeclaration, + AST_NODE_TYPES.TSInterfaceDeclaration, + AST_NODE_TYPES.TSModuleDeclaration, + AST_NODE_TYPES.TSTypeAliasDeclaration, ]); /** * Determine if the variable is directly exported @@ -471,7 +471,7 @@ function isExported(variable: ScopeVariable): boolean { }); } -const LOGICAL_ASSIGNMENT_OPERATORS = new Set(['&&=', '||=', '??=']); +const LOGICAL_ASSIGNMENT_OPERATORS = new Set(['??=', '&&=', '||=']); /** * Determines if the variable is used. diff --git a/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts b/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts index ae30fd12d780..c48e1a13636d 100644 --- a/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts +++ b/packages/eslint-plugin/src/util/isArrayMethodCallWithPredicate.ts @@ -11,13 +11,13 @@ import * as tsutils from 'ts-api-utils'; import { getStaticMemberAccessValue } from './misc'; const ARRAY_PREDICATE_FUNCTIONS = new Set([ + 'every', 'filter', 'find', 'findIndex', 'findLast', 'findLastIndex', 'some', - 'every', ]); export function isArrayMethodCallWithPredicate( diff --git a/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts b/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts index 84d0901a35c0..c990a50a05a5 100644 --- a/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts +++ b/packages/eslint-plugin/src/util/needsPrecedingSemiColon.ts @@ -44,7 +44,7 @@ const NODE_TYPES_BY_KEYWORD: Record = { * Before an opening parenthesis, postfix `++` and `--` always trigger ASI; * the tokens `:`, `;`, `{` and `=>` don't expect a semicolon, as that would count as an empty statement. */ -const PUNCTUATORS = new Set([':', ';', '{', '=>', '++', '--']); +const PUNCTUATORS = new Set(['--', ';', ':', '{', '++', '=>']); /* * Statements that can contain an `ExpressionStatement` after a closing parenthesis. diff --git a/packages/eslint-plugin/tests/docs.test.ts b/packages/eslint-plugin/tests/docs.test.ts index c5cfeb542c06..c94c88e9b931 100644 --- a/packages/eslint-plugin/tests/docs.test.ts +++ b/packages/eslint-plugin/tests/docs.test.ts @@ -151,8 +151,8 @@ describe('Validating rule docs', () => { const ignoredFiles = new Set([ 'README.md', - 'TEMPLATE.md', 'shared', + 'TEMPLATE.md', // These rule docs were left behind on purpose for legacy reasons. See the // comments in the files for more information. 'ban-types.md', @@ -262,11 +262,11 @@ describe('Validating rule docs', () => { const requiredHeadings = ['When Not To Use It']; const importantHeadings = new Set([ - ...requiredHeadings, 'How to Use', 'Options', 'Related To', 'When Not To Use It', + ...requiredHeadings, ]); test('important headings must be h2s', () => { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts index 304f71a98ac4..c55d2b8f2d73 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-parameters.test.ts @@ -976,8 +976,8 @@ declare function setItem(T): T; `, errors: [ { - messageId: 'sole', data: { descriptor: 'function', name: 'T', uses: 'used only once' }, + messageId: 'sole', }, ], }, @@ -989,8 +989,8 @@ interface StorageService { `, errors: [ { - messageId: 'sole', data: { descriptor: 'function', name: 'T', uses: 'never used' }, + messageId: 'sole', }, ], }, From 87ace4ec7799fb2a5e52661c87987565727f809d Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 12:36:10 -0400 Subject: [PATCH 3/6] Updated fixes round 2 --- packages/website/src/components/editor/useSandboxServices.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/website/src/components/editor/useSandboxServices.ts b/packages/website/src/components/editor/useSandboxServices.ts index 13d1779fb7ae..b14372f81a0a 100644 --- a/packages/website/src/components/editor/useSandboxServices.ts +++ b/packages/website/src/components/editor/useSandboxServices.ts @@ -123,8 +123,8 @@ export const useSandboxServices = ( [...webLinter.rules.values()], [ ...new Set([ - ...sandboxInstance.supportedVersions, window.ts.version, + ...sandboxInstance.supportedVersions, ]), ] .filter(item => From 36fdc39739210bbc5512fa134acc66576f62ca78 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 12:44:52 -0400 Subject: [PATCH 4/6] Updated fixes round 3 --- packages/utils/src/ts-eslint/Rule.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 5fdd4c6776ef..591b510b1a38 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -182,8 +182,6 @@ export interface SharedConfigurationSettings { [name: string]: unknown; } -/* eslint-disable perfectionist/sort-interfaces */ - export interface RuleContext< MessageIds extends string, Options extends readonly unknown[], @@ -401,12 +399,12 @@ export interface CodePathSegment { * @see https://github.com/typescript-eslint/typescript-eslint/issues/6993 */ export type CodePathFunction = + | ((codePath: CodePath, node: TSESTree.Node) => void) | (( fromSegment: CodePathSegment, toSegment: CodePathSegment, node: TSESTree.Node, ) => void) - | ((codePath: CodePath, node: TSESTree.Node) => void) | ((segment: CodePathSegment, node: TSESTree.Node) => void); // This isn't the correct signature, but it makes it easier to do custom unions within reusable listeners From f472d1362c3909e537faf107571f407986cb0cb9 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 12:44:59 -0400 Subject: [PATCH 5/6] Updated fixes round 4 --- packages/utils/src/ts-eslint/Rule.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/utils/src/ts-eslint/Rule.ts b/packages/utils/src/ts-eslint/Rule.ts index 591b510b1a38..a48e4c0faf00 100644 --- a/packages/utils/src/ts-eslint/Rule.ts +++ b/packages/utils/src/ts-eslint/Rule.ts @@ -310,8 +310,6 @@ export interface RuleContext< report(descriptor: ReportDescriptor): void; } -/* eslint-enable perfectionist/sort-interfaces */ - /** * Part of the code path analysis feature of ESLint: * https://eslint.org/docs/latest/extend/code-path-analysis From 355329703c69e1cd444c7ab73abde3a53387eff2 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 10 Oct 2024 13:01:03 -0400 Subject: [PATCH 6/6] Updated fixes round 5 --- packages/rule-tester/src/utils/flat-config-schema.ts | 2 +- packages/rule-tester/tests/flat-config-schema.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rule-tester/src/utils/flat-config-schema.ts b/packages/rule-tester/src/utils/flat-config-schema.ts index d6c16f89e2e4..d1fe7a894515 100644 --- a/packages/rule-tester/src/utils/flat-config-schema.ts +++ b/packages/rule-tester/src/utils/flat-config-schema.ts @@ -274,7 +274,7 @@ const booleanSchema = { validate: 'boolean', } satisfies ObjectPropertySchema; -const ALLOWED_SEVERITIES = new Set(['error', 'warn', 'off', 2, 1, 0]); +const ALLOWED_SEVERITIES = new Set([0, 1, 2, 'error', 'off', 'warn']); const disableDirectiveSeveritySchema: ObjectPropertySchema = { diff --git a/packages/rule-tester/tests/flat-config-schema.test.ts b/packages/rule-tester/tests/flat-config-schema.test.ts index b1f5ccb35cec..86356f99b4e8 100644 --- a/packages/rule-tester/tests/flat-config-schema.test.ts +++ b/packages/rule-tester/tests/flat-config-schema.test.ts @@ -39,7 +39,7 @@ describe('merge', () => { }); it('does not preserve the type of merged objects', () => { - const first = new Set(['foo', 'bar']); + const first = new Set(['bar', 'foo']); const second = new Set(['baz']); const result = merge( first as unknown as ObjectLike,