jflint
raw JSON → 0.3.2 verified Fri May 01 auth: no javascript
jflint is a CLI tool that helps lint a Declarative Jenkinsfile by wrapping the Jenkins Pipeline linting API. It sends the Jenkinsfile content to a specified Jenkins server and displays the validation result. The current stable version is 0.3.2. The tool supports Node.js v4–v7 (older versions). Unlike official Jenkins CLI methods (SSH/curl), jflint provides a simpler command-line interface, optional configuration file, and built-in handling of authentication and CSRF. It is a lightweight npm package with no external dependencies.
Common errors
error Error: getaddrinfo ENOTFOUND ↓
cause Invalid Jenkins URL or network issue.
fix
Check jenkinsUrl in config or -j option, ensure Jenkins is reachable.
error HTTP 401 Unauthorized ↓
cause Missing or incorrect username/password.
fix
Provide valid credentials via -u, -p, or config file.
error HTTP 403 No valid crumb was included in the request ↓
cause CSRF protection enabled but not handled.
fix
Use --csrf-disabled if CSRF is disabled, or generate a crumb token.
Warnings
deprecated Node.js >=4 required; Node.js versions 4-7 are end-of-life and insecure. ↓
fix Upgrade Node.js to a modern version (v12+), though jflint may not be actively maintained for newer Node.
gotcha jflint does not actually lint Jenkinsfiles locally; it sends the file to a Jenkins server for validation. A running Jenkins instance is required. ↓
fix Ensure a Jenkins server is accessible and the URL is correct.
gotcha Credentials (username/password) are passed as command-line arguments, which can be visible in process lists or command history. ↓
fix Use the config file to avoid exposing credentials in command line, or set environment variables.
breaking CSRF protection must be handled via --csrf-disabled flag if disabled; otherwise requests will fail. ↓
fix Specify --csrf-disabled if Jenkins CSRF protection is turned off, or configure Jekins to accept CSRF token.
Install
npm install jflint yarn add jflint pnpm add jflint Imports
- jflint wrong
require('jflint')correctnpx jflint Jenkinsfile
Quickstart
// Install globally, then run
$ npm install -g jflint
$ jflint -j http://jenkins.example.com -u admin -p password /path/to/Jenkinsfile
// Or use npx without install
$ npx jflint -j http://jenkins.example.com -u admin -p password /path/to/Jenkinsfile
// With config file .jflintrc
{
"jenkinsUrl": "http://jenkins.example.com",
"username": "admin",
"password": "p@ssword"
}
$ jflint /path/to/Jenkinsfile