-
Notifications
You must be signed in to change notification settings - Fork 2
Add or modify or delete rules
In order to add, modify or delete rules, you'll have to follow a few steps.
This is by far the most important thing you can do in your life. If you wish to change the set of rules, you need to have a working repo locally.
git clone [email protected]:TransitApp/javascript.git
cd javascript/packages/eslint-config-transit
-
npm i
— This will install the eslint config dependencies. -
npm i eslint eslint-plugin-import
— This will install the peer dependencies. -
npm run test
— To check if everything is working on your local.
Once everything is good in da hood, you'll be able to modify the rules.
Adding rules must be discussed and approved by your peers. Once approved, here's the things you'll have to do:
-
Find the rule's name you wanna add on ESLint. A good trick is to force ESLint to give you an error in your IDE for the rule you want to add and pick up the name from there. Once you have it, look it up on ESLint's website to check out the options available.
-
Add a new entry in
index.js
module.exports = { ... rules: { 'my-new-rule': [2, 1, { option1: true, option2: false }], // Look up the configuration your rules can take. }, };
-
Write a test case in
eslint-config-transit-test.js
. Test cases are basically testing your lint configuration. You should be able to write code that belongs to the linting rule you just added, and the linter should pass. You can test it by runningnpm run test
. -
Pull request it, so your peers can review.
If you a repo maintainer, please follow along.
- Once merged, create a new commit with the version bump. Please, follow the semver standards. If you're not sure ask someone.
- After all of that you can run
npm publish
, which will publish the package on the NPM registry.
The process is very similar to adding rules, except you can just delete/modify rule directly from index.js
. Again, pull request it for your peers to review, then bump up the version according to semver. Then publish to NPM.
If you're not sure about any of these steps, please take a look at the Add rules section.