-
Notifications
You must be signed in to change notification settings - Fork 152
Add support for Ember's gts/gjs files #365
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
Conversation
b94aaee to
eb19668
Compare
eb19668 to
8c6dc0c
Compare
There was a problem hiding this 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 intosrc/index.ts - Expand
defaultPreprocessorand test runner to recognize.gjs/.gtsfiles - Add tests and snapshots for
tests/Ember/sfc.gjsandtests/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.exportstoexport defaultmay break CommonJS consumers. Consider adding a CJS-compatible export (e.g.,module.exports = exports.default) or usingexport =for dual module support.
export default {
tests/Ember/ppsi.spec.js
Outdated
| run_spec(__dirname, ['ember-template-tag'], { | ||
| importOrder: ['^@core/(.*)$', '^@server/(.*)', '^@ui/(.*)$', '^[./]'], | ||
| importOrderSeparation: true, | ||
| importOrderParserPlugins : ['ember-template-tag'], |
Copilot
AI
Jul 9, 2025
There was a problem hiding this comment.
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.
| importOrderParserPlugins : ['ember-template-tag'], | |
| importOrderParserPlugins: ['ember-template-tag'], |
Start scaffolding out Ember support Add snapshots Try creating parsers like svelte Update some things
8c6dc0c to
a060e02
Compare
|
@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? |
|
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 |
|
Closing in favor of #376 |
Hello and thank you for this wonderful prettier plugin! I have been using it in Ember apps for awhile, with great success on
tsorjsfiles. 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?