1 | # eslint-config-mongodb-js [![travis][travis_img]][travis_url] [![npm][npm_img]][npm_url]
|
2 |
|
3 | > [eslint shareable configs][shareable-configs] for [mongodb-js][mongodb-js].
|
4 |
|
5 | ## Usage
|
6 |
|
7 | Shareable configs are designed to work with the `extends` feature
|
8 | of `.eslintrc` files. This allows us to easily extend from a base
|
9 | configuration to provide the right rules for all of the extensive
|
10 | range of environments we build modules for:
|
11 |
|
12 | - `mongodb-js`
|
13 | - `mongodb-js/node`
|
14 | - `mongodb-js/browser`
|
15 | - `mongodb-js/shell`
|
16 | - `mongodb-js/react`
|
17 |
|
18 | You can learn more about [Shareable Configs][shareable-configs] on the official ESLint website.
|
19 |
|
20 | ## Conventions
|
21 |
|
22 | Our eslint-config is based on [eslint-config-airbnb][eslint-config-airbnb].
|
23 | We make a best effort to explicitly call out any rules we differ from
|
24 | [eslint-config-airbnb][eslint-config-airbnb] will include a JSDoc
|
25 | comment of `@differ #{dang good reason}`.
|
26 |
|
27 | ## Examples
|
28 |
|
29 | To use the mongodb-js shareable config, first run:
|
30 |
|
31 | ```bash
|
32 | npm install --save-dev eslint eslint-config-mongodb-js
|
33 | ```
|
34 |
|
35 | The barebones mongodb-js `./.eslintrc` file looks like:
|
36 |
|
37 | ```json
|
38 | {
|
39 | "extends": "mongodb-js"
|
40 | }
|
41 | ```
|
42 |
|
43 | If your project runs primarily on the server, your `./.eslintrc`
|
44 | might look something like:
|
45 |
|
46 | ```json
|
47 | {
|
48 | "extends": "mongodb-js/node"
|
49 | }
|
50 | ```
|
51 |
|
52 | If you're working on a UI project that uses browserify:
|
53 |
|
54 | ```json
|
55 | {
|
56 | "extends": "mongodb-js/browser"
|
57 | }
|
58 | ```
|
59 |
|
60 | ## See Also
|
61 |
|
62 | - [mongodb-js-fmt][mongodb-js-fmt] Look no further if you're not a tailor and/or want
|
63 | something that will just magically reformat your code to conform to these best practices.
|
64 | - [mongodb-js-precommit][mongodb-js-precommit] The first line of defense to fighting
|
65 | bugs is not letting bad code into your project in the first place.
|
66 | - [eslint-plugin-mongodb][eslint-plugin-mongodb] Syntax guidance and best practices
|
67 | reinforcement when using MongoDB node.js driver.
|
68 |
|
69 |
|
70 | ## License
|
71 |
|
72 | Apache 2.0
|
73 |
|
74 | [shareable-configs]: http://eslint.org/docs/developer-guide/shareable-configs
|
75 | [travis_img]: https://img.shields.io/travis/mongodb-js/eslint-config.svg
|
76 | [travis_url]: https://travis-ci.org/mongodb-js/eslint-config
|
77 | [npm_img]: https://img.shields.io/npm/v/eslint-config-mongodb-js.svg
|
78 | [npm_url]: https://npmjs.org/package/eslint-config-mongodb-js
|
79 | [mongodb-js]: http://mongodb-js.github.io/
|
80 | [eslint-config-airbnb]: https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb
|
81 | [eslint-plugin-mongodb]: https://github.com/nfroidure/eslint-plugin-mongodb
|
82 | [mongodb-js-precommit]: https://github.com/mongodb-js/precommit
|
83 | [mongodb-js-fmt]: https://github.com/mongodb-js/fmt
|