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

Linting results are different between ‘vue-cli-service serve’ and ‘vue-cli-service lint’ #4425

Closed
junyo opened this issue Aug 12, 2019 · 25 comments

Comments

@junyo
Copy link

junyo commented Aug 12, 2019

Version

3.9.3

Reproduction link

https://github.com/junyo/test-tslint

Environment info

Environment Info:

  System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
  Binaries:
    Node: 11.9.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.17.3 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.1.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.10.0
    @vue/babel-preset-jsx:  1.1.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.1.0
    @vue/cli-overlay:  3.10.0
    @vue/cli-plugin-babel: ^3.10.0 => 3.10.0
    @vue/cli-plugin-e2e-cypress: ^3.10.0 => 3.10.0
    @vue/cli-plugin-typescript: ^3.10.0 => 3.10.0
    @vue/cli-plugin-unit-jest: ^3.10.0 => 3.10.0
    @vue/cli-service: ^3.10.0 => 3.10.0
    @vue/cli-shared-utils:  3.10.0
    @vue/component-compiler-utils:  2.6.0 (3.0.0)
    @vue/preload-webpack-plugin:  1.1.1
    @vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29
    @vue/web-component-wrapper:  1.2.0
    jest-serializer-vue:  2.0.2
    typescript: ^3.4.3 => 3.5.3
    vue: ^2.6.10 => 2.6.10
    vue-class-component: ^7.0.2 => 7.1.0
    vue-hot-reload-api:  2.3.3
    vue-jest:  3.0.4
    vue-loader:  15.7.1
    vue-property-decorator: ^8.1.0 => 8.2.1
    vue-router: ^3.0.3 => 3.1.2
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.0.1 => 3.1.1
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

Warnings output

npm run serve

No Warnings and Errors output

npm run lint

What is expected?

results output from 'vue-cli-service serve' command should be same as 'vue-cli-service lint' command

What is actually happening?

no errors and warnings from 'vue-cli-service lint' command

@canassa
Copy link

canassa commented Aug 18, 2019

I am having the same issue

@BabOuDev
Copy link

+1

@BabOuDev
Copy link

BabOuDev commented Sep 5, 2019

I believe it's a cache issue as if I remove node_module/.cache folder, I get similar results on the first run.

@ahmadarif
Copy link

up

@cdekok
Copy link

cdekok commented Oct 7, 2019

This issues still exists on 4.0.0-rc7 removing the cache folder as mentioned above has no effect, typescript errors (or rather warnings defined as errors) are only showed on serve not lint.

@nilobarp
Copy link

npm run serve does not honor .eslintrc rules while npm run lint does.

I have the following rules defined

{
  "rules": {
    "quotes": ["error", "double", { "avoidEscape": true }],
    "comma-dangle": ["error", "never"]
  }
}

with npm run serve I get a lot of warnings related to double quote and missing commas but npm run lint doesn't report anything.

@BogdanPomirleanuOSF
Copy link

Same issue reproducing for me

npm run serve does not honor .eslintrc rules while npm run lint does.

I have the following rules defined

{
  "rules": {
    "quotes": ["error", "double", { "avoidEscape": true }],
    "comma-dangle": ["error", "never"]
  }
}

with npm run serve I get a lot of warnings related to double quote and missing commas but npm run lint doesn't report anything.

@zacharykeeping
Copy link

zacharykeeping commented Nov 11, 2019

I'm having the same issue. I have to disable "lintOnSave" in the vue config to get it to stop spamming my terminal with warnings.

@shelbykauth
Copy link

Same. I initialized a new repository with version "@vue/cli-service": "^4.0.0", on Sunday (Nov 10)
I'm using vsCode with Prettier extension installed. The default code in Hello World where the Router Links are separated by |... Prettier continually converts it to no space, and I get the yellow warning spam whenever I save, telling me I need to put in a space. But then I run the lint command and it says there are no errors.

I'd ignore it except sometimes I make legit errors and need to see them in the console.

@jc-lab
Copy link

jc-lab commented Nov 28, 2019

+1

@farazshuja
Copy link

In my case setting lintOnSave: true in vue.config.js file fixes the issue.

module.exports = {
    lintOnSave: true,
    ...
}

@ricardovanlaarhoven
Copy link

I'm getting a build error on the linter: unexpected console statement (no-console) but this error is not shown on npm run lint or when i serve the application

I would like to get all errors which i might get in npm run build in the npm run lint otherwise it goes wrong on deployment instead of when we are in development

@thedavefulton
Copy link

thedavefulton commented Dec 27, 2019

I'm seeing the same issue. Of particular note is getting an unused expression message for every call to expect() in my tests. I have chai-friendly installed and configured and it works great when I explicitly run the lint command, but when running tests or building or anything else I get the error message.

I'd be happy to take a run at the issue but I'm honestly not sure where to look. I tried following the CLI code to the config it's using when it runs and got quite lost.

@ux-engineer
Copy link

ux-engineer commented Jan 7, 2020

Has there been any progress on this? I'm on 4.1.2 and this problem still exists.

@ux-engineer
Copy link

ux-engineer commented Jan 7, 2020

To accentuate the importance of this issue, I'm unable to run build, always resulting in Build failed with errors.

Whether lintOnSave is set to true or false has no effect.

EDIT: We have two projects with identical / near-identical Vue setup and dependencies. Somehow this problem is not appearing on the other project (but it has slimmer codebase).

@ux-engineer
Copy link

Found out these are not ESLint errors, but type checking errors.

The weird part is that I've developed using a NPM script for the command tsc --noEmit, and it is giving me clean check.

However type checking errors given by vue-cli-service build are different and there are a whole bunch of them. Where does these come from?

@haoqunjiang
Copy link
Member

tsc cannot check .vue files. There's an issue tracking this: #1891

@haoqunjiang
Copy link
Member

In case anyone's interested in contributing, the root cause is explained here: #3065 (comment)

@mbaev
Copy link

mbaev commented May 8, 2020

May 8th, still here =)

@ghost
Copy link

ghost commented Jun 10, 2020

Same problem in mid 2020, with @vue/cli 4.4.1

@SRNV
Copy link

SRNV commented Jun 30, 2020

same issue for me
no error on serve
have to use lint to see the errors inside the lint and the serve (in different terminal)

@novaknole
Copy link

Anything figured out ? same issue on 11 July.

@jasonkarns
Copy link

Side but strongly related issue: lintOnSave is a terribly misleading name for a setting that controls wether linting is run during build. It has nothing to do with the "saving" of anything.

@LuccaPrado
Copy link

It should be lintOnServe, right @jasonkarns?!

guillett added a commit to betagouv/aides-jeunes that referenced this issue Mar 18, 2021
* Cf [Linting results are different between ‘vue-cli-service serve’ and ‘vue-cli-service lint’](vuejs/vue-cli#4425)
@techbirds
Copy link

techbirds commented Sep 9, 2021

+1

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