openrewrite / openrewrite/rewrite
TypeScript parsing uses strict mode
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
I noticed JavaScript parser seems to be using the strict mode to parse TypeScript/JavaScript code, which results in some pieces of code (not too many!) having parse errors. And assuming no-one is fixing them, they are likely working fine outside of OpenRewrite.
Examples:
Compiler error(s): (29,47): Octal literals are not allowed. Use the syntax '0o777'.
or
SyntaxError: Compiler error(s): (7495,76): The body of an 'if' statement cannot be the empty statement. [1313];
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the JavaScript/TypeScript parser and its strict-mode configuration, then reproduce the examples from pm2's test/programmatic/flagExt.mocha.js and stc's web/src/components/djvu.ts. Determine how parsing should handle these non-strict constructs and add coverage for the reported cases. Done means the examples parse without the reported errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100