@foray1010/eslint-config 10.2.0 → 10.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,18 @@
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
+ ## [10.3.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@10.2.1...@foray1010/eslint-config@10.3.0) (2023-03-30)
7
+
8
+ ### Features
9
+
10
+ - **eslint-config:** enable more `prefer-` rules from unicorn plugin ([2c0b411](https://github.com/foray1010/common-presets/commit/2c0b411a1ab5585db01f321e000239cf13758a94))
11
+
12
+ ## [10.2.1](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@10.2.0...@foray1010/eslint-config@10.2.1) (2023-03-29)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **eslint-config:** disable react/jsx-no-leaked-render as it does not recognize boolean type ([995d096](https://github.com/foray1010/common-presets/commit/995d096efa3627e46b48133ef9994fb4883a64c7))
17
+
6
18
  ## [10.2.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@10.1.0...@foray1010/eslint-config@10.2.0) (2023-03-29)
7
19
 
8
20
  ### Features
package/bases/base.mjs CHANGED
@@ -280,6 +280,14 @@ const baseConfig = [
280
280
  rules: {
281
281
  ...eslintPluginEslintComments.configs['recommended']?.rules,
282
282
  ...eslintPluginImport.configs['recommended']?.rules,
283
+ ...Object.fromEntries(
284
+ Object.entries(
285
+ eslintPluginUnicorn.configs['recommended']?.rules ?? {},
286
+ ).filter(([ruleName]) => {
287
+ // only use recommended `prefer-` rules as other rules are too strict
288
+ return ruleName.startsWith('unicorn/prefer-')
289
+ }),
290
+ ),
283
291
  // allow disable eslint rules for whole file without re-enable it in the end of the file
284
292
  '@eslint-community/eslint-comments/disable-enable-pair': [
285
293
  'error',
@@ -374,10 +382,14 @@ const baseConfig = [
374
382
  // use with `unicorn/throw-new-error`
375
383
  // disallow builtins to be created without `new` operator, to be consistent with es6 class syntax
376
384
  'unicorn/new-for-builtins': 'error',
377
- // prefer `import from 'node:xxx'`
378
- 'unicorn/prefer-node-protocol': 'error',
379
- // prefer Number static properties over global ones
380
- 'unicorn/prefer-number-properties': 'error',
385
+ // `at()` is simpler to use in array and string
386
+ 'unicorn/prefer-at': 'error',
387
+ // EventTarget works on both node.js and browsers, but EventEmitter only works on node.js
388
+ 'unicorn/prefer-event-target': 'error',
389
+ // some legacy projects still use commonjs
390
+ 'unicorn/prefer-module': 'off',
391
+ // it is cleaner than `.replace(//g)`
392
+ 'unicorn/prefer-string-replace-all': 'error',
381
393
  // use with `unicorn/new-for-builtins`
382
394
  'unicorn/throw-new-error': 'error',
383
395
  },
package/bases/react.mjs CHANGED
@@ -31,8 +31,6 @@ const reactConfig = [
31
31
  ...eslintPluginReactHooks.configs['recommended']?.rules,
32
32
  // avoid unexpected form submits
33
33
  'react/button-has-type': 'error',
34
- // avoid displaying unexpected value, and align coding style with react native
35
- 'react/jsx-no-leaked-render': 'error',
36
34
  'react/jsx-no-useless-fragment': [
37
35
  'error',
38
36
  {
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": "10.2.0",
4
+ "version": "10.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": {
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "d413c514ed4534c77b3ca52b11b7bdd2084f0185"
67
+ "gitHead": "c3d2af0ae05213a0cdbcc436bf403654a1d9ed68"
68
68
  }