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

eslint-loader has been deprecated for eslint-webpack-plugin #847

Closed
Kocal opened this issue Oct 9, 2020 · 0 comments
Closed

eslint-loader has been deprecated for eslint-webpack-plugin #847

Kocal opened this issue Oct 9, 2020 · 0 comments

Comments

@Kocal
Copy link
Member

Kocal commented Oct 9, 2020

Hi,

Just for information, eslint-loader has been deprecated (https://github.com/webpack-contrib/eslint-loader) in favor of eslint-webpack-plugin (https://github.com/webpack-contrib/eslint-webpack-plugin).

We will have to:

  • transform our lib/loaders/eslint.js to as dedicated plugin
  • options are similar. From what we use, only cache does not exist anymore, but apparently the plugin already use the ESLint cache Using cache directly from eslint
  • update our tests
  • update our lib/features.js
  • update our dev deps
Kocal added a commit to Kocal/webpack-encore that referenced this issue May 23, 2021
Kocal added a commit to Kocal/webpack-encore that referenced this issue May 23, 2021
Kocal added a commit to Kocal/webpack-encore that referenced this issue May 23, 2021
Kocal added a commit to Kocal/webpack-encore that referenced this issue May 25, 2021
Kocal added a commit to Kocal/webpack-encore that referenced this issue May 25, 2021
Kocal added a commit to Kocal/webpack-encore that referenced this issue May 31, 2021
Kocal added a commit to Kocal/webpack-encore that referenced this issue Sep 3, 2021
Kocal added a commit to Kocal/webpack-encore that referenced this issue Jan 4, 2022
weaverryan added a commit to Kocal/webpack-encore that referenced this issue Jan 21, 2022
weaverryan added a commit that referenced this issue Jan 21, 2022
…847 (Kocal, weaverryan)

This PR was squashed before being merged into the main branch.

Discussion
----------

Move from eslint-loader to eslint-webpack-plugin, close #847

Hi 👋

This PR is a proposal for #847 which add the eslint-webpack-plugin, since the eslint-loader is deprecated.

There are a lot of changes:
- ~**BC** method `.enableEslintLoader()` has been removed, in favor of `.enableEslintPlugin()`. It accepts an object or a function.~ `.enableEslintLoader()` has not been removed, so it's not a BC anymore
- **BC** ESLint <7 support has been dropped, since the plugin requires ESLint >= 7.
- **BC, I guess** No more Encore-specific options, the only option `lintVue` was too specific and not futur proof (if you want to lint GraphQL, JSON or whatever you want, with ESLint, see last § of #574 (comment)). Extensions can easily be configured through `Encore.enableEslintPlugin(options => { options.extensions.push('vue'); })`
- `eslint.CLIEngine` is not used anymore to detect if an ESLint configuration exists, because this class is deprecated since ESLint 7.

~However, some tests are failing but I don't know why:~
```
[
  {
    moduleIdentifier: '/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js??ruleSet[1].rules[0].use[0]!/tmp/err9jr/js/eslint.js',
    moduleName: './js/eslint.js',
    message: 'Module build failed (from ../../home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js):\n' +
      "Error: Cannot find module '`@babel`/plugin-syntax-dynamic-import'\n" +
      'Require stack:\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/index.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/index.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/lib/config/parse-runtime.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/test/helpers/setup.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/test/bin/encore.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/esm-utils.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/mocha.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/cli/one-and-dones.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/cli/options.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/bin/mocha\n' +
      '    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)\n' +
      '    at resolve (internal/modules/cjs/helpers.js:80:19)\n' +
      '    at resolveStandardizedName (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js:96:7)\n' +
      '    at resolvePlugin (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js:40:10)\n' +
      '    at loadPlugin (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js:48:20)\n' +
      '    at loadPlugin.next (<anonymous>)\n' +
      '    at createDescriptor (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:179:16)\n' +
      '    at createDescriptor.next (<anonymous>)\n' +
      '    at step (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:261:32)\n' +
      '    at evaluateAsync (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:291:5)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:44:11\n' +
      '    at Array.forEach (<anonymous>)\n' +
      '    at Function.async (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:43:15)\n' +
      '    at Function.all (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:216:13)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at createDescriptors (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:134:38)\n' +
      '    at createDescriptors.next (<anonymous>)\n' +
      '    at createPluginDescriptors (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:130:17)\n' +
      '    at createPluginDescriptors.next (<anonymous>)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:86:32\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at Function.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/gensync-utils/async.js:16:3)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at step (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:269:25)\n' +
      '    at evaluateAsync (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:291:5)\n' +
      '    at Function.errback (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:113:7)\n' +
      '    at errback (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/gensync-utils/async.js:60:18)\n' +
      '    at async (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:188:31)\n' +
      '    at onFirstPause (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:216:13)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at cachedFunction (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/caching.js:58:46)\n' +
      '    at cachedFunction.next (<anonymous>)\n' +
      '    at mergeChainOpts (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-chain.js:405:34)\n' +
      '    at mergeChainOpts.next (<anonymous>)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-chain.js:364:14\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at buildRootChain (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-chain.js:57:36)\n' +
      '    at buildRootChain.next (<anonymous>)\n' +
      '    at loadPrivatePartialConfig (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/partial.js:85:62)\n' +
      '    at loadPrivatePartialConfig.next (<anonymous>)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/partial.js:131:25\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at step (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:269:25)\n' +
      '    at evaluateAsync (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:291:5)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:93:9\n' +
      '    at new Promise (<anonymous>)\n' +
      '    at async (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:92:14)\n' +
      '    at Object.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:155:26)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at asyncGeneratorStep (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:3:103)\n' +
      '    at _next (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:5:194)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:5:364\n' +
      '    at new Promise (<anonymous>)\n' +
      '    at Object.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:5:97)\n' +
      '    at Object.loader (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:64:18)\n' +
      '    at Object.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:59:12)',
    moduleId: './js/eslint.js',
    moduleTrace: [],
    details: undefined,
    stack: 'ModuleBuildError: Module build failed (from ../../home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js):\n' +
      "Error: Cannot find module '`@babel`/plugin-syntax-dynamic-import'\n" +
      'Require stack:\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/index.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/index.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/lib/config/parse-runtime.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/test/helpers/setup.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/test/bin/encore.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/esm-utils.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/mocha.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/cli/one-and-dones.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/lib/cli/options.js\n' +
      '- /home/hugo/workspace-os/webpack-encore/node_modules/mocha/bin/mocha\n' +
      '    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)\n' +
      '    at resolve (internal/modules/cjs/helpers.js:80:19)\n' +
      '    at resolveStandardizedName (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js:96:7)\n' +
      '    at resolvePlugin (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js:40:10)\n' +
      '    at loadPlugin (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/files/plugins.js:48:20)\n' +
      '    at loadPlugin.next (<anonymous>)\n' +
      '    at createDescriptor (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:179:16)\n' +
      '    at createDescriptor.next (<anonymous>)\n' +
      '    at step (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:261:32)\n' +
      '    at evaluateAsync (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:291:5)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:44:11\n' +
      '    at Array.forEach (<anonymous>)\n' +
      '    at Function.async (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:43:15)\n' +
      '    at Function.all (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:216:13)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at createDescriptors (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:134:38)\n' +
      '    at createDescriptors.next (<anonymous>)\n' +
      '    at createPluginDescriptors (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:130:17)\n' +
      '    at createPluginDescriptors.next (<anonymous>)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-descriptors.js:86:32\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at Function.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/gensync-utils/async.js:16:3)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at step (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:269:25)\n' +
      '    at evaluateAsync (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:291:5)\n' +
      '    at Function.errback (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:113:7)\n' +
      '    at errback (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/gensync-utils/async.js:60:18)\n' +
      '    at async (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:188:31)\n' +
      '    at onFirstPause (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:216:13)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at cachedFunction (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/caching.js:58:46)\n' +
      '    at cachedFunction.next (<anonymous>)\n' +
      '    at mergeChainOpts (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-chain.js:405:34)\n' +
      '    at mergeChainOpts.next (<anonymous>)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-chain.js:364:14\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at buildRootChain (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/config-chain.js:57:36)\n' +
      '    at buildRootChain.next (<anonymous>)\n' +
      '    at loadPrivatePartialConfig (/home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/partial.js:85:62)\n' +
      '    at loadPrivatePartialConfig.next (<anonymous>)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/`@babel`/core/lib/config/partial.js:131:25\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at step (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:269:25)\n' +
      '    at evaluateAsync (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:291:5)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:93:9\n' +
      '    at new Promise (<anonymous>)\n' +
      '    at async (/home/hugo/workspace-os/webpack-encore/node_modules/gensync/index.js:92:14)\n' +
      '    at Object.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:155:26)\n' +
      '    at Generator.next (<anonymous>)\n' +
      '    at asyncGeneratorStep (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:3:103)\n' +
      '    at _next (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:5:194)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:5:364\n' +
      '    at new Promise (<anonymous>)\n' +
      '    at Object.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:5:97)\n' +
      '    at Object.loader (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:64:18)\n' +
      '    at Object.<anonymous> (/home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:59:12)\n' +
      '    at processResult (/home/hugo/workspace-os/webpack-encore/node_modules/webpack/lib/NormalModule.js:676:19)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/webpack/lib/NormalModule.js:778:5\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/loader-runner/lib/LoaderRunner.js:399:11\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/loader-runner/lib/LoaderRunner.js:251:18\n' +
      '    at context.callback (/home/hugo/workspace-os/webpack-encore/node_modules/loader-runner/lib/LoaderRunner.js:124:13)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/babel-loader/lib/index.js:59:103'
  },
  {
    message: 'No ESLint configuration found in /tmp/err9jr/js.',
    details: undefined,
    stack: 'Error: No ESLint configuration found in /tmp/err9jr/js.\n' +
      '    at CascadingConfigArrayFactory._finalizeConfigArray (/home/hugo/workspace-os/webpack-encore/node_modules/`@eslint`/eslintrc/lib/cascading-config-array-factory.js:508:19)\n' +
      '    at CascadingConfigArrayFactory.getConfigArrayForFile (/home/hugo/workspace-os/webpack-encore/node_modules/`@eslint`/eslintrc/lib/cascading-config-array-factory.js:299:21)\n' +
      '    at FileEnumerator._iterateFilesWithFile (/home/hugo/workspace-os/webpack-encore/node_modules/eslint/lib/cli-engine/file-enumerator.js:365:43)\n' +
      '    at FileEnumerator._iterateFiles (/home/hugo/workspace-os/webpack-encore/node_modules/eslint/lib/cli-engine/file-enumerator.js:346:25)\n' +
      '    at FileEnumerator.iterateFiles (/home/hugo/workspace-os/webpack-encore/node_modules/eslint/lib/cli-engine/file-enumerator.js:296:59)\n' +
      '    at iterateFiles.next (<anonymous>)\n' +
      '    at CLIEngine.executeOnFiles (/home/hugo/workspace-os/webpack-encore/node_modules/eslint/lib/cli-engine/cli-engine.js:765:48)\n' +
      '    at ESLint.lintFiles (/home/hugo/workspace-os/webpack-encore/node_modules/eslint/lib/eslint/eslint.js:530:23)\n' +
      '    at lintFiles (/home/hugo/workspace-os/webpack-encore/node_modules/eslint-webpack-plugin/dist/getESLint.js:57:36)\n' +
      '    at lint (/home/hugo/workspace-os/webpack-encore/node_modules/eslint-webpack-plugin/dist/linter.js:93:21)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/eslint-webpack-plugin/dist/index.js:138:11\n' +
      '    at Hook.eval [as callAsync] (eval at create (/home/hugo/workspace-os/webpack-encore/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)\n' +
      '    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/hugo/workspace-os/webpack-encore/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)\n' +
      '    at Compilation.finish (/home/hugo/workspace-os/webpack-encore/node_modules/webpack/lib/Compilation.js:2155:28)\n' +
      '    at /home/hugo/workspace-os/webpack-encore/node_modules/webpack/lib/Compiler.js:1075:19\n' +
      '    at processTicksAndRejections (internal/process/task_queues.js:79:11)'
  }
]
      2) Code splitting with dynamic import
 ERROR  Failed to compile with 1 errors                                                                                                                                       15:54:37

 error  in ./test_tmp/tsnh3r/js/code_splitting_dynamic_import.js                                                                                                              15:54:37
```

~The dependency ``@babel`/plugin-syntax-dynamic-import` is present in Encore's `package.json`, so I don't really understand the issue... 😬~
~Any help would be appreciated! :heart:~
**EDIT:** fixed, see #985 (comment)

WDYT? Thanks!

Commits
-------

8c33cb1 Move from eslint-loader to eslint-webpack-plugin, close #847
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

1 participant