forked from balena-io/etcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: revise ESLint built-in configuration (balena-io#1149)
There are a lot of new rules since the last time I revised the ESLint rules documentation. I've updated the main `.eslintrc.yml` to include some newer additions, plus I added another ESLint configuration file inside `tests`, so we can add some stricted rules to the production code while relaxing them for the test suite (due to the fact that Mocha is not very ES6 friendly and Angular tests require a bit of dark magic to setup). This is a summary of the most important changes: - Disallow "magic numbers" These should now be extracted to constants, which forces us to think of a good name for them, and thus make the code more self-documenting (I had to Google up the meaning of some existing magic numbers, so I guess this will be great for readability purposes). - Require consistent `return` statements Some functions relied on JavaScript relaxed casting mechanism to work, which now have explicit return values. This flag also helped me detect some promises that were not being returned, and therefore risked not being caught by the exception handlers in case of errors. - Disallow redefining function arguments Immutability makes functions easier to reason about. - Enforce JavaScript string templates instead of string concatenation We were heavily mixing boths across the codebase. There are some extra rules that I tweaked, however most of codebase changes in this commit are related to the rules mentioned above. Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
- Loading branch information
Juan Cruz Viotti
authored
Mar 8, 2017
1 parent
c93f528
commit 6c8bc11
Showing
52 changed files
with
514 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.