Content-Length: 364724 | pFad | http://github.com/eslint/eslint/pull/19431

F5 feat: support TypeScript syntax in `default-param-last` by JoshuaKGoldberg · Pull Request #19431 · eslint/eslint · GitHub
Skip to content
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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

JoshuaKGoldberg
Copy link
Contributor

@JoshuaKGoldberg JoshuaKGoldberg commented Feb 17, 2025

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:

  • Class parameter properties
  • Type annotations

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.

Is there anything you'd like reviewers to focus on?

Should we also update documentation?

@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team as a code owner February 17, 2025 15:18
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Feb 17, 2025
@github-actions github-actions bot added the rule Relates to ESLint's core rules label Feb 17, 2025
Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit de59b04
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/67b5d1be9c6c360008e19daa

Copy link
Member

@nzakas nzakas left a 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?

lib/rules/default-param-last.js Outdated Show resolved Hide resolved
lib/rules/default-param-last.js Outdated Show resolved Hide resolved
lib/rules/default-param-last.js Outdated Show resolved Hide resolved
lib/rules/default-param-last.js Outdated Show resolved Hide resolved
lib/rules/default-param-last.js Outdated Show resolved Hide resolved
JoshuaKGoldberg and others added 2 commits February 17, 2025 14:44
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
@@ -14,7 +27,8 @@ module.exports = {
description: "Enforce default parameters to be last",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/default-param-last"
url: "https://eslint.org/docs/latest/rules/default-param-last",
typescript: "syntax"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also wondering if maybe we should add something into meta indicating that this rule is TypeScript-aware?

I found this to be a surprisingly difficult design question. The property needs to indicate:

  • It does support TypeScript syntax
  • It doesn't support TypeScript types

...and I couldn't figure out any nice succinct single-word property names for this. Using typescript: "syntax" here explicitly tells folks it's only syntax, not types. It leaves an option for custom parsers like tseslint to later put in "types" too, maybe. But I'm not confident in this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah. I'll bring it up at the TSC meeting and see what opinions people have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/eslint/eslint/pull/19431

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy