theme-ui icon indicating copy to clipboard operation
theme-ui copied to clipboard

Vite crush when use theme-ui with vite-plugin-linter

Open sikhaman opened this issue 2 years ago • 0 comments

Describe the bug When use theme-ui with Vite and include plugin vite-plugin-linter, dev server fails with error

To Reproduce Steps to reproduce the behavior:

  1. create new project with vite yarn create vite my-react-app --template react-ts
  2. go inside folder and install all dependencies and vite-plugin-linter
  3. open file vite.config and add next code
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import EsLint from 'vite-plugin-linter'
const { EsLinter, linterPlugin } = EsLint

// https://vitejs.dev/config/
export default defineConfig((configEnv) => ({

  plugins: [
    react(),
    linterPlugin(
      {
        include: ['./src/**/*.{ts,tsx}'],
        exclude: ['./src/**/*.test.{ts,tsx}'],
        linters: [new EsLinter({ configEnv })],
      }
    ),
  ],

}))

  1. go to App.tsx and just import there theme provider import { ThemeProvider } from "theme-ui";
  2. run the app yarn dev

Expected behavior All is running and cool

Screenshots Dev server breaks with an errors

Additional context

node:internal/event_target:916
  process.nextTick(() => { throw err; });
                           ^
Error: No ESLint configuration found in /Users/dorado/Desktop/repos/my-vue-app/src.
    at CascadingConfigArrayFactory._finalizeConfigArray (/Users/dorado/Desktop/repos/my-vue-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3977:19)
    at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/dorado/Desktop/repos/my-vue-app/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3768:21)
    at CLIEngine.isPathIgnored (/Users/dorado/Desktop/repos/my-vue-app/node_modules/eslint/lib/cli-engine/cli-engine.js:989:18)
    at ESLint.isPathIgnored (/Users/dorado/Desktop/repos/my-vue-app/node_modules/eslint/lib/eslint/eslint.js:681:26)
    at EsLinter.lint (/Users/dorado/Desktop/repos/my-vue-app/node_modules/vite-plugin-linter/dist/linters/EsLinter.js:71:37)
    at EsLinter.lintServe (/Users/dorado/Desktop/repos/my-vue-app/node_modules/vite-plugin-linter/dist/linters/EsLinter.js:59:36)
    at MessagePort.<anonymous> (/Users/dorado/Desktop/repos/my-vue-app/node_modules/vite-plugin-linter/dist/lintWorkerThread.js:48:24)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:647:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)
Emitted 'error' event on Worker instance at:
    at Worker.[kOnErrorMessage] (node:internal/worker:289:10)
    at Worker.[kOnMessage] (node:internal/worker:300:37)
    at MessagePort.<anonymous> (node:internal/worker:201:57)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:647:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28) {
  messageTemplate: 'no-config-found',
  messageData: { directoryPath: '/Users/dorado/Desktop/repos/my-vue-app/src' }
}
error Command failed with exit code 1.

So I do not know if it is a problem with Vite itself, vite-plugin-linter, or with theme-ui. And my question is how to fix it?

sikhaman avatar Mar 23 '23 17:03 sikhaman