GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [ENHANCEMENT] Add `'use strict'` directive to cjs files · Issue #774 · npm/node-semver

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

New issue
Copy link
New issue
Copy link
Closed
#780
Closed
[ENHANCEMENT] Add 'use strict' directive to cjs files#774
#780
Copy link

Description

@Fdawgs
Fdawgs
opened on Mar 25, 2025
Issue body actions

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.

Reacted by Marc Bernard
Reacted by Marc Bernard

Activity

  1. ljharb commented on Mar 25, 2025

    @ljharb
    ljharb
    on Mar 25, 2025
    Contributor
    More actions

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

  2. wraithgar
    added a commit that references this issue on May 12, 2025

    fix: add missing `'use strict'` directives (#780)

    This issue will close once commit fcafb61 is merged into the 'main' branch.
    fcafb61
  3. wraithgar
    closed this as completedin #780on May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.