High-performance JavaScript and TypeScript linter written in Rust, designed as part of the Oxc (Oxidation Compiler) suite of tools
Oxlint provides a hierarchical rule management system with categories, individual rule configuration, and flexible severity controls. Rules can be configured through command-line options or configuration files with fine-grained control over scope and application.
Oxlint organizes rules into logical categories that can be enabled or disabled as groups:
oxlint -D correctness # Deny (error level)
oxlint -W correctness # Warn level
oxlint -A correctness # Allow (suppress)Code that is outright wrong or useless. Enabled by default at error level.
Examples: no-debugger, no-unreachable, no-duplicate-keys
oxlint -D suspicious
oxlint -W suspicious
oxlint -A suspiciousCode that is most likely wrong or problematic but may have legitimate uses.
Examples: no-empty, no-implicit-coercion, no-unused-vars
oxlint -D pedantic
oxlint -W pedantic
oxlint -A pedanticStrict rules that enforce best practices but may have occasional false positives.
Examples: prefer-const, no-var, eqeqeq
oxlint -D style
oxlint -W style
oxlint -A styleCode style and formatting rules for consistent code appearance.
Examples: semi, quotes, indent, comma-dangle
oxlint -D nursery
oxlint -W nursery
oxlint -A nurseryNew rules under development that may change behavior or have limited testing.
oxlint -D restriction
oxlint -W restriction
oxlint -A restrictionRules that prevent the use of specific language features or patterns.
Examples: no-eval, no-with, no-implicit-globals
oxlint -A all # Allow all rules
oxlint -D all # Deny all rules (except nursery)Applies to all categories except nursery. Does not automatically enable plugins.
# Allow (suppress) - rules produce no output
oxlint --allow RULE_NAME
oxlint -A RULE_NAME
# Warn - rules produce warnings (exit code 0 unless --deny-warnings)
oxlint --warn RULE_NAME
oxlint -W RULE_NAME
# Deny (error) - rules produce errors (exit code 1)
oxlint --deny RULE_NAME
oxlint -D RULE_NAME{
"rules": {
"rule-name": "off", // 0 - disable rule
"rule-name": "warn", // 1 - warning level
"rule-name": "error" // 2 - error level
}
}{
"rules": {
"no-debugger": "error",
"no-console": "warn",
"no-unused-vars": "off",
"eqeqeq": "error",
"prefer-const": "warn"
}
}{
"rules": {
"prefer-const": ["error", {
"destructuring": "any",
"ignoreReadBeforeAssign": false
}],
"no-unused-vars": ["warn", {
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": true
}],
"quotes": ["error", "single", {
"avoidEscape": true,
"allowTemplateLiterals": false
}]
}
}Rules are applied in order from left to right, allowing fine-grained control:
# Start with all rules allowed, then deny specific categories
oxlint -A all -D correctness -D suspicious src/
# Allow a category but deny specific rules
oxlint -A pedantic -D prefer-const -D no-var src/
# Mix of category and individual rule controls
oxlint -D suspicious --allow no-debugger -W no-console src/Command-line options override configuration file settings:
# Override config file rules
oxlint -c .oxlintrc.json -A no-debugger -D prefer-const src/{
"rules": {
"no-console": "error"
},
"overrides": [
{
"files": ["**/*.test.js", "**/*.spec.js"],
"rules": {
"no-console": "off"
}
},
{
"files": ["scripts/**/*.js"],
"rules": {
"no-console": "warn",
"no-process-exit": "off"
}
}
]
}{
"plugins": ["typescript", "react"],
"rules": {
// TypeScript rules
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-function-return-type": "warn",
// React rules
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
// Disable conflicting core rules when using TypeScript
"no-unused-vars": "off"
}
}{
"categories": {
"correctness": "error",
"suspicious": "warn",
"pedantic": "off",
"style": "warn"
},
"rules": {
// Override specific rules within categories
"no-debugger": "warn", // Override correctness default
"prefer-const": "error" // Override pedantic default
}
}oxlint --rulesDisplays all available rules organized by plugin and category.
Rules follow standard naming conventions:
rule-nameplugin-name/rule-name@typescript-eslint/rule-name# Set maximum number of warnings before exit code 1
oxlint --max-warnings 10 src/
# Treat any warning as error
oxlint --deny-warnings src/
# Suppress warnings, show errors only
oxlint --quiet src/# Report unused eslint-disable directives
oxlint --report-unused-disable-directives src/
# Report with specific severity
oxlint --report-unused-disable-directives-severity error src/{
"categories": {
"correctness": "error",
"suspicious": "error",
"pedantic": "error"
},
"rules": {
"no-debugger": "error",
"no-console": "error",
"eqeqeq": "error",
"prefer-const": "error"
}
}{
"categories": {
"correctness": "error",
"suspicious": "warn",
"pedantic": "off"
},
"rules": {
// Gradually enable pedantic rules
"prefer-const": "warn",
"no-var": "warn"
}
}{
"plugins": ["react", "typescript"],
"overrides": [
{
"files": ["**/*.tsx", "**/*.jsx"],
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-key": "error",
"react/no-unused-state": "warn"
}
},
{
"files": ["**/*.ts", "**/*.tsx"],
"rules": {
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-explicit-any": "warn",
"no-unused-vars": "off"
}
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-oxlint