Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prettier-plugin-ember-template-tag

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-ember-template-tag

A prettier plugin for formatting Ember template tags

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

prettier-plugin-ember-template-tag

CI npm license

A Prettier plugin for formatting Ember template tags in both .gjs and .gts files. See also Ember Template Imports.

Usage

  1. Install:

    NPM:

    npm install --save-dev prettier prettier-plugin-ember-template-tag
    

    Yarn:

    yarn add --dev prettier prettier-plugin-ember-template-tag
    

    PNPM:

    pnpm add --save-dev prettier prettier-plugin-ember-template-tag
    
  2. Configure with prettierrc:

    // .prettierrc.js
    module.exports = {
      // ...
      plugins: ['prettier-plugin-ember-template-tag'],
    };
    
  3. Run npm prettier --write .

Opinions

This plugin works by weaving together Prettier's standard babel-ts and glimmer parsers, so it doesn't have many opinions of its own.

With that said, I did have to make some decisions about when and where to include or omit semicolons. You can read more about and comment on my decision process on this RFC.

Configuration

These configuration options are available in addition to Prettier's standard config for JavaScript and Handlebars files.

NameDefaultDescription
templateSingleQuotefalseSame as in Prettier but affecting only template tags

Ignoring code

Because gts/gjs files include both JavaScript and Glimmer template code, you'll need to use the appropriate prettier-ignore comment for the code you are ignoring:

export default class MyComponent extends Component {
  // prettier-ignore
  cells = matrix(
    1, 0, 0,
    0, 1, 0,
    0, 0, 1
  )

  <template>
    {{! prettier-ignore }}
    {{#each this.cells as |cell|}}{{cell.contents}}{{/each}}
  </template>
}

To ignore the entire template, use a JavaScript //prettier-ignore comment before the opening <template> tag:

export default class MyComponent extends Component {
  // prettier-ignore
  <template>
    This whole template is ignored
    <MyUglyComponent     "shall"     be="preserved">
      <ThisPart
        is  =  "also preserved as is"
      />
    </MyUglyComponent>
  </template>
}

Bugs

If you find a bug, please file a bug report! See CONTRIBUTING.md for more details.

Keywords

FAQs

Package last updated on 04 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc