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

chore(format): add prettier to project #284

Merged
merged 6 commits into from
Aug 22, 2022
Merged

Conversation

rwaskiewicz
Copy link
Member

@rwaskiewicz rwaskiewicz commented Aug 19, 2022

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally for affected output targets
  • Tests (npm test) were run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue URL: #285

What is the new behavior?

this commit reworks the pre-existing prettier infrastructure in the
project in an attempt to add continuous integration (ci) checks for
formatting to the project.

prettier and ionic's prettier configuration are added as a top level
dependencies to the project, such that lerna can format all projects
with a 'prettier' script in the future. by using ionic's prettier
configuration, we can converge upon previously agreed upon formatting
config.

ci is updated to run prettier in parallel with other jobs, allowing us
to 'fail-fast' in the event of a formatting error. there is potential
room in the future to refactor ci jobs/steps by adding this parallelism,
but that was not done here in order to limit the scope of this commit.

this commit only handles the angular output target. this allows for
incremental improvement/proof-of-concept to get the idea out to the
teams managing this project for feedback sooner than later

format the contents of the angular output target using the configuration
added in the previous commit.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Looking for feedback/thoughts here from folks more familiar with Lerna setups and whatnot.

@rwaskiewicz rwaskiewicz force-pushed the rwaskiewicz/prettier branch 2 times, most recently from dcadcc7 to cbecc88 Compare August 19, 2022 14:01
@rwaskiewicz rwaskiewicz changed the title [wip]: prettier chore(format): add prettier to project Aug 19, 2022
this commit reworks the pre-existing prettier infrastructure in the
project in an attempt to add continuous integration (ci) checks for
formatting to the project.

prettier and ionic's prettier configuration are added as a top level
dependencies to the project, such that lerna can format all projects
with a 'prettier' script in the future. by using ionic's prettier
configuration, we can converge upon previously agreed upon formatting
config.

ci is updated to run prettier in parallel with other jobs, allowing us
to 'fail-fast' in the event of a formatting error. there is potential
room in the future to refactor ci jobs/steps by adding this parallelism,
but that was not done here in order to limit the scope of this commit.

this commit only handles the angular output target. this allows for
incremental improvement/proof-of-concept to get the idea out to the
teams managing this project for feedback sooner than later
format the contents of the angular output target using the configuration
added in the previous commit.
@rwaskiewicz rwaskiewicz marked this pull request as ready for review August 19, 2022 14:17
@rwaskiewicz rwaskiewicz requested a review from a team August 19, 2022 14:17
@rwaskiewicz rwaskiewicz requested a review from a team as a code owner August 19, 2022 14:17
"@stencil/core": "^2.9.0",
"@types/jest": "^26.0.9",
"jest": "^26.3.0",
"lerna": "^4.0.0",
"lerna-changelog": "^1.0.1",
"np": "^6.0.2",
"prettier": "^2.0.5",
"prettier": "2.7.1",
Copy link
Member Author

Choose a reason for hiding this comment

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

Locking this as Prettier doesn't necessarily follow semver

"rimraf": "^2.6.3",
"rollup": "^2.23.1",
"semver": "^5.5.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

This moved as a result of adding new dependencies via npm's CLI - might as well keep it 🤷

if (componentCorePackage !== undefined) {
const dirPath = includeImportCustomElements ? `/${customElementsDir || 'components'}` : '';
importLocation = `${normalizePath(componentCorePackage)}${dirPath}`;
export const createComponentDefinition =
Copy link
Member Author

Choose a reason for hiding this comment

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

These changes are a little more palatable if you "ignore whitespace" in GH's diff view

@@ -20,6 +20,9 @@
"watch": "tsc --watch",
"rollup": "rollup -c",
"version": "npm run build",
"prettier": "npm run prettier.base -- --write",
"prettier.base": "prettier \"./({anguler-output-target,src,test}/**/*.{ts,tsx,js,jsx})|*.{ts,tsx,js,jsx}\"",
Copy link
Member Author

Choose a reason for hiding this comment

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

Oops - I need to change this - should be 'angular-component-lib'

Copy link
Member

@alicewriteswrongs alicewriteswrongs left a comment

Choose a reason for hiding this comment

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

lgtm!

@rwaskiewicz rwaskiewicz merged commit 19d9f38 into main Aug 22, 2022
@rwaskiewicz rwaskiewicz deleted the rwaskiewicz/prettier branch August 22, 2022 15:14
rwaskiewicz added a commit that referenced this pull request Sep 7, 2022
this commit adds formatting infrastructure to the project for the
react, svelte and vue output targets. it also formats each of the
output targets mentioned above.

this commit is a successor to 19d9f38 (#284), which added formatting
infrastructure to the angular output target.

the examples are intentionally not included in this commit it an
effort to limit scope
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.

None yet

4 participants