@10stars/config 4.1.5 → 4.2.2

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 +98 -170
  2. package/package.json +9 -9
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
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
126
178
  "@typescript-eslint/no-misused-promises": [
127
179
  type.warning,
128
180
  { checksVoidReturn: false },
129
181
  ],
130
- // extra rules for TypeScript
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,
131
209
  /**
132
210
  * Regex
133
211
  */
134
- // extra rules for regex
135
212
  "regexp/no-useless-escape": type.warning,
136
-
137
- // "@typescript-eslint/adjacent-overload-signatures": type.warning,
138
- // "@typescript-eslint/array-type": [type.warning, { default: `array` }],
139
- // "@typescript-eslint/await-thenable": type.warning,
140
- // "@typescript-eslint/ban-ts-ignore": type.ignore,
141
- // // "@typescript-eslint/ban-types",
142
- // "brace-style": type.ignore,
143
- // "@typescript-eslint/brace-style": [
144
- // type.warning,
145
- // `1tbs`,
146
- // { allowSingleLine: true },
147
- // ],
148
- // "@typescript-eslint/class-name-casing": type.ignore, // we disable it to allow TS interfaces to be any case
149
- // "@typescript-eslint/consistent-type-assertions": [
150
- // type.warning,
151
- // { assertionStyle: `as`, objectLiteralTypeAssertions: `never` },
152
- // ],
153
- // "@typescript-eslint/consistent-type-definitions": [
154
- // type.warning,
155
- // `interface`,
156
- // ],
157
- // "@typescript-eslint/explicit-function-return-type": type.ignore,
158
- // "@typescript-eslint/explicit-member-accessibility": type.warning,
159
- // "func-call-spacing": type.ignore,
160
- // "@typescript-eslint/func-call-spacing": type.ignore, // prettier has it
161
- // "@typescript-eslint/generic-type-naming": type.ignore,
162
- // "@typescript-eslint/indent": type.ignore, // prettier has it
163
- // "@typescript-eslint/interface-name-prefix": type.ignore, // we want the types to have ability to be named exactly as values
164
- // // "@typescript-eslint/member-delimiter-style": [
165
- // // type.warning,
166
- // // { delimiter: `none`, requireLast: false },
167
- // // ],
168
- // "@typescript-eslint/member-delimiter-style": type.ignore,
169
- // "@typescript-eslint/member-ordering": [
170
- // type.warning,
171
- // {
172
- // default: [
173
- // `public-static-field`,
174
- // `public-instance-field`,
175
- // `public-constructor`,
176
- // `private-static-field`,
177
- // `private-instance-field`,
178
- // `private-constructor`,
179
- // `public-instance-method`,
180
- // `protected-instance-method`,
181
- // `private-instance-method`,
182
- // ],
183
- // },
184
- // ],
185
- // // "@typescript-eslint/camelcase": [
186
- // // type.warning,
187
- // // { properties: `never`, ignoreDestructuring: true },
188
- // // ],
189
- // // "@typescript-eslint/naming-convention": [
190
- // // type.error,
191
- // // {
192
- // // selector: `variable`,
193
- // // types: [`boolean`],
194
- // // format: [`PascalCase`],
195
- // // prefix: [`is`, `should`, `has`, `can`, `did`, `will`],
196
- // // },
197
- // // ],
198
- // "@typescript-eslint/no-array-constructor": type.ignore,
199
- // "no-empty-function": type.ignore,
200
- // "@typescript-eslint/no-empty-function": type.ignore,
201
- // "@typescript-eslint/no-empty-interface": [
202
- // type.warning,
203
- // { allowSingleExtends: true },
204
- // ],
205
- // "@typescript-eslint/no-explicit-any": type.ignore,
206
- // "no-extra-parens": type.ignore,
207
- // "@typescript-eslint/no-extra-parens": type.ignore,
208
- // "@typescript-eslint/no-extraneous-class": type.warning,
209
- // "@typescript-eslint/no-floating-promises": [
210
- // type.warning,
211
- // { ignoreVoid: true },
212
- // ],
213
- // "@typescript-eslint/no-for-in-array": type.warning,
214
- // "@typescript-eslint/no-inferrable-types": type.warning,
215
- // "no-magic-numbers": type.ignore,
216
- // "@typescript-eslint/no-magic-numbers": [
217
- // type.warning,
218
- // {
219
- // ignore: allowedMagicNumbers,
220
- // ignoreNumericLiteralTypes: true,
221
- // ignoreEnums: true,
222
- // },
223
- // ],
224
- // "@typescript-eslint/no-misused-new": type.warning,
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.5",
8
+ "version": "4.2.2",
9
9
  "author": "10stars.dev <web@alexandrov.co> (https://alexandrov.co)",
10
10
  "keywords": [
11
11
  "config"
@@ -24,18 +24,18 @@
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
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.25",
34
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
35
+ "@typescript-eslint/parser": "^5.0.0",
36
+ "esbuild": "~0.14.1",
37
37
  "esbuild-register": "^3.0.0",
38
- "eslint": "^7.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",
@@ -43,11 +43,11 @@
43
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
50
  "type-fest": "^2.0.0",
51
- "typescript": "^4.4.2"
51
+ "typescript": "^4.5.2"
52
52
  }
53
53
  }