Skip to content

@vue/cli-plugin-eslint 在使用typescript和eslint的时候,默认配置没有包含对ts文件的检查 #3947

Closed
@lovetingyuan

Description

@lovetingyuan

Version

3.6.0

Reproduction link

https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-eslint/generator/index.js#L79
个人认为应该在applyTS方法中加上lint-staged对ts默认的支持

Environment info

Environment Info:

  System:
    OS: Windows 10
    CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
  Binaries:
    Node: 8.11.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    @vue/cli-overlay:  3.6.0
    @vue/cli-plugin-eslint: ^3.6.0 => 3.6.0
    @vue/cli-plugin-typescript: ^3.6.0 => 3.6.0
    @vue/cli-service: ^3.6.0 => 3.6.0
    @vue/cli-shared-utils:  3.6.0
    @vue/component-compiler-utils:  2.6.0
    @vue/eslint-config-standard: ^4.0.0 => 4.0.0
    @vue/eslint-config-typescript: ^4.0.0 => 4.0.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.2
    typescript: ^3.4.3 => 3.4.5
    vue: ^2.6.10 => 2.6.10
    vue-class-component: ^7.0.2 => 7.0.2
    vue-eslint-parser:  2.0.3
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.0
    vue-property-decorator: ^8.1.0 => 8.1.0
    vue-router: ^3.0.3 => 3.0.6
    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.0
    vuex-class: ^0.3.2 => 0.3.2
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

创建项目的时候选择typescript,lint选项使用eslint standard

What is expected?

在生成的项目package.json中应该包含ts文件,例如:

  "lint-staged": {
    "*.{js,vue,ts}": [
      "vue-cli-service lint",
      "git add"
    ]
  }

What is actually happening?

实际上这个lint-staged配置是默认去检查写死的js和vue后缀

  "lint-staged": {
    "*.{js,vue}": [
      "vue-cli-service lint",
      "git add"
    ]
  }

这样会在commit的时候丢失对ts文件的检查,只有独立使用npm run lint才会去检查

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions