Skip to content

Latest commit

 

History

History
151 lines (109 loc) · 3.65 KB

README.md

File metadata and controls

151 lines (109 loc) · 3.65 KB

Tulip

ESLint Config Tulip

Sharable ESLint configuration. This configuration is made for Node.js apps.



Instructions:

  1. Install the package.
  2. Extend it in your eslint configuration.
  3. Enjoy cleaner code!. 🎉
  4. Contribute!

Installation

Make sure you are using Node.js v16.13.1 or higher. Open command prompt (or terminal) in your project folder and use:

npm i -D eslint eslint-config-tulip

This will install the configuration module and you can now use it in your project.

Adding TypeScript

If you are using TypeScript, then you also need to install the plugin and parser for TypeScript:

npm i -D @typescript-eslint/eslint-plugin @typescript-eslint/parser

Usage

Once you have installed the configuration module, you need to tell eslint to use it. You can do this by extending it in your config. ESLint can be configured either in your package.json file or in a separate eslint config file. For more instructions on configuring eslint, please refer to ESLint getting started guide ↗.

For package.json:

{
    "name": "your-project",
    ...
    "eslintConfig": {
        "extends": "tulip"
    }
}

For eslint configuration files (.eslintrc, .eslintrc.json, .eslintrc.js, or .eslintrc.yml):

{
	"extends": "tulip"
}

You can also integrate eslint into your code editor. Follow the instructions in the editors section↗ to set it up for your editor.

Adding TypeScript

If you are using TypeScript, then you need to extend the typescript configuration.

{
    ...
	"root": true,
	"parser": "@typescript-eslint/parser",
	"plugins": ["@typescript-eslint"],
    "extends": "tulip/typescript"
    ...
}

Using Prettier

If you wish to use prettier along with eslint, then you need to use the prettier module. This will turn off certain eslint rules that interfere with prettier.

{
	"extends": "tulip/prettier"
}

Using Typescript? Don't worry, I've got you covered!

{
	"extends": "tulip/prettier-ts"
}

Customizing

This ESLint configuration comes with the latest rules enabled according to my style guide. But, you may want to tweak it depending upon your preferences. Here's an example:

{
	"extends": "tulip",
	"rules": {
		"sort-keys": "off"
	}
}

The sort-keys rule requires you to sort your keys alphabetically. This is helpful when you have too many keys in the object, but you may want to turn this rule off if you are following some other order.

For more information, refer to the Official ESLint Documentation↗ or a more detailed one here↗.
Here's the list of all Available ESLint rules↗.

Contribute

  1. Fork this repository.
  2. Make your changes.
  3. Push your changes to a new branch in your fork.
  4. Submit a pull request!

Credits

License - MIT.

© Riday ♡.

Discord - Riday 💙#7468

Thank you to all those who helped me. 💙