@kaizentech/eslint-config-base 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/index.js +95 -2
- package/package.json +1 -1
package/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# @kaizentech/eslint-config-base
|
2
|
+
|
3
|
+
This package contains base javascript style guide
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
```bash
|
7
|
+
yarn add -D @kaizentech/eslint-config-base eslint prettier
|
8
|
+
```
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
first of all create a .eslintrc.json file in the root of your project.
|
12
|
+
|
13
|
+
then add this
|
14
|
+
|
15
|
+
```json
|
16
|
+
{
|
17
|
+
"root": true,
|
18
|
+
"extends": "@kaizentech/base"
|
19
|
+
}
|
20
|
+
|
21
|
+
```
|
package/index.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
module.exports = {
|
2
|
+
env: {
|
3
|
+
es6: true
|
4
|
+
},
|
2
5
|
parserOptions: {
|
3
6
|
ecmaVersion: 'latest'
|
4
7
|
},
|
@@ -11,7 +14,7 @@ module.exports = {
|
|
11
14
|
'import/order': [
|
12
15
|
'error',
|
13
16
|
{
|
14
|
-
groups: ['builtin', 'external', 'internal'],
|
17
|
+
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index']],
|
15
18
|
pathGroups: [
|
16
19
|
{
|
17
20
|
pattern: 'react',
|
@@ -23,6 +26,10 @@ module.exports = {
|
|
23
26
|
group: 'sibling',
|
24
27
|
patternOptions: { matchBase: true },
|
25
28
|
position: 'after'
|
29
|
+
},
|
30
|
+
{
|
31
|
+
pattern: '@**/**',
|
32
|
+
group: 'internal'
|
26
33
|
}
|
27
34
|
],
|
28
35
|
pathGroupsExcludedImportTypes: ['react'],
|
@@ -67,6 +74,92 @@ module.exports = {
|
|
67
74
|
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
68
75
|
|
69
76
|
// use double quotes if jsx
|
70
|
-
'jsx-quotes': ['error', 'prefer-double']
|
77
|
+
'jsx-quotes': ['error', 'prefer-double'],
|
78
|
+
|
79
|
+
// show error if variable can be const
|
80
|
+
'prefer-const': 'error',
|
81
|
+
|
82
|
+
// show error if trying to reassign const
|
83
|
+
'no-const-assign': 'error',
|
84
|
+
|
85
|
+
// use let
|
86
|
+
'no-var': 'error',
|
87
|
+
|
88
|
+
// do not use object constructor
|
89
|
+
'no-new-object': 'error',
|
90
|
+
|
91
|
+
// use short version of object properties
|
92
|
+
'object-shorthand': 'error',
|
93
|
+
|
94
|
+
// do not use quotes if not need
|
95
|
+
'quote-props': ['error', 'as-needed'],
|
96
|
+
|
97
|
+
// do not use array constructor
|
98
|
+
'no-array-constructor': 'error',
|
99
|
+
|
100
|
+
// muust return in array functions
|
101
|
+
'array-callback-return': 'error',
|
102
|
+
|
103
|
+
// prefer destructuring
|
104
|
+
'prefer-destructuring': 'error',
|
105
|
+
|
106
|
+
// do not use spacing in literal template strings
|
107
|
+
'template-curly-spacing': 'error',
|
108
|
+
|
109
|
+
// do not use eval
|
110
|
+
'no-eval': 'error',
|
111
|
+
|
112
|
+
// show error for unnecessary escape
|
113
|
+
'no-useless-escape': 'error',
|
114
|
+
|
115
|
+
// do not define func inside loops
|
116
|
+
'no-loop-func': 'error',
|
117
|
+
|
118
|
+
// do not use arguments
|
119
|
+
'prefer-rest-params': 'error',
|
120
|
+
|
121
|
+
// do not use func constructor
|
122
|
+
'no-new-func': 'error',
|
123
|
+
|
124
|
+
'space-before-function-paren': [
|
125
|
+
'error',
|
126
|
+
{ anonymous: 'always', named: 'never', asyncArrow: 'always' }
|
127
|
+
],
|
128
|
+
|
129
|
+
// put space before blocks
|
130
|
+
'space-before-blocks': 'error',
|
131
|
+
|
132
|
+
// prefer spread
|
133
|
+
'prefer-spread': 'error',
|
134
|
+
|
135
|
+
// use arraw functions
|
136
|
+
'prefer-arrow-callback': 'error',
|
137
|
+
|
138
|
+
// put space before and after arrow
|
139
|
+
'arrow-spacing': 'error',
|
140
|
+
|
141
|
+
// always put arrow parentheses
|
142
|
+
'arrow-parens': 'error',
|
143
|
+
|
144
|
+
// do not use curly if not need
|
145
|
+
'arrow-body-style': 'error',
|
146
|
+
|
147
|
+
// put parantheses
|
148
|
+
'no-confusing-arrow': 'error',
|
149
|
+
|
150
|
+
// require the use of === and !==
|
151
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
152
|
+
|
153
|
+
// disallow the use of Boolean literals in conditional expressions
|
154
|
+
// also, prefer `a || b` over `a ? a : b`
|
155
|
+
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
156
|
+
|
157
|
+
// disallow use of multiple spaces
|
158
|
+
'no-multi-spaces': [
|
159
|
+
'error',
|
160
|
+
{
|
161
|
+
ignoreEOLComments: false
|
162
|
+
}
|
163
|
+
]
|
71
164
|
}
|
72
165
|
}
|