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

liquid-linter-cli

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liquid-linter-cli

Command-line wrapper for the liquid template language linter.

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Liquid Linter CLI

Project Stage Maintenance Awesome License Dependency Status Latest Version on NPM

Staple Remover Logo

“Great things are done by a series of small things brought together.” ~ Vincent Van Gogh

This package is a wrapper for the NodeJs liquid-linter package, allowing it to be run from the command-line interface (CLI).

Installation

Install this package with NPM using npm install liquid-linter-cli --save (optionally adding --global for a system-wide install) or with Yarn using yarn add liquid-linter-cli (or yarn global add liquid-linter-cli for a system-wide install).

Usage

The lint command can be called with one or more paths of files or folders that need to be linted. The command has support for pipelines. when given a directory, it is scanned for the following file extensions:

  • .htm
  • .html
  • .liquid
  • .lqd
  • .markdown
  • .md

Currently the linter does not have a way to exclude files or folders. An example of how to achieve this is given in the "Pipes" section.

Simple usage

The most simple use is simply:

liquid-linter /path/to/directory/or/file/to/lint

Multiple sources

The lint command has support for multiple paths. This can be a mix of files and folders:

liquid-linter /path/to/directory/one /path/to/file /path/to/directory/two

Custom blocks and tags

Liquid has support for custom tags. The liquid-linter makes the distinction between tags (tags that do not require an end tag) and blocks (tags that do require an end tag).

Custom tags and blocks can be passed to the linter using the --custom-tag and --custom-block flags, respectively. Both can be added multiple times, to add more than one tag or block:

liquid-linter --custom-block section --custom-tag button --custom-tag color /path/to/directory

Piping

In order to exclude files and folder, the user has to create a list themselves which does not contain the files and/or folders that should be excluded.

One way to achieve this is by using a combination of find and xargs.

The following example shows how to lint all files and folders in the current directory except the node_modules and _site folders, and only for files with the .lqd extension (commonly used for includes)

find . -type f -name "*.lqd"     \
  -not -path './node_modules/*'  \
  -not -path './_site/*' -print0 \
| xargs -0 -n1 liquid-linter

Output

The output of the linter displays a list of files and the result of the linting of that file. Files with no issues are colored green, files with issues are colored red.

For files with issues, the line and column(s) at which the error occurred are show.

Example

screenshot of example output

The output is taken directly from liquid-linter. Any weird output or incorrect linting should be reported at the liquid-lint repository.

Contributing

This is an active open-source project. We are always open to people who want to use the code or contribute to it.

We've set up a separate document for our contribution guidelines.

Thank you for being involved! :heart_eyes:

Authors & contributors

The original idea and setup of this repository is by Potherca.

For a full list off all author and/or contributors, check the contributors page.

License

  • The logo for this project is the "Staple Remover" icon by Cassie McKown from the Noun Project

  • The code in this project is licensed under the MIT License

The MIT License (MIT)

Copyright (c) 2017 Dealerdirect B.V.
Copyright (c) 2019 Potherca

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 22 Dec 2020

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