1 | # jslint-configs
|
2 |
|
3 | ![npm](https://img.shields.io/npm/dw/jslint-configs)
|
4 | ![GitHub issues](https://img.shields.io/github/issues-raw/inamtaj/jslint-configs)
|
5 | ![node](https://img.shields.io/node/v/jslint-configs)
|
6 | ![npm peer dependency version](https://img.shields.io/npm/dependency-version/jslint-configs/peer/eslint)
|
7 | ![npm](https://img.shields.io/npm/v/jslint-configs)
|
8 | ![GitHub](https://img.shields.io/github/license/inamtaj/jslint-configs)
|
9 |
|
10 | THE _best_ lint configurations for JS, React, Node, Jest and even React Native!
|
11 |
|
12 | Stop relying on humans to write consistent and good quality JavaScript.
|
13 | Use [jslint-configs](https://github.com/InamTaj/jslint-configs) to ensure your code is clean from common mistakes of JavaScript/React/Node and while doing that, give your developer-productivity an unfair boost!
|
14 |
|
15 | ## ⭐️ Features
|
16 |
|
17 | [jslint-configs](https://github.com/InamTaj/jslint-configs) support linting for the following technologies:
|
18 |
|
19 | - JavaScript and ES6
|
20 | - Node.js
|
21 | - React.js (with latest [React Hooks](https://reactjs.org/docs/hooks-intro.html))
|
22 | - React Native
|
23 |
|
24 | :bulb: For quickly increasing developer's knowledge it also has respective hyperlink for each lint rule as follows:
|
25 |
|
26 | ```javascript
|
27 | 'arrow-parens': [2, // https://eslint.org/docs/rules/arrow-parens
|
28 | 'as-needed',
|
29 | ],
|
30 | ```
|
31 |
|
32 | ### ⭐️ Bonus Features ⭐
|
33 |
|
34 | - Well documented
|
35 | - Extremely small bundle size: `7~9 KB`
|
36 |
|
37 | ## 💿 Installation
|
38 |
|
39 | > Please ensure that `eslint` is already installed in your project
|
40 |
|
41 | - For Yarn: `yarn add --dev jslint-configs`
|
42 | - For NPM: `npm install --save-dev jslint-configs`
|
43 |
|
44 | ## 📖 About Lint Setup
|
45 |
|
46 | The way this lint configuration is setup as follows:
|
47 |
|
48 | - **Base Configuration** (Parent configuration - includes all standard JS linting rules)
|
49 | - **React Configuration** (Inherits from Base Config - adds up all standard React.js and JSX linting rules)
|
50 | - **React Native Configuration** (Inherits from React Config - adds up RN specific rules on top of React rules)
|
51 | - **Node Configuration** (Inherits from Base Config - adds up all standard Node.js linting rules)
|
52 |
|
53 | _Let the picture speak a thousand words!_
|
54 |
|
55 | ![ESLint Configuration Diagram](./assets/images/config-diagram.png)
|
56 |
|
57 | ## 🔧 Usage
|
58 |
|
59 | - Install ESLint in your project (`yarn add --dev eslint`)
|
60 | - Create `.eslintrc.js` at the root of your project
|
61 |
|
62 | #### Vanilla JavaScript
|
63 |
|
64 | If you want to lint only vanilla JavaScript, extend your project's `.eslintrc.js` file from [config-base](./config-base.js) as follows:
|
65 |
|
66 | ```javascript
|
67 | module.exports = {
|
68 | extends: "./node_modules/jslint-configs/index.js",
|
69 | };
|
70 | ```
|
71 |
|
72 | #### React.JS Linting
|
73 |
|
74 | If you want to lint JavaScript + React.JS code, extend your project's `.eslintrc.js` file from [config-react](./config-react.js) as follows:
|
75 |
|
76 | ```javascript
|
77 | module.exports = {
|
78 | extends: "./node_modules/jslint-configs/config-react.js",
|
79 | };
|
80 | ```
|
81 |
|
82 | #### React Native Linting
|
83 |
|
84 | If you want to lint JavaScript + React Native code, extend your project's `.eslintrc.js` file from [config-react](./config-react.js) as follows:
|
85 |
|
86 | ```javascript
|
87 | module.exports = {
|
88 | extends: "./node_modules/jslint-configs/config-react-native.js",
|
89 | };
|
90 | ```
|
91 |
|
92 | #### Node.JS Linting
|
93 |
|
94 | If you want to lint JavaScript + Node.JS, extend your project's `.eslintrc.js` file from [config-node](./config-node.js) as follows:
|
95 |
|
96 | ```javascript
|
97 | module.exports = {
|
98 | extends: "./node_modules/jslint-configs/config-node.js",
|
99 | };
|
100 | ```
|
101 |
|
102 | ## ❤️ Contributing
|
103 |
|
104 | Welcome contributing!
|
105 |
|
106 | Please use GitHub's Issues/PRs.
|