Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to run eslint on single files #295

Open
3 tasks done
mikew opened this issue Jan 16, 2024 · 0 comments
Open
3 tasks done

Ability to run eslint on single files #295

mikew opened this issue Jan 16, 2024 · 0 comments

Comments

@mikew
Copy link
Contributor

mikew commented Jan 16, 2024

Is your feature request related to a problem? Please describe.

Linting all files all the time is much slower than linting a single file when it changes.

Describe the solution you'd like

Would be nice if vite-plugin-checker would:

  • lint all files when starting the dev server
  • lint all files when building
  • lint single files when they're changed

Something like

type EslintConfig =
  | false
  | {
      /**
       * lintCommand will be executed at build mode, and will also be used as
       * default config for dev mode when options.eslint.dev.eslint is nullable.
       */
      lintCommand: string | ((file?: string) => string)
      dev?: Partial<{
        /** You can override the options of translated from lintCommand. */
        overrideConfig: ESLint.Options
        /** which level of the diagnostic will be emitted from plugin */
        logLevel: ('error' | 'warning')[]
      }>
    }

would let people write

vitePluginChecker({
  eslint: {
    lintCommand: (file) => {
      const fileOrAllFiles = file ? file : './src/**/*.{ts,tsx}'
      return `eslint "${fileOrAllFiles}"`
    }
  }
})

Describe alternatives you've considered

There is eslint_d, but the nature of the command built by vite-plugin-checker still lints all files.

Additional context

I'm willing to work on this.

Validations

  • Read the docs.
  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant