### Run Tool Example with `just example` Source: https://github.com/oxc-project/oxc/blob/main/AGENTS.md Runs a tool's example, such as a linter example. Use this for quick testing of specific tools within the project. ```bash just example tool # Run tool example (e.g., just example linter) ``` -------------------------------- ### Run `oxc_linter` Example Source: https://github.com/oxc-project/oxc/blob/main/AGENTS.md Runs the `linter` example for the `oxc_linter` crate on a specified directory. Useful for testing linting rules. ```bash cargo run -p oxc_linter --example linter -- src/ ``` -------------------------------- ### Project file structure for oxfmt example Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/sort_package_json/1.snap.md This file tree represents the directory structure for the oxfmt example, including configuration and source files. ```tree - fixtures/ - disabled.json - package.json - sort_scripts.json ``` -------------------------------- ### Run Crate Examples for Testing Source: https://github.com/oxc-project/oxc/blob/main/AGENTS.md Executes examples from specific crates for quick testing and debugging. Replace `` and `` with the relevant identifiers. ```bash cargo run -p --example -- [args] ``` -------------------------------- ### Define project file structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/stdin/1.snap.md Example directory layout for testing the formatter. ```text - fixtures/ - input.graphql - input.rb - input.ts ``` -------------------------------- ### Run `oxc` Compiler Example Source: https://github.com/oxc-project/oxc/blob/main/AGENTS.md Runs the `compiler` example for the main `oxc` crate with the `full` feature enabled, processing a JavaScript file. Useful for testing the full compilation pipeline. ```bash cargo run -p oxc --example compiler --features="full" -- test.js ``` -------------------------------- ### Define project file structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/nested_config_parse_error/0.snap.md Example file tree showing configuration files and source files. ```text - fixtures/ - .oxfmtrc.json - root.js - sub/ - .oxfmtrc.json ``` -------------------------------- ### Run `oxc_transformer` Example Source: https://github.com/oxc-project/oxc/blob/main/AGENTS.md Executes the `transformer` example for the `oxc_transformer` crate on an input JavaScript file. Useful for testing code transformations. ```bash cargo run -p oxc_transformer --example transformer -- input.js ``` -------------------------------- ### Initialize with Workspace Options Source: https://github.com/oxc-project/oxc/blob/main/crates/oxc_language_server/README.md Example of client-provided initialization options, including workspace URI and specific Oxc configuration settings. ```json { "initializationOptions": [ { "workspaceUri": "file://workspace-directory", "options": { "run": "onType", "configPath": null, "tsConfigPath": null, "unusedDisableDirectives": "allow", "typeAware": false, "disableNestedConfig": false, "fixKind": "safe_fix", "rulesCustomization": {}, "fmtConfigPath": null } } } ] } ``` -------------------------------- ### Oxfmt Configuration File Example Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/migrate_prettier/6.snap.md This is an example of the `.oxfmtrc.json` file created after migrating from a Prettier configuration. It includes settings for Tailwind CSS sorting, print width, package.json sorting, and ignore patterns. ```json { "sortTailwindcss": {}, "printWidth": 80, "sortPackageJson": false, "ignorePatterns": [] } ``` -------------------------------- ### Run `oxc_parser` Example Source: https://github.com/oxc-project/oxc/blob/main/AGENTS.md Runs the `parser` example for the `oxc_parser` crate, processing a JavaScript file. Useful for debugging parsing logic. ```bash cargo run -p oxc_parser --example parser -- test.js ``` -------------------------------- ### Oxformatter Configuration File Example Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/js_config/0.snap.md An example of an oxfmt configuration file. This file specifies formatting rules for the tool. ```typescript export default { // ... }; ``` -------------------------------- ### Example file tree structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/config_ignore_patterns/1.snap.md Represents the directory layout for testing formatting configurations. ```text - fixtures/ - basic/ - .oxfmtrc.json - fmtrc.jsonc - not-formatted/ - bad.js - err.js - nested_cwd/ - .oxfmtrc.json - generated/ - error.html - src/ - test.js - sub/ - generated/ - error.html - src/ - test.js ``` -------------------------------- ### Example File Tree for Migration Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/migrate_biome/11.snap.md Illustrates the directory structure before running the migration command, showing various configuration files and test cases. ```plaintext - fixtures/ - already_exists/ - .oxfmtrc.json - arrow_parens/ - biome.json - attribute_position/ - biome.json - basic_config/ - biome.json - both_json_jsonc/ - biome.json - biome.jsonc - defaults/ - biome.json - force_ignore/ - biome.json - ignore_patterns/ - biome.json - js_overrides/ - biome.json - jsonc_config/ - biome.jsonc - no_config/ - .gitkeep - warn_overrides/ - biome.json ``` -------------------------------- ### Example File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/migrate_biome/7.snap.md Illustrates the directory structure and relevant configuration files for testing Oxc formatter migrations. ```plaintext - fixtures/ - already_exists/ - .oxfmtrc.json - arrow_parens/ - biome.json - attribute_position/ - biome.json - basic_config/ - biome.json - both_json_jsonc/ - biome.json - biome.jsonc - defaults/ - biome.json - force_ignore/ - biome.json - ignore_patterns/ - biome.json - js_overrides/ - biome.json - jsonc_config/ - biome.jsonc - no_config/ - .gitkeep - warn_overrides/ - biome.json ``` -------------------------------- ### Example File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/exclude_nested/0.snap.md This is the file tree structure used in the example. The `oxfmt --check` command operates on files within this structure. ```text - fixtures/ - foo/ - bar/ - error.js - ok.js - ok.js - ok.js ``` -------------------------------- ### Example file tree structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/vite_config/3.snap.md Represents the directory layout for testing formatting scenarios. ```text - fixtures/ - basic/ - child/ - test.ts - test.ts - vite.config.ts - monorepo/ - .oxfmtrc.json - packages/ - app/ - test.ts - vite.config.ts ``` -------------------------------- ### Example File Tree for oxfmt Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/svelte/0.snap.md Illustrates a typical project file structure relevant to oxfmt operations, including source files and configuration files. ```text - fixtures/ - App.svelte - Doc.mdx - fmt-bool-disable.json - fmt-md-only.json - fmt-no-svelte.json - fmt-overrides-only.json - fmt-root-overrides.json - fmt-simple.json - legacy/ - Old.svelte - README.md - script.js ``` -------------------------------- ### File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/sort_imports/1.snap.md Illustrates the directory structure and relevant files for the formatting check example, including configuration and source files. ```text - fixtures/ - custom_groups_selector_modifiers.json - custom_groups_selector_modifiers.ts - custom_groups.json - custom_groups.ts ``` -------------------------------- ### Example File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/vite_plus/7.snap.md Illustrates a typical file tree structure for oxfmt snapshot tests, including various fixture directories and configuration files. ```text - fixtures/ - basic/ - test.ts - vite.config.ts - error_load_failure/ - .oxfmtrc.json - child/ - test.ts - vite.config.ts - fn_export/ - test.ts - vite.config.ts - no_fmt_field/ - test.ts - vite.config.ts - priority/ - oxfmt.config.ts - test.ts - vite.config.ts - skip_finds_parent/ - .oxfmtrc.json - child/ - test.ts - vite.config.ts ``` -------------------------------- ### Project File Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/external_formatter_with_config/0.snap.md Example file tree for the Oxc project, showing configuration and test files. ```bash - fixtures/ - .oxfmtrc.json - test.vue ``` -------------------------------- ### Project File Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/nested_config_prettierignore/0.snap.md Example directory layout for an OXC project. ```text - fixtures/ - .oxfmtrc.json - .prettierignore - root-ignored.js - root.js - sub/ - .oxfmtrc.json - formatted.js - sub-ignored.js ``` -------------------------------- ### Oxformatter JSON Configuration File Example Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/js_config/0.snap.md An example of an oxfmt configuration file in JSON format. This file specifies formatting rules for the tool. ```json { // ... } ``` -------------------------------- ### Project file structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/error_reports/0.snap.md Represents the directory layout for the formatting check example. ```text - fixtures/ - invalid.js - invalid.yaml ``` -------------------------------- ### Example file tree structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/migrate_prettier/8.snap.md Represents the directory structure containing various Prettier configuration scenarios. ```text - fixtures/ - already_exists/ - .oxfmtrc.json - basic_config/ - .prettierrc - default_printwidth/ - .prettierrc - no_config/ - .gitkeep - sort_pkg_disabled/ - .prettierrc - sort_pkg_enabled/ - .prettierrc - tailwind_empty/ - .prettierrc - tailwind_options/ - .prettierrc - tailwind_regex/ - .prettierrc - with_ignore/ - .prettierignore - .prettierrc ``` -------------------------------- ### Workspace Configuration Example Source: https://github.com/oxc-project/oxc/blob/main/crates/oxc_language_server/README.md Example of a client response for workspace configuration requests. This configuration influences how the Oxc language server operates, such as when to run diagnostics. ```json [ { "run": "onType", "configPath": null, "tsConfigPath": null, "unusedDisableDirectives": "allow", "typeAware": false, "disableNestedConfig": false, "fixKind": "safe_fix", "rulesCustomization": {}, "fmt": { "configPath": null } } ] ``` -------------------------------- ### Oxc Exit Code 1 Example Source: https://github.com/oxc-project/oxc/blob/main/apps/oxlint/test/fixtures/missing_plugin/output.snap.md This example shows the standard output when Oxc fails to parse its configuration file due to a missing plugin. ```text Failed to parse oxlint configuration file. x Failed to load JS plugin: ./plugin.js | Cannot find module './plugin.js' ``` -------------------------------- ### Example File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/migrate_biome/10.snap.md Illustrates the directory structure for testing various configuration scenarios with oxfmt, including different Biome configurations and ignore patterns. ```plaintext - fixtures/ - already_exists/ - .oxfmtrc.json - arrow_parens/ - biome.json - attribute_position/ - biome.json - basic_config/ - biome.json - both_json_jsonc/ - biome.json - biome.jsonc - defaults/ - biome.json - force_ignore/ - biome.json - ignore_patterns/ - biome.json - js_overrides/ - biome.json - jsonc_config/ - biome.jsonc - no_config/ - .gitkeep - warn_overrides/ - biome.json ``` -------------------------------- ### File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/migrate_prettier/5.snap.md Example file tree structure relevant to Oxfmt migration tests, showing various Prettier configuration scenarios. ```text - fixtures/ - already_exists/ - .oxfmtrc.json - basic_config/ - .prettierrc - default_printwidth/ - .prettierrc - no_config/ - .gitkeep - sort_pkg_disabled/ - .prettierrc - sort_pkg_enabled/ - .prettierrc - tailwind_empty/ - .prettierrc - tailwind_options/ - .prettierrc - tailwind_regex/ - .prettierrc - with_ignore/ - .prettierignore - .prettierrc ``` -------------------------------- ### Example File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/config_file/1.snap.md Illustrates a typical file tree structure for Oxc project fixtures, including configuration files and nested directories. ```treeview - fixtures/ - .oxfmtrc.json - .oxfmtrc.jsonc - fmt.config.ts - fmt.json - fmt.jsonc - nested/ - .oxfmtrc.jsonc - deep/ - test.js ``` -------------------------------- ### Example File Tree Structure Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/gitignore/1.snap.md This file tree illustrates a typical project structure with root and subdirectory .gitignore files, showing which files are intended to be ignored by the formatter. ```text - fixtures/ - .gitignore - another/ - another.js - ignored-by-root.js - root.js - subdir/ - .gitignore - ignored-by-subdir.js - sub.js ``` -------------------------------- ### OXC CFG Plugin Output Example Source: https://github.com/oxc-project/oxc/blob/main/apps/oxlint/test/fixtures/cfg/output.snap.md Displays the node visitation order and code path analysis for a while loop. ```text x cfg-plugin(cfg): Visited nodes: | * onCodePathStart Program | * onCodePathSegmentStart Program | * onCodePathSegmentEnd Literal | * onCodePathSegmentStart Literal | * onCodePathSegmentEnd BlockStatement | * onCodePathSegmentStart BlockStatement | * onCodePathSegmentLoop WhileStatement | * onCodePathSegmentEnd WhileStatement | * onUnreachableCodePathSegmentStart WhileStatement | * onUnreachableCodePathSegmentEnd Program | * onCodePathEnd Program ,-[files/index.js:1:1] 1 | while (true) {} : ^^^^^^^^^^^^^^^^ `---- Found 0 warnings and 1 error. Finished in Xms on 1 file with 2 rules using X threads. ``` -------------------------------- ### Standard output for successful check Source: https://github.com/oxc-project/oxc/blob/main/apps/oxfmt/test/cli/oxfmtrc_overrides/6.snap.md Example output when all files are correctly formatted. ```text Checking formatting... All matched files use the correct format. Finished in