Comments (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.
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.
no-undef
is disabled byplugin:@typescript-eslint/eslint-recommended
no-unused-vars
is disabled byplugin:@typescript-eslint/recommended
(also extends the above config)
@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.
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.
Same here and not just for imported types...
from eslint-config-typescript.
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)
- Error while loading rule '@typescript-eslint/naming-convention' HOT 3
- Error while loading rule '@typescript-eslint/indent' in TSX HOT 1
- no-undef ESLint rule active in Vue files using ts syntax in both base and recommended config
- typescript-eslint/no-floating-promises - You have used a rule which requires parserServices to be generated HOT 3
- Error: Cannot find module 'eslint/use-at-your-own-risk'
- [Bug] ESLint throws `Parsing error: ',' expected` when using TypeScript `satisfies` HOT 1
- Default `parserOptions.ecmaFeatures.jsx: true` breaks type assertion parsing in setup scripts
- [TypeScript 5.0] WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.
- typescript-eslint@v6 HOT 2
- Wrongly installed @typescript-eslint/eslint-plugin HOT 5
- Error: Plugin "@typescript-eslint" was conflicted between ".eslintrc.js » plugin:@typescript-eslint/recommended-type-checked » ./configs/base" and ".eslintrc.js » @vue/eslint-config-typescriptBug: <short description of the issue>
- <script setup lang="ts" generic=" multiline generic definition "> cause ESLint Parsing error, but can correctly build. HOT 1
- Integration with ESLint's built-in configurations (`strict-type-checked`, `stylistic-type-checked`) HOT 1
- [Feature request] Support typescript-eslint v7 HOT 2
- Docs improvement
- Flat config support HOT 2
- Support additional typescript-eslint configs
- [13.0.0] Error: Error while loading rule '@typescript-eslint/consistent-type-imports': You have used a rule which requires parserServices to be generated HOT 1
- TypeScript version warning on a new Vue project
- Support ESLint `v9` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eslint-config-typescript.