vite-plugin-oxlint
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

⚓️+⚡️Vite Plugin Oxlint

This is a Vite plugin for integrating the Oxlint linter into your Vite project. This plugin is an adaptation of the vite-plugin-biome for oxlint.

Installation

npm install vite-plugin-oxlint oxlint

Usage

Add the plugin to your vite.config.js file.

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. If you use a configuration file, other Allow / Deny / Warn rules configurations will be ignored. Default to oxlintrc.json.

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 yout src directory.

import oxlintPlugin from 'vite-plugin-oxlint'

export default {
  plugins: [
    oxlintPlugin({
      path: 'src',
    }),
  ],
}

Allow / Deny / Warin rules

You can allow, deny or warn oxlinter rules or categories. To see the list of available rules and categories, run: npx oxlint --rules

Default to deny: correctness.

Example: deny (turn on) correctness and perf rules and allow (turn off) the debugger and eqeqeq rule.

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 for a list of available options.

Example: add the --deny-warnings and --quiet option to the vite-plugin-oxlint config:

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 and configure ESlint with eslint-plugin-oxlint to turn off rules already supported in oxlint

import oxlintPlugin from 'vite-plugin-oxlint'
import eslintPlugin from 'vite-plugin-eslint'

export default {
  plugins: [oxlintPlugin(), eslintPlugin()],
}

License

MIT LICENSE

GitHub

/vite-plugin-oxlint/

    Package Sidebar

    Install

    npm i vite-plugin-oxlint

    Weekly Downloads

    133

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    7.39 kB

    Total Files

    7

    Last publish

    Collaborators

    • arnriu