Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[@vue/cli-plugin-typescript#lint]: Uses a hard-coded list instead of project file list #2912

Copy link
Copy link
Closed
@DorianGrey

Description

@DorianGrey
Issue body actions

Version

3.1.1

Reproduction link

https://github.com/DorianGrey/vue-ts-playground/tree/cypress-ts

Node and OS info

Node 10.13 / yarn 1.12.1 / Manjaro 18

Steps to reproduce

  • Checkout the repository branch mentioned above
  • yarn
  • yarn lint

(Sorry it's not that minimal, but the required parts should be easy to find).

What is expected?

The linter should only pick up the files referenced by the typescript project, extended by .vue files in src.

As a result, yarn lint should not end up with any errors, like using tslint for the same purpose does.

What is actually happening?

Running yarn lint will yield an error like this:

 vue-cli-service lint --fix && stylelint "src/**/*.{scss,vue}"
 ERROR  FatalError: 
Invalid source file: [...]/tests/e2e/specs/test.ts. Ensure that the files supplied to lint have a .ts, .tsx, .d.ts, .js or .jsx extension.

On the branch linked above, I've followed the cypress doc for adding typescript support for the E2E spec files: https://docs.cypress.io/guides/tooling/typescript-support.html
(The default setup failed with a similar error as mentioned here: #2903)
For details about the changes made, see: https://github.com/DorianGrey/vue-ts-playground/pull/12/files

To get this working, it is required to create a separate typescript project that only covers the tests/e2e folder, due to different target and types requirements. Thus, it is also required to exclude this folder in the root project. However, the linter as configured by @vue/cli-plugin-typescript uses a hard-coded list of file patterns if none provided, and those also cover the tests/unit and tests/e2e folders:

const files = args._ && args._.length
? args._
: ['src/**/*.ts', 'src/**/*.vue', 'src/**/*.tsx', 'tests/**/*.ts', 'tests/**/*.tsx']

I'm wondering why you're not using program.getSourceFiles() (which correctly takes care of any include or exclude option) and just extend that list with the files yielded by the src/**/*.vue pattern. On a more general level, this hard-coded list causes any include, exclude or files restriction in the tsconfig.json to be ignored.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.