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

Proposal to replace #504 (ESLint/Vue) #574

Merged
merged 6 commits into from Apr 17, 2020

Conversation

Kocal
Copy link
Contributor

@Kocal Kocal commented May 3, 2019

This PR add a second argument to Encore.enableEslintLoader() that is used to let the ESLint loader lint .vue files:

Encore.enableEslintLoader(() => {}, {
    lintVue: true
});

Using lintVue won't add any ESLint configuration, that the job of the final user (see #504 (comment)).

EDIT:

While #657 is being discussed, you can use the following code to:

Encore.enableEslintLoader((options) => {
  delete options.parser;
}, {
  lintVue: true
});

EDIT 2:

PR #687 has been merged and issue #657 is now resolved. It means that you can use the following code to let eslint-loader handle .vue files:

Encore.enableEslintLoader(() => {}, {
    lintVue: true
});

@masi
Copy link

masi commented May 5, 2019

FYI: to make the Vue linter plugin work you have to use it's own parser:

    .enableEslintLoader(options => {
        options.parser = 'vue-eslint-parser';
        options.parserOptions.parser = 'babel-eslint';
    })

If you fail to do so, linting will fail:

https://eslint.vuejs.org/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error

Or is this is part of the configuration work left for the user to do? Otherwise the user may assume that the loader ensures not only "babel-eslint" but "also "vue-eslint-parser" which it currently does not. Actually the current code doesn't even verify if the Vue loader is enabled at all.

Sidenote: if you're using typescript then it is @typescript-eslint/parserfor parserOptions.parser.

@Kocal
Copy link
Contributor Author

Kocal commented May 5, 2019

Or is this is part of the configuration work left for the user to do?

Normally yes, but since Encore already configure some ESLint options (loader) I may think to no.

I don't like to configure ESLint with .enableEslintLoader() - because linting issues are not displayed in IDE, and we can't run ESLint manually -, but maybe we can document something like this:

Encore.enableEslintLoader(options => {
  // remove Encore pre-defined value
  delete options.parser; // let eslint-vue-plugin handle the new parser value

  options.extends = (options.extends || []).concat('plugin:vue/recommended');
  options.parserOptions = Object.assign({}, options.parserOptions || {}, {
    parser: 'babel-eslint'
  }); 
}, { 
  lintVue: true
});

If it were up to me, I would only use .enableEslintLoader() to use my .eslintrc file to prevent issues:

Encore.enableEslintLoader(options => {
  options.configFile = __dirname + '/.eslintrc';
  delete options.parser; // I'm not sure I should do this, it's taken from #473 
}, {
  lintVue: true
});

In my opinion, Encore should only run and not configure ESLint. 😕

Actually the current code doesn't even verify if the Vue loader is enabled at all.

You don't need to enable Vue loader to lint Vue files with ESLint loader.

@Kocal
Copy link
Contributor Author

Kocal commented May 5, 2019

In fact I even don't find my PR useful, using .configureLoaderRule() should be enough: 🤔

Encore.configureLoaderRule('eslint', loader => {
  loader.test = /\.(jsx?|vue)$/
});

@masi
Copy link

masi commented May 5, 2019

I don't like to configure ESLint with .enableEslintLoader() - because linting issues are not displayed in IDE, and we can't run ESLint manually

And I don't like the fact that the configuration is hidden away within Encore/Webpack.

Encore.enableEslintLoader(options => {
  options.configFile = __dirname + '/.eslintrc';
  delete config.parser; // I'm not sure I should do this, it's taken from #473 
}, {
  lintVue: true
});

I didn't delete config.parser, but set it to the same value as in my .eslintrc (which has been BTW been deprectated in favour of .eslintrc.yaml and .eslintrc.js).

Does Encore need to set babel-eslint as parser? If it didn't we hadn't do go into such troubles for Vue (and Typescript) which need a different configuration.

In my opinion, Encore should only run and not configure ESLint. 😕

Perhaps the new eslintOption lintVue could turn off the default configuration completely.

Personally I'm happy to use configureLoaderRule and kicking the default configuraton, but getting a warning about messing with the loader rules every times is annoying.

@Kocal
Copy link
Contributor Author

Kocal commented May 5, 2019

Personally I'm happy to use configureLoaderRule and kicking the default configuraton, but getting a warning about messing with the loader rules every times is annoying.

We can improving the actual behavior by using a boolean like displayWarningForConfigureLoaderRule = true, display the warning when it's true, and set it at false after calling the method. 👍

@Lyrkan
Copy link
Collaborator

Lyrkan commented May 16, 2019

Sorry for not looking into this sooner.

I actually prefer this solution to #504 even if it only adds .vue files to the ones processed by the eslint-loader.

but maybe we can document something like this:

Encore.enableEslintLoader(options => {
  // remove Encore pre-defined value
  delete options.parser; // let eslint-vue-plugin handle the new parser value

  options.extends = (options.extends || []).concat('plugin:vue/recommended');
  options.parserOptions = Object.assign({}, options.parserOptions || {}, {
    parser: 'babel-eslint'
  }); 
}, { 
  lintVue: true
});

I'm against that as it is way to complicated and won't be understood by someone who isn't used to JavaScript (many Symfony devs aren't).

If it were up to me, I would only use .enableEslintLoader() to use my .eslintrc file to prevent issues:

Encore.enableEslintLoader(options => {
  options.configFile = __dirname + '/.eslintrc';
  delete config.parser; // I'm not sure I should do this, it's taken from #473 
}, {
  lintVue: true
});

Do you actually need all of that? we are not changing the default value for configFile, so it should already look for an .eslintrc file by default, no?

As for parser you'd also have to set it in your .eslintrc file anyway, so our default value would probably be overriden.

If we remove both of those lines we get something way simpler:

Encore.enableEslintLoader(() => {}, {
  lintVue: true,
});

In fact I even don't find my PR useful, using .configureLoaderRule() should be enough: 🤔

Encore.configureLoaderRule('eslint', loader => {
  loader.test = /\.(jsx?|vue)$/
});

I'd say that for now it should be enough, but I don't like recommending it since it relies on our internal implementation, which prevents us from guaranteeing BC.

In my opinion, Encore should only run and not configure ESLint.

When I started to respond I was disagreeing with you about that point, but the more I think about it the more I feel that you may be right...

We should probably only be configuring things that can't be set from within an .eslintrc file (loader options or CLIEngine-only options).

@Kocal
Copy link
Contributor Author

Kocal commented May 17, 2019

I'm against that as it is way to complicated and won't be understood by someone who isn't used to JavaScript (many Symfony devs aren't).

Nah just forgot about this, I don't know what happens in my head when I wrote this... 😅

Do you actually need all of that? we are not changing the default value for configFile, so it should already look for an .eslintrc file by default, no?

No we actually don't need to configure configFile, actually only parser is to configure.

As for parser you'd also have to set it in your .eslintrc file anyway, so our default value would probably be overriden.

That what I thought but nope, I have to delete options.parser to make it works. Otherwise I have the following error:
Capture d’écran de 2019-05-17 07-03-04

It's a well known error (see FAQ), it seems that eslint-loader override .eslint* config 🤔

By using the following code, eslint-loader is able to lint .vue files properly:

Encore
  .enableEslintLoader(options => {
    delete options.parser; 
  })
  .configureLoaderRule('eslint', loader => {
    loader.test = /\.(jsx?|vue)$/;
  })

Capture d’écran de 2019-05-17 07-23-46

(Note that the issue with ./DataTable.scss?module, I don't have this when running ESLint manually. I will probably open a new issue soon 😉 )
EDIT: my bad, it's because my preset is using eslint-plugin-import-resolver-node, configuring it to use eslint-import-resolver-webpack made the work :) )

When I started to respond I was disagreeing with you about that point, but the more I think about it the more I feel that you may be right...

In fact, the main problem with Encore configuring ESLint is that Encore pre-configure ESLint and the final user is not aware about that (unless he take a look to the source code).

And also the fact that IDEs won't be able to provide ESLint integration.

We should probably only be configuring things that can't be set from within an .eslintrc file (loader options or CLIEngine-only options).

Definitly yes! 😄

@Lyrkan
Copy link
Collaborator

Lyrkan commented May 17, 2019

That what I thought but nope, I have to delete options.parser to make it works. Otherwise I have the following error:

Yep... it actually makes sense since options from the loader are passed to the CLIEngine and that ESLint uses the following order of precedence (https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy):

The complete configuration hierarchy, from highest precedence to lowest precedence, is as follows:

  1. Inline configuration
    1.1. /eslint-disable/ and /eslint-enable/
    1.2. /global/
    1.3. /eslint/
    1.4. /eslint-env/
  2. Command line options (or CLIEngine equivalents):
    2.1. --global
    2.2.--rule
    2.3. --env
    2.4. -c, --config
  3. Project-level configuration:
    3.1. .eslintrc.* or package.json file in same directory as linted file
    3.2. Continue searching for .eslintrc and package.json files in ancestor directories (parent has highest precedence, then grandparent, etc.), up to and including the root directory or until a config with "root": true is found.
  4. In the absence of any configuration from (1) through (3), fall back to a personal default configuration in ~/.eslintrc.

@weaverryan
Copy link
Member

Hi!

Sorry for coming in late. This is a complex issue with... I think a lot being learned along the way. Is this PR still valid & does it solve the issues with vue and eslint? And should #504 be closed?

Thanks!

@Kocal
Copy link
Contributor Author

Kocal commented Jun 16, 2019

Hi, don't worry :)

Yes this PR is still valid and allow ESLint to lint .vue files in an easier way than using .configureLoaderRule('eslint', ...):

  Encore
    .enableEslintLoader(options => {
        delete options.parser;
    })
    .configureLoaderRule('eslint', loader => {
        loader.test = /\.(jsx?|vue)$/;
    })

@Lyrkan
Copy link
Collaborator

Lyrkan commented Jul 12, 2019

@weaverryan What would you think about not passing the parser option to the eslint-loader anymore?

TL;DR of previous comments:

The default ESLint parser doesn't support experimental things so we currently default to babel-eslint.

In some cases people may want/need to use another parser (for instance the vue-eslint-parser) but they won't be able to do it from within their .eslintrc file (which is usually read by IDEs, so probably a good thing to have it here) because what we pass to the loader has a higher priority than what is set there.

Doing this shouldn't break a lot of things but some users could have to yarn add -D babel-eslint and add "parser": "babel-eslint" to their conf.

@Kocal
Copy link
Contributor Author

Kocal commented Oct 17, 2019

What should we do about this PR?

@Kocal
Copy link
Contributor Author

Kocal commented Oct 19, 2019

As requested by @weaverryan, I've added a temporary comment which show how to make ESLint working with Vue files and eslint-plugin-vue.

See #657 for the discussion about ESLint external configuration.

@Kocal
Copy link
Contributor Author

Kocal commented Feb 8, 2020

Blocked by #687

weaverryan added a commit that referenced this pull request Mar 20, 2020
This PR was merged into the master branch.

Discussion
----------

Remove ESLint user-related config

Hi ✋

This PR is a proposal for #657 implementation and should fix issues encountered in #473, #574, #656, #659, and #685.

As discussed in #657, it would be better if Encore didn't configure ESLint itself. It should be done by the end user in an configuration file (e.g.: `.eslintrc.js`)

ESLint's `parser` option is not configured by default anymore, and `babel-eslint` requirement has been removed. We can considering this as a breaking change, end users should now configure `parser: 'babel-eslint` themselves.

Method `Encore.enableEslintLoader('extends-name')` has been deprecated and undocumented, in order to prevent end users to configure ESLint through Encore.

A nice message is also displayed when no ESLint configuration is found:
![Capture d’écran de 2020-01-12 11-15-09](https://user-images.githubusercontent.com/2103975/72217430-dfa2a480-352d-11ea-96e3-0e77236127d6.png)
I couldn't use `FriendlyErrorsPlugin` for this because error is not coming from Webpack. If someone has a better idea... 😕

**Pros:**
- end users have now full control hover ESLint configuration **by default**
- no need to `delete options.parser` when trying to use [`eslint-plugin-vue`](https://github.com/vuejs/eslint-plugin-vue) or [`@typescript-eslint/parser`](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)
- IDEs will be able to integrate ESLint (if they support it)

**Cons:**
- end users should now configure `parser` option to `babel-eslint` themselves
- end users will have to move their config to external config file, but it's ok

What do you think?
Thanks.

**EDIT:** tests failures are unrelated I think.

Commits
-------

9d3b02f tweaking wording and order
d23982a Display message if no ESLint configuration is found
c828b32 Deprecate `Encore.enableEslintLoader('extends-name')`
9f31d95 Add test for ESLint with external configuration (and babel-eslint usage)
3ba6cf2 Remove babel-eslint from ESLint configuration
@weaverryan
Copy link
Member

Unblocked ;)

Sorry for the wait

@Kocal
Copy link
Contributor Author

Kocal commented Mar 20, 2020

Nice! Thank you :)

@Kocal
Copy link
Contributor Author

Kocal commented Mar 20, 2020

@weaverryan PR has been rebased updated, the comment about delete options.parser has been removed.

@weaverryan
Copy link
Member

@Kocal This is looking really solid.

But if the user has enableVueLoader() AND enableEslintLoader(), might it be safe to assume that they want to lint .vue files also?

Or... we could even go further... and always lint .vue files? We already "always" lint .jsx files... why not lint .vue files if the user happens to process any? Because, it now looks like this PR as all about just adding the .vue extension to the loader test.

WDYT?

weaverryan added a commit that referenced this pull request Mar 27, 2020
…peScript with Babel (Kocal)

This PR was squashed before being merged into the master branch (closes #694).

Discussion
----------

Add Encore.enableBabelTypeScriptPreset() to "compile" TypeScript with Babel

See #691, I thought it can be interesting to have a test here.

Using Babel to "compile" TypeScript is faster than using `ts-loader` or `tsc` directly, because in fact, it literally remove types annotations.

To continue to check types, you have to run `tsc --emitDeclarationOnly` manually (or in a CI). But this is not part of the PR.

To migrate an already existing TypeScript app, you just have to configure `babel-loader` to run over `.tsx?` file like this:
```diff
Encore
-  .enableTypeScriptLoader()
+  .configureLoaderRule('javascript', loader => {
+    loader.test = /.(j|t)sx?$/; // let Babel to run over .tsx? files too
+  })
```

Install some dependencies: `yarn add --dev @babel/preset-typescript @babel/plugin-proposal-class-properties`.

And modify your Babel configuration:
```diff
{
    "presets": [
        "@babel/env",
+        "@babel/typescript"
    ],
+    "plugins": [
+        "@babel/proposal-class-properties"
+    ]
}
```

Maybe I can update `Encore.configureBabel()` and add an option to runs over TypeScript files too... like I did in #574, something like this:
```js
Encore
  .configureBabel(null, {
    typescript: true
  })
```

I've also changed the legacy import/export (`import a = require('...')` to `import a from '...'`). Because it's the legacy way (ES6 imports are very fine) and the Babel TypeScript was not compatible with them:
![Capture d’écran de 2020-02-07 22-06-11](https://user-images.githubusercontent.com/2103975/74066752-0a323100-49f8-11ea-91b8-cfdbc6de28a2.png)

**EDIT :** Added `Encore.enableBabelTypeScriptPreset()` that do all the job for us! :)

```js
// simple usage
Encore.enableBabelTypeScriptPreset();

// configure TypeScript preset (https://babeljs.io/docs/en/babel-preset-typescript#options)
Encore.enableBabelTypeScriptPreset({
  isTSX: true;
})
```

`Encore.enableBabelTypeScriptPreset()` can not be used aside `Encore.enableTypeScriptLoader()` or `Encore.enableForkedTypeScriptTypesChecking()`.

Commits
-------

bdd553a chore: typo
96a666b feat: implement Encore.enableBabelTypeScriptPreset()
6f992b0 feat: prepare method "enableBabelTypeScriptPreset"
8238c32 fixture: add code that only works in TypeScript
66067a0 test: add test for TypeScript "compilation" with Babel
2e21d4f chore(deps-dev): install Babel TypeScript preset, with class properties plugin
e053a5e fix(fixtures): use "better" syntax for TypeScript import/export
@Kocal
Copy link
Contributor Author

Kocal commented Mar 27, 2020

Hi 👋

But if the user has enableVueLoader() AND enableEslintLoader(), might it be safe to assume that they want to lint .vue files also?

Mmmh maybe... but I don't like to force the user like this.
It will sureley break for users that don't use eslint-plugin-vue (or anything else that handle .vue files), they will see the error Parsing error: Unexpected token < when ESLint will try to lint .vue files, and nothing will tell them that they can use eslint-plugin-vue.

I prefer this setting to be explicit to prevent those kind of issues. But that's my opinion. What do you think @weaverryan / @Lyrkan?

Or... we could even go further... and always lint .vue files? We already "always" lint .jsx files... why not lint .vue files if the user happens to process any? Because, it now looks like this PR as all about just adding the .vue extension to the loader test.

Yeah that's what I thought some months ago #574 (comment) 😅

But while writing this comment, I thought about different files that ESLint can lints with good plugins/parser.
Since ESLint can literally lint any kind of files if there is a plugin/parser for that (like GraphQL, JSON, Svelte, ...), maybe it would be better to have a method which configure extensions for eslint-loader? Something like this:

Encore.enableEslintLoader(() => {}, {
    extensions: /^.(jsx?|vue)$/, // e.g.: with a regex
    extensions: ['.js', '.jsx', '.vue', '...'], // with an array
});

That would be futur proof.

What do you think?

@weaverryan
Copy link
Member

Hey @Kocal!

Sorry for the slow reply - I kept almost replying, then something at home distracted me :p. Anyways, after reading your message, I'm happy with the current status of the PR. And we can discuss other options once we've used this and gotten feedback :).

Cheers!

@weaverryan
Copy link
Member

Thank you @Kocal!

@weaverryan weaverryan merged commit 4e6bcf4 into symfony:master Apr 17, 2020
@Kocal
Copy link
Contributor Author

Kocal commented Apr 17, 2020

Hi Ryan,

No problem, thank you! :)

@Kocal Kocal deleted the feat/eslint-vue branch April 17, 2020 11:01
weaverryan added a commit that referenced this pull request 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

Successfully merging this pull request may close these issues.

None yet

4 participants