Skip to content

Conversation

@RobbieTheWagner
Copy link
Contributor

Hello and thank you for this wonderful prettier plugin! I have been using it in Ember apps for awhile, with great success on ts or js files. However, Ember has now moved to SFC via gjs/gts files and I would love to get support into this library for them.

I started scaffolding some of it out, modeling it after the Svelte implementation, but I do not really know much about implementing a prettier plugin. This is very much a work in progress, but perhaps someone who knows more could help out here if they have time?

@RobbieTheWagner RobbieTheWagner marked this pull request as draft June 25, 2025 20:32
@byara byara requested review from Copilot and vladislavarsenev July 9, 2025 11:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds initial support for Ember single-file components (.gjs/.gts) by integrating an Ember-specific preprocessor and parser into the import-sorting plugin.

  • Introduce emberPreprocessor, load Ember parsers, and wire them into src/index.ts
  • Expand defaultPreprocessor and test runner to recognize .gjs/.gts files
  • Add tests and snapshots for tests/Ember/sfc.gjs and tests/Ember/sfc.gts, and update docs and package metadata

Reviewed Changes

Copilot reviewed 30 out of 59 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Ember/sfc.gjs & tests/Ember/sfc.gts New Ember SFC tests for .gjs/.gts import sorting
src/utils/create-ember-parsers.ts Load Ember template-tag parsers if available
src/preprocessors/ember-preprocessor.ts New preprocessor to apply import sorting before Ember formatting
src/preprocessors/default-processor.ts Skip sorting for .gjs/.gts alongside Svelte/Vue
src/index.ts Register Ember parser & preprocessor in plugin config
test-setup/run_spec.cjs Update test runner to require plugin via plugin.default and ignore .cjs spec
package.json Add type: module, Ember plugin dependency, peer/optional flags
README.md Document <SEPARATOR> behavior and Ember support
Comments suppressed due to low confidence (1)

src/index.ts:73

  • [nitpick] Switching from module.exports to export default may break CommonJS consumers. Consider adding a CJS-compatible export (e.g., module.exports = exports.default) or using export = for dual module support.
export default {

run_spec(__dirname, ['ember-template-tag'], {
importOrder: ['^@core/(.*)$', '^@server/(.*)', '^@ui/(.*)$', '^[./]'],
importOrderSeparation: true,
importOrderParserPlugins : ['ember-template-tag'],
Copy link

Copilot AI Jul 9, 2025

Choose a reason for hiding this comment

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

[nitpick] The space before the colon in importOrderParserPlugins : is inconsistent with surrounding object keys. Please remove the extra space so it reads importOrderParserPlugins: for uniform styling.

Suggested change
importOrderParserPlugins : ['ember-template-tag'],
importOrderParserPlugins: ['ember-template-tag'],

Copilot uses AI. Check for mistakes.
Start scaffolding out Ember support

Add snapshots

Try creating parsers like svelte

Update some things
@RobbieTheWagner RobbieTheWagner changed the base branch from main to v6 July 9, 2025 12:10
@RobbieTheWagner
Copy link
Contributor Author

@vladislavarsenev I'm not very familiar with prettier-plugin-ember-template-tag or how to make sure we are setting it up here to run correctly so we can sort imports in gjs/gts files. Do you have any insights into changes I should make to get it running?

@RobbieTheWagner
Copy link
Contributor Author

I think the problem is we still lack full ESM support. I am working on another PR to update us to vitest to make that work

@RobbieTheWagner
Copy link
Contributor Author

Closing in favor of #376

@RobbieTheWagner RobbieTheWagner deleted the ember-sfc-support branch July 24, 2025 15:39
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.

1 participant