-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
feat: support TypeScript syntax in default-param-last
#19431
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
feat: support TypeScript syntax in default-param-last
#19431
Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Thanks for getting this started. I left some points of clarification.
With regards to documentation, I think it would be good to add some code examples showing TypeScript.
I'm also wondering if maybe we should add something into meta
indicating that this rule is TypeScript-aware?
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
@JoshuaKGoldberg, I have a question: once this feature will be released, does it mean that ESLint could support the TypeScript linting out-of-box without any extra plugins or projects like typescript-eslint? |
Depends what you mean by "TypeScript linting". For syntax-only linting with just ESLint core rules, technically yes. See #19173 (comment) -> #19173 (comment) for a list of what will switch from needing a typescript-eslint extension rule to working out-of-the-box in ESLint core. Typed linting, however, will not be supported in ESLint core. You'll still need typescript-eslint or an equivalent for that. See #19173 -> #19173 (comment). ESLint core also presently doesn't have any plans that I know of to support TypeScript-specific rules that don't need typed linting. Example: tl;dr: no, the strong recommendation from typescript-eslint going forward will still be to use typescript-eslint when linting TypeScript code. |
We discussed today and we're at least going to start with this:
For now, I think this is enough and we don't need to get to deep into the difference between being syntax-aware and type-aware. We're not planning on displaying this info anywhere so in the short-term it will be mostly for our own edification but we are also looking at how we can use this info to, for example, automatically disable JavaScript-specific rules when linting JSON. |
Hi everyone, it looks like we lost track of this pull request. Please review and see what the next steps are. This pull request will auto-close in 7 days without an update. |
Not stale! waiting for a review. |
@JoshuaKGoldberg did you intended to include updates to |
Ah, yes, and never mentioned this in the OP - editing it in now. Without the changes:
|
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.
LGTM. Would like another review to double check the check-rule-examples
changes.
Sorry! closed it accidentally. |
Coming over from https://github.com/eslint/eslint/pull/19431/files#r1991932318: this PR is accumulating more and more TypeScript support changes. Would it be preferable to split them out once everything is working into their own PR? I see #19529 was also sent with some of the same changes. |
I think if we hide "Open in Playground" for now, that's enough to merge this. The playground changes may take a bit to get working and we can always iterate on the error location in a separate PR. |
Agreed. |
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.
LGTM, thanks!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[x] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
What changes did you make? (Give an overview)
Starts on #19173.
Updates
default-param-last
to account for TypeScript syntax features as handled in the@typescript-eslint/default-param-last
extension rule:Includes tests equivalent to what the extension rule currently tests that's exclusive to TypeScript. They're in a separate
ruleTesterTypeScript
instance that uses@typescript-eslint/parser
.Also updates
tools/check-rule-examples.js
to allow TypeScript code block. Previously it only allowed JavaScript.Is there anything you'd like reviewers to focus on?
Should we also update documentation?