Skip to content

Commit 4e46c43

Browse files
authored
Merge pull request #14 from gitKrystan/docs2
Update docs again
2 parents 5e76d3f + b8a9a9c commit 4e46c43

12 files changed

Lines changed: 243 additions & 51 deletions

File tree

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ dist-ssr
2323
.npmrc
2424

2525
# Editor directories and files
26-
.vscode/*
27-
!.vscode/extensions.json
2826
.idea
2927
.DS_Store
3028
*.suo
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: 🐞 Bug report
3+
about: Report a bug in the plugin. Before you create a new issue, please
4+
search for similar issues. It's possible somebody has encountered this bug already.
5+
title: '[Bug] Bug report'
6+
labels: ''
7+
assignees: ''
8+
---
9+
10+
### 🐞 Describe the Bug
11+
12+
A clear and concise description of what the bug is.
13+
14+
### 🔬 Minimal Reproduction
15+
16+
Describe steps to reproduce. If possible, please create a PR with a failing test as described in `CONTRIBUTING.md`.
17+
18+
### 😕 Actual Behavior
19+
20+
A clear and concise description of what is happening.
21+
22+
### 🤔 Expected Behavior
23+
24+
A clear and concise description of what you expected to happen.
25+
26+
### 🌍 Environment
27+
28+
- prettier-plugin-ember-template-tag version: -
29+
- ember-template-imports version: -
30+
31+
### ➕ Additional Context
32+
33+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: 🚀 Feature request
3+
about: Request a feature for the plugin. Before you create a new issue, please
4+
search for similar issues.
5+
title: '[Feature] Feature request'
6+
labels: ''
7+
assignees: ''
8+
---
9+
10+
### 💬 Describe the Feature
11+
12+
A clear and concise description of what the feature is.
13+
14+
### 🔬 Use Case
15+
16+
Describe your use case.
17+
18+
### ➕ Additional Context
19+
20+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/3-other.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: Other
3+
about: Report an issue that does not fit any of the categories above.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ dist-ssr
1515
.npmrc
1616

1717
# Editor directories and files
18-
.vscode/*
19-
!.vscode/extensions.json
2018
.idea
2119
.DS_Store
2220
*.suo

.prettierignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ dist-ssr
2323
.npmrc
2424

2525
# Editor directories and files
26-
.vscode/*
27-
!.vscode/extensions.json
2826
.idea
2927
.DS_Store
3028
*.suo

.vscode/extensions.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"dbaeumer.vscode-eslint",
8+
"esbenp.prettier-vscode",
9+
"visualstudioexptteam.vscodeintellicode"
10+
],
11+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
12+
"unwantedRecommendations": []
13+
}

.vscode/launch.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Program",
11+
"skipFiles": ["<node_internals>/**"],
12+
"program": "${workspaceFolder}/src/main.ts",
13+
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
14+
"sourceMaps": true
15+
},
16+
{
17+
"type": "node",
18+
"request": "launch",
19+
"name": "Debug Current Test File",
20+
"autoAttachChildProcesses": true,
21+
"skipFiles": ["<node_internals>/**"],
22+
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
23+
"args": ["run", "${relativeFile}"],
24+
"smartStep": true,
25+
"console": "integratedTerminal"
26+
}
27+
]
28+
}

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"explorer.excludeGitIgnore": true,
3+
"npm.packageManager": "pnpm",
4+
"eslint.packageManager": "pnpm",
5+
6+
"editor.formatOnSave": true,
7+
"[javascript]": {
8+
"editor.defaultFormatter": "esbenp.prettier-vscode"
9+
},
10+
// Turn off this formatter so Prettier will be the only formatter and the user won't have to pick.
11+
"javascript.format.enable": false
12+
}

CONTRIBUTING.md

Lines changed: 99 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,114 @@
1-
## Try it out
1+
# Contributing to prettier-plugin-ember-template-tag
22

3-
1. Edit `example.gjs` or `example.gts` to make the ugliest component file you can think of.
4-
1. Run `pnpm run example` or `pnpm run example-ts`
3+
Thank you so much for your contributions!
4+
5+
## Bug Reports and Issues
6+
7+
If you find a bug, please [open an issue](https://github.com/gitKrystan/prettier-plugin-ember-template-tag/issues/new/choose) to describe it. If you can also open a PR with a failing test, that would be awesome.
8+
9+
Currently there are several `HACK`s and `FIXME`s 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.
10+
11+
Find me on the [Ember Discord](https://discord.com/invite/emberjs) at `hm_krystan#0533` if I don't respond to your issue in a timely manner.
12+
13+
## Development
14+
15+
1. Ensure you have the following set up in your development environment:
16+
17+
- [node](https://nodejs.org/en/download/)
18+
- [pnpm](https://pnpm.io/)
19+
20+
1. [Fork this repo](https://github.com/gitKrystan/prettier-plugin-ember-template-tag/fork) and pull.
21+
22+
1. Install dependencies:
23+
24+
```bash
25+
pnpm install --recursive
26+
```
27+
28+
1. Run the tests to ensure your development environment is working properly:
29+
30+
Watch mode:
31+
32+
```bash
33+
pnpm test
34+
```
35+
36+
Single run:
37+
38+
```bash
39+
pnpm test:run
40+
```
41+
42+
Watch mode with a cute UI in the browser:
43+
44+
```bash
45+
pnpm test:ui
46+
```
47+
48+
## Pull Requests
549

6-
## Prior art and useful links
50+
We love pull requests. Here's a quick guide:
751

8-
https://prettier.io/docs/en/plugins.html#developing-plugins
52+
1. Follow the [Development](#development) guide above to set up your environment.
953

10-
https://medium.com/@fvictorio/how-to-write-a-plugin-for-prettier-a0d98c845e70
54+
1. 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](#tests) section below for tips on writing tests.
1155

12-
https://github.com/ember-template-imports/ember-template-imports/blob/master/src/preprocess-embedded-templates.ts#L180
56+
1. Make the test pass. See the [Examples](#examples) section below for a useful development workflow.
1357

14-
https://github.com/ember-template-imports/ember-template-imports/blob/master/src/parse-templates.ts
58+
1. Update the README, etc, as necessary if the documentation is affected by your change.
1559

16-
https://github.com/glimmerjs/glimmer-experimental/tree/master/packages/%40glimmerx/prettier-plugin-component-templates
60+
1. Ensure that the linters and Prettier pass:
1761

18-
https://github.com/ember-template-lint/ember-template-lint/pull/2483/files
62+
To lint:
1963

20-
https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBLAtgBwgJxgAgGEItoECAzHE-AcgAEBzAGw3ThwHpJSpzaA3AB0oI-PgDaAfSkBxADIBJALLKAogCUpAFTXKACvICCugBQADEWPwAeABYBGAHzj8ACTjNmEfAHVczAAm+A7unt5+AcEOHl4+-jhBIbERCUkx4fFRyZmRidEpWfk5cXnphWXR4jacjk4i5gA0+MD4AM4wOKhgMMoQgXBI+J0ArnD4AL4AlAC6VlCQUB346CPMMKisfPgAvJIyCirqWroGxmaWolDVda4VacEATGGlD-iP99kfuW-fr1+fYp-VIAn5faq1ZwNZqtDpdHp9AZDUbjaZzK6cABUmLEmPwRmucAAHgBDLDMcayABSAGV8BRNuNoPgAO52bp2VnjMAk644EbXGB2cb6HBwGAbDj03D4al0zDMEaMVBQAB0uM4ImJ2Dw+AGFBJawIYGYJLabXwygAnsReORrMT4FBAhbbdg+LAWtZpHIlKpNDo9IYTGoLNYbs47mDigBmF4g2OApIxpPBFPR5Op-Dp-6JjNpiF1axNFrtTrdXr9QbDfmo2bzcRskkEPbmeDk5vjVjwHAk5jDOzN-CoC1QCAEEnDOAd+CXBuuBecTj4ABWI2Wk9Y-Z47FgIgmIEaIAgmA20DayFAJJw1BZ+mvCAvKD7LJJVovR4ARr2wABrcU0mScDyCqcDIAazBtHAX4-v+MA0pgJJgCqjDICiR7Tp+cCBAMgTyLyjAjCSjBwAAYrg6DNhsUCoc+IwwBAh4gHYMDoMwvjsvAbSIWAcA0o+qAbAAboJVrIOA5pMSqUF4KKxGUeBfZQUeK5tESNIoRSACKIzjmBSAQcpICITgMniZ+JJYcwTGYF0sC+KggRCsgAAcAAMR62RAUG+L2mDibZcAyUJYFHgAjrp8CiieT4gGaAC0fDYdhTFihFqBinJjAKQZSnQSAUHoKgaG1kebSaXAOl6YpkH5TAlkOU5djII8R6dCSmwobaOUgEFACsTHrnA2iWU+hn5UJYyKM65A0mAXSngSgQ0jAVoUjVUETBMQA
64+
```bash
65+
pnpm lint
66+
```
2167

22-
https://github.com/prettier/prettier/blob/main/commands.md
68+
To run autofix:
69+
70+
```bash
71+
pnpm lint:fix
72+
```
73+
74+
1. Commit your changes. Please include a [useful commit message](https://initialcommit.com/blog/git-commit-messages-best-practices). If your pull request fixes an issue, specify the issue number in the commit message (e.g. `FIXES #123`).
75+
76+
1. 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.
77+
78+
1. Find me on the [Ember Discord](https://discord.com/invite/emberjs) at `hm_krystan#0533` if I don't respond to your pull request in a timely manner.
79+
80+
NOTE: Partially copied from https://github.com/emberjs/ember.js/blob/master/CONTRIBUTING.md
81+
82+
## Examples
83+
84+
1. Follow the [Development](#development) guide above to set up your environment.
85+
86+
1. Edit `example.gjs` or `example.gts` to make the ugliest component file you can think of.
87+
88+
1. 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.)
89+
90+
1. Don't commit your changes to the example files.
2391

2492
## Tests
2593

26-
`pnpm test`
94+
Most of the tests are generated by formatting example files from the `cases` directory and comparing the output to [Vitest snapshots](https://vitest.dev/guide/snapshot.html).
95+
96+
You can find the test file here: https://github.com/gitKrystan/prettier-plugin-ember-template-tag/blob/main/tests/format.test.ts
97+
98+
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
99+
100+
New cases will be tested against a variety of configs. If you also want to test against for "ambiguous expressions" issues as described [here](https://github.com/gitKrystan/prettier-plugin-ember-template-tag/issues/1), you can include the comment `/*AMBIGUOUS*/` anywhere in your test cases and it will be replaced by the ambiguous cases listed [here](https://github.com/gitKrystan/prettier-plugin-ember-template-tag/blob/de5722b476d83671fdf199a6a8097978fe245a46/tests/format.test.ts#L20-L29) in a variety of generated tests. If you find a new ambiguous case, add it to that list.
101+
102+
Once you make your changes and/or add new cases `pnpm test -u` to update the snapshots then carefully inspect the results to ensure the output matches your expecations.
103+
104+
## Prior Art and Useful Resources
105+
106+
[Prettier plugin development documentation](https://prettier.io/docs/en/plugins.html#developing-plugins)
107+
108+
[Prettier printer doc commands](https://github.com/prettier/prettier/blob/main/commands.md)
109+
110+
[Ember Template Imports method to preprocess embedded templates](https://github.com/ember-template-imports/ember-template-imports/blob/master/src/preprocess-embedded-templates.ts#L180)
27111

28-
## Bugs
112+
[Sample AST and Prettier doc for preprocessed embedded templates](https://prettier.io/playground/#N4Igxg9gdgLgprEAuEBLAtgBwgJxgAgGEItoECAzHE-AcgAEBzAGw3ThwHpJSpzaA3AB0oI-PgDaAfSkBxADIBJALLKAogCUpAFTXKACvICCugBQADEWPwAeABYBGAHzj8ACTjNmEfAHVczAAm+A7unt5+AcEOHl4+-jhBIbERCUkx4fFRyZmRidEpWfk5cXnphWXR4jacjk4i5gA0+MD4AM4wOKhgMMoQgXBI+J0ArnD4AL4AlAC6VlCQUB346CPMMKisfPgAvJIyCirqWroGxmaWolDVda4VacEATGGlD-iP99kfuW-fr1+fYp-VIAn5faq1ZwNZqtDpdHp9AZDUbjaZzK6cABUmLEmPwRmucAAHgBDLDMcayABSAGV8BRNuNoPgAO52bp2VnjMAk644EbXGB2cb6HBwGAbDj03D4al0zDMEaMVBQAB0uM4ImJ2Dw+AGFBJawIYGYJLabXwygAnsReORrMT4FBAhbbdg+LAWtZpHIlKpNDo9IYTGoLNYbs47mDigBmF4g2OApIxpPBFPR5Op-Dp-6JjNpiF1axNFrtTrdXr9QbDfmo2bzcRskkEPbmeDk5vjVjwHAk5jDOzN-CoC1QCAEEnDOAd+CXBuuBecTj4ABWI2Wk9Y-Z47FgIgmIEaIAgmA20DayFAJJw1BZ+mvCAvKD7LJJVovR4ARr2wABrcU0mScDyCqcDIAazBtHAX4-v+MA0pgJJgCqjDICiR7Tp+cCBAMgTyLyjAjCSjBwAAYrg6DNhsUCoc+IwwBAh4gHYMDoMwvjsvAbSIWAcA0o+qAbAAboJVrIOA5pMSqUF4KKxGUeBfZQUeK5tESNIoRSACKIzjmBSAQcpICITgMniZ+JJYcwAC0MAfsZXSwL4qCBEKyAABwAAxHpg1BQb4vaYOJvlwDJQlgUeACOunwKKJ5PiAZrWXw2HYUxYrRagYpyYwCkGUp0EgFB6CoGhtZHm0mlwDpemKZBhUwJZzmuXYyCPEenQkpsKG2nlIChQArEx65wNollPoZhVCWMijOuQNJgF0p4EoENIwFaFJ1VBEwTEAA)
29113

30-
HACKs and FIXMEs
114+
[Prettier plugin for experimental hbs tagged expressions](https://github.com/glimmerjs/glimmer-experimental/tree/master/packages/%40glimmerx/prettier-plugin-component-templates)

0 commit comments

Comments
 (0)