NOTE: This assumes you have oxc and mastodon cloned into the ~/code directory specifically, adjust the directions accordingly for whatever directory you store your git repositories.
Setup:
- Clone oxc and mastodon repos locally.
git clone https://github.com/mastodon/mastodongit clone https://github.com/oxc-project/oxc
- Set up oxc to be able to build it locally with Rust, etc. (see oxc docs)
- In the root of the mastodon repo, create a directory
oxlint-dist/to hold the built oxc files. - Add
oxlint-dist/to the.gitignorefile in the mastodon repo. - You will want/need to generate an
.oxlintrc.jsonfor mastodon if you didn't add one already/have one to test.- You can convert the existing eslint config they have using
@oxlint/migrate - You can use the one from this branch, which is generated with oxlint v1.26.0 with the migration tool (jsPlugins disabled, type aware rules disabled, and all migrated 'warn'-level rules set to 'off' since they just add noise)
- You can convert the existing eslint config they have using
- If you want to compare against the ESLint results for a lint run on the repo:
yarn installto install dependenciesyarn run lint:jswill run the ESLint lints, you may need to addoxlint-dist/to the ignorePatterns in the eslint config.
Testing a patch:
- If you have already done this before, you may want to delete the contents of the
oxlint-distdirectory in mastodon to ensure a clean build. - In the oxc repo:
- Go to
apps/oxlint/. - Run
pnpm run build-devto generate the oxlint CLI. - Copy the
dist/you've just built over to mastodon:cp -R dist/ ~/code/mastodon/oxlint-dist/
- Go to
- In the mastodon repo:
- Run oxlint with your locally-build patch:
node dist/cli.js -c .oxlintrc.json - Review the output and see if your patch is working as expected.
- Run oxlint with your locally-build patch: