Skip to content

Commit

Permalink
Ensure strict mode directive in all files
Browse files Browse the repository at this point in the history
DEFRA/water-abstraction-team#115

It is currently an unwritten convention (we are [working on](DEFRA/water-abstraction-team#117) fixing that!) to add 'use strict' to the top of all our files. Why?

> JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
> [MSDN docs - Strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)

When the alternate mode is named 'sloppy', would you want to use it!?

The docs do provide some further explanation of what declaring strict mode means

> Strict mode makes several changes to normal JavaScript semantics:
>
> 1. Eliminates some JavaScript silent errors by changing them to throw errors.
> 2. Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode.
> 3. Prohibits some syntax likely to be defined in future versions of ECMAScript.

For these reasons, this change updates our ESLint rules to ensure we do this.
  • Loading branch information
Cruikshanks committed May 12, 2024
1 parent 2ff8986 commit fe50c8a
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit fe50c8a

Please sign in to comment.