Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npm-package-json-lint

Package Overview
Dependencies
Maintainers
1
Versions
90
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.

  • 8.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
159K
increased by7.95%
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

FAQs

Package last updated on 09 Jun 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc