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

Enabling fix doesn't seem to update source files #43

Closed
duclet opened this issue Nov 14, 2020 · 5 comments · Fixed by #47
Closed

Enabling fix doesn't seem to update source files #43

duclet opened this issue Nov 14, 2020 · 5 comments · Fixed by #47

Comments

@duclet
Copy link

duclet commented Nov 14, 2020

  • Operating System: Manjaro Linux
  • Node Version: v13.9.0
  • NPM Version: 6.13.7
  • webpack Version: 5.4.0
  • eslint-webpack-plugin Version: 2.3.0

Expected Behavior

Running webpack with the fix option enabled should update the source code and autofix the rules that it can.

Actual Behavior

If running without the fix option, it shows the error. If running with the fix option enabled, no errors are shown but source code is not updated.

Code

// webpack.config.js
...
   plugins: [
        new CleanWebpackPlugin({ verbose: true }),
        new VueLoaderPlugin(),
        new ESLintWebpackPlugin({ extensions: ['.ts', '.vue'], fix: true }),
        new PrettierPlugin({ extensions: ['.js', '.ts', '.vue'] }),
    ],
    module: {
        rules: [
            { test: /\.vue$/, loader: 'vue-loader' },
            {
                test: /\.ts$/,
                exclude: /node_modules/,
                loader: 'ts-loader',
                options: { appendTsSuffixTo: [/\.vue$/] },
            },
            { test: /\.js$/, loader: "source-map-loader" }
        ]
    }
...
// .eslintrc
{
  "root": true,
  "parser": "vue-eslint-parser",
  "parserOptions": {
    "parser": "@typescript-eslint/parser",
    "sourceType": "module"
  },
  "plugins": ["simple-import-sort"],
  "rules": {
    "simple-import-sort/sort": "error"
  }
}

How Do We Reproduce?

With configs above, running npx webpack in theory should fix the following file by re-ordering the imports:

import MyInternalClass from './my-internal-class';
import BindAll from 'lodash-decorators/bindAll';
import shuffle from 'lodash/shuffle';
@starzou
Copy link

starzou commented Nov 16, 2020

I have the same problem.

@starzou
Copy link

starzou commented Nov 16, 2020

@ricardogobbosouza Can you take a look at this problem? Thank you.

@Liqiaomiao
Copy link

Liqiaomiao commented Nov 19, 2020

I have the same problem.

configureWebpack: config => {
    config.devtool =
      config.mode === 'development'
        ? 'cheap-module-eval-source-map'
        : 'source-map';
    return  {
      plugins:[new ESLintWebpackPlugin({
        context:'src',
        extensions: ['.vue','.js'],
        fix: true,
      })]
    }
  },

@rook-tx
Copy link

rook-tx commented Nov 20, 2020

Same problem here, what's the latest?

Node 15.0.1
npm 7.0.3
webpack 4.44.2
eslint 7.13.0
eslint-webpack-plugin 2.4.0

@starzou
Copy link

starzou commented Nov 30, 2020

@alexander-akait @jsg2021

Hello, It is still not fixed.

@jsg2021 jsg2021 mentioned this issue Nov 30, 2020
6 tasks
ricardogobbosouza added a commit that referenced this issue Nov 30, 2020
* test: add failing test

* fix: #44 keep all results across runs

* fix: #45 - include eslint options in types

* fix: 43

Co-authored-by: Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>
sakura-flutter added a commit to sakura-flutter/tampermonkey-scripts that referenced this issue Dec 1, 2020
@4版本兼容webpack@5与webpack-cli@4
eslint-webpack-plugin必须要2.4.1版本以上,[之前的版本传递fix选项失败](webpack-contrib/eslint-webpack-plugin#43)
sakura-flutter added a commit to sakura-flutter/tampermonkey-scripts that referenced this issue Aug 1, 2022
@4版本兼容webpack@5与webpack-cli@4
eslint-webpack-plugin必须要2.4.1版本以上,[之前的版本传递fix选项失败](webpack-contrib/eslint-webpack-plugin#43)
sakura-flutter added a commit to sakura-flutter/tampermonkey-scripts that referenced this issue Aug 1, 2022
@4版本兼容webpack@5与webpack-cli@4
eslint-webpack-plugin必须要2.4.1版本以上,[之前的版本传递fix选项失败](webpack-contrib/eslint-webpack-plugin#43)
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

Successfully merging a pull request may close this issue.

4 participants