Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: update babel alignment tests to latest version#4774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bradzacher merged 1 commit intomainfromtest/update-babel-tests
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
const x: X<never>;
var x: X<never>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

For my learning: why the change?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

babel reports now errors for unidealized const variables, witch is tested in

    /**     * [BABEL ERRORED, BUT TS-ESTREE DID NOT]     * SyntaxError: Missing initializer in const declaration.     */    'var-with-definite-assignment',

JoshuaKGoldberg reacted with thumbs up emoji
Observable.empty<never>();
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
const x: abstract new () => void;
var x: abstract new () => void;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
const x: new () => void;
var x: new () => void;
2 changes: 1 addition & 1 deletionpackages/typescript-estree/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,7 +51,7 @@
},
"devDependencies": {
"@babel/code-frame": "^7.16.0",
"@babel/parser": "^7.16.0",
"@babel/parser": "^7.17.8",
"@types/babel__code-frame": "^7.0.3",
"@types/debug": "*",
"@types/glob": "*",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -181,12 +181,6 @@ tester.addFixturePatternConfig('javascript/classes', {
* TS3.6 made computed constructors parse as actual constructors.
*/
'class-two-methods-computed-constructor',
/**
* Babel emits a `PrivateName` instead of `PrivateIdentifier`
*/
'class-private-identifier-accessor',
'class-private-identifier-method',
'class-private-identifier-field',
],
});

Expand DownExpand Up@@ -236,12 +230,18 @@ tester.addFixturePatternConfig('javascript/importMeta');
tester.addFixturePatternConfig('javascript/labels');

tester.addFixturePatternConfig('javascript/modules', {
ignore: [
/**
* [BABEL ERRORED, BUT TS-ESTREE DID NOT]
* SyntaxError: Unexpected keyword 'default'.
*/
'invalid-export-named-default',
],
ignoreSourceType: [
'error-function',
'error-strict',
'error-delete',
'invalid-await',
'invalid-export-named-default',
// babel does not recognize these as modules
'export-named-as-default',
'export-named-as-specifier',
Expand All@@ -261,13 +261,6 @@ tester.addFixturePatternConfig('javascript/objectLiteralComputedProperties');

tester.addFixturePatternConfig('javascript/objectLiteralDuplicateProperties', {
ignore: [
/**
* Babel throws SyntaxError: Redefinition of __proto__ property
*
* TypeScript reports it via the overloaded TS 2300 "Duplicate identifier '{0}'.", which we
* do not currently enable as per the notes above.
*/
'error-proto-string-property', // babel parse errors
/**
* ts-estree throws thanks to TS 1117 (ts 3.2 at time of writing)
* "An object literal cannot have multiple properties with the same name in strict mode."
Expand DownExpand Up@@ -306,13 +299,6 @@ tester.addFixturePatternConfig('jsx', {
* https://github.com/Microsoft/TypeScript/issues/7410
*/
'embedded-tags',
/**
* Current random error difference on jsx/invalid-no-tag-name.src.js
* ts-estree - SyntaxError
* Babel - RangeError
* @see https://github.com/babel/babel/issues/6680
*/
'invalid-no-tag-name',
/**
* [BABEL ERRORED, BUT TS-ESTREE DID NOT]
* SyntaxError: Unexpected token
Expand DownExpand Up@@ -398,18 +384,17 @@ tester.addFixturePatternConfig('typescript/basics', {
* TODO: enforce that accessibility is not allowed on a private identifier
*/
'class-private-identifier-field-with-accessibility-error',
/**
* Babel emits a `PrivateName` instead of `PrivateIdentifier`
*/
'class-private-identifier-field-with-annotation',
/**
* [TS-ESTREE ERRORED, BUT BABEL DID NOT]
* TypeScript 4.4 new feature
* @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-4.html#abstract-properties-do-not-allow-initializers
*/
'abstract-class-with-abstract-readonly-property',
'abstract-class-with-abstract-properties',
'abstract-class-with-override-property',
/**
* [BABEL ERRORED, BUT TS-ESTREE DID NOT]
* SyntaxError: Missing initializer in const declaration.
*/
'var-with-definite-assignment',
],
ignoreSourceType: [
/**
Expand All@@ -436,6 +421,7 @@ tester.addFixturePatternConfig('typescript/basics', {
'import-type-named',
'import-type-named-as',
'import-type-star-as-ns',
'keyword-variables',
],
});

Expand Down
14 changes: 14 additions & 0 deletionspackages/typescript-estree/tests/ast-alignment/utils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -263,6 +263,20 @@ export function preprocessBabylonAST(ast: File): any {
Object.keys(node).forEach(key => delete node[key]);
Object.assign(node, typeAnnotation);
},
/**
* babel 7.17.x introduced index property to location data to 2 node types
* TODO: report this to babel
*/
TSEnumDeclaration(node: any) {
if (node.loc?.start?.index) {
delete node.loc.start.index;
}
},
TSTypePredicate(node: any) {
if (node.loc?.start?.index) {
delete node.loc.start.index;
}
},
},
);
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp