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

Added prettier-plugin for formatting glimmer component templates #117

Merged
merged 9 commits into from
Jul 15, 2021

Conversation

wondersloth
Copy link
Contributor

@wondersloth wondersloth commented Jun 15, 2021

  • Creates a prettier plugin to format hbs tagged template expressions with prettier's glimmer printer.
  • Updated prettier to latest 2.3.1
  • Updated eslint to latest
  • Decoupled prettier (formatting) from eslint.

@wondersloth wondersloth force-pushed the prettier branch 2 times, most recently from 6496f59 to 5ab013f Compare June 15, 2021 02:50
@wondersloth

This comment has been minimized.

Copy link
Contributor Author

@wondersloth wondersloth left a comment

Choose a reason for hiding this comment

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

Preliminary review. Made some comments.

package.json Outdated Show resolved Hide resolved
"prepublishOnly": "scripts/build.js",
"problems": "tsc -p tsconfig.json --noEmit",
"start": "webpack-dev-server",
"storybook": "yarn build && yarn workspace basic-example-app storybook",
"test": "yarn lint && testem ci && yarn test:babel-plugins",
"test": "yarn format:check && yarn lint && testem ci && yarn test:babel-plugins && yarn test:prettier",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We may not want this here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I respond to this in a comment by @chiragpat below.

@wondersloth

This comment has been minimized.

@@ -13,15 +13,17 @@
],
"scripts": {
"build": "scripts/build.js",
"format:check": "prettier --check 'packages/**/*.{js,ts}'",
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't this just be done by the prettier plugin in eslint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When prettier and eslint both do formatting we get sometimes a double rewrite of a file, with the collision of rules being applied to a tagged template expression.

What we're doing now is simply using prettier to do a style-check format and do a check then use eslint lint for anti-patterns.

Comment on lines +49 to +52
node.type === 'TaggedTemplateExpression' &&
node.tag.type === 'Identifier' &&
node.tag.name === 'hbs' &&
name === 'quasi'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't cover any renames of the named hbs import.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will create an issue for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Issue created: #121

@chiragpat chiragpat merged commit efd540f into glimmerjs:master Jul 15, 2021
@chiragpat chiragpat added the enhancement New feature or request label Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants