Oxlint v0.10 Migration Guide
Oxlint v0.10.0 is here! This release includes several exciting features, including many improvements to configuration files.
New Features
New Rules
This release includes the following new rules:
promise/no-callback-in-promise
react/iframe-missing-sandbox
node/no-new-require
And adds auto fixes/suggestions for:
eslint/no-plusplus
Enable/Disable Rules by Category
You can now enable or disable entire categories of rules with the categories
field inside of your configuration file.
Now, instead of running this command:
oxlint -D correctness -W suspicious -c oxlint.json
You can add a categories
field to your oxlint.json
:
{
"categories": {
"correctness": "deny",
"suspicious": "warn",
},
"rules": {
"no-const-assign": "error",
"import/no-cycle": "error",
},
}
and drop the -D
and -W
flags.
plugins
Are Now Supported in Configuration Files
Configuration files now support the plugins
array from ESLint v8 configs. This allows you to enable plugins without CLI arguments, making it possible to use plugins in VSCode.
{
"plugins": ["import"],
"categories": {
"correctness": "deny",
"suspicious": "warn",
},
"rules": {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
},
}
This plays nicely with categories
, as enabled/disabled categories affect plugins as well.
{
"plugins": ["import"],
// `categories` affects all enabled plugins
"categories": {
"correctness": "allow",
"suspicious": "warn",
},
"rules": {
"no-const-assign": "error",
"import/no-cycle": "error",
},
}
Breaking Changes and Migration Guide
CLI vs Config File Rule Priority
Before, config files would override rules set in CLI arguments. For example, running this command:
oxlint -A correctness -c oxlintrc.json
With this config file
{
"rules": {
"no-const-assign": "error",
},
}
Would result in a single rule, no-const-assign
being turned on at an error level with all other rules disabled (i.e. set to "allow").
Now, CLI arguments will override config files. That same command with the same config file will result with all rules being disabled. To get the same behavior as before, enable and disable categories in your config file instead of with CLI arguments.
oxlint -c oxlint.json
{
"categories": {
"correctness": "allow",
},
"rules": {
"no-const-assign": "error",
},
}