Linting is important part of code development that provides static analysis and helps to find bugs in code. Integrating it with editors makes it more efficient, as problems can be solved as you write the code, rather than in a cycle later on.
It also helps to developers to adhere to various style guidelines during the coding stage, rather than only finding out at review time.
It is recommended for any new project to have linting set up from the start.
This respository is has ESLint for providing javascript analysis. It is a highly flexible tool especially as it is pluggable, so more rules can be added easily.
The rules turned on here, are a combination of the rules used for the Hello and Activity Stream projects.
Editor integration is where developers using linting tools can really gain time. They can get feedback on their code as they are writing it, flagging up potential issues before they even try to run it.
Additionally, there are some plugins that are recommended. Included in this example repository:
- eslint-plugin-json
- Provides linting of json files.
- eslint-plugin-mocha
- Provides rules for various good practices for Mocha tests.
- eslint-plugin-promise
- Provides rules for enforcing best practices for Javascript promises.
Not included, but useful depending on the project:
- eslint-plugin-mozilla
- A collection of rules that help enforce various coding practice from Mozilla.
- Mainly based on chrome style code, can help with module imports for example.
- eslint-plugin-react
- Provides React specific linting rules.
The web-ext tool provides its own linting mechanism for checking WebExtension based add-ons conform to specific rules.