High-performance JavaScript and TypeScript linter written in Rust, designed as part of the Oxc (Oxidation Compiler) suite of tools
Oxlint uses ESLint-compatible JSON configuration files with additional oxlint-specific features. Configuration files support comments and provide JSON schema validation for IDE integration.
Oxlint automatically looks for .oxlintrc.json in the current working directory. You can specify a custom configuration file using the --config option.
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "warn",
"suspicious": "warn",
"pedantic": "off"
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"extends": ["./base-config.json"],
"globals": {
"myGlobal": "readonly",
"myWritableGlobal": "writable"
},
"ignorePatterns": ["dist/**", "**/*.d.ts"],
"overrides": [
{
"files": ["*.test.js", "*.spec.js"],
"rules": {
"no-unused-vars": "off"
}
}
],
"plugins": ["typescript", "react", "import"],
"rules": {
"eqeqeq": "error",
"no-debugger": "warn",
"prefer-const": ["error", { "destructuring": "all" }]
},
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"typescript": true
}
}
}Control entire rule categories with a single setting.
{
"categories": {
"correctness": "error" | "warn" | "off",
"suspicious": "error" | "warn" | "off",
"pedantic": "error" | "warn" | "off",
"perf": "error" | "warn" | "off",
"style": "error" | "warn" | "off",
"nursery": "error" | "warn" | "off",
"restriction": "error" | "warn" | "off"
}
}Enable predefined global variables for different environments.
{
"env": {
"browser": boolean,
"node": boolean,
"es6": boolean,
"es2017": boolean,
"es2020": boolean,
"es2021": boolean,
"es2022": boolean,
"worker": boolean,
"amd": boolean,
"mocha": boolean,
"jasmine": boolean,
"jest": boolean,
"phantomjs": boolean,
"jquery": boolean,
"qunit": boolean,
"prototypejs": boolean,
"shelljs": boolean,
"meteor": boolean,
"mongo": boolean,
"applescript": boolean,
"nashorn": boolean,
"serviceworker": boolean,
"atomtest": boolean,
"embertest": boolean,
"webextensions": boolean,
"greasemonkey": boolean,
"builtin": boolean
}
}Extend from other configuration files with relative path resolution.
{
"extends": string[]
}Define additional global variables and their mutability.
{
"globals": {
[key: string]: "readonly" | "writable" | "off"
}
}Specify glob patterns for files and directories to exclude from linting.
{
"ignorePatterns": string[]
}Apply different rules to specific files or patterns.
{
"overrides": [
{
"files": string[],
"excludedFiles": string[],
"env": EnvironmentConfig,
"globals": GlobalsConfig,
"rules": RulesConfig,
"settings": SettingsConfig
}
]
}Enable or configure specific linting plugins.
{
"plugins": [
"eslint", // Core ESLint rules (default)
"typescript", // @typescript-eslint rules (default)
"@typescript-eslint", // Alternative name for typescript
"react", // React-specific rules
"react-hooks", // React Hooks rules
"import", // ES6 import/export rules
"import-x", // Alternative name for import
"unicorn", // Unicorn rules (enabled by default)
"oxc", // OXC-specific rules (enabled by default)
"deepscan", // Alternative name for oxc
"jsdoc", // JSDoc comment rules
"jest", // Jest testing rules
"vitest", // Vitest testing rules
"jsx-a11y", // JSX accessibility rules
"nextjs", // Next.js rules
"react-perf", // React performance rules
"promise", // Promise usage rules
"node", // Node.js rules
"regex", // Regex rules
"vue" // Vue.js rules
]
}Configure individual linting rules with severity levels and options.
{
"rules": {
[ruleName: string]:
| "off" | "warn" | "error"
| [("off" | "warn" | "error"), ...any[]]
}
}Rule Severity Levels:
"off" or 0 - Disable the rule"warn" or 1 - Rule violations produce warnings (exit code 0 unless --deny-warnings)"error" or 2 - Rule violations produce errors (exit code 1)Rule Configuration with Options: Many rules accept additional configuration options:
{
"rules": {
"prefer-const": ["error", { "destructuring": "all" }],
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }]
}
}Configure plugin-specific settings that affect rule behavior.
{
"settings": {
"react": {
"createClass": string,
"pragma": string,
"fragment": string,
"version": string | "detect",
"flowVersion": string
},
"import/resolver": {
"node": {
"extensions": string[]
},
"typescript": boolean | {
"alwaysTryTypes": boolean,
"project": string | string[]
}
},
"import/ignore": string[],
"import/extensions": string[],
"import/core-modules": string[],
"import/external-module-folders": string[]
}
}Oxlint discovers configuration files using the following priority order:
--config path/to/config.json).oxlintrc.json in current directory.oxlintrc.json in parent directories (unless --disable-nested-config)Oxlint provides JSON Schema validation for configuration files:
{
"$schema": "./node_modules/oxlint/configuration_schema.json"
}This enables IDE features like autocompletion, validation, and documentation tooltips.
oxlint --print-configOutputs the final resolved configuration without performing linting.
oxlint --disable-nested-configPrevents automatic discovery of configuration files in parent directories.
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript"],
"env": {
"browser": true,
"es6": true
},
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-function-return-type": "warn"
}
}{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "jsx-a11y"],
"env": {
"browser": true,
"es6": true
},
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"jsx-a11y/alt-text": "warn"
}
}{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["node"],
"env": {
"node": true,
"es6": true
},
"rules": {
"node/no-missing-import": "error",
"node/no-unpublished-require": "warn"
}
}{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["jest"],
"overrides": [
{
"files": ["**/*.test.js", "**/*.spec.js"],
"env": {
"jest": true
},
"rules": {
"jest/expect-expect": "error",
"jest/no-disabled-tests": "warn"
}
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-oxlint