Since I switched to dynamic imports, I am getting errors from eslint
, as my configuration does not support these yet. I searched a lot on Google how to do this correctly, but the only info I found was this issue that has been closed due to age, but does not appear to be resolved yet:
opened 11:23PM - 06 Mar 19 UTC
closed 03:49PM - 15 Mar 19 UTC
enhancement
core
evaluating
archived due to age
<!--
ESLint adheres to the [JS Foundation Code of Conduct](https://js.found… ation/community/code-of-conduct).
This template is for requesting a change that is not a bug fix, rule change, or new rule. If you are here for another reason, please see below:
1. To report a bug: https://eslint.org/docs/developer-guide/contributing/reporting-bugs
2. To request a rule change: https://eslint.org/docs/developer-guide/contributing/rule-changes
3. To propose a new rule: https://eslint.org/docs/developer-guide/contributing/new-rules
4. If you have any questions, please stop by our chatroom: https://gitter.im/eslint/eslint
Note that leaving sections blank will make it difficult for us to troubleshoot and we may have to close the issue.
-->
**The version of ESLint you are using.**
Latest
**The problem you want to solve.**
I want to use ESLint and Webpack without babel-ESLint, but due to the lack of support for dynamic import, which Webpack uses to determine where to split code, I must use babel-eslint where I would otherwise be happy without transpiling.
**Your take on the correct solution to problem.**
According to
https://github.com/eslint/eslint#what-about-experimental-features, it states:
> ESLint's parser only officially supports the latest final ECMAScript standard. We will make changes to core rules in order to avoid crashes on stage 3 ECMAScript syntax proposals (as long as they are implemented using the correct experimental ESTree syntax)
I believe this is a case that warrants an exception to this rule given the prominence of `import` in otherwise bland es5 code due to Webpack. `import` is stage 3, fully 262 tested, battle tested in all browsers, mandated by the html standard and firmly ensconced in the bundling ecosystem.
The proposed fix is to support dynamic support in ESLint now ahead of stage 4, especially considering it has an unknown timeline to advance to stage 4.
**Are you willing to submit a pull request to implement this change?**
Yes :-)
Did anyone else manage to configure eslint
correctly (or, even better, prettier-eslint
inside VS Code)?
Adding
parser: 'babel-eslint'
on top level of .eslintrc
did the trick.
I had it under parserOptions
, which did not work.
To do this I use babel-eslint
parser, eslint-plugin-import
and eslint-import-resolver-meteor
1 Like