Skip to content

Commit

Permalink
feat: allow eslint legacy config usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Djiit committed Jan 22, 2024
1 parent de893d6 commit 3be900d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,36 @@ pnpm add eslint-plugin-oxlint --D

## Usage

This is a flat config usage.
### Flat config

This plugin is optimized for flat config usage (eslint >= 9.0). See [here](https://eslint.org/docs/latest/use/configure/configuration-files-new) for more details. Use it like this:

```js
// eslint.config.js
import oxlint from "eslint-plugin-oxlint"
import oxlint from "eslint-plugin-oxlint";
export default [
... // other plugins
...// other plugins
oxlint, // oxlint should be the last one
]
];
```

### Legacy config

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

```js
// .eslintrc.js
module.exports = {
... // other config
presets: [
... // other presets
"plugin:oxlint/recommended",
],
}
```

### Run it before eslint

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

```json
Expand All @@ -40,4 +59,5 @@ And then you can add the following script to your `package.json`:
You need to install both the [oxc](https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode) and [eslint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extensions

## License

[MIT](https://github.com/Dunqing/eslint-plugin-oxlint/blob/main/LICENSE)
8 changes: 7 additions & 1 deletion index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ const ruleMaps = require('./rules.cjs')
const rules = Object.values(ruleMaps).reduce((accumulator, object) => ({ ...accumulator, ...object }))

module.exports = {
rules
rules,
configs: {
recommended: {
plugins: ["oxlint"],
rules,
},
},
}
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ const rules = Object.values(ruleMaps).reduce((accumulator, object) => ({ ...accu

export default {
rules,
configs: {
recommended: {
plugins: ["oxlint"],
rules,
},
},
};

0 comments on commit 3be900d

Please sign in to comment.