Skip to content

Commit

Permalink
feat: add buildFromOxlintConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Sysix committed Oct 27, 2024
1 parent dd6dc94 commit 22f0166
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,38 @@ module.exports = {
}
```

### Detect rules from `oxlint.json`

If you are using flat configuration (eslint >= 9.0), you can use the following config:

```js
// eslint.config.js
import { buildFromOxlintConfigFile } from 'eslint-plugin-oxlint';
export default [
...// other plugins
{
// oxlint should be the last one
name: 'oxc/custom',
rules: buildFromOxlintConfigFile('./oxlint.json'),
},
];
```

If you are using legacy configuration (eslint < 9.0), you can use the following config:

```js
import { buildFromOxlintConfigFile } from 'eslint-plugin-oxlint';

// .eslintrc.js
module.exports = {
... // other config
rules: {
... // other rules
...buildFromOxlintConfigFile('./oxlint.json'),
},
}
```

### Run it before eslint

And then you can add the following script to your `package.json`:
Expand Down

0 comments on commit 22f0166

Please sign in to comment.