Skip to content

Allow linting of <script> section only if lang="ts" #2012

Open
@jez9999

Description

@jez9999

I'd like to be able to lint my .vue file script sections only if lang="ts". At the moment ESLint is linting script sections that are just plain JS (ie. <script setup>) as well as TS ones (<script setup lang="ts">) when I run eslint . --ext .vue --ignore-path .gitignore. A good solution would perhaps be to be able to say in .eslintrc.cjs which script section languages should be linted. Another solution would be to allow to set which rules get linted based on language; obviously certain TS rules I apply do not apply to plain JS because plain JS cannot set types.

Tell us about your environment

  • ESLint version: ^8.22.0
  • eslint-plugin-vue version: ^9.3.0
  • Node version: 16.17.0

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