Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 2.6 KB

Linting.md

File metadata and controls

59 lines (42 loc) · 2.6 KB

Linting

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.

ESLint - Javascript Linting

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

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.

How to integrate

Useful ESLint plugins.

Additionally, there are some plugins that are recommended. Included in this example repository:

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.

Web-ext lint

The web-ext tool provides its own linting mechanism for checking WebExtension based add-ons conform to specific rules.