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

[Bug]: eslint plugin Not working properly #6432

Open
hatedMe opened this issue Apr 30, 2024 · 1 comment
Open

[Bug]: eslint plugin Not working properly #6432

hatedMe opened this issue Apr 30, 2024 · 1 comment

Comments

@hatedMe
Copy link

hatedMe commented Apr 30, 2024

Version

System:
    OS: Windows 10 10.0.19045
    CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900K
    Memory: 8.38 GB / 31.75 GB
  Browsers:
    Edge: Chromium (123.0.2420.97)
    Internet Explorer: 11.0.19041.3636
  npmPackages:
    @rsbuild/core: ^0.6.8 => 0.6.8 
    @rsbuild/plugin-babel: ^0.6.8 => 0.6.8 
    @rsbuild/plugin-vue2: ^0.6.8 => 0.6.8 
    @rsbuild/plugin-vue2-jsx: ^0.6.8 => 0.6.8   

Details

Using eslint-plugin failed to automatically repair the code. It works normally in @rsbuild/[email protected], but it does not work properly in version 0.5.0 or above.

I tried it with the official example, but there were also problems.

Example link:
https://github.com/rspack-contrib/rspack-examples/tree/main/rsbuild/vue3-eslint

  1. Modify version number
// package.json 
"@rsbuild/core": "^0.4.15",
"@rsbuild/plugin-eslint": "^0.4.15",
"@rsbuild/plugin-vue": "^0.4.15",
  1. Add eslint plugin to automatically repair configuration
// rsbuild.config.ts
import { defineConfig } from "@rsbuild/core";
import { pluginVue } from "@rsbuild/plugin-vue";
import { pluginEslint } from "@rsbuild/plugin-eslint";

export default defineConfig({
  plugins: [
    pluginVue(),
    pluginEslint({
      eslintPluginOptions: {
        extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"],
          fix: true,  
      },
    }),
  ],
});
  1. In order to test that the bug is obvious, I added a double quote rule in .eslintrc.cjs
//.eslintrc.cjs
rules : {
    quotes: ["error", "double"],
},
  1. When saving the code in index.ts, all single quotes should be changed to double quotes.
// before
import './index.css';
import { createApp } from 'vue';
import App from './App.vue';

createApp(App).mount('#root');

// after
import "./index.css";
import { createApp } from "vue";
import App from "./App.vue";

createApp(App).mount("#root");

The above code can work normally in @0.4.15, but as long as you upgrade @rsbuild/core, @rsbuild/plugin-eslint, @rsbuild/plugin Problems will occur, there is no automatic fix, @rsbuild/plugin-eslint and eslint-webpack-plugin have similar problems just because the version number has changed, nothing else. Change, could this problem be caused by rspack?

Reproduce link

https://github.com/rspack-contrib/rspack-examples/tree/main/rsbuild/vue3-eslint

Reproduce Steps

1.git clone https://github.com/rspack-contrib/rspack-examples
2.pnpm install
3.cd rsbuild/vue3-eslint
4.pnpm dev

@chenjiahan
Copy link
Member

It seems like a regression of Rspack, I will transfer this issue to the Rspack repo.

@chenjiahan chenjiahan transferred this issue from web-infra-dev/rsbuild May 1, 2024
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

2 participants