-
Notifications
You must be signed in to change notification settings - Fork 203
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
Fixes #1434 - adding Prettier #1468
Conversation
Would it be possible to split out the commit with all the changes to the code? Ideally there would be one commit for removing eslint, one for adding prettier, and one for transforming code. Also, we'll need to update the .travis.yml config... right now it's exploding on |
I'd be interested to have @denschub take a look at this PR as well. |
There's still some eslint specific comments in the code, for example:
So if we decide there's no more usage for eslint, we should remove those. I wonder if we should document how this affects workflow in CONTRIBUTING.md as well. |
I wonder how people are using this w/ eslint though... with this change we lose out on all the recommended linting rules: http://eslint.org/docs/rules/ (and the few that we have added). |
@miketaylr hum yes, I may have been a bit quick on this PR. |
}); | ||
}); | ||
"Add a screenshot to a comment": function() { | ||
return FunctionalHelpers.openPage( |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@miketaylr Yes, it's Prettier's role, but maybe it's a bit too gross? You find that you lose what compared to eslint? |
We lose the "safety" stuff that eslint was checking. eslint was also checking boring things like, do you have a space before a paren -- in my mind, this is what Prettier is good at. Don't think about style, let the machine do style. But it doesn't tell us if we accidentally introduced a new global variable, for example: https://github.com/webcompat/webcompat.com/blob/master/.eslintrc#L6 It should be possible to have both eslint and prettier -- just get rid of the code style rules from eslint, and run prettier after that? I didn't study these yet, but I see: https://github.com/prettier/eslint-config-prettier |
@miketaylr right now, this recipe https://github.com/webcompat/webcompat.com/blob/master/package.json#L48 handle your comment above ? |
hum, let me rethink completely my PR. |
Yeah, I guess. (But I never use that...) To be clear, I'm +1 on prettier, it does way more than eslint --fix. I just don't want us to lose linting non-style stuff. |
Yeah, and I agree with you. |
@miketaylr another approch. Combined prettier with eslint. I have removed rules of eslint and have added prettier instead. We keep our lint/fix, with the Formatted Code by Prettier. What do you think ? |
@@ -9,7 +9,7 @@ module.exports = function(grunt) { | |||
cssPath: "webcompat/static/css", | |||
imgPath: "webcompat/static/img", | |||
banner: "/*! <%= pkg.title %>\n" + | |||
" * Copyright (c) <%= grunt.template.today(\"yyyy\") %> <%= pkg.author.name %>\n" + | |||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' + |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Interesting, while trying this locally I got the following error:
Wonder why that didn't get picked up... (I can fix it up). |
(ah that's because that code got merged in before @magsout made this PR. forgive me, I'm v slow sometimes...) |
@magsout this looks good, we should probably update CONTRIBUTING.md as well. One question about workflow... for some imaginary scenario:
Does that seem like the best way? |
Actually, I think we can merge this and I'll file a follow up issue to document recommended workflow. |
@miketaylr yes, it does 👍 |
Closes #1434
r? @miketaylr you write all JS of webcompat.
Every commit, this recipe https://github.com/webcompat/webcompat.com/pull/1468/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R56 Is triggered.
if any JS is modified, it is automatically added after a
git commit
https://github.com/webcompat/webcompat.com/pull/1468/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R62 ? I'm not sure if it's a good idea.The configuration is simple, I have modified only this option --trailing-com. (added a comma at the end of object)