Skip to content

Latest commit

 

History

History
112 lines (63 loc) · 5.8 KB

CONTRIBUTING.md

File metadata and controls

112 lines (63 loc) · 5.8 KB

Contributing to prettier-plugin-ember-template-tag

Thank you so much for your contributions!

Bug Reports and Issues

If you find a bug, please open an issue to describe it. If you can also open a PR with a failing test, that would be awesome.

Currently there are several HACKs and FIXMEs in the code. If you happen to find a bug, it might be worthwhile to look through those to see if they might be the culprit.

Find me on the Ember Discord at hm_krystan#0533 if I don't respond to your issue in a timely manner.

Development

  1. Ensure you have the following set up in your development environment:

  2. Fork this repo and pull.

  3. Install dependencies:

    pnpm install --recursive
  4. Run the tests to ensure your development environment is working properly:

    Watch mode:

    pnpm test

    Single run:

    pnpm test:run

    Watch mode with a cute UI in the browser:

    pnpm test:ui

Pull Requests

We love pull requests. Here's a quick guide:

  1. Follow the Development guide above to set up your environment.

  2. Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, we need a test! The best tests will fail without your code and pass with it. See the Tests section below for tips on writing tests.

  3. Make the test pass. See the Examples section below for a useful development workflow.

  4. Update the README, etc, as necessary if the documentation is affected by your change.

  5. Ensure that the linters and Prettier pass:

    To lint:

    pnpm lint

    To run auto-fix:

    pnpm lint:fix
  6. Commit your changes. Please include a useful commit message. If your pull request fixes an issue, specify the issue number in the commit message (e.g. FIXES #123).

  7. Push to your fork and submit a pull request. Please provide us with some explanation of why you made the changes you made. For new features make sure to explain a standard use case to us.

  8. Find me on the Ember Discord at hm_krystan#0533 if I don't respond to your pull request in a timely manner.

NOTE: Partially copied from https://github.com/emberjs/ember.js/blob/master/CONTRIBUTING.md

Examples

  1. Follow the Development guide above to set up your environment.

  2. Edit example.gjs or example.gts to make the ugliest component file you can think of.

  3. Run pnpm run example or pnpm run example-ts to prettify your ugly file. 😍 (Note that run example will also build the project, so it may take a second.)

  4. Don't commit your changes to the example files.

Tests

Most of the tests are generated by formatting example files from the cases directory and comparing the output to Vitest snapshots.

To add a new case, add your case file(s) in the appropriate place(s) here: https://github.com/gitKrystan/prettier-plugin-ember-template-tag/tree/main/tests/cases

New cases will be tested against a variety of configs. If you also want to test against for "ambiguous expressions" issues as described here, you can include the comment /*AMBIGUOUS*/ anywhere in your test cases and it will be replaced by the ambiguous cases listed here in a variety of generated tests. If you find a new ambiguous case, add it to that list.

Once you make your changes and/or add new cases pnpm test:run -u to update the snapshots then carefully inspect the results to ensure the output matches your expectations.

Prior Art and Useful Resources

Prettier plugin development documentation

Prettier printer doc commands

Ember Template Imports method to preprocess embedded templates

Sample AST and Prettier doc for preprocessed embedded templates

Prettier plugin for experimental hbs tagged expressions