JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48339
  • Score
    100M100P100Q165319F
  • License MIT

Plugs ESLint into Vite dev server

Package Exports

  • @nabla/vite-plugin-eslint

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@nabla/vite-plugin-eslint) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@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

shouldLint

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

formatter

  • Type: string

If provided, the value is passed to eslint.loadFormatter. Default to a custom format with one line per warning/error. Use stylish to get a CRA like output.