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

Missing typings for .vue files when running with typescript-eslint #231

Closed
4 tasks done
danieldasilva-smake opened this issue May 2, 2024 · 2 comments
Closed
4 tasks done

Comments

@danieldasilva-smake
Copy link

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I'm using eslint-plugin-vue.
  • I'm sure the problem is a parser problem. (If you are not sure, search for the issue in eslint-plugin-vue repo and open the issue in eslint-plugin-vue repo if there is no solution.
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.57.0

What version of eslint-plugin-vue and vue-eslint-parser are you using?

What did you do?

I created a new Vue.js project with TS + ESLint and updated the .eslintrc.cjs to add the @typescript-eslint/no-unsafe-argument rule.

I also set the parserOptions.project and parserOptions.parser options so that typescript-eslint works.

Configuration
/* eslint-env node */
require("@rushstack/eslint-patch/modern-module-resolution");

module.exports = {
  root: true,
  extends: [
    "plugin:vue/vue3-essential",
    "eslint:recommended",
    "@vue/eslint-config-typescript",
  ],
  parserOptions: {
    ecmaVersion: "latest",
    project: "./tsconfig*.json",
    parser: {
      js: "@typescript-eslint/parser",
      jsx: "@typescript-eslint/parser",
      cjs: "@typescript-eslint/parser",
      mjs: "@typescript-eslint/parser",
      ts: "@typescript-eslint/parser",
      tsx: "@typescript-eslint/parser",
      cts: "@typescript-eslint/parser",
      mts: "@typescript-eslint/parser",
      "<template>": "espree",
    },
  },
  rules: {
    "@typescript-eslint/no-unsafe-argument": "error",
  },
};

What did you expect to happen?

No errors to be shown when running npm run lint

What actually happened?

I got an @typescript-eslint/no-unsafe-argument error in the src/main.ts because the App.vue file couldn't be typed when passing it to createApp.

Link to Minimal Reproducible Example

https://github.com/danieldasilva-smake/missing-vue-file-typings-eslint

Additional comments

No response

@rijenkii
Copy link

Duplicate of #104 ("[no-unsafe-*] rules" section)?

@danieldasilva-smake
Copy link
Author

Duplicate of #104 ("[no-unsafe-*] rules" section)?

Yes, thank you :)

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

2 participants