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

Install a .clang-format file instead of delegate to gts package .clang-format #120

Closed
usergenic opened this issue Jan 25, 2018 · 6 comments

Comments

@usergenic
Copy link

This is useful for IDEs and tooling to recognize the intended clang-format settings for format-on-save behaviors etc.

@ofrobots
Copy link
Contributor

Thanks for the suggestion! I think it is a good idea. The only reason we didn't do it so far to make sure we roll out updates to the config without having to force users to update their local copies. The use case of exposing the setting to the IDEs is a good one though.

We can probably install a copy at init time, and do an up-to-date check on gts check and gts fix.

@JustinBeckwith
Copy link
Collaborator

As much as I'd like the IDE integration, part of the appeal of this library is that it's a no-config, easy to update, opinionated thingy. Once we start exposing the .clang-format, its a slippery slope to not being opinionated.

I wonder how tools like standardjs and prettier handle this kind of stuff.

@usergenic
Copy link
Author

If the IDE doesn't support redefining the config file location, a temporary workaround as a developer can be to copy or symlink to the files inside ./node_modules/gts/.

I personally like the idea that gts check could basically warn "hey you have a local config which is different than the one in the gts package" and "gts fix" could remedy by refreshing local/overwriting it. Whether gts init always installs the local copies may not be as important, though it would be nice if it had a flag/option to do so.

@usergenic
Copy link
Author

This matters for tslint.json too although in the tslint.json example they can have an extends property that references the gts package's config. (#119)

@ofrobots
Copy link
Contributor

I think the slope would be a lot slipperier for tslint.json. For .clang-format, there is so little to customize in there (it's a 1-liner). Providing a copy of the file doesn't necessarily invite the user to go edit it, IMO. If a user really does go and edit their format, they really, absolutely, wanted to follow a different coding format.

If such a user can still derive value from this module – that is – they value the compiler, lint configs and the tooling; then I think we should let them.

"Opinionated by default; not inviting customization; but ultimately allowing it" is the philosophy I would like to follow.

@JustinBeckwith
Copy link
Collaborator

I can get behind that :)

ofrobots added a commit to ofrobots/ts-style that referenced this issue Jun 3, 2018
`init` now generates a .clang-format file. This allows IDEs to pick up
the config and integrate well with the gts provided style.

Fixes: google#120
ofrobots added a commit that referenced this issue Jun 4, 2018
`init` now generates a .clang-format file. This allows IDEs to pick up
the config and integrate well with the gts provided style.

Fixes: #120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants