-
-
Notifications
You must be signed in to change notification settings - Fork 681
Chore: ts-parser support in demo #1972
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this looks mostly good. I have just one suggestion.
parser: this.typescript | ||
? this.tsEslintParser | ||
: this.langTs | ||
? { | ||
ts: this.tsEslintParser, | ||
typescript: this.tsEslintParser | ||
} | ||
: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's really hard to read this. Can we extract part of this to a separate variable to make it more readable? Or use if
? Or configure Prettier to allow parentheses here?
Also, is the second check really needed? Or can we always set the TS parser for the ts
and typescript
blocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review!
I would like to rewrite this and write comments.
this.typescript
is intended to be used when using ts
code blocks.
The this.langTs
condition is used during <script lang="ts">
or <script lang="typescript">
. <script lang="typescript">
is not currently used, but I think someone may PR a new rule to enforce it in the future.
.eslintrc.js
Outdated
@@ -131,7 +131,8 @@ module.exports = { | |||
'unicorn/no-useless-undefined': 'off', | |||
'unicorn/prefer-optional-catch-binding': 'off', // not supported by current ESLint parser version | |||
'unicorn/prefer-module': 'off', | |||
'unicorn/prevent-abbreviations': 'off' | |||
'unicorn/prevent-abbreviations': 'off', | |||
'unicorn/no-nested-ternary': 'off' // conflicts with Prettier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it makes the code more readable than Prettier 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much better now. LGTM! :)
This PR modifies the documentation site demo so that it parses well using typescript.
https://deploy-preview-1972--eslint-plugin-vue.netlify.app/rules/valid-define-emits.html
https://deploy-preview-1972--eslint-plugin-vue.netlify.app/rules/valid-define-props.html
We'll need to clear the cache in netlify for this to take effect.
Related to #1968 (comment)