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 '--quiet' Option has no effect #4560

Closed
sense-it-gmbh opened this issue Sep 10, 2019 · 10 comments
Closed

ESLint '--quiet' Option has no effect #4560

sense-it-gmbh opened this issue Sep 10, 2019 · 10 comments

Comments

@sense-it-gmbh
Copy link

Version

3.11.0

Environment info

  System:
    OS: Windows 10
    CPU: (4) x64 AMD Ryzen 3 2200G with Radeon Vega Graphics
  Binaries:
    Node: 8.12.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.18362.267.0
  npmPackages:
    @kazupon/vue-i18n-loader: ^0.3.0 => 0.3.0
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.0.0
    @vue/babel-preset-app:  3.8.0
    @vue/babel-preset-jsx:  1.0.0
    @vue/babel-sugar-functional-vue:  1.0.0
    @vue/babel-sugar-inject-h:  1.0.0
    @vue/babel-sugar-v-model:  1.0.0
    @vue/babel-sugar-v-on:  1.0.0
    @vue/cli-overlay:  3.8.0
    @vue/cli-plugin-babel: ^3.8.0 => 3.8.0
    @vue/cli-plugin-e2e-cypress: ^3.8.0 => 3.8.0
    @vue/cli-plugin-eslint: ^3.8.0 => 3.8.0
    @vue/cli-plugin-unit-mocha: ^3.8.0 => 3.8.0
    @vue/cli-service: ^3.8.4 => 3.8.4
    @vue/cli-shared-utils:  3.8.0
    @vue/component-compiler-utils:  2.6.0
    @vue/eslint-config-standard: ^4.0.0 => 4.0.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.2 (4.7.1)
    vue: ^2.6.6 => 2.6.10
    vue-cli-plugin-i18n: ^0.6.0 => 0.6.0
    vue-cli-plugin-vuetify: ^0.5.0 => 0.5.0
    vue-eslint-parser:  2.0.3 (5.0.0)
    vue-hot-reload-api:  2.3.3
    vue-i18n: ^8.0.0 => 8.11.2
    vue-i18n-extract:  0.4.14
    vue-i18n-ts:  0.1.0
    vue-loader:  15.7.0
    vue-router: ^3.0.6 => 3.0.6
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuetify: ^1.5.16 => 1.5.16
    vuetify-loader: ^1.2.2 => 1.2.2
    vuex: ^3.1.1 => 3.1.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

  1. Take a VUE-CLI Project with @vue/cli-plugin-eslint
  2. Provoke some linter-errors AND -warnings
  3. Call npm run lint --quiet

What is expected?

A list of all errors but no linter-warnings

What is actually happening?

A list of all linter-warnings and errors


Also, setting:

module.exports = {
	devServer: {
		overlay: {
			warnings: false,
			errors: true
		}
	}
}

in vue.config.js does not cause all errors to be displayed. It seems like 'fixable' errors are skipped.

@LinusBorg
Copy link
Member

vue-cli-service lint does not support CLI-only options, since it uses the CLIEngine programmatically.

You can however run eslint directly if you want to use these options - lint is just a thin wrapper around it.

Concerning the overlay, we would need a new issue with a reproduction. It sounds like it would be relared to eslint-loader, though - not Vue CLI.

@casperwilkes
Copy link

I believe i was running into the same issue as @sense-it-gmbh .

Every time an error would occur within eslint, it would also throw dozens of warnings. I'm getting the handle of Vue, so of course I'm going to have a few errors. Every time an error happens, I'd have to scroll through dozens of warnings just to get to the cause of the error... that caused the warnings.

I'm using hotloading, and was linting on save.

So, to only show errors on save -

in vue.config.js, add inside module.exports

chainWebpack: config => {
    config.module
          .rule('eslint')
          .use('eslint-loader')
          .options({quiet: true});
}

For accomplishing the same goal on manual saves -

In package.json, inside of "scripts" modify the `lint" options to:

"lint": "vue-cli-service lint --quiet"

@sense-it-gmbh
Copy link
Author

@LinusBorg id like to quote you and the @vue/cli-plugin-eslint here. You said:

vue-cli-service lint does not support CLI-only options [...]

But the docs say:

Other ESLint CLI options are also supported.

Which is true?

@LinusBorg
Copy link
Member

LinusBorg commented Nov 29, 2019

What I say is true, the README needs correction but we somehow haven't gotten around to doing it,.

See #4007, #4849

@sense-it-gmbh
Copy link
Author

What I say is true, the README needs correction but we somehow haven't gotten around to doing it,.

See #4007, #4849

Np np, i never said that you are wrong, just, that there is some misleading information out there.

Ty for your reply.

@ysyzqq
Copy link

ysyzqq commented Dec 29, 2019

@casperwilkes
"lint": "vue-cli-service lint --quiet"
doesn't work, how to fix this problem

@casperwilkes
Copy link

@ysyzqq Did you try both methods in my original answer?
And you made sure to stop the service, and restart it?

@Trobbdor
Copy link

Trobbdor commented Feb 25, 2020

@casperwilkes I'm showing up to a dead thread, but I've tried your suggestions yet I see nothing change (adding the chained webpack config or appending --quiet to the end of the lint script).

For the record, vue-cli-service lint --fix also has no affect. I haven't tested other arguments, but right now my impression is none will work in my project.

@sense-it-gmbh
Copy link
Author

@TrobbinsForNow
Try these in youe package.json:

{
  "scripts": {
    "lint": "vue-cli-service lint --no-fix",
    "lint:quiet": "eslint --quiet \"{tests,src}/**/*.{js,vue}\"",
    "lint:fix": "vue-cli-service lint"
  }
}
  • lint prevents auto-fixing with the --no-fix option of the CLI plugin
  • lint:quiret only shows errors only, no warnings
  • lint:fix the unmodified call to the cli-plugin

@nicooprat
Copy link

In vue-cli 5, the ESlint plugin has changed ; from the migration docs:

eslint-loader is replaced by eslint-webpack-plugin

So I had to change the previous chainWebpack rule like this:

config
  .plugin('eslint')
  .tap(([options]) => [{...options, quiet: true}]);

Hope it helps!

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

6 participants