2.0.4 • Published 17 days ago

@nabla/vite-plugin-eslint v2.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
17 days ago

@nabla/vite-plugin-eslint npm

Plugs ESLint into Vite dev server.

Differences with vite-plugin-eslint

  • Keeps HMR fast: linting is done asynchronously and doesn't block the transform process
  • Reduces noise: Display results via console logs

logs.png

Because of this, the plugin can't fail the build and is only applied in dev. Like typechecking, linting should be done before or in parallel of the build command.

Install

yarn add --dev @nabla/vite-plugin-eslint

Usage

import { defineConfig } from "vite";
import eslintPlugin from "@nabla/vite-plugin-eslint";

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

Options

eslintOptions

Note: the fix option is only supported from 1.3.4

shouldLint

  • Type: (path: string) => boolean
  • Default: (path) => path.match(/\/src\/[^?]*\.(vue|svelte|m?[jt]sx?)$/)

You can use DEBUG=eslint node_modules/.bin/vite to debug this option (available in 1.4.0)

formatter

  • Type: string | ((result: ESLint.LintResult) => void)
  • Default: Custom format with one line per warning/error.

If provided, the value is passed to eslint.loadFormatter. Use stylish to get a CRA like output. Async formatters are supported in 1.5.0. Function support was added in 2.0.2.

2.0.3

17 days ago

2.0.4

17 days ago

1.6.0

6 months ago

2.0.2

6 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.4.2

1 year ago

1.5.0

1 year ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago