Skip to content

Commit 714266f

Browse files
dependabot[bot]JoshuaKGoldberg
authored andcommitted
chore: bump @types/jest from 26.0.24 to 27.0.1 (typescript-eslint#3748)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.24 to 27.0.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest) --- updated-dependencies: - dependency-name: "@types/jest" dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 47811e7 commit 714266f

18 files changed

+137
-154
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"@types/eslint-visitor-keys": "^1.0.0",
8787
"@types/glob": "^7.1.3",
8888
"@types/is-glob": "^4.0.1",
89-
"@types/jest": "^26.0.23",
89+
"@types/jest": "^27.0.1",
9090
"@types/jest-specific-snapshot": "^0.5.5",
9191
"@types/lodash": "^4.14.170",
9292
"@types/marked": "^2.0.3",

Diff for: packages/ast-spec/src/base/ClassPropertyBase.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Decorator } from '../special/Decorator/spec';
22
import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec';
3-
import type { Expression } from '../unions/Expression';
43
import type {
54
PropertyName,
65
PropertyNameComputed,
@@ -11,7 +10,6 @@ import type { BaseNode } from './BaseNode';
1110

1211
interface ClassPropertyBase extends BaseNode {
1312
key: PropertyName;
14-
value: Expression | null;
1513
computed: boolean;
1614
static: boolean;
1715
declare: boolean;

Diff for: packages/ast-spec/src/element/ClassProperty/spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ import type {
33
ClassPropertyComputedNameBase,
44
ClassPropertyNonComputedNameBase,
55
} from '../../base/ClassPropertyBase';
6+
import type { Expression } from '../../unions/Expression';
67

78
export interface ClassPropertyComputedName
89
extends ClassPropertyComputedNameBase {
10+
value: Expression | null;
911
type: AST_NODE_TYPES.ClassProperty;
1012
}
1113

1214
export interface ClassPropertyNonComputedName
1315
extends ClassPropertyNonComputedNameBase {
16+
value: Expression | null;
1417
type: AST_NODE_TYPES.ClassProperty;
1518
}
1619

Diff for: packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ export default util.createRule<Options, MessageIds>({
336336
return;
337337

338338
case AST_NODE_TYPES.ClassProperty:
339-
case AST_NODE_TYPES.TSAbstractClassProperty:
340339
if (node.accessibility === 'private') {
341340
return;
342341
}

Diff for: packages/eslint-plugin/src/rules/member-ordering.ts

+3
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ function getNodeType(node: Member): string | null {
186186
case AST_NODE_TYPES.TSConstructSignatureDeclaration:
187187
return 'constructor';
188188
case AST_NODE_TYPES.TSAbstractClassProperty:
189+
return node.type && functionExpressions.includes(node.type)
190+
? 'method'
191+
: 'field';
189192
case AST_NODE_TYPES.ClassProperty:
190193
return node.value && functionExpressions.includes(node.value.type)
191194
? 'method'

Diff for: packages/eslint-plugin/tests/rules/member-ordering.test.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,7 @@ abstract class Foo {
13111311
private D: string;
13121312
protected static F(): {};
13131313
public E(): {};
1314-
public abstract A = () => {};
1314+
public abstract A(): void;
13151315
protected abstract G(): void;
13161316
}
13171317
`,
@@ -3618,7 +3618,7 @@ type Foo = {
36183618
{
36193619
code: `
36203620
abstract class Foo {
3621-
abstract A = () => {};
3621+
abstract A(): void;
36223622
B: string;
36233623
}
36243624
`,
@@ -3639,9 +3639,6 @@ abstract class Foo {
36393639
abstract class Foo {
36403640
abstract A: () => {};
36413641
B: string;
3642-
public C() {};
3643-
private D() {};
3644-
abstract E() {};
36453642
}
36463643
`,
36473644
errors: [
@@ -3659,18 +3656,19 @@ abstract class Foo {
36593656
{
36603657
code: `
36613658
abstract class Foo {
3662-
B: string;
3663-
abstract C = () => {};
36643659
abstract A: () => {};
3660+
B: string;
3661+
public C() {};
3662+
private D() {};
3663+
abstract E() {};
36653664
}
36663665
`,
3667-
options: [{ default: ['method', 'constructor', 'field'] }],
36683666
errors: [
36693667
{
36703668
messageId: 'incorrectGroupOrder',
36713669
data: {
3672-
name: 'C',
3673-
rank: 'field',
3670+
name: 'B',
3671+
rank: 'public abstract field',
36743672
},
36753673
line: 4,
36763674
column: 5,

Diff for: packages/eslint-plugin/tests/rules/quotes.test.ts

+18-45
Original file line numberDiff line numberDiff line change
@@ -455,25 +455,25 @@ class Foo {
455455
{
456456
code: `
457457
abstract class Foo {
458-
public abstract a = "";
459-
public abstract "a-b" = "";
458+
public abstract a: "";
459+
public abstract "a-b": "";
460460
}
461461
`,
462462
},
463463
{
464464
code: `
465465
abstract class Foo {
466-
public abstract a = '';
467-
public abstract 'a-b' = '';
466+
public abstract a: '';
467+
public abstract 'a-b': '';
468468
}
469469
`,
470470
options: ['single'],
471471
},
472472
{
473473
code: `
474474
abstract class Foo {
475-
public abstract a = \`\`;
476-
public abstract 'a-b' = \`\`;
475+
public abstract a: \`\`;
476+
public abstract 'a-b': \`\`;
477477
}
478478
`,
479479
options: ['backtick'],
@@ -1047,21 +1047,21 @@ class Foo {
10471047
{
10481048
code: `
10491049
abstract class Foo {
1050-
public abstract a = '';
1051-
public abstract 'a-b' = '';
1050+
public abstract a: '';
1051+
public abstract 'a-b': '';
10521052
}
10531053
`,
10541054
output: `
10551055
abstract class Foo {
1056-
public abstract a = "";
1057-
public abstract "a-b" = "";
1056+
public abstract a: "";
1057+
public abstract "a-b": "";
10581058
}
10591059
`,
10601060
errors: [
10611061
{
10621062
...useDoubleQuote,
10631063
line: 3,
1064-
column: 23,
1064+
column: 22,
10651065
},
10661066
{
10671067
...useDoubleQuote,
@@ -1071,28 +1071,28 @@ abstract class Foo {
10711071
{
10721072
...useDoubleQuote,
10731073
line: 4,
1074-
column: 27,
1074+
column: 26,
10751075
},
10761076
],
10771077
},
10781078
{
10791079
code: `
10801080
abstract class Foo {
1081-
public abstract a = "";
1082-
public abstract "a-b" = "";
1081+
public abstract a: "";
1082+
public abstract "a-b": "";
10831083
}
10841084
`,
10851085
output: `
10861086
abstract class Foo {
1087-
public abstract a = '';
1088-
public abstract 'a-b' = '';
1087+
public abstract a: '';
1088+
public abstract 'a-b': '';
10891089
}
10901090
`,
10911091
errors: [
10921092
{
10931093
...useSingleQuote,
10941094
line: 3,
1095-
column: 23,
1095+
column: 22,
10961096
},
10971097
{
10981098
...useSingleQuote,
@@ -1102,38 +1102,11 @@ abstract class Foo {
11021102
{
11031103
...useSingleQuote,
11041104
line: 4,
1105-
column: 27,
1105+
column: 26,
11061106
},
11071107
],
11081108
options: ['single'],
11091109
},
1110-
{
1111-
code: `
1112-
abstract class Foo {
1113-
public abstract a = "";
1114-
public abstract "a-b" = "";
1115-
}
1116-
`,
1117-
output: `
1118-
abstract class Foo {
1119-
public abstract a = \`\`;
1120-
public abstract "a-b" = \`\`;
1121-
}
1122-
`,
1123-
errors: [
1124-
{
1125-
...useBacktick,
1126-
line: 3,
1127-
column: 23,
1128-
},
1129-
{
1130-
...useBacktick,
1131-
line: 4,
1132-
column: 27,
1133-
},
1134-
],
1135-
options: ['backtick'],
1136-
},
11371110

11381111
// TSAbstractMethodDefinition
11391112
{

Diff for: packages/scope-manager/src/referencer/ClassVisitor.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ class ClassVisitor extends Visitor {
237237
this.#referencer.visit(node.key);
238238
}
239239

240-
this.#referencer.visit(node.value);
240+
if (node.type !== AST_NODE_TYPES.TSAbstractClassProperty) {
241+
this.#referencer.visit(node.value);
242+
}
241243

242244
if ('decorators' in node) {
243245
node.decorators?.forEach(d => this.#referencer.visit(d));
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
abstract class Foo {
22
abstract bar;
3-
abstract baz = 3;
3+
abstract baz: number;
44
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
abstract class Foo {
2-
public abstract readonly foo = 'string';
2+
public abstract readonly foo: string;
33
}

Diff for: packages/typescript-estree/src/convert.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ export class Converter {
10911091
? AST_NODE_TYPES.TSAbstractClassProperty
10921092
: AST_NODE_TYPES.ClassProperty,
10931093
key: this.convertChild(node.name),
1094-
value: this.convertChild(node.initializer),
1094+
...(isAbstract ? {} : { value: this.convertChild(node.initializer) }),
10951095
computed: isComputedProperty(node.name),
10961096
static: hasModifier(SyntaxKind.StaticKeyword, node),
10971097
readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined,

Diff for: packages/typescript-estree/tests/ast-alignment/utils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any {
176176
if (node.abstract) {
177177
node.type = AST_NODE_TYPES.TSAbstractClassProperty;
178178
delete node.abstract;
179+
delete node.value;
179180
}
180181
/**
181182
* TS 3.7: declare class properties

0 commit comments

Comments
 (0)