Use package.json for eslint configurations

Use package.json for eslint configurations

{mr.b}
TekTalks
Published in
1 min readNov 30, 2018

--

So this a bit of sequel on my tutorial right here for sublime text. If you haven’t already, please visit the link.

From that tutorial I had the entire eslint conifgurations under .eslintrc file. Which it’s not a problem really, It will completely work as expected. BUT just to play around, you can actually have the eslint configurations, rules and etc on your package.json. Nice right? So here’s how to do it. Just simply add the key “eslintConfig” config on your package.json and start adding your eslint rules.

Here’s an example.

Notice under “eslintConfig” we extends to “airbnb-base” that means it will use the very famous airbnb linting rules. And if you wan’t to override or add rule that is not on airbnb just specify it under the “rules” key. And by the way, you can extends to other linting rules if you like. Now, don’t forget to install “eslint-config-airbnb-base” on your dev dependencies, “yarn add eslint-config-airbnb-base -D.”

This should work on Sublime Text, VSCode or any IDE that you like.

If your using Sublime Text you may want check my other tutorial Make coding Reactjs, JSX and Es6 on Sublime Text better with eslint.

Happy coding!

--

--