Registry / testing / postman-eslint

postman-eslint

JSON →
library1.0.3jsnpmunverified

A CLI tool for linting JavaScript scripts (pre-request and test scripts) in Postman collections using ESLint. Version 1.0.3, stable release. It fetches a Postman collection via API, extracts scripts from collection/folder/request levels, and runs ESLint with your local flat config. Differentiator: specifically targets Postman script linting with built-in globals like `pm`, uses Postman Collection SDK for parsing. Requires Node.js >=14.0.0.

npm install postman-eslint
INSTALL
IMPORT
SIG · POSTMAN-ESLINT
P
postman-eslint
testingjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

postman-eslint (CLI)
npx postman-eslint --collection <id> --api-key <key>
node postman-eslint.js
The package is a CLI tool, not a library. Use npx or install globally. The binary is `postman-eslint`.
ESLint config sample
cp node_modules/postman-eslint/eslint.config.js ./
require('postman-eslint/eslint.config.js')
The config file is meant to be copied, not imported. It uses CommonJS (module.exports) and is included for convenience.
Environment variable for API key
export POSTMAN_API_KEY=your_key
postman-eslint --api-key $POSTMAN_API_KEY
The CLI will read POSTMAN_API_KEY from environment if --api-key is not provided. Using env var is more secure.

Installs the CLI globally, sets the API key via environment variable, and lints the specified Postman collection.

npm install -g postman-eslint export POSTMAN_API_KEY='your-api-key' postman-eslint --collection 'your-collection-id'
postman-eslint --version
Debug
Known issues
gotchaRequires ESLint flat config format (eslint.config.js). If you use .eslintrc, it will not work.
fix
Create or convert to eslint.config.js using flat config format. See https://eslint.org/docs/latest/use/configure/configuration-files-new
affects: >=1.0.0
gotchaMust have an eslint.config.js in the current working directory; does not search parent directories.
fix
Ensure eslint.config.js exists where you run the command.
affects: >=1.0.0
gotchaAPI key is required; will fail if not provided via --api-key or POSTMAN_API_KEY environment variable.
fix
Provide API key via command line option or environment variable.
affects: >=1.0.0
deprecatedPackage version 1.0.3 uses older postman-collection SDK; consider updating if available.
fix
Check for newer versions of postman-eslint and postman-collection.
affects: 1.0.0 - 1.0.3
Errors
Common errors & fixes
Error: No ESLint config found. Please ensure eslint.config.js exists in the current directory.
Missing eslint.config.js file in the project root.
fix
Create an eslint.config.js file (flat config) in the directory where you run postman-eslint.
Error: API key is required. Provide via --api-key or POSTMAN_API_KEY environment variable.
Neither command-line option nor environment variable set.
fix
Set POSTMAN_API_KEY environment variable or pass --api-key argument.
Error: Failed to fetch collection. Check collection ID and API key.
Invalid collection ID or API key, or network issue.
fix
Verify collection ID and API key; ensure internet connectivity.
Error: Cannot find module 'eslint'
ESLint is not installed in the project.
fix
npm install --save-dev eslint
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
postman-collectionrequiredUsed to parse Postman collections from JSON response
eslintoptionalPeer dependency for linting; must have ESLint installed in the project
Agent activity
4 hits · last 30 days
node
4
Resources
postman-eslint — npm install postman-eslint · libregistry