-
Notifications
You must be signed in to change notification settings - Fork 31
style(js,json,less): use 'prettier' to handle code style #580
style(js,json,less): use 'prettier' to handle code style #580
Conversation
prettier reduces the barrier to entry, by automatically handling all js and less code styling automatically. Unlike ESLint every rule, in prettier is automatically fixable, with special attention payed to how line wrapping is handled.
remove eslint disables intended for use with eslint-config-google
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 looks like it's replacing single quotes to double quotes, breaking the google style guide?
@davidmsibley Currently I have |
@davidmsibley updated to use single quotes |
I'm confused about a couple things in this. I gotta read it more, but I was referring to the single to double quote replacement that was happening in the js, not the less. Now the less is switched from double to single quotes. Unrelated to whether or not we use prettier, I'm WAY more opposed to code being changed on commit than stopping you from committing. That sounds like many, many unintended problems waiting to happen. |
😆 The codeclimate failure is occurring because the normalized code style allows codeclimate to detect nine places with code similarity that it wasn't able to before. |
Does this automatically re-format to use Google's code style or does this use a separate style that we would have to match to Google's? |
Okay, I hadn't understood that nuance. -1. Code is either in Google Style or it's not. Automatically different, even subtly, is not Google Style. I'd only be open to automatic code styling if it's automatically styling to the adopted code style. :) This also may be a tool that it'd be best to adopt on a less-core module or three before adopting it here in |
The subtle differences are trailing commas and quotes.
Or we could make the automated style the adopted style. 😉
I understand the concern, in the past formatters could be flaky. 😨 Prettier and ESLint are based of ESTree an AST standard developed by Mozilla for accurately representing and safely manipulating code structure. 👍 Furthermore, Prettier is in production use today on some major projects: React, Jest, Yarn, and others.
🤷♂️ With the clean breakup of modules, it is arguably questionable if there is a "core" and what isn't core. Until recently I thought
Since all the modules are closely interrelated, what is module is sufficiently "low risk" in your mind? |
|
Closing this, til decision is made over in UW-Madison-DoIT/widget-creator#25 |
Rather than throwing an error during
precommit
hook.prettier
will reformat all the code to meet the styleguide standards automatically.Check out this talk for more information on the 'why' to use prettier.
part 1 of #535
part 2 is in #581
Contributor License Agreement adherence: