-
Notifications
You must be signed in to change notification settings - Fork 191
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
Use prettier #1470
Use prettier #1470
Conversation
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.
Looks like a great start!
This comment was marked as resolved.
This comment was marked as resolved.
I tried having 2 space indentation for everything, but 4 spaces for markdown files: printWidth: 120
tabWidth: 2
overrides:
- files:
- "*.md"
options:
tabWidth: 4 But Prettier apparently has a weird bug where doing this results in markdown lists with indentation after the bullet: - Updated `nf-core download` to work with latest DSL2 syntax for containers ([#1379](https://github.com/nf-core/tools/issues/1379))
- Made `nf-core modules create` detect repository type with explicit `.nf-core.yml` instead of random readme stuff ([#1391](https://github.com/nf-core/tools/pull/1391))
- Added a Gitpod environment and Dockerfile ([#1384](https://github.com/nf-core/tools/pull/1384))
- Adds conda, Nextflow, nf-core, pytest-workflow, mamba, and pip to base Gitpod Docker image. should be: - Updated `nf-core download` to work with latest DSL2 syntax for containers ([#1379](https://github.com/nf-core/tools/issues/1379))
- Made `nf-core modules create` detect repository type with explicit `.nf-core.yml` instead of random readme stuff ([#1391](https://github.com/nf-core/tools/pull/1391))
- Added a Gitpod environment and Dockerfile ([#1384](https://github.com/nf-core/tools/pull/1384))
- Adds conda, Nextflow, nf-core, pytest-workflow, mamba, and pip to base Gitpod Docker image. This is discussed in prettier/prettier#5019 but is not yet resolved. Anyway, I can't remember why we wanted 4-space indentation in markdown now? I think it was GitHub rendering, but I just checked this PR and it seems to render fine. I found some GitHub issues suggesting that this used to be a problem on GitHub but since they changed markdown renderers (years ago now) it's not. So maybe this fixed itself? Anyway, TLDR is that everything is 2-space indentation now, including markdown. Hopefully this doesn't break too much stuff. |
I don't understand why the CI tests can't find the repository type 🤔 |
ohh it's because it's not within the pipeline repo 🤦🏻 Ok then we should probably also make the error message more obvious here 😅 |
This means that we can run prettier directly on the entire codebase, without ignoring the template. Will probably need quite a lot of sanity checking to make sure that I didn't break stuff!
Right, that'll do for tonight. Still want to do a sanity check that the output from the pipeline template is basically (functionally) still the same and that I haven't accidentally broken anything in the GitHub actions workflows for example. But basically ready for review and testing now I think....?? |
Ok, updated to keep 4-space indentation for JSON files to make the diff as small as possible so that template merges are not a nightmare. Also fixed some other linting errors in created pipelines. |
@@ -30,13 +30,13 @@ input: | |||
|
|||
## TODO nf-core: Add a description of all of the variables used as output | |||
output: | |||
{% if has_meta -%} | |||
#{% if has_meta -%} Only when we have meta |
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.
was commenting the line here intended?
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.
Yes - Prettier breaks if it can't parse the YAML files. Sticking the Jinja templating stuff either in quotes or on comment lines means that the template is still valid YAML and so prettier can format it.
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.
Note that this is a YAML comment and Jinja ignores it. If we wanted a Jinja comment that's done with {# jinja here #}
. So the YAML comment #
here has no effect.
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.
https://prettier.io/docs/en/ignore.html#yaml
I think this is what we need.
The changes due to the new linter look good to me, not too many changes are needed! |
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.
Had to partially re-review after starting yesterday already and some changes came in later 👍🏻 Looks very good to me, lets hope its not too much effort when the template updates are coming in ;-)
* style: Add prettier config files * build: Add prettier vscode extension * ci: Replace markdownlint and yamllint with prettier * style: Run prettier * style: Use indent of 2 for markdown as well nf-core/tools#1470 (comment) * style: Fix indent * style: Let editorconfig take over tab widths * style: yaml => yml * ci: Run prettier once Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se> Co-authored-by: Phil Ewels <phil.ewels@scilifelab.se>
PR checklist
CHANGELOG.md
is updateddocs
is updated