-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Possible incompatibility with enableEslintLoader()
and eslint-vue-plugin
#473
Comments
That's really strange. Options This is what I have when running ESLint manually, and everything works fine: |
The problem is imho not in the configuration but rather in the loader rule setup: the eslint loader that encore configures never adds .vue files to its rules. Added it in my PR when eslint & vue loader are both active. With that patch you can .eslintrc.json
webpack.config.js
and I think these are all the dependencies: plays well together with vscode's js language server when this is set:
good luck! |
If someone has the same issue, since #509 you will be able to write this: Encore.configureLoaderRule('eslint', loader => {
loader.test = /\.(jsx?|vue)$/
}); |
…erryan) This PR was merged into the master branch. Discussion ---------- feat: Add method to configure loaders rules This PR is a proposal to resolve #473 and #504 in a clean way. `Encore.configureLoaderRule()` is a low-level function, and has for goal to let the user having full access to Webpack loaders rules (what we push into `module.rules`) and configure them. This is the implementation of the idea I had in #504 (comment). For resolving Vue files linting issue, the next example would be the ideal solution I think: ```js Encore .configureLoaderRule('eslint', loader => { loader.test = /\.(jsx?|vue)$/ }); // actually, the equivalent code is something like this: const webpackConfig = Encore.getWebpackConfig(); const eslintLoader = webpackConfig.module.rules.find(rule => rule.loader === 'eslint-loader'); eslintLoader.test = /\.(jsx?|vue)$/; return webpackConfig; ``` For now, only ESLint loader is supported, but we can easily add other loaders. Let me know what you think of this solution, thanks! Commits ------- 94da0c2 language tweak 9dd6ca4 chore(tests): correct some tests due to last feature for CSSModules 4dbe443 chore(cr): add real aliases support 729a696 feat: add warning 5cf3d02 feat: add missing loaders, add more tests 86dc788 refactor(test): `configureLoaderRule()` will be easier to test 39cb9bd chore(cr): move tests into bc0e9bf chore(cr): add shortcut function applyRuleConfigurationCallback bc1d025 chore(cr): more user-friendly error for valid configurable loaders 01880cf Add method on "Encore" 49a4258 add tests 9892516 feat: implement "configureLoaderRule" method
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
Hi, I am the frontend dev that was blaming
webpack-encore
one year ago 👀First, let me congratulate you @weaverryan and the community,
webpack-encore
seems has become very mature over time. It's nice to have webpack 4, Babel 7 and ESLint working out of the box.Even if I still prefer using
vue-cli
for a SPA (with Symfony as API) or a raw simple webpack config for smaller project,webpack-encore
is really a must have for more oriented Symfony projects.So I'm facing an issue with using the ESLint loader with
eslint-plugin-vue
for linting.vue
files.This is how I configure the
eslint-loader
:This is my
.eslintrc
:And this is my ESLint dependencies:
And this is what happens when running
webpack-encore
:This is a
webpack-encore
issue because everything is fine when running ESLint manually:I followed the link What is the "Use the latest vue-eslint-parser" error?, and it's a problem of ESLint parser configuration.
We should do this to fix the problem:
But the
parser
options is hardcoded inloaders/eslint.js
:So I updated my code and tried this:
Screenshot
or even this:
Screenshot
I have no more
eslint-loader
errors, buteslint-loader
seems to not be working anymore 🤷♂️Does someone already faced this issue?
I will do more investigation and see if I can help more.
Thanks!
The text was updated successfully, but these errors were encountered: