Neutrinojs: Your flexible build tool

Marcellin Nshimiyimana
Friday Knowledge
Published in
3 min readMar 8, 2019

This week, I learned how to use neutrinojs to lint react components in a custom manner.

In this write up, I explain how this build tool helped me fix this annoying eslint issue.

Introduction

One of the sales pitches of Neutrinojs is that: you can use it to build and publish Reactjs components to npm.

One usage i found intriguing was their configuration api, which allows you to easily modify the build process in any way you want.

This flexibility makes Neutrinojs, friendly to both beginners and experienced developers.

Beginners get to take advantage of code management tools, without the need to know the ins and outs of them.

Experienced developers get to save project setup time and still be able to use their favorite build processes.

Neutrinojs allows developers to modify build process without ejecting!

You can check this Mozilla blog post for a simple tutorial!

Explanation

Problem

Suppose you wrote the code below

Then you run npm run lint , which throws an eslint error.

To fix this error, you run npm run lint -- --fix , which modifies your code and also throws an Airbnb-eslint related error.

Solution (power of Neutrinojs!)

Now you dig around and find out that you can get your desired syntax by overriding eslint’s function-paren-newline and comma-dangle rules.

So, you provide this override to Neutrinojs through its .neutrinorc.js config file.

After that, you revert back changes made by npm run lint -- --fix

Now, when run npm run lint you do not get any linting errors!

Note: Example used is part of the development of react-geojson-editor

Conclusion

Neutrinojs is a great tool for developers who want to take charge of their build processes and still take advantage of code management best practices done by smart people.

--

--

Marcellin Nshimiyimana
Friday Knowledge

Always debugging, because problem knowledge equals half the solution!