Skip to content
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

Switch hints to use double quotes everywhere #5261

Merged
merged 5 commits into from
Mar 7, 2019

Conversation

scheibo
Copy link
Contributor

@scheibo scheibo commented Mar 6, 2019

Also, have Battle#hint take Side per @urkerab's suggestion.
Followup to #5258, no functionality changes.

Also, have `Battle#hint` take Side per @urkerab's suggestion.
Followup to smogon#5258, no functionality changes.
data/mods/gen1/scripts.js Outdated Show resolved Hide resolved
Co-Authored-By: scheibo <[email protected]>
@Zarel
Copy link
Member

Zarel commented Mar 6, 2019

The rule I have in mind is:

foo(bar, baz);
// good

foo(bar,
  baz);
// good

foo(
  bar,
  baz
);
// good

foo(bar,
  baz
);
// bad

foo(
  bar,
  baz);
// bad

@scheibo
Copy link
Contributor Author

scheibo commented Mar 6, 2019

I agree, that seems like a good style. TBH though, I think we should be using an automatic formatter (prettier, clang-format, etc, take your pick) and if we can't configure it with the style we want completely (the string quoting rules spring to mind) we should just accept it because not having to GAF about formatting issues and having an automatically uniform codebase far outweighs trying to manually achieve 'perfection' but having it poorly done (humans are fallible). I go into more details about that in the doc I'm writing reviewing PS with suggestions, but because its came up twice recently I figured I might as well float the idea your way earlier.

scheibo added 2 commits March 6, 2019 10:44
Small consistency nit with no functional different, but volatiles
are IDs and all the rest are lowercase.
@Zarel
Copy link
Member

Zarel commented Mar 7, 2019

Hm. I've always thought prettier output was uglier than the manual stuff we've been doing. I don't really mind everything being somewhat inconsistent, in exchange for being able to convey information with code structure.

sim/battle.ts Outdated Show resolved Hide resolved
@Zarel
Copy link
Member

Zarel commented Mar 7, 2019

I think the current tradeoff is good enough; we leave some formatting decisions in the hands of coders (and accept that they might be wrong sometimes), in exchange for having some flexibility in how you want the code to look.

Co-Authored-By: scheibo <[email protected]>
@Zarel Zarel merged commit 295f7c6 into smogon:master Mar 7, 2019
@scheibo
Copy link
Contributor Author

scheibo commented Mar 7, 2019

Hm. I've always thought prettier output was uglier than the manual stuff we've been doing. I don't really mind everything being somewhat inconsistent, in exchange for being able to convey information with code structure.

I haven't used prettier, I'm using a clang-format based solution that we use at work (I suggested prettier because its more popular). Its not perfect (I really dont like that it makes type A = 'foo' | 'bar' | ... into type A = 'foo'|'bar'|... for example), but I've stopped fighting it after having used it for several years (and you can always selectively turn it off for sections where it does something stupid. I might even be able to configure, I havent bothered looking into it).

I really like the style of the new PS (and Preact PS client) code. I think before suggesting a move to an automatic formatter more formally I'll need to try setting one up and seeing concretely what changes it would make. I don't know about prettier, but I think clang-format comes pretty close to what we're doing anyway (minus the "/`/' stuff)

@scheibo scheibo deleted the hints3 branch March 10, 2019 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants