@10stars/config 4.1.4 → 4.2.1

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 +102 -174
  2. package/package.json +13 -13
package/.eslintrc.js CHANGED
@@ -30,11 +30,11 @@ const allowedMagicNumbers = (() => {
30
30
  })()
31
31
 
32
32
  const reactUseHooks = [
33
- "useUpdateEffect",
34
- "useIsomorphicLayoutEffect",
35
- "useDeepCompareEffect",
36
- "useShallowCompareEffect",
37
- "useCustomCompareEffect",
33
+ `useUpdateEffect`,
34
+ `useIsomorphicLayoutEffect`,
35
+ `useDeepCompareEffect`,
36
+ `useShallowCompareEffect`,
37
+ `useCustomCompareEffect`,
38
38
  ]
39
39
 
40
40
  const type = {
@@ -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`,
@@ -61,12 +61,12 @@ module.exports = {
61
61
  jest: true,
62
62
  },
63
63
  extends: [
64
- "eslint:recommended",
65
- "plugin:@typescript-eslint/recommended",
66
- "plugin:@typescript-eslint/recommended-requiring-type-checking",
67
- "plugin:react/recommended",
68
- "plugin:react-hooks/recommended",
69
- "plugin:regexp/recommended",
64
+ `eslint:recommended`,
65
+ `plugin:@typescript-eslint/recommended`,
66
+ `plugin:@typescript-eslint/recommended-requiring-type-checking`,
67
+ `plugin:react/recommended`,
68
+ `plugin:react-hooks/recommended`,
69
+ `plugin:regexp/recommended`,
70
70
 
71
71
  // "plugin:import/typescript",
72
72
  // "plugin:import/warnings",
@@ -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,184 +111,104 @@ 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
  */
109
121
  "react-hooks/exhaustive-deps": [
110
122
  type.warning,
111
123
  {
112
- additionalHooks: `(${reactUseHooks.join("|")})`,
124
+ additionalHooks: `(${reactUseHooks.join(`|`)})`,
113
125
  },
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
- // extra rules for TypeScript
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
+ "no-magic-numbers": type.ignore,
158
+ "@typescript-eslint/no-magic-numbers": [
159
+ type.warning,
160
+ {
161
+ ignore: allowedMagicNumbers,
162
+ ignoreNumericLiteralTypes: true,
163
+ ignoreEnums: true,
164
+ },
165
+ ],
166
+ "@typescript-eslint/no-unnecessary-type-arguments": type.warning,
167
+ "@typescript-eslint/unified-signatures": type.warning,
168
+ // string
169
+ "@typescript-eslint/prefer-string-starts-ends-with": type.warning,
170
+ // RegExp
171
+ "@typescript-eslint/prefer-regexp-exec": type.warning,
172
+ // array
173
+ "@typescript-eslint/prefer-includes": type.warning,
174
+ "@typescript-eslint/require-array-sort-compare": type.warning,
175
+ // loops
176
+ "@typescript-eslint/prefer-for-of": type.warning,
177
+ // promises
178
+ "@typescript-eslint/no-misused-promises": [
179
+ type.warning,
180
+ { checksVoidReturn: false },
181
+ ],
182
+ "@typescript-eslint/no-floating-promises": [
183
+ type.warning,
184
+ { ignoreVoid: true },
185
+ ],
186
+ // namespace
187
+ "@typescript-eslint/no-unnecessary-qualifier": type.warning,
188
+ // for classes
189
+ "@typescript-eslint/no-extraneous-class": type.warning,
190
+ "@typescript-eslint/explicit-member-accessibility": type.warning,
191
+ "@typescript-eslint/member-ordering": [
192
+ type.warning,
193
+ {
194
+ default: [
195
+ `public-static-field`,
196
+ `public-instance-field`,
197
+ `public-constructor`,
198
+ `private-static-field`,
199
+ `private-instance-field`,
200
+ `private-constructor`,
201
+ `public-instance-method`,
202
+ `protected-instance-method`,
203
+ `private-instance-method`,
204
+ ],
205
+ },
206
+ ],
207
+ "no-useless-constructor": type.ignore,
208
+ "@typescript-eslint/no-useless-constructor": type.warning,
127
209
  /**
128
210
  * Regex
129
211
  */
130
- // extra rules for regex
131
212
  "regexp/no-useless-escape": type.warning,
132
-
133
- // "@typescript-eslint/adjacent-overload-signatures": type.warning,
134
- // "@typescript-eslint/array-type": [type.warning, { default: `array` }],
135
- // "@typescript-eslint/await-thenable": type.warning,
136
- // "@typescript-eslint/ban-ts-ignore": type.ignore,
137
- // // "@typescript-eslint/ban-types",
138
- // "brace-style": type.ignore,
139
- // "@typescript-eslint/brace-style": [
140
- // type.warning,
141
- // `1tbs`,
142
- // { allowSingleLine: true },
143
- // ],
144
- // "@typescript-eslint/class-name-casing": type.ignore, // we disable it to allow TS interfaces to be any case
145
- // "@typescript-eslint/consistent-type-assertions": [
146
- // type.warning,
147
- // { assertionStyle: `as`, objectLiteralTypeAssertions: `never` },
148
- // ],
149
- // "@typescript-eslint/consistent-type-definitions": [
150
- // type.warning,
151
- // `interface`,
152
- // ],
153
- // "@typescript-eslint/explicit-function-return-type": type.ignore,
154
- // "@typescript-eslint/explicit-member-accessibility": type.warning,
155
- // "func-call-spacing": type.ignore,
156
- // "@typescript-eslint/func-call-spacing": type.ignore, // prettier has it
157
- // "@typescript-eslint/generic-type-naming": type.ignore,
158
- // "@typescript-eslint/indent": type.ignore, // prettier has it
159
- // "@typescript-eslint/interface-name-prefix": type.ignore, // we want the types to have ability to be named exactly as values
160
- // // "@typescript-eslint/member-delimiter-style": [
161
- // // type.warning,
162
- // // { delimiter: `none`, requireLast: false },
163
- // // ],
164
- // "@typescript-eslint/member-delimiter-style": type.ignore,
165
- // "@typescript-eslint/member-ordering": [
166
- // type.warning,
167
- // {
168
- // default: [
169
- // `public-static-field`,
170
- // `public-instance-field`,
171
- // `public-constructor`,
172
- // `private-static-field`,
173
- // `private-instance-field`,
174
- // `private-constructor`,
175
- // `public-instance-method`,
176
- // `protected-instance-method`,
177
- // `private-instance-method`,
178
- // ],
179
- // },
180
- // ],
181
- // // "@typescript-eslint/camelcase": [
182
- // // type.warning,
183
- // // { properties: `never`, ignoreDestructuring: true },
184
- // // ],
185
- // // "@typescript-eslint/naming-convention": [
186
- // // type.error,
187
- // // {
188
- // // selector: `variable`,
189
- // // types: [`boolean`],
190
- // // format: [`PascalCase`],
191
- // // prefix: [`is`, `should`, `has`, `can`, `did`, `will`],
192
- // // },
193
- // // ],
194
- // "@typescript-eslint/no-array-constructor": type.ignore,
195
- // "no-empty-function": type.ignore,
196
- // "@typescript-eslint/no-empty-function": type.ignore,
197
- // "@typescript-eslint/no-empty-interface": [
198
- // type.warning,
199
- // { allowSingleExtends: true },
200
- // ],
201
- // "@typescript-eslint/no-explicit-any": type.ignore,
202
- // "no-extra-parens": type.ignore,
203
- // "@typescript-eslint/no-extra-parens": type.ignore,
204
- // "@typescript-eslint/no-extraneous-class": type.warning,
205
- // "@typescript-eslint/no-floating-promises": [
206
- // type.warning,
207
- // { ignoreVoid: true },
208
- // ],
209
- // "@typescript-eslint/no-for-in-array": type.warning,
210
- // "@typescript-eslint/no-inferrable-types": type.warning,
211
- // "no-magic-numbers": type.ignore,
212
- // "@typescript-eslint/no-magic-numbers": [
213
- // type.warning,
214
- // {
215
- // ignore: allowedMagicNumbers,
216
- // ignoreNumericLiteralTypes: true,
217
- // ignoreEnums: true,
218
- // },
219
- // ],
220
- // "@typescript-eslint/no-misused-new": type.warning,
221
- // "@typescript-eslint/no-misused-promises": [
222
- // type.warning,
223
- // { checksVoidReturn: false },
224
- // ],
225
- // "@typescript-eslint/no-namespace": type.warning,
226
- // "@typescript-eslint/no-non-null-assertion": type.warning,
227
- // "@typescript-eslint/no-parameter-properties": type.warning,
228
- // "@typescript-eslint/no-require-imports": type.ignore,
229
- // "@typescript-eslint/no-this-alias": type.warning,
230
- // "@typescript-eslint/no-type-alias": type.ignore,
231
- // "@typescript-eslint/no-unnecessary-condition": type.ignore, // doesn't work well
232
- // "@typescript-eslint/no-unnecessary-qualifier": type.warning,
233
- // "@typescript-eslint/no-unnecessary-type-arguments": type.warning,
234
- // "@typescript-eslint/no-unnecessary-type-assertion": type.warning,
235
- // "@typescript-eslint/no-unused-vars": type.ignore,
236
- // "@typescript-eslint/no-use-before-define": type.warning,
237
- // "no-useless-constructor": type.ignore,
238
- // "@typescript-eslint/no-useless-constructor": type.warning,
239
- // "@typescript-eslint/no-var-requires": type.warning,
240
- // "@typescript-eslint/prefer-for-of": type.warning,
241
- // "@typescript-eslint/prefer-function-type": type.warning,
242
- // "@typescript-eslint/prefer-includes": type.warning,
243
- // "@typescript-eslint/prefer-namespace-keyword": type.ignore,
244
- // "@typescript-eslint/prefer-readonly": type.warning,
245
- // "@typescript-eslint/prefer-regexp-exec": type.warning,
246
- // "@typescript-eslint/prefer-string-starts-ends-with": type.warning,
247
- // "@typescript-eslint/promise-function-async": type.warning,
248
- // quotes: type.ignore,
249
- // "@typescript-eslint/quotes": [type.warning, `backtick`],
250
- // "@typescript-eslint/require-array-sort-compare": type.warning,
251
- // "require-await": type.ignore,
252
- // "@typescript-eslint/require-await": type.warning,
253
- // "@typescript-eslint/restrict-plus-operands": type.ignore,
254
- // semi: type.ignore,
255
- // "@typescript-eslint/semi": type.ignore,
256
- // "@typescript-eslint/strict-boolean-expressions": type.ignore, // doesn't work well
257
- // // "@typescript-eslint/strict-boolean-expressions": [
258
- // // type.warning,
259
- // // { allowNullable: true, ignoreRhs: true },
260
- // // ],
261
- // "@typescript-eslint/triple-slash-reference": [
262
- // type.warning,
263
- // { path: `never`, types: `never`, lib: `never` },
264
- // ],
265
- // "@typescript-eslint/type-annotation-spacing": type.ignore,
266
- // "@typescript-eslint/typedef": type.ignore,
267
- // "@typescript-eslint/unbound-method": type.warning,
268
- // "@typescript-eslint/unified-signatures": type.warning,
269
-
270
- // // These rules don't add much value, are better covered by TypeScript and good definition files
271
- // "react/no-direct-mutation-state": type.ignore,
272
- // "react/no-deprecated": type.ignore,
273
- // "react/no-string-refs": type.ignore,
274
- // "react/require-render-return": type.ignore,
275
-
276
- // "react/jsx-filename-extension": [
277
- // type.warning,
278
- // { extensions: [`.jsx`, `.tsx`] },
279
- // ], // also want to use with ".tsx"
280
- // "react/prop-types": type.ignore, // Is this incompatible with TS props type?
281
-
282
- // // https://reactjs.org/docs/hooks-rules.html#eslint-plugin
283
- // "react-hooks/rules-of-hooks": type.error, // Checks rules of Hooks
284
- // "react-hooks/exhaustive-deps": type.warning, // Checks effect dependencies
285
213
  },
286
214
  }
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.4",
8
+ "version": "4.2.1",
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
  }