Enhance the padding-line lint rules #1146
Merged
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.
DEFRA/water-abstraction-team#115
We enhanced our linting rules to enforce spaces around blocks and expressions. This is a great step to helping folks 'fall into the pit of success' and avoid reviewers having to nitpick PRs.
But having enabled it, we've spotted that it is highlighting some things that are perfectly acceptable.
We also think there are a few other options we could add.
So, this change is about building on the padding-line-between-statements we've already added.
Notes
That last change ensures we put a blank line between variable declarations and the logic.
Running the linter across all files highlighted a number of violations. But the first 3 we fixed in this change give a good example of what to expect from this rule.
app/presenters/base.presenter.js
- simple example of separating variables from logic to help readabilityapp/presenters/bill-runs/two-part-tariff/review-bill-run.presenter.js
- demonstrating that comments are handled!app/presenters/licences/set-up.presenter.js
- this is an example of compromise. It could be rightly argued it is better to have the var declaration next to the logic. But for the sake of consistency and having a tool to automate this stuff, we'll compromise and make the change