Skip to content

ancazzz/eslint-config

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-config

This repository contains some custom ESLint rules.

This project only works with Node.js 12 and later.

Rules

readable-stringify

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 value 2): the expected value for the third argument

Contributing

Set up

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 install

at the root of the project.

Running tests

This project has 2 set of tests:

  • unit tests - in the tests directory
  • end to end tests - in the e2e directory

To start the unit tests run

npm run test-unit

To start the 2e2 tests run

npm run test-2e2

you can also run all the tests at once with

npm test

The tests should be considered as successful if their return code is 0. The will likely not log much if they don't fail.

Adding a new rule

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.

Testing with docker

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.1%
  • Dockerfile 1.9%