Giter Club home page Giter Club logo

docker-jsonlint's Introduction

docker-jsonlint

Build Status Docker Hub pulls

Docker Hub badge

Dockerized jsonlint with various versions, easy to use and easy to integrate with CI.

Table of Contents

Usage

Command line

Use latest version

docker run --rm -v $PATH_TO_JSON:/json peterdavehello/jsonlint jsonlint -q JSON_FILE.json

# Please replace "$PATH_TO_JSON" with your custom path,
# and replace "JSON_FILE.json" with your real json file filename.

Use specific version

Just like above, but you can specify version of jsonlint, for example:

docker run --rm -v $PATH_TO_JSON:/json peterdavehello/jsonlint:1.6.3 jsonlint -q JSON_FILE.json

# Please replace "1.6.3" with the version number you want.
# Don't forget to replace "$PATH_TO_JSON" & "JSON_FILE.json".

Continuous Integration (CI)

Travis CI

Enable Docker service in your .travis.yml:

services:
  - docker

And use the same command in the scripts part as the command line mentions, for example:

services:
  - docker

scripts:
  - docker run --rm -v $TRAVIS_BUILD_DIR:/json peterdavehello/jsonlint:1.6.3 jsonlint -q example.json

This will lint a example json file called example.json

GitLab CI

Add this block to your .gitlab-ci.yml:

jsonlint:
  stage: lint
  variables:
    jsonlint_version: "1.6.3"
  image: peterdavehello/jsonlint:$jsonlint_version
  only:
    changes:
      - "**/*.json"
  script:
    - find . -name "*.json" | xargs -n 1 jsonlint -q

Replace "1.6.3" with the version you want to use, you can also use "latest" for the very new version.

jsonlint cli usage

Just pass -h/--help to jsonlint to get its help message, for example:

$ docker run --rm peterdavehello/jsonlint jsonlint --help

Usage: jsonlint [file] [options]

file     file to parse; otherwise uses stdin

Options:
   -v, --version            print version and exit
   -s, --sort-keys          sort object keys
   -i, --in-place           overwrite the file
   -t CHAR, --indent CHAR   character(s) to use for indentation  [  ]
   -c, --compact            compact error display
   -V, --validate           a JSON schema to use for validation
   -e, --environment        which specification of JSON Schema the validation file uses  [json-schema-draft-03]
   -q, --quiet              do not print the parsed json to STDOUT  [false]

For more details, check out the jsonlint project page.

Build

Build command, you need to specify a valid jsonlint version argument to jsonLINT_VERSION:

docker build --build-arg JSONLINT_VERSION="1.6.3" -t docker-jsonlint .

# Replace "docker-jsonlint" with the preferred image name

You can find a valid version on jsonlint npm registry page, or just poke the registry to retrieve more details.

docker-jsonlint's People

Contributors

peterdavehello avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mfominov svx

docker-jsonlint's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

dockerfile
Dockerfile
  • node 20-alpine
travis
.travis.yml
  • node 18

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.