Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Make typescript-eslint rules compatible with .vue files #524

Closed
Labels
breaking changeThis change will require a new major version to be releasedenhancementNew feature or requesthas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Milestone
@paetling

Description

@paetling

My team and I are writing a Vue app using typescript. We have started making extensive use ofvue single file components. The single file components end with a.vue file extension. Inside the components there are three possible sections:

  • <template></template>
  • <script lang="ts"></script>
  • `<style></style>

The problem we are seeing is that some of the eslint plugin rules (explicit-function-return-types andexplicit-member-accessibility) use a function in utils calledisTypescriptFile. This check ensures that the rules are run only on.ts or.tsx files. This means that we are not getting some of our linting rules run in our.vue files.

I can think of a couple good ways to fix this and would like some feedback on which is preferred :)

  1. change theisTypescriptFile check to not only check the .tsx? extension but also check for.vue files which include a<script lang="ts"> tag.
  2. Make the linter configurable on what files it should include as typescript files (run time variables, env variables, config file, etc). These variables would then replace the static file extension checker logic inisTypescriptFile.

Repro

  • Create a repo with a.eslintrc.js file. Which includes@typescript-eslint in its plugins and '@typescript-eslint/explicit-function-return-type': 'error'` in its rules
  • create a.vue file with<script lang="ts"></script>
  • In that script tag create a function with no return type
  • Linter will not catch the error
{"rules": {"typescript/<rule>": ["<setting>"]  }}
// your repro code case

Expected Result
Linting of.vue files for all typescript-eslint rules.

Actual Result
explicit-function-return-types andexplicit-member-accessibility are not linting in.vue files.

Versions

packageversion
@typescript-eslint/eslint-plugin1.9.0
@typescript-eslint/parser1.9.0
TypeScript3.3.4
ESLint5.15.3
node11.9.0
npm6.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeThis change will require a new major version to be releasedenhancementNew feature or requesthas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp