-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
@typescript-eslint/eslint-plugin
crashes when applying rules to Vue SFC <script>
not parsed with @typescript-eslint/parser
#156
Comments
I checked the error and
are undefined when no |
Would it be possible to return an "empty" / no-op |
I found the cause of the issue: Because I set added following config to the eslint parserOptions: {
parser: {
js: 'espree',
jsx: 'espree',
ts: require.resolve('@typescript-eslint/parser'),
tsx: require.resolve('@typescript-eslint/parser'),
}
} and
This caused the |
By setting the parser to |
It would be awesome to be able to filter But if there was an ESLint Processor for Vue, it would be possible to filter for the Would something like this be possible?: .eslintrc.js {
plugin: 'vue',
processor: 'vue/sfc-processor',
parser: 'vue-eslint-parser', // why not 'vue/parser'?
overrides: [
{
files: ['*.vue'],
rules: {
// ...
}
},
{
files: ['**/*.vue/*.ts'],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
]
}
]
} |
@typescript-eslint/parser
can't parse a Vue SFC without <script>
correctly@typescript-eslint/eslint-plugin
crashes when applying rules to Vue SFC <script>
not parsed with @typescript-eslint/parser
Thank you for posting issue.
I think it's technically impossible. TypeScript cannot provide type information for virtual filenames. |
We recommend using typescript in all your vue files if you want to do type checking. |
I fixed my error by setting the parserOptions: {
parser: '@typescript-eslint/parser'
}, |
While using
@typescript-eslint/recommended-requiring-type-checking
withvue-eslint-parser
asparser
,@typescript-eslint/parser
can't check for types when there is no<script>
used in a Vue SFC.Stacktrace:
When adding an empty
<script setup lang="ts"></script>
the error is not shown anymore when running eslint.The issue seems to be, that the
parserServices
or a property of it is missing when there is no<script>
in a Vue SFC:https://github.com/typescript-eslint/typescript-eslint/blob/dc1f9309cf04aa7314e758980ac687558482f47f/packages/utils/src/eslint-utils/getParserServices.ts#L19-L26
The text was updated successfully, but these errors were encountered: