Skip to content

Commit 7ea2074

Browse files
chore(deps): update dependency eslint-plugin-perfectionist to v3.8.0 (#9976)
* chore(deps): update dependency eslint-plugin-perfectionist to v3.8.0 * Updated fixes * Updated fixes round 2 * Updated fixes round 3 * Updated fixes round 4 * Updated fixes round 5 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Josh Goldberg <git@joshuakgoldberg.com>
1 parent 91ca27c commit 7ea2074

21 files changed

Lines changed: 55 additions & 61 deletions

‎packages/eslint-plugin/src/rules/class-methods-use-this.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ export default createRule<Options, MessageIds>({
257257
/*
258258
* Class field value are implicit functions.
259259
*/
260-
'PropertyDefinition > *.key:exit'(): void {
261-
pushContext();
262-
},
263260
'PropertyDefinition:exit'(): void {
264261
popContext();
265262
},
263+
'PropertyDefinition > *.key:exit'(): void {
264+
pushContext();
265+
},
266266

267267
/*
268268
* Class static blocks are implicit functions. They aren't required to use `this`,

‎packages/eslint-plugin/src/rules/no-duplicate-type-constituents.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type Options = [
2222

2323
export type MessageIds = 'duplicate' | 'unnecessary';
2424

25-
const astIgnoreKeys = new Set(['range', 'loc', 'parent']);
25+
const astIgnoreKeys = new Set(['loc', 'parent', 'range']);
2626

2727
const isSameAstNode = (actualNode: unknown, expectedNode: unknown): boolean => {
2828
if (actualNode === expectedNode) {

‎packages/eslint-plugin/src/rules/no-implied-eval.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import {
1212
} from '../util';
1313

1414
const FUNCTION_CONSTRUCTOR = 'Function';
15-
const GLOBAL_CANDIDATES = new Set(['global', 'window', 'globalThis']);
15+
const GLOBAL_CANDIDATES = new Set(['global', 'globalThis', 'window']);
1616
const EVAL_LIKE_METHODS = new Set([
17+
'execScript',
1718
'setImmediate',
1819
'setInterval',
1920
'setTimeout',
20-
'execScript',
2121
]);
2222

2323
export default createRule({

‎packages/eslint-plugin/src/rules/no-redeclare.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ export default createRule<Options, MessageIds>({
5555
],
5656
create(context, [options]) {
5757
const CLASS_DECLARATION_MERGE_NODES = new Set<AST_NODE_TYPES>([
58+
AST_NODE_TYPES.ClassDeclaration,
5859
AST_NODE_TYPES.TSInterfaceDeclaration,
5960
AST_NODE_TYPES.TSModuleDeclaration,
60-
AST_NODE_TYPES.ClassDeclaration,
6161
]);
6262
const FUNCTION_DECLARATION_MERGE_NODES = new Set<AST_NODE_TYPES>([
63-
AST_NODE_TYPES.TSModuleDeclaration,
6463
AST_NODE_TYPES.FunctionDeclaration,
64+
AST_NODE_TYPES.TSModuleDeclaration,
6565
]);
6666
const ENUM_DECLARATION_MERGE_NODES = new Set<AST_NODE_TYPES>([
6767
AST_NODE_TYPES.TSEnumDeclaration,

‎packages/eslint-plugin/src/rules/no-type-alias.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ export default createRule<Options, MessageIds>({
146146
const aliasTypes = new Set([
147147
AST_NODE_TYPES.TSArrayType,
148148
AST_NODE_TYPES.TSImportType,
149-
AST_NODE_TYPES.TSTypeReference,
150-
AST_NODE_TYPES.TSLiteralType,
151-
AST_NODE_TYPES.TSTypeQuery,
152149
AST_NODE_TYPES.TSIndexedAccessType,
150+
AST_NODE_TYPES.TSLiteralType,
153151
AST_NODE_TYPES.TSTemplateLiteralType,
152+
AST_NODE_TYPES.TSTypeQuery,
153+
AST_NODE_TYPES.TSTypeReference,
154154
]);
155155

156156
/**

‎packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AST_NODE_TYPES, ASTUtils } from '@typescript-eslint/utils';
55

66
import { createRule, getStaticStringValue, nullThrows } from '../util';
77

8-
const UNNECESSARY_OPERATORS = new Set(['=', '&&=', '||=', '??=']);
8+
const UNNECESSARY_OPERATORS = new Set(['??=', '&&=', '=', '||=']);
99

1010
export default createRule({
1111
name: 'no-unnecessary-parameter-property-assignment',

‎packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ export default createRule({
177177
},
178178
TSEnumDeclaration: enterDeclaration,
179179
'TSEnumDeclaration:exit': exitDeclaration,
180+
'TSModuleDeclaration:exit': exitDeclaration,
180181
'TSModuleDeclaration > TSModuleBlock'(
181182
node: TSESTree.TSModuleBlock,
182183
): void {
183184
enterDeclaration(node.parent);
184185
},
185-
'TSModuleDeclaration:exit': exitDeclaration,
186186
TSQualifiedName(node: TSESTree.TSQualifiedName): void {
187187
visitNamespaceAccess(node, node.left, node.right);
188188
},

‎packages/eslint-plugin/src/rules/no-unnecessary-type-parameters.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export default createRule({
5252
const smTypeParameterVariable = nullThrows(
5353
(() => {
5454
const variable = scope.set.get(esTypeParameter.name.name);
55-
return variable != null && variable.isTypeVariable
56-
? variable
57-
: undefined;
55+
return variable?.isTypeVariable ? variable : undefined;
5856
})(),
5957
"Type parameter should be present in scope's variables.",
6058
);

‎packages/eslint-plugin/src/rules/parameter-properties.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils';
55
import { createRule, nullThrows } from '../util';
66

77
type Modifier =
8-
| 'private readonly'
98
| 'private'
10-
| 'protected readonly'
9+
| 'private readonly'
1110
| 'protected'
12-
| 'public readonly'
11+
| 'protected readonly'
1312
| 'public'
13+
| 'public readonly'
1414
| 'readonly';
1515

1616
type Prefer = 'class-property' | 'parameter-property';

‎packages/eslint-plugin/src/rules/prefer-function-type.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,6 @@ export default createRule({
194194
// when entering an interface reset the count of `this`s to empty.
195195
tsThisTypes = [];
196196
},
197-
'TSInterfaceDeclaration TSThisType'(node: TSESTree.TSThisType): void {
198-
// inside an interface keep track of all ThisType references.
199-
// unless it's inside a nested type literal in which case it's invalid code anyway
200-
// we don't want to incorrectly say "it refers to name" while typescript says it's completely invalid.
201-
if (literalNesting === 0 && tsThisTypes != null) {
202-
tsThisTypes.push(node);
203-
}
204-
},
205197
'TSInterfaceDeclaration:exit'(
206198
node: TSESTree.TSInterfaceDeclaration,
207199
): void {
@@ -211,6 +203,14 @@ export default createRule({
211203
// on exit check member and reset the array to nothing.
212204
tsThisTypes = null;
213205
},
206+
'TSInterfaceDeclaration TSThisType'(node: TSESTree.TSThisType): void {
207+
// inside an interface keep track of all ThisType references.
208+
// unless it's inside a nested type literal in which case it's invalid code anyway
209+
// we don't want to incorrectly say "it refers to name" while typescript says it's completely invalid.
210+
if (literalNesting === 0 && tsThisTypes != null) {
211+
tsThisTypes.push(node);
212+
}
213+
},
214214
// keep track of nested literals to avoid complaining about invalid `this` uses
215215
'TSInterfaceDeclaration TSTypeLiteral'(): void {
216216
literalNesting += 1;

0 commit comments

Comments
 (0)