This repository contains some custom ESLint rules.
This project only works with Node.js 12 and later.
The readable-stringify rule can be used to enforce the use of JSON.stringify
with 3 arguments. The last arguments should be a number to ensure the output
of JSON.stringify is indented and human readable.
This rule takes the following option:
spacing(default value2): the expected value for the third argument
In order to run this project, you will need Node.js. On MacOS or Linux, the easiest way to install Node.js is to use nvm.
Also, you will need to install ESLint locally. This can be done using npm (which is provided with Node.js).
Simply run
npm installat the root of the project.
This project has 2 set of tests:
- unit tests - in the
testsdirectory - end to end tests - in the
e2edirectory
To start the unit tests run
npm run test-unitTo start the 2e2 tests run
npm run test-2e2you can also run all the tests at once with
npm testThe tests should be considered as successful if their return code is 0. The will likely not log much if they don't fail.
To add a new rule, please add a new file in the rules directory with the code
of the rule inside.
Also, please consider updating the unit tests and the end-to-end tests to cover the new rule.
A Dockerfile is provided for testing convenience.
You can build it with
docker build . -t eslint
Then run it with
docker run -ti eslint
The container should exit properly if the tests are passing.