# The JavaScript Oxidation Compiler (oxc) [![Discord chat][discord-badge]][discord-url] [![MIT licensed][mit-badge]][mit-url] [![CI on main][ci-badge]][ci-url] [![npm version][npm-badge]][npm-url] [discord-badge]: https://img.shields.io/discord/1079625926024900739?logo=discord&label=discord&color=brightgreen [discord-url]: https://discord.gg/9uXCAwqQZW [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg?color=brightgreen [mit-url]: LICENSE [ci-badge]: https://github.com/Boshen/oxc/actions/workflows/check.yaml/badge.svg?branch=main [ci-url]: https://github.com/Boshen/oxc/actions/workflows/check.yaml?query=branch=main [npm-badge]: https://img.shields.io/npm/v/oxidation-compiler/latest?color=brightgreen [npm-url]: https://www.npmjs.com/package/oxidation-compiler/v/latest The Oxidation Compiler is currently creating a suite of tools for the JavaScript/TypeScript language, which comprises: * Parser - Done * Linter - Work in progress * Formatter * Transpiler * Minifier ## Goals The primary objectives for this project include: * Create a *really* fast native program by using the Rust programming language * Provide the basic building blocks for creating your own tools by having good API designs * Provide good documentation on learning Rust and compiler techniques > Performance issues are considered as bugs in this project. ## Contributing This project is an invitation for you to come and learn Rust with us, We welcome and appreciate all contributions to this project. To get started, check out [CONTRIBUTING.md](./CONTRIBUTING.md). If you are unable to contribute code,, you can still participate by: * star and watch this project * join us on [Discord](https://discord.gg/9uXCAwqQZW) * [follow me on twitter](https://twitter.com/boshen_c) * provide your wisdom in [discussions](https://github.com/Boshen/oxc/discussions) ## Milestone As of now, Oxc has a fully working parser and a prototype for the linter. The current objectives are: * A MVP (Most Viable Product) for the linter. * Improve the parser for real usage. Areas include: * Performance * API * Pass more conformance tests ## Linter The linter is fast to the extent that it feels broken. With a few rules implemented, testing in the [VSCode](https://github.com/microsoft/vscode) repo: ``` vscode  main ❯ npx oxidation-compiler@latest lint src Checked 3479 files in 335ms using 12 cores. Found 17 errors. ``` And also in a large monorepo: ``` Checked 73660 files in 7415ms using 12 cores. Found 470 errors. ``` On my Intel i7 6-core, the linter is around 84 times faster than ESLint. But we'll get slightly slower as we add more features. See [benchmark](./benchmark/) for details. ### Try it out yourself! The linter is currently usable and it can potentially catch a few mistakes for you: ``` npx oxidation-compiler@latest lint path ``` All feedbacks are welcome. ## Parser Conformance The `cargo coverage` command reports the following conformance summary ``` Test262 Summary: AST Parsed : 44000/44000 (100.00%) Positive Passed: 44000/44000 (100.00%) Negative Passed: 3915/3915 (100.00%) Babel Summary: AST Parsed : 2064/2071 (99.66%) Positive Passed: 2054/2071 (99.18%) Negative Passed: 1333/1502 (88.75%) TypeScript Summary: AST Parsed : 2330/2340 (99.57%) Positive Passed: 2323/2340 (99.27%) Negative Passed: 680/2532 (26.86%) ``` Conformance for Test262 is now complete. Only unstable stage 3 `json-modules` and stage 3 `decorators` tests are skipped. ## Learning Resources * My [small tutorial on how to write a JavaScript Parser in Rust](https://boshen.github.io/javascript-parser-in-rust/) * [Crafting Interpreters](https://craftinginterpreters.com) * [Create an issue and insert your inspirational learning resources here] ## Credits This project was incubated with the assistance of these exceptional mentors and their projects: * [Rome Tools](https://rome.tools) - [@MichaReiser](https://github.com/MichaReiser), [@ematipico](https://github.com/ematipico) * [Ruff](https://beta.ruff.rs) - [@charliermarsh](https://github.com/charliermarsh) * [quick-lint-js](https://quick-lint-js.com) - [@strager](https://github.com/strager) * [elm-review](https://package.elm-lang.org/packages/jfmengels/elm-review/latest) - [@jfmengels](https://github.com/jfmengels) * [@domonji](https://github.com/domonji) for contribution to the TypeScript parser ## License [MIT](./LICENSE) ## Third Party Licenses Licenses are list in [THIRD-PARTY-LICENSE](./LICENSE-THIRD-PARTY-LICENSE) This project partially copies code from the following projects: | Project | License | | ------------- | ------------- | | [eslint/eslint](https://github.com/eslint/eslint) | [MIT](https://github.com/eslint/eslint/blob/main/LICENSE) | | [typescript-eslint/typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) | [MIT](https://github.com/typescript-eslint/typescript-eslint/blob/main/LICENSE) | | [microsoft/TypeScript](https://github.com/microsoft/TypeScript) | [Apache 2.0](https://github.com/microsoft/TypeScript/blob/main/LICENSE.txt) | | [rome/tools](https://github.com/rome/tools) | [MIT](https://github.com/rome/tools/blob/main/LICENSE) | | [mozilla-spidermonkey/jsparagus](https://github.com/mozilla-spidermonkey/jsparagus) | [MIT](https://github.com/mozilla-spidermonkey/jsparagus/blob/master/LICENSE-MIT) [Apache 2.0](https://github.com/mozilla-spidermonkey/jsparagus/blob/master/LICENSE-APACHE-2.0) | | [acorn](https://github.com/acornjs/acorn) | [MIT](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE) | | [miette](https://github.com/zkat/miette) | [Apache 2.0](https://github.com/zkat/miette/blob/main/LICENSE) |