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
Prettier on scss and css files generated + reformat css.ejs and scss.ejs #7476
Conversation
1d65c3e
to
9cce38b
Compare
@JulioJu great work. |
9cce38b
to
1d0920b
Compare
options: | ||
jsxBracketSameLine: false | ||
arrowParens: avoid | ||
parser: typescript |
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.
This line is not mandatory. Prettier detects the parser needed.
@gmarziou. To simplify prettierrc, we could delete all "parser" lines? What do you think about that? I asked me before commit, but I didn't dare delete that…
Maybe it's better to have a more accurate prettierc? We have a complete syntax… Maybe it's better ^^! I believe it's better to see what we do… As you wish ;-).
Note: parser will be renamed "language" (see prettier/prettier#2846).
EDIT excuse-me: the original author of this file is @deepu105 ;-)
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.
Lets leave it like that as its more explicit
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.
@deepu105. I'm pretty sure, this syntax doesn't work. We could deduce that beccause we could see than 7fcd4b0 works, but 7a85416 fail. My assumption is that somewhere (but I don't know where) a command $ yarn prettier --write --parser css "src/**/*.ts"
is launched. In my computer, in folder ngx-default-sample, when I run command $ yarn prettier --write --parser css "src/**/*.ts"
, I have the same kind of error than in line 1526 of https://travis-ci.org/jhipster/generator-jhipster/jobs/365956929 (build of 7a85416).
We could read at line 1526 of https://travis-ci.org/jhipster/generator-jhipster/jobs/365956929 than
SyntaxError: (postcss) CssSyntaxError Unknown word (1:1)
> 1 | export * from './foo.service';
| ^
2 | export * from './foo-update.component';
3 | export * from './foo-delete-dialog.component';
I don't understand this error beacause in folder "ngx-default-sample" there isn't file "foo.service", there isn't entity "foo". Have you an ideay why on remote Travis it tests folder "foo"?
As 7fcd4b0 works, I could --hard reset to this commit ?
Or maybe I could try simply with a .prettierrc without explicit parser? Thanks 7fcd4b0, and with the result of the command « $ yarn prettier --write --parser css "src/**/*.ts
» I believe it's better to let prettier choose the parser corresponding to the file extension.
printWidth: 140
singleQuote: true
tabWidth: 4
useTabs: false
overrides:
- files: "src/**/{*.ts,*.tsx}"
options:
jsxBracketSameLine: false
arrowParens: avoid
What do you think about that?
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.
@deepu105 I'm going to test the syntax above with a new commit…
jsxBracketSameLine: false | ||
arrowParens: avoid | ||
parser: typescript | ||
- files: "src/**/*.css" |
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.
@gmarziou : same as above: should we delete 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.
Try to track why https://travis-ci.org/jhipster/generator-jhipster/jobs/365748086 fail.
@@ -1,5 +1,5 @@ | |||
#!/bin/bash | |||
set -e | |||
set -ex |
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.
There is a strange error so I enable the bash option « trace for each command after it expands the command and before it executes it » to see accurately where there is a bug. Advise at https://docs.travis-ci.com/user/installing-dependencies/#Installing-Projects-from-Source.
Note: when I run or $ ./build-samples.sh build ngx-default
yarn prettier:format
on my computer, all work fine. Strange!
EDIT:
$ ./build-samples.sh build ngx-default
could success because it doesn't call the script who failed: scripts/00-install-jhipster.sh
! Moreover, there isn't yarn link
, so we dowload each time the last release of JHipster. I will submit a new issue, and maybe a Pull Request.
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.
@pascalgrimaud is this ok?
This is totally awesome!!! Only downside is that @deepu105 you need to modify your Devoxx slides to include this :-D |
a12468d
to
7a85416
Compare
@deepu105 I'm going to test the idea explained at #7476 (comment).
|
@deepu105 it works! There is a strange behaviour in the Travis build of 7a85416. I've let an hypothesis, but it's strange. I believe it's better to let Prettier choose which rules and which parser work on a filetype. Be too much accurate in .prettierrc seems introduce confusion during Travis build. Only let a comment for humans is I believe better, and let Prettier works freely is I believe more reliable. |
generators/generator-base-private.js
Outdated
@@ -1071,12 +1074,12 @@ module.exports = class extends Generator { | |||
*/ | |||
registerClientTransforms(generator = this) { | |||
if (!generator.skipClient) { | |||
const typescriptFilter = filter(['**/*.{ts,tsx}'], { restore: true }); | |||
const myFilter = filter(['src/**/*.{ts,tsx,scss,css}'], { restore: true }); |
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.
Rename to prettierFilter
@@ -1,5 +1,5 @@ | |||
#!/bin/bash | |||
set -e | |||
set -ex |
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.
@pascalgrimaud is this ok?
@JulioJu ok for your last comment, let prettier choose options, if that works fine. Can you cleanup your commits, may be squash the reverts |
3625f47
to
8adca2a
Compare
72ed276
to
e19617a
Compare
@deepu105 |
e19617a
to
16dbec9
Compare
No the jhipster-parent failure is my fault!! |
@jdubois ok :-) ! What is « jhipster-parent » ? |
"jhipster-parent" is a new library on which "jhipster-framework" and "jhipster-dependencies" depend - they should all be served from Maven Central, and this is what I failed this morning. |
16dbec9
to
5dc9dea
Compare
Fix #7451