Skip to content

Conversation

@thelovekesh
Copy link
Collaborator

@thelovekesh thelovekesh commented Sep 30, 2022

Summary

This PR aims to add prettier as the code formatter.

  • Add prettier and @wordpress/prettier-config devDeps.
  • Update @wordpress/eslint-plugin config from @wordpress/eslint-plugin/recommended-with-formatting to @wordpress/eslint-plugin/recommended as it incorporates prettier by default.
  • Update code formatting with a new formatter.
  • Update eslint-disable and translators comments(It is done because prettier and ESLint use different JS parsers, hence prettier was showing errors at how those eslint-disable comments were placed.).
  • Remove Eslint rule(react/jsx-one-expression-per-line) due to conflict with prettier.
  • Move .eslintrc to .eslintrc.js as it is recommended to use an extension-based config file.

Checklist

  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@github-actions
Copy link
Contributor

github-actions bot commented Sep 30, 2022

Plugin builds for 0d46ad0 are ready 🛎️!

@westonruter westonruter removed the request for review from delawski September 30, 2022 20:11
@westonruter
Copy link
Member

As opposed to applying prettier, I thought we were just going to disable prettier from running to avoid making many changes? I mean, I don't think it's necessarily a problem to update the formatting since I don't think there are significant PRs that would be made stale by applying prettier. I don't feel strongly either way. Just curious.

@thelovekesh
Copy link
Collaborator Author

Ahh. Maybe I misinterpreted our discussion. I think I can add prettier 😄

I don't think there are significant PRs that would be made stale by applying prettier.

I also considered the case and I think having a code formatter like prettier is not a bad choice. Prettier is a very widely used tool and can be helpful in developer experience which is useful in the long run if someone wanted to work with JS codebase.

We can disable it as well. I am aware of disabling it in VSCode using a config file but not sure about other code editors/IDEs.

@westonruter
Copy link
Member

westonruter commented Dec 8, 2022

Note: we'll need to Squash-merge this and then add the commit hash to a .git-blame-ignore-revs file.

Update: See 82fd59f.

@westonruter westonruter added this to the v2.3.1 milestone Dec 8, 2022
@westonruter westonruter merged commit 614e495 into develop Dec 8, 2022
@westonruter westonruter deleted the add/prettier branch December 8, 2022 17:53
@westonruter westonruter modified the milestones: v2.3.1, v2.4 Jan 26, 2023
@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelogged Whether the issue/PR has been added to release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants