-
-
Notifications
You must be signed in to change notification settings - Fork 267
[IMP] Add Prettier and ESLint with --fix #618
[IMP] Add Prettier and ESLint with --fix #618
Conversation
b194a65
to
16f8ab0
Compare
16f8ab0
to
200f754
Compare
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.
the concept looks good to me
thanks!
@yajo Nice improvement! |
200f754
to
0129df2
Compare
I tried this on my favorite repo and found a few potential issues:
Otherwise, for .js, .yml, and .css files, it looks good 👍 |
I think yes, autoformatting is good everywhere IMHO, MD included. We can add the exception for LICENSE files however, although it's weird that your license is written in MD because I have not seen any LICENSE provider that uses MD. They tend to use raw txt instead. Do you have an example?
Again if you can point to the example... You can see I ignored for instance
You mean eslint out of pre-commit, right? For instance when using an integrated eslint on your IDE... Well, you see that it needs a new npm dependency that includes some configs. You have to make sure that the npm package |
You can look in the mis-builder repo (I think I got the license from the GNU website).
Example in OCA/mis-builder, So yeah, to avoid bad surprises, I would tend to restrict prettier to an explicit list of formats (.js, .css and friends, and .xml when it's stable).
Yes exactly. I think there is huge value to have |
f805338
to
1a84ab0
Compare
I see, yes it's downloadable from GNU as MD. OK, I added an exclusion pattern to avoid touching license files. 😊
Excluded now.
That's basically what I'm proposing here. Those formats are JS, Less, CSS, SCSS, HTML and MD. It's just that it's implicit, but since the prettier version is pinned, there'll be no surprises there.
I have a mixed feeling here. On one side, you're right that it's good to have ides working out of the box, but it's also true that what really works out of the box is On the other side, a problem maintaining Balancing both things, I personally prefer the maintenance side of the problem. The dev side can be fixed very easily with an entry in the contributing guideline: "How to set up a development environment". Now that we have bots 🤖 we can instruct them to add a link to that section in all repos (or modules) READMEs. |
I'd be more comfortable to leave out html and md.
Can't we include the |
why do you want ugly MD/HTML files around? 🤔 I'm reluctant to exclude those. The same reasons we want code autoformatters for other formats apply for MD and HTML, and in any case, the autogenerated If you are worried about reducing diff... then we shouldn't use code formatters at all; but I guess we already passed that milestone, so I see no problem there.
Nope. JSON doesn't support comments. |
Simplifying
I'm going to include a link to this comment, explaining that style rules shouldn't be included (those are handled by Prettier; we only need rules that check AST patterns), and that we shouldn't include any rule listed in https://github.com/prettier/eslint-config-prettier/blob/v6.6.0/index.js. |
1a84ab0
to
6a3a97f
Compare
This should be ready to merge 😊 |
The |
cf8ce5a
to
dd062cc
Compare
I added prettier ignore marks to README template, to avoid that. I also opened OCA/maintainer-tools#436 to avoid different header styles. That should fix the problem. 😊 |
Does this mean all README.md need to be updated manually? |
I was supposing it is an automatic process also... It can be done with a There's the possibility to make the script inject the prettier lines inside instead, but prettier converts |
So? |
I'm fine with the js and yml parts. I checked the last comments again and it seems to me we are still blocked on README.md
README.md files are maintained manually. The easiest way out is still to leave |
Given we're going to add a big reformatter change, I took the chance to update some hooks. I tested this config and it works fine. |
e2e270e
to
6c162d3
Compare
The email is ready, I just need to know the schedule if possible. Otherwise you can just reply to it in the mailing list to tell that. |
This commit includes: - Using https://prettier.io/ for supported file formats (these include CSS, SCSS, JS, HTML, MD, YAML and others; see website). - Transform `.eslintrc` (deprecated) to `.eslintrc.yml`, which supports more advanced syntax. - Simplify `.eslintrc.yml` removing disabled checks. All checks are disabled by default anyways. - Remove from `.eslintrc.yml` all stylistic checks that would conflict with Prettier. - Add `Promise` as a builtin for v13 (this was missed before, so I take this chance to add that). - Format properly `.travis.yml` so that when it gets merged downstream it gets less diffs when passed trhough Prettier. - Use `eslint --fix` so we get less warnings and more fixes. - Add prettier ignoration tags to README.md template, to avoid double-formatting addons table section. - Add prettier XML plugin too, as a separate job. - Ignore for now README.md files to avoid overcomplicating maintenance of those files.
6c162d3
to
bb15a90
Compare
I can try to prepare a bit this week-end and apply it on all repos the week-end of February 15th. |
OK, then can this be merged already? It won't affect until you deploy the
changes actually.
I wonder if you want me to apply these manually to web and website repos,
in PRs, given they contain most js code and will maybe produce some errors
in eslint... It can also serve as playground.
El vie., 24 ene. 2020 a las 11:14, Stéphane Bidoul (<
[email protected]>) escribió:
… I can try to prepare a bit this week-end and apply it on all repos the
week-end of February 15th.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#618?email_source=notifications&email_token=AAHNXDN5754YGMBFYCL37Q3Q7LEPZA5CNFSM4JPB4SDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ2O7PI#issuecomment-578088893>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHNXDLE33HHCK35OKSSYYDQ7LEPZANCNFSM4JPB4SDA>
.
--
Jairo Llopis
|
On Fri, Jan 24, 2020 at 12:23 PM Jairo Llopis ***@***.***> wrote:
OK, then can this be merged already? It won't affect until you deploy the
changes actually.
Sure
I wonder if you want me to apply these manually to web and website repos,
in PRs, given they contain most js code and will maybe produce some errors
in eslint... It can also serve as playground.
No problem, go ahead.
…-sbi
|
I don't have merge permissions here, could anybody merge please? |
A couple of fixes missing from OCA#618. @Tecnativa TT20357
Implement changes from OCA/maintainer-quality-tools#618 and OCA/maintainer-quality-tools#628. @Tecnativa TT20357
I'm late into this conversation but does that mean we're going to fix all the migration PRs that haven't been merged yet. It's a lot of work, even though I know it's for the best... |
Implement changes from OCA/maintainer-quality-tools#618 and OCA/maintainer-quality-tools#628. @Tecnativa TT20357
I don't think all will need to be fixed, but maybe some.
As migrations usually don't collide (all is new code), most chances are
that this will mean just do a rebase and an amend.
El vie., 24 ene. 2020 a las 13:50, Laurent Mignon (ACSONE) (<
[email protected]>) escribió:
… I'm late into this conversation but does that mean we're going to fix all
the migration PRs that haven't been merged yet. It's a lot of work, even
though I know it's for the best...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#618?email_source=notifications&email_token=AAHNXDKZM7LNACW2N33SD4TQ7LW2LA5CNFSM4JPB4SDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ22YRY#issuecomment-578137159>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHNXDJATWKTCD2A5YMFXRDQ7LW2LANCNFSM4JPB4SDA>
.
--
Jairo Llopis
|
you are right @yajo Neverthless, in any case the PRs will no longer be mergeable. 😱 😏 |
Yes, I guess the amend will be required anyway. Merge them quick before february 15th! 😁 |
@sbidoul If I propose OCA/stock-logistics-warehouse#828 in this repo during the next week, do you think it can be included in the next pre-commit files update? |
@guewen Sure! |
Implement changes from OCA/maintainer-quality-tools#618, OCA/maintainer-quality-tools#628 and OCA/maintainer-quality-tools#630. @Tecnativa TT20357 squash! [IMP] pre-commit update
Implement changes from OCA/maintainer-quality-tools#618, OCA/maintainer-quality-tools#628 and OCA/maintainer-quality-tools#630. @Tecnativa TT20357
Implement changes from OCA/maintainer-quality-tools#618, OCA/maintainer-quality-tools#628 and OCA/maintainer-quality-tools#630. @Tecnativa TT20357 squash! [IMP] pre-commit update
Implement changes from OCA/maintainer-quality-tools#618, OCA/maintainer-quality-tools#628 and OCA/maintainer-quality-tools#630. @Tecnativa TT20357 squash! [IMP] pre-commit update
Implement changes from OCA/maintainer-quality-tools#618, OCA/maintainer-quality-tools#628, OCA/maintainer-quality-tools#630 and OCA/maintainer-quality-tools#631. @Tecnativa TT20357
This commit includes:
eslint-config-prettier
and removing stylistic checks to avoid conflicts with Prettier.Promise
as a builtin for v13 (this was missed before, so I take this chance to add that)..travis.yml
so that when it gets merged downstream it gets less diffs when passed trhough Prettier.eslint --fix
so we get less warnings and more fixes.Some insights:
[DO NOT MERGE] Prettier test web#1441[IMP] Add Prettier and ESLint with --fix #618 (comment) as an example of how a web repo looks after this change.A beta XML Prettier plugin exists, which could be used in the future to autoformat XML files too!But it's not usable for us right now, as you can see in Commented elements are uncommented prettier/plugin-xml#13 (comment)Once that's fixed, we can use a configuration similar to How to integrate in pre-commit? prettier/plugin-xml#17 (comment) to integrate here.@Tecnativa @sbidoul @moylop260 OCA/maintainer-tools#323 (comment) TT20357