@10stars/config 4.1.3 → 4.2.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.
Files changed (2) hide show
  1. package/.eslintrc.js +103 -160
  2. package/package.json +13 -13
package/.eslintrc.js CHANGED
@@ -50,7 +50,7 @@ module.exports = {
50
50
  `@typescript-eslint`,
51
51
  `import`,
52
52
  `react`,
53
- `react-hooks`,
53
+ `react-hooks`, // https://reactjs.org/docs/hooks-rules.html#eslint-plugin
54
54
  `regexp`,
55
55
  `simple-import-sort`,
56
56
  `sort-keys-fix`,
@@ -88,11 +88,19 @@ module.exports = {
88
88
  },
89
89
  },
90
90
  rules: {
91
- // eslint-plugin-import, see https://github.com/benmosher/eslint-plugin-import
91
+ /**
92
+ * ESLint core rules
93
+ */
94
+ "no-case-declarations": type.ignore, // TypeScript shows us error, if the variable is reused in the same scope, so this rule is not applicable
95
+ /**
96
+ * eslint-plugin-import @see https://github.com/benmosher/eslint-plugin-import
97
+ */
92
98
  "import/order": type.ignore, // turn off in favor of eslint-plugin-simple-import-sort
93
99
  "import/no-unresolved": type.ignore,
94
100
  "import/no-duplicates": type.warning,
95
- // eslint-plugin-simple-import-sort
101
+ /**
102
+ * eslint-plugin-simple-import-sort
103
+ */
96
104
  "sort-imports": type.ignore, // we use eslint-plugin-import instead
97
105
  "simple-import-sort/imports": type.warning,
98
106
  "simple-import-sort/exports": type.warning,
@@ -103,6 +111,10 @@ module.exports = {
103
111
  "react/no-children-prop": type.ignore,
104
112
  "react/prop-types": type.ignore,
105
113
  "react/react-in-jsx-scope": type.ignore,
114
+ "react/jsx-filename-extension": [
115
+ type.warning,
116
+ { extensions: [`.jsx`, `.tsx`] },
117
+ ], // also want to use with ".tsx"
106
118
  /**
107
119
  * Hooks
108
120
  */
@@ -114,167 +126,98 @@ module.exports = {
114
126
  ],
115
127
  /**
116
128
  * TypeScript
129
+ * List of ignored (not recommended) rules we also explored:
130
+ * - @typescript-eslint/consistent-type-assertions
131
+ * - @typescript-eslint/explicit-module-boundary-types
132
+ * - @typescript-eslint/no-parameter-properties
133
+ * - @typescript-eslint/no-require-imports
134
+ * - @typescript-eslint/no-type-alias
135
+ * - @typescript-eslint/no-unnecessary-condition
136
+ * - @typescript-eslint/strict-boolean-expressions // doesn't work well
117
137
  */
118
- // recommended rules for TypeScript
119
- "@typescript-eslint/explicit-module-boundary-types": type.ignore,
138
+ // disabled recommended rules
120
139
  "@typescript-eslint/no-unused-vars": type.ignore, // removed by bundler, so it shouldn't be a rule
121
140
  "@typescript-eslint/no-empty-function": type.ignore, // used for prototyping
122
- "@typescript-eslint/no-unsafe-assignment": type.ignore, // we ignore this as it noticeably slows down the code writing
141
+ "@typescript-eslint/no-explicit-any": type.ignore,
142
+ "@typescript-eslint/ban-types": type.ignore,
143
+ // ---- we ignore these "no-unsafe-*" as it noticeably slows down the code writing
144
+ "@typescript-eslint/no-unsafe-assignment": type.ignore,
123
145
  "@typescript-eslint/no-unsafe-member-access": type.ignore,
124
- "@typescript-eslint/unbound-method": type.ignore,
146
+ "@typescript-eslint/no-unsafe-return": type.ignore,
125
147
  "@typescript-eslint/no-non-null-assertion": type.ignore, // sometimes TS incorrectly asserts, so there's a need to override
126
-
127
- // "@typescript-eslint/adjacent-overload-signatures": type.warning,
128
- // "@typescript-eslint/array-type": [type.warning, { default: `array` }],
129
- // "@typescript-eslint/await-thenable": type.warning,
130
- // "@typescript-eslint/ban-ts-ignore": type.ignore,
131
- // // "@typescript-eslint/ban-types",
132
- // "brace-style": type.ignore,
133
- // "@typescript-eslint/brace-style": [
134
- // type.warning,
135
- // `1tbs`,
136
- // { allowSingleLine: true },
137
- // ],
138
- // "@typescript-eslint/class-name-casing": type.ignore, // we disable it to allow TS interfaces to be any case
139
- // "@typescript-eslint/consistent-type-assertions": [
140
- // type.warning,
141
- // { assertionStyle: `as`, objectLiteralTypeAssertions: `never` },
142
- // ],
143
- // "@typescript-eslint/consistent-type-definitions": [
144
- // type.warning,
145
- // `interface`,
146
- // ],
147
- // "@typescript-eslint/explicit-function-return-type": type.ignore,
148
- // "@typescript-eslint/explicit-member-accessibility": type.warning,
149
- // "func-call-spacing": type.ignore,
150
- // "@typescript-eslint/func-call-spacing": type.ignore, // prettier has it
151
- // "@typescript-eslint/generic-type-naming": type.ignore,
152
- // "@typescript-eslint/indent": type.ignore, // prettier has it
153
- // "@typescript-eslint/interface-name-prefix": type.ignore, // we want the types to have ability to be named exactly as values
154
- // // "@typescript-eslint/member-delimiter-style": [
155
- // // type.warning,
156
- // // { delimiter: `none`, requireLast: false },
157
- // // ],
158
- // "@typescript-eslint/member-delimiter-style": type.ignore,
159
- // "@typescript-eslint/member-ordering": [
160
- // type.warning,
161
- // {
162
- // default: [
163
- // `public-static-field`,
164
- // `public-instance-field`,
165
- // `public-constructor`,
166
- // `private-static-field`,
167
- // `private-instance-field`,
168
- // `private-constructor`,
169
- // `public-instance-method`,
170
- // `protected-instance-method`,
171
- // `private-instance-method`,
172
- // ],
173
- // },
174
- // ],
175
- // // "@typescript-eslint/camelcase": [
176
- // // type.warning,
177
- // // { properties: `never`, ignoreDestructuring: true },
178
- // // ],
179
- // // "@typescript-eslint/naming-convention": [
180
- // // type.error,
181
- // // {
182
- // // selector: `variable`,
183
- // // types: [`boolean`],
184
- // // format: [`PascalCase`],
185
- // // prefix: [`is`, `should`, `has`, `can`, `did`, `will`],
186
- // // },
187
- // // ],
188
- // "@typescript-eslint/no-array-constructor": type.ignore,
189
- // "no-empty-function": type.ignore,
190
- // "@typescript-eslint/no-empty-function": type.ignore,
191
- // "@typescript-eslint/no-empty-interface": [
192
- // type.warning,
193
- // { allowSingleExtends: true },
194
- // ],
195
- // "@typescript-eslint/no-explicit-any": type.ignore,
196
- // "no-extra-parens": type.ignore,
197
- // "@typescript-eslint/no-extra-parens": type.ignore,
198
- // "@typescript-eslint/no-extraneous-class": type.warning,
199
- // "@typescript-eslint/no-floating-promises": [
200
- // type.warning,
201
- // { ignoreVoid: true },
202
- // ],
203
- // "@typescript-eslint/no-for-in-array": type.warning,
204
- // "@typescript-eslint/no-inferrable-types": type.warning,
205
- // "no-magic-numbers": type.ignore,
206
- // "@typescript-eslint/no-magic-numbers": [
207
- // type.warning,
208
- // {
209
- // ignore: allowedMagicNumbers,
210
- // ignoreNumericLiteralTypes: true,
211
- // ignoreEnums: true,
212
- // },
213
- // ],
214
- // "@typescript-eslint/no-misused-new": type.warning,
215
- // "@typescript-eslint/no-misused-promises": [
216
- // type.warning,
217
- // { checksVoidReturn: false },
218
- // ],
219
- // "@typescript-eslint/no-namespace": type.warning,
220
- // "@typescript-eslint/no-non-null-assertion": type.warning,
221
- // "@typescript-eslint/no-parameter-properties": type.warning,
222
- // "@typescript-eslint/no-require-imports": type.ignore,
223
- // "@typescript-eslint/no-this-alias": type.warning,
224
- // "@typescript-eslint/no-type-alias": type.ignore,
225
- // "@typescript-eslint/no-unnecessary-condition": type.ignore, // doesn't work well
226
- // "@typescript-eslint/no-unnecessary-qualifier": type.warning,
227
- // "@typescript-eslint/no-unnecessary-type-arguments": type.warning,
228
- // "@typescript-eslint/no-unnecessary-type-assertion": type.warning,
229
- // "@typescript-eslint/no-unused-vars": type.ignore,
230
- // "@typescript-eslint/no-use-before-define": type.warning,
231
- // "no-useless-constructor": type.ignore,
232
- // "@typescript-eslint/no-useless-constructor": type.warning,
233
- // "@typescript-eslint/no-var-requires": type.warning,
234
- // "@typescript-eslint/prefer-for-of": type.warning,
235
- // "@typescript-eslint/prefer-function-type": type.warning,
236
- // "@typescript-eslint/prefer-includes": type.warning,
237
- // "@typescript-eslint/prefer-namespace-keyword": type.ignore,
238
- // "@typescript-eslint/prefer-readonly": type.warning,
239
- // "@typescript-eslint/prefer-regexp-exec": type.warning,
240
- // "@typescript-eslint/prefer-string-starts-ends-with": type.warning,
241
- // "@typescript-eslint/promise-function-async": type.warning,
242
- // quotes: type.ignore,
243
- // "@typescript-eslint/quotes": [type.warning, `backtick`],
244
- // "@typescript-eslint/require-array-sort-compare": type.warning,
245
- // "require-await": type.ignore,
246
- // "@typescript-eslint/require-await": type.warning,
247
- // "@typescript-eslint/restrict-plus-operands": type.ignore,
248
- // semi: type.ignore,
249
- // "@typescript-eslint/semi": type.ignore,
250
- // "@typescript-eslint/strict-boolean-expressions": type.ignore, // doesn't work well
251
- // // "@typescript-eslint/strict-boolean-expressions": [
252
- // // type.warning,
253
- // // { allowNullable: true, ignoreRhs: true },
254
- // // ],
255
- // "@typescript-eslint/triple-slash-reference": [
256
- // type.warning,
257
- // { path: `never`, types: `never`, lib: `never` },
258
- // ],
259
- // "@typescript-eslint/type-annotation-spacing": type.ignore,
260
- // "@typescript-eslint/typedef": type.ignore,
261
- // "@typescript-eslint/unbound-method": type.warning,
262
- // "@typescript-eslint/unified-signatures": type.warning,
263
-
264
- // // These rules don't add much value, are better covered by TypeScript and good definition files
265
- // "react/no-direct-mutation-state": type.ignore,
266
- // "react/no-deprecated": type.ignore,
267
- // "react/no-string-refs": type.ignore,
268
- // "react/require-render-return": type.ignore,
269
-
270
- // "react/jsx-filename-extension": [
271
- // type.warning,
272
- // { extensions: [`.jsx`, `.tsx`] },
273
- // ], // also want to use with ".tsx"
274
- // "react/prop-types": type.ignore, // Is this incompatible with TS props type?
275
-
276
- // // https://reactjs.org/docs/hooks-rules.html#eslint-plugin
277
- // "react-hooks/rules-of-hooks": type.error, // Checks rules of Hooks
278
- // "react-hooks/exhaustive-deps": type.warning, // Checks effect dependencies
148
+ "@typescript-eslint/unbound-method": type.ignore,
149
+ // other
150
+ quotes: type.ignore,
151
+ "@typescript-eslint/array-type": [type.warning, { default: `array` }],
152
+ "@typescript-eslint/quotes": [type.warning, `backtick`],
153
+ "@typescript-eslint/consistent-type-definitions": [
154
+ type.warning, // @see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces
155
+ `type`, // there are many drawbacks in using `interface` over `type`. It saves time to use `type` everywhere
156
+ ],
157
+ "@typescript-eslint/naming-convention": [
158
+ type.error,
159
+ {
160
+ selector: `variable`,
161
+ types: [`boolean`],
162
+ format: [`PascalCase`],
163
+ prefix: [`is`, `should`, `has`, `can`, `did`, `will`],
164
+ },
165
+ ],
166
+ "no-magic-numbers": type.ignore,
167
+ "@typescript-eslint/no-magic-numbers": [
168
+ type.warning,
169
+ {
170
+ ignore: allowedMagicNumbers,
171
+ ignoreNumericLiteralTypes: true,
172
+ ignoreEnums: true,
173
+ },
174
+ ],
175
+ "@typescript-eslint/no-unnecessary-type-arguments": type.warning,
176
+ "@typescript-eslint/unified-signatures": type.warning,
177
+ // string
178
+ "@typescript-eslint/prefer-string-starts-ends-with": type.warning,
179
+ // RegExp
180
+ "@typescript-eslint/prefer-regexp-exec": type.warning,
181
+ // array
182
+ "@typescript-eslint/prefer-includes": type.warning,
183
+ "@typescript-eslint/require-array-sort-compare": type.warning,
184
+ // loops
185
+ "@typescript-eslint/prefer-for-of": type.warning,
186
+ // promises
187
+ "@typescript-eslint/no-misused-promises": [
188
+ type.warning,
189
+ { checksVoidReturn: false },
190
+ ],
191
+ "@typescript-eslint/no-floating-promises": [
192
+ type.warning,
193
+ { ignoreVoid: true },
194
+ ],
195
+ // namespace
196
+ "@typescript-eslint/no-unnecessary-qualifier": type.warning,
197
+ // for classes
198
+ "@typescript-eslint/no-extraneous-class": type.warning,
199
+ "@typescript-eslint/explicit-member-accessibility": type.warning,
200
+ "@typescript-eslint/member-ordering": [
201
+ type.warning,
202
+ {
203
+ default: [
204
+ `public-static-field`,
205
+ `public-instance-field`,
206
+ `public-constructor`,
207
+ `private-static-field`,
208
+ `private-instance-field`,
209
+ `private-constructor`,
210
+ `public-instance-method`,
211
+ `protected-instance-method`,
212
+ `private-instance-method`,
213
+ ],
214
+ },
215
+ ],
216
+ "no-useless-constructor": type.ignore,
217
+ "@typescript-eslint/no-useless-constructor": type.warning,
218
+ /**
219
+ * Regex
220
+ */
221
+ "regexp/no-useless-escape": type.warning,
279
222
  },
280
223
  }
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  },
6
6
  "name": "@10stars/config",
7
7
  "description": "10stars.dev Shareable Configs",
8
- "version": "4.1.3",
8
+ "version": "4.2.0",
9
9
  "author": "10stars.dev <web@alexandrov.co> (https://alexandrov.co)",
10
10
  "keywords": [
11
11
  "config"
@@ -24,30 +24,30 @@
24
24
  "lint-rule-timings": "cross-env TIMING=1 npm run lint"
25
25
  },
26
26
  "dependencies": {
27
- "@commitlint/cli": "^13.0.0",
28
- "@commitlint/config-conventional": "^13.0.0",
27
+ "@commitlint/cli": "^15.0.0",
28
+ "@commitlint/config-conventional": "^15.0.0",
29
29
  "@types/aws-lambda": "^8.0.0",
30
- "@types/jest": "^26.0.0",
30
+ "@types/jest": "^27.0.0",
31
31
  "@types/lodash": "^4.0.0",
32
32
  "@types/node": "^16.0.0",
33
33
  "@types/react": "^17.0.0",
34
- "@typescript-eslint/eslint-plugin": "^4.0.0",
35
- "@typescript-eslint/parser": "^4.0.0",
36
- "esbuild": "^0.12.15",
37
- "esbuild-register": "^2.3.0",
38
- "eslint": "^7.0.0",
34
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
35
+ "@typescript-eslint/parser": "^5.0.0",
36
+ "esbuild": "~0.13.15",
37
+ "esbuild-register": "^3.0.0",
38
+ "eslint": "^8.0.0",
39
39
  "eslint-config-prettier": "^8.0.0",
40
40
  "eslint-plugin-import": "^2.0.0",
41
41
  "eslint-plugin-react": "^7.0.0",
42
42
  "eslint-plugin-react-hooks": "^4.0.0",
43
- "eslint-plugin-regexp": "^0.13.2",
43
+ "eslint-plugin-regexp": "^1.0.0",
44
44
  "eslint-plugin-simple-import-sort": "^7.0.0",
45
45
  "eslint-plugin-sort-keys-fix": "^1.0.0",
46
- "eslint-watch": "7.0.0",
46
+ "eslint-watch": "8.0.0",
47
47
  "husky": "^7.0.0",
48
48
  "nodemon": "^2.0.7",
49
49
  "prettier": "^2.0.0",
50
- "type-fest": "^1.0.0",
51
- "typescript": "^4.3.5"
50
+ "type-fest": "^2.0.0",
51
+ "typescript": "^4.5.2"
52
52
  }
53
53
  }