You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

npm-package-json-lint

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-package-json-lint

Configurable linter for package.json files.

9.0.0
latest
Source
npmnpm
Version published
Weekly downloads
203K
-3.39%
Maintainers
1
Weekly downloads
 
Created

What is npm-package-json-lint?

npm-package-json-lint is a tool for linting package.json files, ensuring they adhere to a defined set of rules and best practices. It helps maintain consistency and correctness in package.json files across projects.

What are npm-package-json-lint's main functionalities?

Linting package.json files

This feature allows you to define a set of rules for linting package.json files. The code sample shows a configuration file that extends the default configuration and specifies rules for the name type, version format, and requiring an author field.

module.exports = {
  extends: 'npm-package-json-lint-config-default',
  rules: {
    'name-type': 'error',
    'version-format': 'error',
    'require-author': 'error'
  }
};

Custom rule definitions

You can define custom rules to enforce specific requirements in your package.json files. The code sample demonstrates how to restrict certain dependencies and require the scripts field.

module.exports = {
  rules: {
    'no-restricted-dependencies': ['error', ['lodash', 'underscore']],
    'require-scripts': 'error'
  }
};

Command-line interface

The package provides a CLI for linting package.json files. The code sample shows how to run the linter using npx and a specified configuration file.

npx npm-package-json-lint . --config .npmpackagejsonlintrc.json

Other packages similar to npm-package-json-lint

Keywords

lint

FAQs

Package last updated on 29 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts