Skip to content

@vue/cli-plugin-eslint - Other ESLint CLI options are *not* also supported. #4007

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

Open
DaedalusDev opened this issue May 16, 2019 · 11 comments

Comments

@DaedalusDev
Copy link

Version

3.7.0

Environment info

Environment Info:

  System:
    OS: Linux 4.4 Ubuntu 16.04.6 LTS (Xenial Xerus)
    CPU: (8) x64 Intel(R) Xeon(R) CPU E5-1620 v3 @ 3.50GHz
  Binaries:
    Node: 8.12.0 - ~/node-current/bin/node
    Yarn: 1.3.2 - ~/node-current/bin/yarn
    npm: 6.9.0 - ~/node-current/bin/npm
  Browsers:
    Chrome: 73.0.3683.75
    Firefox: 60.2.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.7.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.7.0 
    @vue/cli-plugin-babel: ^3.7.0 => 3.7.0 
    @vue/cli-plugin-e2e-cypress: ^3.7.0 => 3.7.0 
    @vue/cli-plugin-eslint: ^3.7.0 => 3.7.0 
    @vue/cli-plugin-pwa: ^3.7.0 => 3.7.0 
    @vue/cli-plugin-unit-jest: ^3.7.0 => 3.7.0 
    @vue/cli-service: ^3.7.0 => 3.7.0 
    @vue/cli-shared-utils:  3.7.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/devtools: ^1.1.0 => 1.1.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:  4.7.1 
    jest-serializer-vue:  2.0.2 
    vue: ^2.6.10 => 2.6.10 
    vue-cli-plugin-quasar: ^1.0.0-beta.1 => 1.0.0-beta.1 
    vue-d3-network: ^0.1.109 => 0.1.109 
    vue-eslint-parser:  2.0.3 
    vue-hot-reload-api:  2.3.3 
    vue-jest:  3.0.4 
    vue-loader:  15.7.0 
    vue-masonry-css: ^1.0.2 => 1.0.3 
    vue-router: ^3.0.2 => 3.0.2 
    vue-server-renderer:  2.6.10 
    vue-split-panel: ^1.0.4 => 1.0.4 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.10 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vuedraggable: ^2.20.0 => 2.20.0 
    vuelidate: ^0.7.4 => 0.7.4 
    vuex: ^3.1.0 => 3.1.0 
  npmGlobalPackages:
    @vue/cli: 3.5.5

Steps to reproduce

run vue-cli-service lint with extra options (ex: node ./node_modules/.bin/vue-cli-service lint -o report.json -f json)

What is expected?

Extra params would be proxied to eslint cli

What is actually happening?

No extra options are supported.

@LinusBorg
Copy link
Member

LinusBorg commented May 16, 2019

This is mostly a documentation issue.

Since we don't run the eslint cli, but instead use its Node API, we indeed only support options that are not related to the eslint CLI output.

So you can pass options like --ignore-pattern, but not -o or -f

@cjackson
Copy link

We can specify --format on the vue-cli-service lint command. Is there a way to output the result to a file, similar to the -o option on the eslint CLI?

@LinusBorg
Copy link
Member

LinusBorg commented May 23, 2019

No, I'm not aware of a way to do that.

@DaedalusDev
Copy link
Author

@cjackson You can simply use stdout syntax like node ./node_modules/.bin/vue-cli-service lint --format json > report.json but unfortunally, if all is clean, the command will output something line DONE No lint errors found!...

Maybe a feature request ?

@cjackson
Copy link

@DaedalusDev That's what I ended up doing using a bash script to clean up the output a bit. I'll make a feature request for this later today or tomorrow.

@chrisbraddock
Copy link

chrisbraddock commented Jul 5, 2019

This would be nice for collecting linting metadata in CI.

@hskrishna29
Copy link

@DaedalusDev That's what I ended up doing using a bash script to clean up the output a bit. I'll make a feature request for this later today or tomorrow.

I ran into this issue when I wanted to output the lint results to a file. Found out its not supported. Any advancements with respect to this?

@zwik
Copy link

zwik commented Aug 1, 2019

I'm also interested in this, I would love to push the ESLint report into SonarQube because the linting in SonarQube is not so configurable as ESLint is.

As far as I understand now, it appears there's no work around yet? At least with the suggestions above I'm not able to get a usable file.

I just browsed the code for the eslint plugin a bit. What is the general idea? Should all parameters be implemented one to one or is there just a selection of parameters that need to be implemented since there are currently only a couple?

@LinusBorg
Copy link
Member

LinusBorg commented Aug 1, 2019

As far as I understand now, it appears there's no work around yet

I would say that running eslint directly is a totally fine workaroud. Even though lint.js seems to do a lot of stuff, most of that is about either

  • loading the config (which eslint cli does for you)
  • configuring the CLIEngine (which you also don't have to when running eslint via cli directly)
  • setting some default folder and file globs to define what to lint

The latter can be done quickly by adding your own globs when running eslint via cli.

So in summary: The lint command itself doesn't do much more than run eslint

Given that, and given that there are eslint options that only work with eslint CLI, not with eslint CLIEngine, I don't think that it's worth re-creating these options in our codebase, as it doesn't take much to run eslint "manually" and use the options directly.

I think it would make more sense to document how to run eslint manually (with which globs etc) to make it work exactly like lint - then people can use that when they need to use eslint options that only work in the cli version.

@probil
Copy link

probil commented Aug 4, 2019

Thanks @LinusBorg I fixed it this way

// package.json
"lint": "npx eslint src test *.js"

Then during CI:

npm run lint -- --format junit -o /tmp/test-results/code-style-test-results.xml

@cawoodm
Copy link

cawoodm commented Nov 16, 2020

I would say that running eslint directly is a totally fine workaroud.

I thought the whole point of this plugin is that it makes ESLint work for .vue files? How is ESLint going to lint .vue files on it's own?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants