@foray1010/eslint-config 7.0.1 → 7.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/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [7.3.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.2.0...@foray1010/eslint-config@7.3.0) (2022-07-28)
7
+
8
+ ### Features
9
+
10
+ - **eslint-config:** use jest/unbound-method for tests ([babe1d7](https://github.com/foray1010/common-presets/commit/babe1d7f9f9f208f60cb08e5ec52ac6b93136644))
11
+
12
+ ## [7.2.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.1.0...@foray1010/eslint-config@7.2.0) (2022-07-27)
13
+
14
+ ### Features
15
+
16
+ - **eslint-config:** reenable @typescript-eslint/restrict-template-expressions ([772d768](https://github.com/foray1010/common-presets/commit/772d76811189b79efc0c49dcb4225ca6741da26c))
17
+ - **eslint-config:** reenable @typescript-eslint/unbound-method ([8451f92](https://github.com/foray1010/common-presets/commit/8451f92d0a983a84bbb7181d75652bab84e6bedc))
18
+ - **eslint-config:** separate type imports which allow certain optimizations within compilers ([15a15c9](https://github.com/foray1010/common-presets/commit/15a15c9f57dc9b58e52109d523b95df15c725b8e))
19
+
20
+ ## [7.1.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.0.1...@foray1010/eslint-config@7.1.0) (2022-06-14)
21
+
22
+ ### Features
23
+
24
+ - avoid unnecessary closing tags ([602dd20](https://github.com/foray1010/common-presets/commit/602dd2071393ee0ee584eba06de9cb122a91b203))
25
+
6
26
  ## [7.0.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@7.0.0...@foray1010/eslint-config@7.0.1) (2022-06-13)
7
27
 
8
28
  ### Bug Fixes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@foray1010/eslint-config",
4
- "version": "7.0.1",
4
+ "version": "7.3.0",
5
5
  "homepage": "https://github.com/foray1010/common-presets/tree/master/packages/eslint-config#readme",
6
6
  "bugs": "https://github.com/foray1010/common-presets/issues",
7
7
  "repository": {
@@ -48,5 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "gitHead": "162f905054a12ba6777eb746f2f440a68876463c"
51
+ "gitHead": "1a8bec3ae717a3e1d87041091475f3346476b1a3"
52
52
  }
package/presets/base.js CHANGED
@@ -149,6 +149,11 @@ module.exports = {
149
149
  },
150
150
  plugins: ['@typescript-eslint/eslint-plugin'],
151
151
  rules: {
152
+ // separate type imports which allow certain optimizations within compilers
153
+ '@typescript-eslint/consistent-type-imports': [
154
+ 'error',
155
+ { prefer: 'type-imports' },
156
+ ],
152
157
  // encourage to use private accessibility modifier
153
158
  '@typescript-eslint/explicit-member-accessibility': [
154
159
  'error',
@@ -183,8 +188,6 @@ module.exports = {
183
188
  '@typescript-eslint/no-unsafe-member-access': 'off',
184
189
  // some third party packages doesn't offer typings
185
190
  '@typescript-eslint/no-unsafe-return': 'off',
186
- // must remove unused variables and types
187
- '@typescript-eslint/no-unused-vars': 'error',
188
191
  // do not block functions referring to other functions
189
192
  '@typescript-eslint/no-use-before-define': [
190
193
  'error',
@@ -205,11 +208,22 @@ module.exports = {
205
208
  ],
206
209
  // fault alarms in 4.29.3
207
210
  '@typescript-eslint/restrict-plus-operands': 'off',
208
- // 1. mistakenly recognize string as any in 4.29.3
209
- // 2. allow `any` to be used in template string
210
- '@typescript-eslint/restrict-template-expressions': 'off',
211
- // redundant for composing functions
212
- '@typescript-eslint/unbound-method': 'off',
211
+ // allow primitive value in template string
212
+ '@typescript-eslint/restrict-template-expressions': [
213
+ 'error',
214
+ {
215
+ allowNumber: true,
216
+ allowBoolean: true,
217
+ allowAny: true, // mistakenly recognize string as any in 4.29.3
218
+ allowNullish: true,
219
+ allowRegExp: true,
220
+ },
221
+ ],
222
+ // ignore static function as those are not supposed to use `this`
223
+ '@typescript-eslint/unbound-method': [
224
+ 'error',
225
+ { ignoreStatic: true },
226
+ ],
213
227
  },
214
228
  overrides: [
215
229
  {
@@ -217,6 +231,10 @@ module.exports = {
217
231
  rules: {
218
232
  // doesn't work with jest.fn<void>()
219
233
  '@typescript-eslint/no-invalid-void-type': 'off',
234
+ // replace by jest/unbound-method
235
+ '@typescript-eslint/unbound-method': 'off',
236
+ // allow passing an unbound method to `expect` calls
237
+ 'jest/unbound-method': ['error', { ignoreStatic: true }],
220
238
  },
221
239
  },
222
240
  ],
package/presets/react.js CHANGED
@@ -43,6 +43,8 @@ module.exports = {
43
43
  ],
44
44
  // rely on typescript instead, and it does not work well with types that are imported from elsewhere
45
45
  'react/prop-types': 'off',
46
+ // avoid unnecessary closing tags
47
+ 'react/self-closing-comp': 'error',
46
48
  'react-hooks/exhaustive-deps': [
47
49
  'error',
48
50
  {