springernature / eslint-config-springernature

ESLint shareable config used at Springer Nature
MIT License
3 stars 0 forks source link

adds node 'use strict' requirement #47

Closed jpw closed 4 months ago

jpw commented 3 years ago

We want to use strict mode in node.

So we are mainly using CommonJS modules, and they require 'use strict'; at the top of each file to trigger strict mode. It's boilerplate, but IMO well worth it. This PR amends the linter to throw errors if a node module is not being run in strict mode.

This change may inconvenience authors of new node projects, if so I think they can override in their project .eslintrc. Personally I think it's a better default to enforce strict mode when linting existing projects and see how it impacts ECMAScript module authors later...

Note the eslint strict syntax looks a bit weird IMO, but it seems to work as desired.