Vue-cli: Linting results are different between ‘vue-cli-service serve’ and ‘vue-cli-service lint’

Created on 12 Aug 2019  Â·  23Comments  Â·  Source: vuejs/vue-cli

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

bug help wanted

Most helpful comment

I am having the same issue

All 23 comments

I am having the same issue

+1

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

up

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.

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.

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.

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.

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.

+1

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

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

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

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.

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

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).

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?

tsc cannot check .vue files. There's an issue tracking this: https://github.com/vuejs/vue-cli/issues/1891

In case anyone's interested in contributing, the root cause is explained here: https://github.com/vuejs/vue-cli/issues/3065#issuecomment-454373989

May 8th, still here =)

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

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)

Anything figured out ? same issue on 11 July.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghenry picture ghenry  Â·  40Comments

GeertClaes picture GeertClaes  Â·  31Comments

williamstar picture williamstar  Â·  79Comments

yyx990803 picture yyx990803  Â·  34Comments

mayefeng picture mayefeng  Â·  44Comments