1 | # eslint-config
|
2 |
|
3 | This package provides App Press' .eslintrc.json as an extensible shared config.
|
4 |
|
5 | ## Usage
|
6 | A few ESLint configurations are exported for convenience; all exports allow for standard testing frameworks (Mocha, Jasmine, and Jest):
|
7 |
|
8 | ### eslint-config
|
9 | The default export contains all ESLint rules, including ES6 and React, and tries to find a balance between traditional server-side and client-side code styles. For this reason, it does not use modules for client-side code by default; thus, the following code will not pass linting:
|
10 |
|
11 | ```js
|
12 | import React from "react";
|
13 | ```
|
14 |
|
15 | But this will:
|
16 |
|
17 | ```js
|
18 | const React = require("react");
|
19 | ```
|
20 |
|
21 | 1. `npm install --save-dev @app-press/eslint-config eslint eslint-plugin-react`
|
22 | 1. Add `"extends": "@app-press/eslint-config` to your .eslintrc file
|
23 |
|
24 | ### eslint-config/node
|
25 | This export is for use on server-side-only code and will not lint React (though it will lint ES6).
|
26 |
|
27 | 1. `npm install --save-dev @app-press/eslint-config eslint`
|
28 | 1. Add `"extends": "@app-press/eslint-config/node` to your .eslintrc.json file
|
29 |
|
30 | ### eslint-config/client
|
31 | This export is for use on client-side-only code and will lint React (including JSX) and ES6 code.
|
32 |
|
33 | 1. `npm install --save-dev @app-press/eslint-config eslint`
|
34 | 1. Add `"extends": "@app-press/eslint-config/client` to your .eslintrc file
|
35 |
|
36 | ### eslint-config/client-modules
|
37 | This export is for use on client-side-only code and will lint React (including JSX) and ES6 code. It will also expect that all client-side code is ES6 module based (and thus will assume strict by default).
|
38 |
|
39 | 1. `npm install --save-dev @app-press/eslint-config eslint`
|
40 | 1. Add `"extends": "@app-press/eslint-config/client-modules` to your .eslintrc file
|
41 |
|
42 | **To override specific rules**, simply add a `rules` section to your .elintrc.json and add your desired rules — they will take precedence.
|
43 |
|
44 | You may also modify the parser, parserOptions, etc. Just include those sections as well.
|