-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remaining TypeScript Printing Issues #1643
Comments
@azz How do we run these TS tests? I just updated to |
@LukeSheard the tests aren't in this repo, they're in the TS repo: https://github.com/Microsoft/TypeScript/tree/master/tests We just clone the TypeScript repo next to the prettier repo and run them that way. I added a script |
Perhaps |
node scripts/run-external-typescript-tests.js
Error: this script currently only works on windows. :( |
Is there a reason the TypeScript tests aren't copied into the repo as the Flow tests are? |
@lydell there are 11k of them :x Only a hundred-ish for flow. |
@vjeux My MacBook died so I am unable to pursue fixing the script on Mac for the moment. I left a comment at the top of the script as to why it doesn't work. |
Oh noes, sad to hear! |
../tslint/src/rules/semicolonRule.ts: SyntaxError: Expression expected. (94:43)
92 |
93 | class SemicolonWalker extends Lint.AbstractWalker<Options> {
> 94 | private scanner?: ts.Scanner = undefined?;
| ^
95 | public walk(sourceFile: ts.SourceFile) {
96 | const cb = (node: ts.Node): void => {
97 | switch (node.kind) { Any idea why it's not parsing? |
The |
So close!
I think we need more accuracy on that percentage! (99.68%) |
On a related note, prettier for typescript is significantly slower than running it for normal js. I can't wait for the babylon integration to land, this would avoid having to parse it once and then completely reshuffle the ast. |
Okay I'm done for the day, If we fix the following 5 issues, we should be good to go for all the projects (but angular):
I haven't finished yet to categorize all the angular errors, but I think that there are some unique ones that aren't tracked here. This is really awesome! Even with those remaining errors, most of the files actually compile fine! |
@vjeux Would you mind sharing your method for evaluating this? Performance has never been an issue in |
@JamesHenry I've been running prettier on a bunch of files for both typescript and js and it feels significantly faster using flow. I haven't benchmarked it or anything yet :) |
Another one causing causing some -class Foo<___proto__> {}
+class Foo<____proto__> {} |
Nice! |
On master, angular has only those two issues remaining:
../angular//packages/compiler-cli/integrationtest/ngtools_src/feature2/feature2.module.ts: SyntaxError: ',' expected. (19:91)
17 | declarations: [FeatureComponent],
18 | imports: [RouterModule.forChild([
> 19 | {path: '', component: FeatureComponent}, {path: 'd', loadChildren: './default.module'} {
| ^
20 | path: 'e',
21 | loadChildren: 'feature/feature.module#FeatureModule'
22 | }
../angular//packages/platform-browser/src/dom/dom_adapter.ts: Error: Comment "<T extends Node>" was not printed. Please report this error!
at /Users/vjeux/random/prettier/index.js:46:13
at Array.forEach (native)
at ensureAllCommentsPrinted (/Users/vjeux/random/prettier/index.js:44:15)
at format (/Users/vjeux/random/prettier/index.js:70:3)
at formatWithShebang (/Users/vjeux/random/prettier/index.js:233:12)
at Object.module.exports.format (/Users/vjeux/random/prettier/index.js:246:12)
at format (/Users/vjeux/random/prettier/bin/prettier.js:180:25)
at /Users/vjeux/random/prettier/bin/prettier.js:304:16
at /Users/vjeux/random/prettier/bin/prettier.js:359:7
at Array.forEach (native) |
@vjeux Love how prettier is in your "random" folder 😄 |
@vjeux What's the priority on the three |
@azz: we should fix them :) This one is also an error that we should fix: ../angular//packages/platform-browser/src/dom/dom_adapter.ts: Error: Comment "<T extends Node>" was not printed. Please report this error! |
Let's close this one now that TypeScript has been released. |
Latest run through the TypeScript codebase's test suite resulted in this output:
13886 good, 886 bad
Scrolling through the debug output, it appears that all of the
SyntaxError
s are fine (actual syntax errors in the input), but the following are still issues:12
13
20
21
58
prettier(input) !== prettier(prettier(input))
gistUnstable yield re-print with TypeScript parser #1769, TypeScript: fix unstable optional method #1770, Unstable comments with TypeScript #1771 and TypeScript: upgrade typescript-eslint-parser to 992f1fa #1785
3
Error: Comment location overlaps with node location
gist0
2
0
4
Error: Comment "<omitted>" was not printed. Please report this error!
gistFixed by Add TSTupleType to ast-types #1685 and TypeScript: fix namespace comment printing #1765
0
5
82
TypeError: Cannot read property 'type' of undefined
gistNote: most/all of these are issues with decorators
Fixed by Handle TypeScript decorators #1678
0
62
Error: Value undefined is not a valid document
gistFixed by TypeScript: handle undefined variable declarations #1645 and Exponentiation tokens are not supported eslint/typescript-eslint-parser#280
0
56
Error: did not recognize object of type "TSInterfaceHeritage"
gistFixed by TypeScript: add TSInterfaceHeritage to ast-types #1644
0
5
15
42
ast(input) !== ast(prettier(input))
gistFixed by TypeScript: handle ExperimentalSpreadOperator, optional method, and abstract interface #1763 and TypeScript: allow parens with TSFunctionType and ignore empty specifiers #1764
0
6
TypeError: Cannot read property 'some' of undefined
gistFixed by TypeScript: handle global namespace without modifiers #1646
15
1623263144313errorsLooks like we're getting close!
The text was updated successfully, but these errors were encountered: