Giter Club home page Giter Club logo

Comments (5)

Livijn avatar Livijn commented on May 2, 2024 5

I am also receiving the same error. Here is a reproducible example.

<script lang="ts">
import { defineComponent, PropType } from 'vue';

export default defineComponent({
  name: 'HelloWorld',
  props: {
    msg: String as PropType<String>
  }
})
</script>

Throws error:
ESLint: 'PropType' is defined but never used.(no-unused-vars)

from eslint-config-typescript.

backbone87 avatar backbone87 commented on May 2, 2024 5

I have a similar problem with eslint core rule no-undef and global types.

The reason is that some eslint core rules should be disabled.

@vue/eslint-config-typescript only extends plugin:@typescript-eslint/eslint-recommended, but not plugin:@typescript-eslint/recommended, so no-unused-vars is not disabled. So extending plugin:@typescript-eslint/recommended should fix this issue.

In my case no-undef gets triggered inside vue files anyway. The reason for this is that plugin:@typescript-eslint/eslint-recommended only disables core rules for .ts/x files, but not .vue files. Except for copying over the rule disables, i have no solution here, yet.

edit:
The following override can be added to the .eslintrc.js to enable plugin:@typescript-eslint/eslint-recommended for vue files (should be early in the overrides):

  overrides: [
    {
      files: ['*.vue'],
      rules: require('@typescript-eslint/eslint-plugin').configs['eslint-recommended'].overrides[0].rules,
    },
  ],

from eslint-config-typescript.

pr3tori4n avatar pr3tori4n commented on May 2, 2024 3

I'm seeing similar issues in our codebase. Can verify there's issues with no-unused-vars. Can also verify that WIStundent's workaround in the first comment fixes those.

Also was seeing issues with globals. I was able to resolve those by adding them to the globals in the config

globals: {
  foo: 'readonly',
}

from eslint-config-typescript.

ux-engineer avatar ux-engineer commented on May 2, 2024

Same here and not just for imported types...

from eslint-config-typescript.

agentschmitt avatar agentschmitt commented on May 2, 2024

i have also problem with the rule no-undef when using the ruleset @vue/typescript/recommended

error: 'NotificationPermission' is not defined (no-undef) at src\views\Navigation.vue:72:28
public notification(): NotificationPermission {

from eslint-config-typescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.