Add rubocop to Rails template #264
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update:
Oops! Sorry, please don't merge (yet).
I just noticed that our opal-dep unfortunately blocks
the latest version of rubocop from getting installed:
I still think that adding rubocop would be a good idea,
but this PR should not be merged until our opal dependency
has been updated to
>= 1.0.0
(which should resolve the conflict).Sorry for spotting this problem late (after the PR was already up).
In my testing it worked as intended because I have a recent version
of rubocop installed globally (outside the bundle). But this can obv
not be relied on in the installer that is shipped to users.
This gives users who start with the rails template
a lint-clean installation and a safe
.rubocop.yml
.You can try it out by running:
This will:
rubocop -a
to auto-fix the (minor) linter-complaints that the default install comes withMyApp
and a safe .rubocop.yml that disables all rules that can break Hyperstack, plus tweaks some to allow for Hyperstacky syntax (e.g. multi-line blocks with { })It does in no way enforce the use of rubocop in the new project
but provides a safe starting point to users who want to use it.
I believe this is important because the rubocop defaults (without a .rubocop.yml)
are not safe for Hyperstack. As of today, when you run
rubocop -a
on a vanillaHyperstack project without this config then it will almost certainly break.