oxc/justfile
Trevor Manz 8f5e9831df
feat(rulegen): Add jsx-a11y rulegen (#1119)
Adds the `just new-jsx-a11y-rule` for bootstrapping
`eslint-plugin-jsx-a11y` linting rules.

One tricky thing about the tests in that repo is that the aren't
provided as array expressions
(e.g., `[case0, case1, case2, ...]`) but rather separate arguments to
`[].concat()`
(e.g., `[].concat(case0, case1, case2, ...)`). There is probably a more
elegant way to match
these expressions, but this is what I came up with.

The other thing I introduced in this PR is prefer Rust's raw strings
(`r#`) when generating the
test cases. Sometimes running `just new-*` spit out unescaped back
quotes, which caused issues.
2023-10-31 13:18:48 +08:00

96 lines
2.3 KiB
Makefile
Executable file

#!/usr/bin/env -S just --justfile
_default:
@just --list -u
alias r := ready
alias c := coverage
# Make sure you have cargo-binstall installed.
# You can download the pre-compiled binary from <https://github.com/cargo-bins/cargo-binstall#installation>
# or install via `cargo install cargo-binstall`
# Initialize the project by installing all the necessary tools.
init:
cargo binstall cargo-nextest cargo-watch cargo-insta cargo-edit typos-cli taplo-cli wasm-pack cargo-llvm-cov -y
# When ready, run the same CI commands
ready:
git diff --exit-code --quiet
typos
cargo fmt
just check
just test
just lint
git status
# Update our local branch with the remote branch (this is for you to sync the submodules)
update:
git pull --recurse-submodules
# --no-vcs-ignores: cargo-watch has a bug loading all .gitignores, including the ones listed in .gitignore
# use .ignore file getting the ignore list
# Run `cargo watch`
watch command:
cargo watch --no-vcs-ignores -i '*snap*' -x '{{command}}'
# Run the example in `parser`, `formatter`, `linter`
example tool:
just watch 'run -p oxc_{{tool}} --example {{tool}}'
# Format all files
fmt:
cargo fmt
taplo format
# Run cargo check
check:
cargo ck
# Run all the tests
test:
cargo nextest run
# Lint the whole project
lint:
cargo lint -- --deny warnings
# Run all the conformance tests. See `tasks/coverage`, `tasks/transform_conformance`, `tasks/minsize`
coverage:
cargo coverage
cargo run --release -p oxc_transform_conformance
# cargo minsize
# Get code coverage
codecov:
cargo codecov --html
# Run the benchmarks. See `tasks/benchmark`
benchmark:
cargo benchmark
# Create a new lint rule by providing the ESLint name. See `tasks/rulegen`
new-rule name:
cargo run -p rulegen {{name}}
new-jest-rule name:
cargo run -p rulegen {{name}} jest
new-ts-rule name:
cargo run -p rulegen {{name}} typescript
new-unicorn-rule name:
cargo run -p rulegen {{name}} unicorn
new-react-rule name:
cargo run -p rulegen {{name}} react
new-jsx-a11y-rule name:
cargo run -p rulegen {{name}} jsx-a11y
# Sync all submodules with their own remote repos (this is for Boshen updating the submodules)
sync:
git submodule update --init --remote
# Upgrade all Rust dependencies
upgrade:
cargo upgrade --incompatible