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

[code-infra] Replace all references of event as e #41968

Open
Janpot opened this issue Apr 19, 2024 · 6 comments
Open

[code-infra] Replace all references of event as e #41968

Janpot opened this issue Apr 19, 2024 · 6 comments
Labels
scope: code-infra Specific to the core-infra product

Comments

@Janpot
Copy link
Member

Janpot commented Apr 19, 2024

For example

onKeyDown: (e: React.KeyboardEvent<HTMLAnchorElement>) => {

Also enforce this with an eslint rule. e.g. https://eslint.org/docs/latest/rules/id-length https://eslint.org/docs/latest/rules/id-denylist

Single letter identifiers are desired in some cases (t for translations, and i, j, k for loop variables). So let's keep the scope of this issue down to specific identifiers only and not enforce it by length. Some other ids I can think of are:

  • err => error
  • res => response, or did you mean result, or resolve?
  • ?
@Janpot Janpot added the good first issue Great for first contributions. Enable to learn the contribution process. label Apr 19, 2024
@github-actions github-actions bot added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 19, 2024
@Janpot Janpot added scope: code-infra Specific to the core-infra product good first issue Great for first contributions. Enable to learn the contribution process. and removed good first issue Great for first contributions. Enable to learn the contribution process. status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 19, 2024
@danilo-leal
Copy link
Contributor

I've also seen somewhat similar stuff with t being used for translation:

Should we think of it similarly?

@Janpot Janpot removed the good first issue Great for first contributions. Enable to learn the contribution process. label Apr 19, 2024
@Janpot
Copy link
Member Author

Janpot commented Apr 19, 2024

Maybe, it's up to the core team IMO. I think we're all quite on the same page for e=>event

I found this issue back in the GitHub project I'm trying to revive for code-infra. Maybe we should groom this a bit first

@flaviendelangle
Copy link
Member

The one-letter variables are a never-ending topic in software development 😆

For e => event, it enforces some consistency across the codebase so I'm all in favor of doing it.

IMHO the rule should not apply to for loops for (let i=0), and for map / filter it's debatable but I don't have a strong preference.

@Janpot
Copy link
Member Author

Janpot commented Apr 22, 2024

I agree. Ok, I propose then to keep the scope of this issue to e => event only. And to instead use the id-denylist rule. wdyt?

@oliviertassinari oliviertassinari changed the title [core] Replace all references of event as e [code-infra] Replace all references of event as e Apr 26, 2024
@AfaqShuaib09
Copy link

Hey, Could someone this issue to me? I would love to make a PR on this issue
Thanks

@Janpot
Copy link
Member Author

Janpot commented Apr 30, 2024

@AfaqShuaib09 Go for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: code-infra Specific to the core-infra product
Projects
None yet
Development

No branches or pull requests

4 participants