Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensions not being applied to Typescript #768

Open
joao-offerfit opened this issue Oct 16, 2024 · 0 comments
Open

extensions not being applied to Typescript #768

joao-offerfit opened this issue Oct 16, 2024 · 0 comments

Comments

@joao-offerfit
Copy link

joao-offerfit commented Oct 16, 2024

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"
        ]
      }
    ]
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant