Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure blank line b4 function return statements
DEFRA/water-abstraction-team#115 This has been an unwritten convention we often pick up in the PRs of those new to the team. We like to see a blank line before the `return` statement in a function. ```javascript // Bad function rubbishNameGenerator () { const firstName = 'John' const lastName = 'Doe' return `${firstName} ${lastName}` } // Good function rubbishNameGenerator () { const firstName = 'John' const lastName = 'Doe' return `${firstName} ${lastName}` } ``` But we don't want to see it all the time! // Bad function rubbishNameGeneratorV2 (useAlternate = false) { if (useAlternate) { return 'Jane Doe' } return 'John Doe' } // Good function rubbishNameGeneratorV2 (useAlternate = false) { if (useAlternate) { return 'Jane Doe' } return 'John Doe' } ``` We weren't sure we could make ESLint see the difference but it turns out we can. So, this change enables and adds an initial configuration for the rule [padding-line-between-statements](https://eslint.style/rules/js/padding-line-between-statements). > We expect to expand the config to cover some more unwritten conventions regarding white space in our code. But those will come separately!
- Loading branch information