npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

unplugin-oxlint

v0.7.3

Published

A universal bundler plugin for integrating the Oxlint linter into your project.

Downloads

582

Readme

unplugin-oxlint

NPM version

🌋 A universal bundler plugin for integrating the Oxlint linter into your project.

Features

🚀 A quick and simple way to use oxlint in your project.

🛠️ Support linting with both bundler plugin and Node.js API.

⚙️ Support common bundlers like Vite, Rollup, esbuild, and Webpack by unplugin.

🔍 Support mixed use in eslint projects by eslint-plugin-oxlint.

😊 Friendly output in terminal grouped by filepath.

⚡ Only lint the files that have changed for better performance by chokidar.

screenshot

Installation

# npm
npm i -D oxlint unplugin-oxlint

# pnpm
pnpm add -D oxlint unplugin-oxlint

# yar
yarn add -D oxlint unplugin-oxlint

Usage

Bundler Plugin

Recommended the bundler plugin way to use the full options of unplugin-oxlint.

// vite.config.ts
import Oxlint from 'unplugin-oxlint/vite'

export default defineConfig({
  plugins: [Oxlint()],
})

// rollup.config.js
import Oxlint from 'unplugin-oxlint/rollup'

export default {
  plugins: [Oxlint()],
}

// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [require('unplugin-oxlint/esbuild')()],
})

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [require('unplugin-oxlint/webpack')()],
}

Node.js API

For cases that require execution in a Node.js environment, an API method is also provided to perform linting actions.

Tips: The Node.js API supports most options except for watch.

// scripts/lint.js
import { lint } from 'unplugin-oxlint'

lint({ includes: 'src/**/*.ts', glob: true })

If you're looking for a way to use lint in scripts.

{
  "scripts": {
    "lint": "node scripts/lint.js"
  }
}

And the lint function can alse be used for creating integrations with other projects.

type Lint = (options: Omit<Options, 'watch'>) => Promise<LintResult[]>

interface LintResult {
  filename: string
  severity: 'off' | 'warning' | 'error'
  message: string
  linter: 'oxlint' | 'eslint'
  ruleId: string
}

Playground

See playground.

ESLint

If you are looking for a way to use oxlint in projects that still need ESLint, You can use eslint-plugin-oxlint to turn off ESLint rules that are already supported by oxlint.

The rules are extracted from here

unplugin-oxlint will automatically run the eslint script after oxlint when build start and file change.

# npm
npm i -D eslint eslint-plugin-oxlint

# pnpm
pnpm add -D eslint eslint-plugin-oxlint

# yarn
yarn add -D eslint eslint-plugin-oxlint

Example

Use eslint-plugin-oxlint with @antfu/eslint-config

// eslint.config.js
import antfu from '@antfu/eslint-config'
import oxlint from 'eslint-plugin-oxlint'

export default [
  ...await antfu(),
  oxlint.configs['flat/all'],
]

Options

For all options please refer to docs.

This plugin accepts most options of vite-plugin-oxlint, and some extra options that are specific to this plugin.

~~options.path~~

  • ~~Type: string | string[]~~
  • ~~Default: '.'~~

options.includes

  • Type: string | string[]
  • Default: '.'

Paths to files or dirs to be watched, for more details see: chokidar v4

And for those who wants to use glob pattern, unplugin-oxlint also provide glob options.

options.glob

  • Type: boolean
  • Default: false

Watched by glob patterns

Example:

Oxlint({
  includes: ['src/**/*.ts'],
  glob: true,
}),

options.excludes

  • Type: RegExp[]
  • Default: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/]

options.rootDir

  • Type: string
  • Default: '.'

options.fix

  • Type: boolean
  • Default: false

Fix as many issues as possible. Only unfixed issues are reported in the output

options.watch

  • Type: boolean
  • Default: false

Continue to watch for changes in any of the resolved path

options.config

  • Type: string
  • Default: ''

ESLint configuration file

options.noIgnore

  • Type: boolean
  • Default: false

Disables excluding of files from .eslintignore files, --ignore-path flags and --ignore-pattern flags

options.quiet

  • Type: boolean
  • Default: false

Disable reporting on warnings, only errors are reported

options.denyWarnings

  • Type: boolean
  • Default: false

Ensure warnings produce a non-zero exit code

options.packageManager

  • Type: 'npm' | 'pnpm' | 'yarn' | 'bun'

Declare the package manager which you want to use

Normally you don't need to modify this option. unplugin-oxlint will automatically detect package.json and lock file by nypm

License

MIT License © 2024-PRESENT Tamago