https://github.com/52-entertainment/vite-plugin-oxlint
⚓️+⚡️- Oxlint plugin for vite.
https://github.com/52-entertainment/vite-plugin-oxlint
oxc oxlint vite vite-plugin
Last synced: 8 days ago
JSON representation
⚓️+⚡️- Oxlint plugin for vite.
- Host: GitHub
- URL: https://github.com/52-entertainment/vite-plugin-oxlint
- Owner: 52-entertainment
- License: mit
- Created: 2024-02-14T11:55:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-29T09:56:48.000Z (about 1 year ago)
- Last Synced: 2024-05-29T10:25:37.402Z (11 months ago)
- Topics: oxc, oxlint, vite, vite-plugin
- Language: TypeScript
- Homepage:
- Size: 18.6 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-vite - vite-plugin-oxlint - Oxlint linter. (Plugins / Framework-agnostic Plugins)
- awesome-vite - vite-plugin-oxlint - Oxlint linter. (Plugins / Framework-agnostic Plugins)
README
# ⚓️+⚡️Vite Plugin Oxlint
This is a Vite plugin for integrating the [Oxlint](https://oxc-project.github.io) linter into your Vite project.
## Installation
```bash
npm install vite-plugin-oxlint oxlint
```## Usage
Add the plugin to your `vite.config.js` file.
```javascript
import oxlintPlugin from 'vite-plugin-oxlint'export default {
plugins: [oxlintPlugin()],
}
```## Advanced Usage
### Oxlint Configuration File
You can use a configuration file. See [Oxlint configuration file](https://oxc.rs/docs/guide/usage/linter/config.html).
[Allow / Deny / Warn](#allow--deny--warn-rules) will override config files rules.
Default to `oxlintrc.json`.
```javascript
import oxlintPlugin from 'vite-plugin-oxlint'export default {
plugins: [
oxlintPlugin({
configFile: 'eslintrc.json',
}),
],
}
```### Change working directory
You can change the directory where oxlinter will run.
Default to the root of your project.Examples: only lint files in your `src` directory.
```javascript
import oxlintPlugin from 'vite-plugin-oxlint'export default {
plugins: [
oxlintPlugin({
path: 'src',
}),
],
}
```### Ignore patterns
You can specify patterns of files to ignore. The supported syntax is the same as for .eslintignore and .gitignore files You should quote your patterns in order to avoid shell interpretation of glob patterns
See [oxlint ignore](https://oxc.rs/docs/guide/usage/linter/cli.html#ignore-files)Example: lint files in your `src`, but not test.js files:
```javascript
import oxlintPlugin from 'vite-plugin-oxlint'export default {
plugins: [
oxlintPlugin({
path: 'src',
ignorePattern: '"test.js"',
}),
],
}
```### Allow / Deny / Warn rules
You can allow, deny or warn oxlinter rules or categories.
To see the list of available rules and categories, run:
`npx oxlint --rules`
This will override [config files](#oxlint-configuration-file).Example: deny (turn on) `correctness` and `perf` rules and allow (turn off) the `debugger` and `eqeqeq` rule.
```javascript
import oxlintPlugin from 'vite-plugin-oxlint'export default {
plugins: [
oxlintPlugin({
deny: ['correctness', 'perf'],
allow: ['debugger', 'eqeqeq'],
warn: [],
}),
],
}
```### Additional oxlint config:
You can pass any additional oxlint config as a string.
See [oxlint options](https://oxc-project.github.io/docs/guide/usage/linter.html#useful-options) for a list of available options.Example: add the `--deny-warnings` and `--quiet` option to the `vite-plugin-oxlint` config:
```javascript
import oxlintPlugin from 'vite-plugin-oxlint'export default {
plugins: [
oxlintPlugin({
params: '--deny-warnings --quiet',
}),
],
}
```## Integration with ESlint
If your project still needs ESlint, you can use [vite-plugin-eslint](https://github.com/gxmari007/vite-plugin-eslint) and configure ESlint with [eslint-plugin-oxlint](https://github.com/oxc-project/eslint-plugin-oxlint) to turn off rules already supported in oxlint
```javascript
import oxlintPlugin from 'vite-plugin-oxlint'
import eslintPlugin from 'vite-plugin-eslint'export default {
plugins: [oxlintPlugin(), eslintPlugin()],
}
```## License
[MIT LICENSE](LICENSE)
[GitHub](https://github.com/52-entertainment/vite-plugin-oxlint)