1 | # Swissquote ESLint preset
|
2 |
|
3 | ## Features
|
4 |
|
5 | - Provide a style guide for your JavaScript
|
6 | - Warns on common mistakes in JavaScript
|
7 | - Works with EcmaScript 2015+ using the `babel-eslint` parser
|
8 |
|
9 | ## Presets
|
10 |
|
11 | This plugin comes with four presets
|
12 |
|
13 | - `format` Base formatting rules, should work on any code (included in `legacy`
|
14 | and `recommended`)
|
15 | - `node` Adds environment information for Node.js
|
16 | - `legacy` For all your EcmaScript 5 code
|
17 | - `recommended` For all your EcmaScript 2015+ code, also contains rules for React
|
18 |
|
19 | ## Included plugins
|
20 |
|
21 | the `recommended` preset includes three plugins:
|
22 |
|
23 | - `eslint-plugin-import` provides some rules to clean imports.
|
24 | - `eslint-plugin-react` ensures you follow some best practices with React.
|
25 | - `eslint-plugin-sonarjs` provides some advanced rules made by the guys at [SonarQube](https://www.sonarqube.org/).
|
26 |
|
27 | To make it easy to install this plugin, those rules are added to ESLint automatically, but prefixed with `swissquote/`.
|
28 | This is due to a limitation with ESLint that doesn't allow us to add plugins to ESLint through an API.
|
29 |
|
30 | ## Usage
|
31 |
|
32 | Include them with in your projects like this:
|
33 |
|
34 | ```json
|
35 | {
|
36 | "plugins": ["@swissquote/swissquote"],
|
37 | "extends": ["plugin:@swissquote/swissquote/recommended"]
|
38 | }
|
39 | ```
|