webpack-contrib / eslint-webpack-plugin

A ESLint plugin for webpack
MIT License
255 stars 47 forks source link

'extensions' has been removed #251

Closed bprize15 closed 2 months ago

bprize15 commented 2 months ago

Bug report

Actual Behavior

When using eslint-webpack-plugin 4.1.0 with webpack 5.52.1, I pass an instance of the plugin object to webpack via the plugins array with the extensions option as follows:

 plugins: [
        new ESLintPlugin({
          extensions: ['js', 'ts', 'jsx', 'tsx'],
        }),
        ...
],

However, I receive the error:

[INFO] ERROR in [eslint] Invalid Options:
[INFO] - Unknown options: extensions
[INFO] - 'extensions' has been removed.

My project is using eslint 9.1.1. According to the documentation, it looks like the extensions field is no longer used, which I suspect is the cause of this error.

The most recent version with the extensions field is eslint 8.x.

According to the plugin's documentation on NPM:

You also need to install eslint >= 8 from npm, if you haven't already.

Expected Behavior

When using eslint-webpack-plugin 4.1.0 with webpack 5.52.1, I expect to be able to pass an instance of the plugin object to webpack via the plugins array with the extensions option set to lint the correct files.

How Do We Reproduce?

  1. Install eslint-webpack-plugin 4.1.0, webpack 5.52.1, and eslint 9.1.1.
  2. Pass an instance of ESLintPlugin (even if the extensions field is not set, you should still see the error. I assume this is because extensions is still passed to the ESLint object).

Please paste the results of npx webpack-cli info here, and mention other relevant information

System:
    OS: macOS 13.5.1
    CPU: (12) arm64 Apple M2 Max
    Memory: 5.30 GB / 64.00 GB
  Binaries:
    Node: 20.12.2 - ~/.nvm/versions/node/v20.12.2/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v12.16.1/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.2/bin/npm
  Browsers:
    Chrome: 124.0.6367.93
    Safari: 17.0
  Packages:
    browser-sync-webpack-plugin: 2.3.0 => 2.3.0 
    copy-webpack-plugin: 12.0.2 => 12.0.2 
    css-loader: 7.1.1 => 7.1.1 
    css-minimizer-webpack-plugin: 6.0.0 => 6.0.0 
    eslint-webpack-plugin: 4.1.0 => 4.1.0 
    file-loader: ^6.2.0 => 6.2.0 
    fork-ts-checker-webpack-plugin: 9.0.2 => 9.0.2 
    html-webpack-plugin: 5.6.0 => 5.6.0 
    json-loader: 0.5.7 => 0.5.7 
    loaders.css:  0.1.2 
    postcss-loader: 8.1.1 => 8.1.1 
    sass-loader: 14.2.1 => 14.2.1 
    sass-resources-loader: ^2.2.5 => 2.2.5 
    simple-progress-webpack-plugin: 2.0.0 => 2.0.0 
    source-map-loader: 5.0.0 => 5.0.0 
    sourcemap-istanbul-instrumenter-loader: 0.2.0 => 0.2.0 
    style-loader: 4.0.0 => 4.0.0 
    terser-webpack-plugin: 5.3.10 => 5.3.10 
    thread-loader: 4.0.2 => 4.0.2 
    ts-loader: 9.5.1 => 9.5.1 
    webpack: 5.91.0 => 5.91.0 
    webpack-cli: ^5.1.4 => 5.1.4 
    webpack-dev-server: 5.0.4 => 5.0.4 
    webpack-merge: 5.10.0 => 5.10.0 
    webpack-notifier: 1.15.0 => 1.15.0 
    workbox-webpack-plugin: 7.1.0 => 7.1.0 
halfninja commented 2 months ago

Experiencing the same issue - error goes away after downgrading to eslint@^8.

bprize15 commented 2 months ago

Experiencing the same issue - error goes away after downgrading to eslint@^8.

Yeah did the same thing to fix it. Might just need to update documentation in that case if that is the expected behavior.

ricardogobbosouza commented 2 months ago

Eslint 9 support #250