UNPKG

1.93 kBMarkdownView Raw
1# eslint-config
2
3This package provides App Press' .eslintrc.json as an extensible shared config.
4
5## Usage
6A few ESLint configurations are exported for convenience; all exports allow for standard testing frameworks (Mocha, Jasmine, and Jest):
7
8### eslint-config
9The 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
12import React from "react";
13```
14
15But this will:
16
17```js
18const React = require("react");
19```
20
211. `npm install --save-dev @app-press/eslint-config eslint eslint-plugin-react`
221. Add `"extends": "@app-press/eslint-config` to your .eslintrc file
23
24### eslint-config/node
25This export is for use on server-side-only code and will not lint React (though it will lint ES6).
26
271. `npm install --save-dev @app-press/eslint-config eslint`
281. Add `"extends": "@app-press/eslint-config/node` to your .eslintrc.json file
29
30### eslint-config/client
31This export is for use on client-side-only code and will lint React (including JSX) and ES6 code.
32
331. `npm install --save-dev @app-press/eslint-config eslint`
341. Add `"extends": "@app-press/eslint-config/client` to your .eslintrc file
35
36### eslint-config/client-modules
37This 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
391. `npm install --save-dev @app-press/eslint-config eslint`
401. 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
44You may also modify the parser, parserOptions, etc. Just include those sections as well.