-
Notifications
You must be signed in to change notification settings - Fork 106
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
[Bug] Vite can not find eslint config #367
[Bug] Vite can not find eslint config #367
Comments
Hi, I think this is maybe a bug in vite-plugin-eslint, that it tries to lint virtual files. But, you can prevent it by using an exclude option like: plugins: [eslintPlugin({
exclude: [/virtual:/, /node_modules/]
})], When I try that in your example project, I get other lint warnings, but it completes successfully. Maybe you can open an issue or PR in that repo with this suggestion. |
@gipoezcan that looks like a completely different issue. It looks like you're trying to import |
@IanVS I'm very sorry, I had apparently commented under the wrong issue: storybookjs/storybook#21101 (comment) |
No worries, happy to try to help if you make a new one. |
Oh yep, I was wondering if maybe you were hitting that other issue. I'll try to find some time to work on it, but I don't use windows, so it's a bit tricky to verify. |
@IanVS if you need anything from me to verify/reproduce, just mention. Thank you. |
This exact issue has started happening to us again (the Vite config fix above worked for a little while). This only happens in Github Actions for some reason.
Our Vite config:
Running on Node 18. |
Same issue for me, using glob fixed the issue for me: //vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import eslint from 'vite-plugin-eslint';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
eslint({
exclude: ['/virtual:/**', 'node_modules/**'],
}),
}); |
I have the same issue but is with vite:import-analysis my main.ts config: import { loadConfigFromFile, mergeConfig } from "vite";
const path = require("path");
module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"storybook-addon-mock",
"storybook-dark-mode",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
features: {
storyStoreV7: false,
},
async viteFinal(config, { configType }) {
const response = await loadConfigFromFile(
path.resolve(__dirname, "../vite.config.ts")
);
return mergeConfig(config, {
...response?.config,
plugins: [],
});
},
}; vite.config.ts: import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import viteTsconfigPaths from "vite-tsconfig-paths";
import svgrPlugin from "vite-plugin-svgr";
import { resolve } from "path";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), viteTsconfigPaths(), svgrPlugin()],
resolve: {
alias: [
{
find: "theme/utils.scss",
replacement: `${resolve(__dirname)}/src/theme/utils.scss`,
},
],
},
build: {
outDir: "build",
},
}); |
Also had to exclude
|
What version of
vite
are you using?2.9.7
System info and storybook versions
System:
OS: macOS 12.3.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.18 - ~/.yarn/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Browsers:
Chrome: 100.0.4896.127
Firefox: 92.0.1
Safari: 15.4
npmPackages:
@storybook/addon-actions: ^6.4.22 => 6.4.22
@storybook/addon-essentials: ^6.4.22 => 6.4.22
@storybook/addon-links: ^6.4.22 => 6.4.22
@storybook/builder-vite: ^0.1.33 => 0.1.33
@storybook/vue3: ^6.4.22 => 6.4.22
Describe the Bug
I am currently trying to add eslint to the storybook setup with vite and it works in the "normal" project structure but when I add the eslint plugin to the storybook vite config, it crashes with the following exception:
I am using the
vite-plugin-eslint^1.6.0
plugin to integrate eslint.Link to Minimal Reproducible Example
https://github.com/Marcoru97/vite-eslint-storybook-example
Participation
The text was updated successfully, but these errors were encountered: