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

lint: Wrap array/objects from JSX in one line if possible #1494

Open
WaDadidou opened this issue Jan 25, 2025 · 0 comments
Open

lint: Wrap array/objects from JSX in one line if possible #1494

WaDadidou opened this issue Jan 25, 2025 · 0 comments
Labels
enhancement New feature or request question Further information is requested refacto

Comments

@WaDadidou
Copy link
Collaborator

In our front, a lot of arrays and objects declarations could be wrapped on one line, but are extended on many lines.
It increases the number of lines in files
(Even if I think it's more readable (And big blocks can be wrapped/collapsed by click in IDEs), I understand the need).

This
Image
Could be this
Image

Formatting can be done using IDE parameters, but we want to be objective and format the code automatically.
So, maybe a lint rule can do the job

Here: https://github.com/TERITORI/teritori-dapp/blob/main/.eslintrc.js#L93-L98
I propose to add these two rules:

"array-bracket-newline": ["error", "consistent"],
"object-curly-newline": ["error", "never"]

(Not fully tested, not tested in CI)

Then, the code is formatted automatically in CI, using our config https://github.com/TERITORI/teritori-dapp/blob/main/.github/workflows/js.yml#L25
Or manually, using our scripts: https://github.com/TERITORI/teritori-dapp/blob/main/package.json#L12-L13

==> Should we make a PR that format the tens of files after manually triggering a yarn lint-fix? Or should we make a PR that just add these rules ?


Cf this comment on a PR: #1477 (comment)

@WaDadidou WaDadidou added enhancement New feature or request question Further information is requested refacto labels Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested refacto
Projects
None yet
Development

No branches or pull requests

1 participant