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

yaml-lint

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaml-lint

A simple (CLI) tool to lint YAML files

  • 1.7.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
50K
decreased by-82.46%
Maintainers
1
Weekly downloads
 
Created

What is yaml-lint?

The 'yaml-lint' npm package is a tool for validating YAML files. It checks for syntax errors and ensures that the YAML content is properly formatted. This is particularly useful for developers who work with YAML configuration files and need to ensure their correctness.

What are yaml-lint's main functionalities?

Linting YAML files

This feature allows you to lint a YAML string to check for syntax errors. If the YAML content is valid, it will log 'YAML is valid'. If there are any errors, it will catch them and log 'YAML is invalid' along with the error details.

const yamlLint = require('yaml-lint');

const yamlContent = `
foo: bar
baz: qux
`;

yamlLint.lint(yamlContent)
  .then(() => {
    console.log('YAML is valid');
  })
  .catch((error) => {
    console.error('YAML is invalid:', error);
  });

Linting YAML files from the filesystem

This feature allows you to lint a YAML file from the filesystem. It reads the file content and checks for syntax errors. If the file is valid, it will log 'YAML file is valid'. If there are any errors, it will catch them and log 'YAML file is invalid' along with the error details.

const yamlLint = require('yaml-lint');
const fs = require('fs');

const yamlFilePath = 'path/to/your/file.yaml';

fs.readFile(yamlFilePath, 'utf8', (err, data) => {
  if (err) throw err;

  yamlLint.lint(data)
    .then(() => {
      console.log('YAML file is valid');
    })
    .catch((error) => {
      console.error('YAML file is invalid:', error);
    });
});

Other packages similar to yaml-lint

Keywords

FAQs

Package last updated on 13 May 2022

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