Skip to content

Conversation

@NJ-2020
Copy link
Contributor

@NJ-2020 NJ-2020 commented Oct 19, 2025

Explanation of Change

Enforce that .find is being used instead of .filter when matching one/1 element, and enforce to use .findLast when trying to match the last element

$: Expensify/App#67423

PROPOSAL: Expensify/App#67423 (comment)

@github-actions
Copy link
Contributor

github-actions bot commented Oct 19, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 19, 2025

I have read the CLA Document and I hereby sign the CLA

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 19, 2025

recheck

@NJ-2020

This comment was marked as resolved.

roryabraham
roryabraham previously approved these changes Oct 20, 2025
@roryabraham
Copy link
Contributor

@NJ-2020 you need to sign the CLA for this repo before I can merge this.

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 21, 2025

@roryabraham FYI, I just added new eslint rules for some another tasks. Thanks

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 21, 2025

@NJ-2020 you need to sign the CLA for this repo before I can merge this.

@roryabraham I've already signed the CLA for this repo, but I am still seeing the workflow is failing, is there anything I am missing something?

@roryabraham
Copy link
Contributor

@NJ-2020 you've got conflicts to fix here. CLA bot is broken by something else. I'll look into it ASAP

@roryabraham
Copy link
Contributor

I have identified the problem with the CLA. It should be fixed tomorrow

@roryabraham roryabraham changed the title Add new plugin/rule for eslint-plugin-unicorn [HOLD] Add new plugin/rule for eslint-plugin-unicorn Oct 22, 2025
@roryabraham
Copy link
Contributor

Putting this on HOLD temporarily because publishing is broken in this repo. Hopefully should be fixed tomorrow

CLABotify added a commit to Expensify/CLA that referenced this pull request Oct 22, 2025
@roryabraham
Copy link
Contributor

CLA is fixed! still working on fixing npm publishing in this repo

@roryabraham
Copy link
Contributor

npm publish is fixed. Taking this off hold

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 23, 2025

@NJ-2020 you've got conflicts to fix here. CLA bot is broken by something else. I'll look into it ASAP

Fixed ☑️ Thanks

@roryabraham roryabraham changed the title [HOLD] Add new plugin/rule for eslint-plugin-unicorn Add new plugin/rule for eslint-plugin-unicorn Oct 23, 2025

languageOptions: {
parserOptions: {
globals: globals.builtin,

This comment was marked as resolved.

@gelocraft
Copy link
Contributor

@NJ-2020 I think you're having some trouble with merge conficts? Let me help you.

  • I think the first thing you have to do is to sync your main fork
  • After syncing your fork, in your local copy run git fetch origin
  • After fetching origin, make sure u stash your changes from your current branch
  • Run git stash -u to stash all the modified and untracked files
  • Reset your commit head to origin/main
git reset --hard origin/main
  • Finally, you're now ready adding new changes
  • After you commit your changes, forced push your commits to your pr branch

@gelocraft
Copy link
Contributor

@NJ-2020 I think you're having some trouble with merge conficts? Let me help you.

  • I think the first thing you have to do is to sync your main fork
  • After syncing your fork, in your local copy run git fetch origin
  • After fetching origin, make sure u stash your changes from your current branch
  • Run git stash -u to stash all the modified and untracked files
  • Reset your commit head to origin/main
git reset --hard origin/main
  • Finally, you're now ready adding new changes
  • After you commit your changes, forced push your commits to your pr branch

And by doing all of these, it will make the commit history clean. Cool, right?

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 23, 2025

#163 (comment), #163 (comment)

@gelocraft Thank you, FYI I am having some issues with my prettier vscode/codebase

@gelocraft
Copy link
Contributor

gelocraft commented Oct 23, 2025

@NJ-2020 I think it would be better to add the lint rules one at a time in separate PRs. Doing them all in a single PR could go against the code of conduct (GET SHIT DONE) and contributing guidelines.

@gelocraft
Copy link
Contributor

#163 (comment), #163 (comment)

@gelocraft Thank you, FYI I am having some issues with my prettier vscode/codebase

hmm... not sure about that. i use neovim btw

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 23, 2025

@roryabraham I think we're good to merge. Tests & lint for the changed files check are passing (tested locally).

@gelocraft
Copy link
Contributor

gelocraft commented Oct 23, 2025

Explanation of Change

Add new plugin (eslint-plugin-unicorn) & some new rules:

  • Enforce that .find or .findLast are being used instead of .filter
  • Enforce to use .replaceAll instead of .replace when dealing over regex searches
  • Enforce to use set.size instead of Array.from(set).length for better performance

$: Expensify/App#67423 Expensify/App#67424 Expensify/App#67425

PROPOSAL: Expensify/App#67423 (comment) Expensify/App#67424 (comment) Expensify/App#67425 (comment)

@roryabraham wouldn’t submitting fixes for all assigned issues in a single PR go against the project’s contributing guidelines and code of conduct? Each issue should ideally have its own PR, right?

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 23, 2025

@roryabraham wouldn’t submitting fixes for all assigned issues in a single PR go against the project’s contributing guidelines and code of conduct? Each issue should ideally have its own PR, right?

@gelocraft FYI, usually I always do separate PR for each issue (E/App, expensify-common), but at this point (eslint-config-expensify), I don't think it's really necessary to create separate PR for each new rule (small changes) and the current PR doesn't need too much review and since this is straightforward PR and hasn't been merged yet, so I don't see any issues including other rule.

If this is still against (eslint-config-expensify) the project’s contributing guidelines and code of conduct, I will make sure to create separate PR for each lint/rule/issue

Thanks.

@roryabraham
Copy link
Contributor

roryabraham commented Oct 23, 2025

wouldn’t submitting fixes for all assigned issues in a single PR go against the project’s contributing guidelines and code of conduct? Each issue should ideally have its own PR, right?

I certainly don't think it's a code of conduct violation. It may be somewhere in the contributing guidelines that smaller PRs are better, because that's certainly one of our best practices. But in some cases, the same change might naturally fix multiple bugs, and that's ok.

In this case, I agree with @gelocraft that it would be better to add each rule in a separate pull request. That way we get more granular releases, allowing for separate E/App PRs to enable each rule individually. That is in everyone's best interest for several reasons:

  • It makes it easier to track which PR is associated with which issue for payment sake
  • It reduces the likelihood of any individual PR causing a regression, and if one rule change
    ends up having to be reverted, they don't all have to be reverted.
  • Smaller PRs generally means fewer conflicts, which often results in greater velocity of code actually being merged and deployed.
  • Multiple C+ reviewers can be assigned to review each PR, and each PR has a smaller testing surface

Copy link
Contributor

@roryabraham roryabraham left a comment

Choose a reason for hiding this comment

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

Let's enable all the rules in separate PRs

@NJ-2020 NJ-2020 changed the title Add new plugin/rule for eslint-plugin-unicorn Enable prefer-array-find unicorn eslint rule Oct 25, 2025
@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 25, 2025

@roryabraham Done, updated ☑️

@NJ-2020 NJ-2020 requested a review from roryabraham October 25, 2025 03:55
@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 25, 2025

@NJ-2020
Copy link
Contributor Author

NJ-2020 commented Oct 27, 2025

@roryabraham I think we're good to merge 😁, please let me know if you need anything from my side. Thanks

@roryabraham roryabraham merged commit 7debd2f into Expensify:main Oct 28, 2025
6 checks passed
@os-botify
Copy link
Contributor

os-botify bot commented Oct 28, 2025

🚀 Published to npm in 2.0.95 🎉

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants