Skip to content

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

Closed

Description

@Janpot

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?
  • ?

Activity

  1. added
    good first issue
    on Apr 19, 2024
  2. added
    status: waiting for maintainer
    on Apr 19, 2024
  3. added
    scope: code-infra
    good first issue
    and removed
    good first issue
    status: waiting for maintainer
    on Apr 19, 2024
  4. danilo-leal commented on Apr 19, 2024

    @danilo-leal
    Collaborator

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

    Should we think of it similarly?

  5. removed
    good first issue
    on Apr 19, 2024
  6. Janpot commented on Apr 19, 2024

    @Janpot
    MemberAuthor

    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

  7. flaviendelangle commented on Apr 22, 2024

    @flaviendelangle
    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.

  8. Janpot commented on Apr 22, 2024

    @Janpot
    MemberAuthor

    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?

  9. changed the title [-][core] Replace all references of event as e[/-] [+][code-infra] Replace all references of event as e[/+] on Apr 26, 2024
  10. AfaqShuaib09 commented on Apr 29, 2024

    @AfaqShuaib09

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

  11. Janpot commented on Apr 30, 2024

    @Janpot
    MemberAuthor

    @AfaqShuaib09 Go for it

  12. Janpot commented on Nov 12, 2026

    @Janpot
    MemberAuthor

    Fixed in #43866. The id-denylist rule for e now lives in the shared code-infra ESLint config.

  13. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor

    This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
    Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: code-infra

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions