### Minimal Setup Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/package-overview.md A minimal setup example using the 'flat/recommended' configuration. ```javascript import oxlint from 'eslint-plugin-oxlint'; export default [...oxlint.configs['flat/recommended']]; ``` -------------------------------- ### Plugins Configuration Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example showing how to specify custom plugins. ```json { "plugins": ["typescript", "react", "nextjs"] } ``` -------------------------------- ### Usage Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/api-reference.md Example of how to build configurations using oxlint.buildFromOxlintConfig. ```typescript const configs = oxlint.buildFromOxlintConfig( { categories: { correctness: 'warn' }, rules: { eqeqeq: 'error' } }, { typeAware: true, withNursery: false } ); ``` -------------------------------- ### Extends Configuration Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example demonstrating the use of the 'extends' property to include multiple configurations. ```json { "extends": [ "./.oxlintrc.base.json", "./.oxlintrc.team-standards.json", { "plugins": ["react"], "rules": { "react/no-unused-state": "off" } } ] } ``` -------------------------------- ### Full Example Oxlint Configuration Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md A comprehensive example of an Oxlint configuration file, including extends, plugins, categories, rules, overrides, ignorePatterns, and options. ```json { "extends": [ "./.oxlintrc.base.json", "./.oxlintrc.framework.json" ], "plugins": ["typescript", "react", "nextjs"], "categories": { "correctness": "error", "suspicious": "warn", "pedantic": "warn", "style": "off", "restriction": "warn", "perf": "warn" }, "rules": { "eqeqeq": "error", "no-console": "warn", "no-alert": "error", "no-unused-vars": "warn", "@typescript-eslint/no-unused-vars": [ "warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^ _" } ], "react/display-name": "off", "react/jsx-no-target-blank": "error" }, "overrides": [ { "files": ["**/__tests__/**/*.ts", "**/*.test.ts"], "plugins": ["jest"], "rules": { "no-console": "off", "jest/no-disabled-tests": "error" } }, { "files": ["scripts/**/*.ts"], "rules": { "no-console": "off" } } ], "ignorePatterns": [ "node_modules", "dist", "build", ".next", "out", "coverage" ], "options": { "typeAware": true } } ``` -------------------------------- ### Installation Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/README.md Install the eslint-plugin-oxlint package as a development dependency. ```shell pnpm add -D eslint-plugin-oxlint ``` -------------------------------- ### Installation Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/package-overview.md Install the eslint-plugin-oxlint and oxlint packages as development dependencies. ```bash npm install --save-dev eslint-plugin-oxlint oxlint ``` -------------------------------- ### From File Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/package-overview.md An example showing how to build configuration directly from an '.oxlintrc.json' file. ```javascript import oxlint from 'eslint-plugin-oxlint'; export default [ ...oxlint.buildFromOxlintConfigFile('./.oxlintrc.json') ]; ``` -------------------------------- ### Integration with buildFromOxlintConfigFile Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example of loading configuration from a file using buildFromOxlintConfigFile. ```typescript const configs = oxlint.buildFromOxlintConfigFile('./.oxlintrc.json', { typeAware: true }); ``` -------------------------------- ### buildFromOxlintConfigFile() Usage Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/api-reference.md Example demonstrating how to use buildFromOxlintConfigFile to generate ESLint configurations by reading from an oxlint configuration file. ```typescript import oxlint from 'eslint-plugin-oxlint'; // Read from .oxlintrc.json const configs = oxlint.buildFromOxlintConfigFile('./.oxlintrc.json', { typeAware: true, withNursery: false }); export default [ ...oxlint.configs['flat/recommended'], ...configs ]; ``` -------------------------------- ### .oxlintrc.json Configuration Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/REFERENCE.md An example of a .oxlintrc.json file showing various configuration options. ```json { "extends": ["./.oxlintrc.base.json"], "plugins": ["typescript", "react"], "categories": { "correctness": "error", "suspicious": "warn" }, "rules": { "eqeqeq": "error", "no-console": "warn" }, "overrides": [ { "files": ["**/*.test.ts"], "rules": { "no-console": "off" } } ], "ignorePatterns": ["node_modules", "dist"], "options": { "typeAware": true } } ``` -------------------------------- ### Example JSON configuration with overrides Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Demonstrates how to configure rules and apply file-specific overrides. ```json { "rules": { "no-console": "off" }, "overrides": [ { "files": ["src/**/*.test.ts"], "rules": { "no-console": "off" }, "plugins": ["jest"] }, { "files": ["scripts/**/*.ts"], "plugins": ["node"] } ] } ``` -------------------------------- ### OxlintOptions Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/types.md Example of an OxlintConfig object with options. ```typescript const config: OxlintConfig = { plugins: ['typescript'], options: { typeAware: true, typeCheck: true } }; ``` -------------------------------- ### Example JSON configuration with options Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Illustrates Oxlint-specific options that affect rule processing. ```json { "options": { "typeAware": true, "typeCheck": true } } ``` -------------------------------- ### Rules Configuration Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example of explicitly configuring individual rules, overriding category settings. ```json { "rules": { "eqeqeq": "error", "no-console": "warn", "no-unused-vars": 0, "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_"}], "react/display-name": "off" } } ``` -------------------------------- ### Minimal Setup Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/REFERENCE.md Minimal ESLint configuration using eslint-plugin-oxlint. ```javascript // eslint.config.js import oxlint from 'eslint-plugin-oxlint'; export default [...oxlint.configs['flat/recommended']]; ``` -------------------------------- ### Categories Configuration Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example of configuring rule categories and their severity levels. ```json { "categories": { "correctness": "error", "suspicious": "warn", "pedantic": "warn", "style": "off", "restriction": "warn", "perf": "warn", "nursery": "off" } } ``` -------------------------------- ### Usage: Legacy config example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/README.md Example of using eslint-plugin-oxlint with legacy configuration (eslint < 9.0). ```javascript // .eslintrc.js module.exports = { ... // other config extends: [ ... // other presets "plugin:oxlint/recommended", ], } ``` -------------------------------- ### Enabling Nursery Rules Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/configuration.md Demonstrates how to enable experimental nursery rules. ```typescript const configs = oxlint.buildFromOxlintConfig( { categories: { nursery: 'warn' } }, { withNursery: true } ); ``` -------------------------------- ### JSONC Support Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example of oxlint configuration using JSONC format, allowing comments. ```jsonc { // Enable correctness and suspicious rules "categories": { "correctness": "warn", "suspicious": "warn", /* Style rules are disabled by default */ "style": "off" } } ``` -------------------------------- ### Pre-built Configurations Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/REFERENCE.md Examples of using pre-built configurations for ESLint. ```javascript import oxlint from 'eslint-plugin-oxlint'; // Recommended (correctness rules only) oxlint.configs['flat/recommended'] oxlint.configs.recommended // Legacy format // All rules (all categories) oxlint.configs['flat/all'] oxlint.configs.all // Legacy format // Plugin-specific oxlint.configs['flat/typescript'] oxlint.configs['flat/react'] oxlint.configs['flat/nextjs'] // ... see configuration.md for full list // Category-specific oxlint.configs['flat/correctness'] oxlint.configs['flat/suspicious'] ``` -------------------------------- ### Usage: Flat config example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/README.md Example of using eslint-plugin-oxlint with flat config (eslint >= 9.0). ```javascript // eslint.config.js import oxlint from 'eslint-plugin-oxlint'; export default [ ...// other plugins ...oxlint.configs['flat/recommended'], // oxlint should be the last one ]; ``` -------------------------------- ### buildFromOxlintConfig() Usage Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/api-reference.md Example demonstrating how to use buildFromOxlintConfig to generate ESLint configurations from an oxlint configuration object. ```typescript import oxlint from 'eslint-plugin-oxlint'; const configs = oxlint.buildFromOxlintConfig({ plugins: ['typescript', 'react'], categories: { correctness: 'warn', suspicious: 'warn' }, rules: { 'eqeqeq': 'error' } }); export default [ ...oxlint.configs['flat/recommended'], ...configs ]; ``` -------------------------------- ### EslintPluginOxlintConfig Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/types.md Example of an EslintPluginOxlintConfig object. ```typescript const config: EslintPluginOxlintConfig = { name: 'oxlint/recommended', rules: { 'eqeqeq': 'off', '@typescript-eslint/no-unused-vars': 'off' } }; ``` -------------------------------- ### Integration with buildFromOxlintConfig Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example of using the buildFromOxlintConfig function with configuration options. ```typescript const configs = oxlint.buildFromOxlintConfig({ plugins: ["typescript"], categories: { correctness: "error" }, rules: { eqeqeq: "error" }, overrides: [ { files: ["**/*.test.ts"], rules: { "no-console": "off" } } ], ignorePatterns: ["node_modules", "dist"] }, { typeAware: true, withNursery: false }); ``` -------------------------------- ### OxlintConfig Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/types.md Example of an OxlintConfig object. ```typescript const config: OxlintConfig = { rules: { 'eqeqeq': 'error', 'no-unused-vars': 'warn', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], 'react/no-unused-state': 'off' } }; ``` -------------------------------- ### Invalid Extended Config Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/oxlint-config-schema.md Example of an invalid extended configuration structure. ```json { "extends": ["./missing-base.json"] } ``` -------------------------------- ### JSONC Support Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/function-reference.md An example demonstrating the support for JSONC format, including single-line and multi-line comments, and trailing commas in configuration files. ```jsonc { // Enable correctness rules "categories": { "correctness": "error", "suspicious": "warn", }, /* Disable style rules */ "rules": { "eqeqeq": "error" } } ``` -------------------------------- ### OxlintConfigCategories Example Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/types.md Example of configuring categories in OxlintConfig. ```typescript const config: OxlintConfig = { categories: { correctness: 'error', suspicious: 'warn', style: 'off' } }; ``` -------------------------------- ### Combining Multiple Configurations Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/_autodocs/configuration.md Example demonstrating how to combine multiple flat configurations and custom ESLint rules. ```javascript import oxlint from 'eslint-plugin-oxlint'; export default [ // Core rules ...oxlint.configs['flat/recommended'], // Framework-specific ...oxlint.configs['flat/react'], ...oxlint.configs['flat/nextjs'], // Additional categories ...oxlint.configs['flat/suspicious'], // Custom ESLint config { files: ['src/**/*.ts'], rules: { 'some-rule': 'warn' } } ]; ``` -------------------------------- ### Vite+ CLI Commands Source: https://github.com/oxc-project/eslint-plugin-oxlint/blob/main/AGENTS.md Commands to interact with the Vite+ toolchain, including installation, checking, and running tasks. ```bash vp help vp --help ``` ```bash vp install ``` ```bash vp check ``` ```bash vp test ``` ```bash vp run