eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

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

Open jez9999 opened this issue 1 year ago • 6 comments

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

jez9999 avatar Oct 18 '22 10:10 jez9999