Skip to content

[ENHANCEMENT] Add 'use strict' directive to cjs files #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Fdawgs opened this issue Mar 25, 2025 · 1 comment · May be fixed by #780
Open

[ENHANCEMENT] Add 'use strict' directive to cjs files #774

Fdawgs opened this issue Mar 25, 2025 · 1 comment · May be fixed by #780

Comments

@Fdawgs
Copy link

Fdawgs commented Mar 25, 2025

It would be beneficial to add the 'use strict' directive to all cjs files in this repo. Strict mode can improve performance by eliminating some JavaScript features that hinder optimizations. It also helps avoid subtle bugs by enforcing more consistent scoping and variable declarations.

At present this directive is dotted around a handful of files in the repo.

The MDN article on strict mode alludes to it, but the V8 JS engine used by Node will use more optimised execution paths when strict mode is enabled. See related Stack Overflow discussion for an example.

Happy to make a PR to resolve this.

@ljharb
Copy link
Contributor

ljharb commented Mar 25, 2025

This is a great idea, and it can be enforced with the eslint strict rule.

@Fdawgs Fdawgs linked a pull request Apr 24, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants