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

Adopt eslint-plugin-unicorn #1812

Merged
merged 2 commits into from
Dec 15, 2024
Merged

Adopt eslint-plugin-unicorn #1812

merged 2 commits into from
Dec 15, 2024

Conversation

ericcornelissen
Copy link
Owner

@ericcornelissen ericcornelissen commented Dec 15, 2024

Summary

Start using eslint-plugin-unicorn to enforce opinionated stylistic consistency. All rules are explicitly configured to ensure the code follows the standard of this project.

Start using `eslint-plugin-unicorn` to enforce opinionated stylistic
consistency. All rules are explicitly configured to ensure the code
follows the standard of this project.

This commit includes "trivial" refactoring in scope of the rules.

Most rules are enabled as is. Some rules are disabled for various
reasons:
- `import-style`: limited value while hard to configure. Default config
  not desired.
- `no-nested-ternary`: conflicts with Prettier.
- `no-null`: non-trivial to refactor but intend adopt based on the
  motivation provided in the rule description.
- `prefer-spread`: imperfect rule that conflicts with this code base.
  Open to reconsider later.
- `prefer-string-raw`: I'm okay with escaping and am concerned about
  performance impacts of using `String.raw`.
- `prefer-ternary`: too situational to lint for in my opinion. Open to
  reconsider later.
- `prevent-abbreviations`: mainly don't have a solution for the "args"
  abbreviation. Open to reconsider later.
@ericcornelissen ericcornelissen added dependencies Changes to the project's dependencies meta Relates to the project or repository itself labels Dec 15, 2024
@github-actions github-actions bot added the test Relates to testing label Dec 15, 2024
config/eslint.js Outdated Show resolved Hide resolved
Refactor the ESLint configuration primarily with the goal of enforcing a
consistent style on all JavaScript in the code base to the extend
possible.

This change did uncover some new problems with the newly introduced
unicorn plugin:

- `consistent-destructuring`: like `prefer-ternary`: too situational
  to lint for in my opinion. Open to reconsider later.
- `number-literal-case`: conflicts with Prettier

Lastly, the `unicorn/prefer-string-replace-all` rule has also been
disabled because it is not compatible with Node.js v14.18.0, which is
still supported by this package.
@github-actions github-actions bot added the fuzz Relates to fuzzing label Dec 15, 2024
@ericcornelissen ericcornelissen merged commit 6098fc5 into main Dec 15, 2024
59 checks passed
@ericcornelissen ericcornelissen deleted the lint-unicorn branch December 15, 2024 15:53
@ericcornelissen ericcornelissen removed the fuzz Relates to fuzzing label Dec 15, 2024
@ericcornelissen ericcornelissen removed the test Relates to testing label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Changes to the project's dependencies meta Relates to the project or repository itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant