Skip to content

extensions not being applied to Typescript #768

Open
@joao-offerfit

Description

I am integrating XO to a Vue Project and I'm having a hard time trying to apply ts rules under .vue files.

Inside XO, If I update this constant:

const TYPESCRIPT_EXTENSION = [
	'ts',
	'tsx',
	'mts',
	'cts',
];

to that:

const TYPESCRIPT_EXTENSION = [
	'ts',
	'tsx',
	'mts',
	'cts',
	'vue',
];

Then the rules start to get applied to .vue files, which use Typescript. It seems like extensions aren't taken into account when it comes to applying ts rules (doesn't fall under the condition of isTypescript which only takes into account TYPESCRIPT_EXTENSION), my expectation was to be able to include .vue files as ts files somehow.

Any ideas on how to solve this issue? This is my current configuration:

"xo": {
    "prettier": true,
    "parser": "vue-eslint-parser",
    "parserOptions": {
      "parser": "@typescript-eslint/parser",
      "sourceType": "module"
    },
    "plugins": [
      "sonarjs",
      "vue"
    ],
    "extends": [
      "plugin:sonarjs/recommended-legacy"
    ],
    "extensions": [
      "vue"
    ],
    "envs": [
      "browser"
    ],
    "semicolon": false,
    "rules": {
      "unicorn/filename-case": [
        "error",
        {
          "case": "camelCase",
          "ignore": [
            "\\.vue$"
          ]
        }
      ],
      "unicorn/prevent-abbreviations": [
        "error",
        {
          "replacements": {
            "props": false
          }
        }
      ]
    "overrides": [
      {
        "files": "level3/**/*.vue",
        "extends": [
          "plugin:vue/vue3-recommended",
          "@vue/eslint-config-typescript/recommended"
        ]
      }
    ]
  }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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