Skip to content

Some rules enforced in .ts but not .vue? #18

@sbmw

Description

@sbmw

My eslintrc.json:

{
    "env": {
        "browser": true,
        "es2021": true
    },
    "extends": ["plugin:vue/vue3-recommended", "eslint:recommended", "@vue/typescript/recommended", "@vue/prettier", "@vue/prettier/@typescript-eslint"],
    "parser": "vue-eslint-parser",
    "parserOptions": {
        "ecmaVersion": 2021,
        "parser": "@typescript-eslint/parser"
    },
    "plugins": ["vue", "@typescript-eslint", "prettier"],
    "root": true,
    "rules": {
        "prettier/prettier": "error"
    }
}

I add the following to both a .ts and .vue file (with script lang set to ts):

let foo = "";
var boo = "";

In both files @typescript-eslint/no-unused-vars raises a warning as expected.

However, prefer-const and no-var are only detected (as errors) in the .ts file. These two rules are activated in the extended config https://github.com/typescript-eslint/typescript-eslint/blob/498f397ff3898dde631f37311615b555f38a414e/packages/eslint-plugin/src/configs/eslint-recommended.ts#L27

Why do these rules not kick in within .vue? Sorry if I'm missing something!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy