feat: support TypeScript syntax in default-param-last#19431
feat: support TypeScript syntax in default-param-last#19431mdjermanovic merged 10 commits intoeslint:mainfrom
default-param-last#19431Conversation
✅ Deploy Preview for docs-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
nzakas
left a comment
There was a problem hiding this comment.
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: |
nzakas
left a comment
There was a problem hiding this comment.
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. |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@eslint/js](https://eslint.org) ([source](https://github.com/eslint/eslint/tree/HEAD/packages/js)) | devDependencies | minor | [`9.22.0` -> `9.23.0`](https://renovatebot.com/diffs/npm/@eslint%2fjs/9.22.0/9.23.0) | | [eslint](https://eslint.org) ([source](https://github.com/eslint/eslint)) | devDependencies | minor | [`9.22.0` -> `9.23.0`](https://renovatebot.com/diffs/npm/eslint/9.22.0/9.23.0) | --- ### Release Notes <details> <summary>eslint/eslint (@​eslint/js)</summary> ### [`v9.23.0`](https://github.com/eslint/eslint/releases/tag/v9.23.0) [Compare Source](eslint/eslint@v9.22.0...v9.23.0) ##### Features - [`557a0d2`](eslint/eslint@557a0d2) feat: support TypeScript syntax in no-useless-constructor ([#​19535](eslint/eslint#19535)) (Josh Goldberg ✨) - [`8320241`](eslint/eslint@8320241) feat: support TypeScript syntax in `default-param-last` ([#​19431](eslint/eslint#19431)) (Josh Goldberg ✨) - [`833c4a3`](eslint/eslint@833c4a3) feat: defineConfig() supports "flat/" config prefix ([#​19533](eslint/eslint#19533)) (Nicholas C. Zakas) - [`4a0df16`](eslint/eslint@4a0df16) feat: circular autofix/conflicting rules detection ([#​19514](eslint/eslint#19514)) (Milos Djermanovic) - [`be56a68`](eslint/eslint@be56a68) feat: support TypeScript syntax in `class-methods-use-this` ([#​19498](eslint/eslint#19498)) (Josh Goldberg ✨) ##### Bug Fixes - [`0e20aa7`](eslint/eslint@0e20aa7) fix: move deprecated `RuleContext` methods to subtype ([#​19531](eslint/eslint#19531)) (Francesco Trotta) - [`cc3bd00`](eslint/eslint@cc3bd00) fix: reporting variable used in catch block in `no-useless-assignment` ([#​19423](eslint/eslint#19423)) (Tanuj Kanti) - [`d46ff83`](eslint/eslint@d46ff83) fix: `no-dupe-keys` false positive with proto setter ([#​19508](eslint/eslint#19508)) (Milos Djermanovic) - [`e732773`](eslint/eslint@e732773) fix: navigation of search results on pressing Enter ([#​19502](eslint/eslint#19502)) (Tanuj Kanti) - [`f4e9c5f`](eslint/eslint@f4e9c5f...
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-lastto account for TypeScript syntax features as handled in the@typescript-eslint/default-param-lastextension rule:Includes tests equivalent to what the extension rule currently tests that's exclusive to TypeScript. They're in a separate
ruleTesterTypeScriptinstance that uses@typescript-eslint/parser.Also updates
tools/check-rule-examples.jsto allow TypeScript code block. Previously it only allowed JavaScript.Is there anything you'd like reviewers to focus on?
Should we also update documentation?