@foray1010/eslint-config 10.2.1 → 10.4.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,22 @@
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.4.0](https://github.com/foray1010/common-presets/compare/@foray1010/eslint-config@10.3.0...@foray1010/eslint-config@10.4.0) (2023-03-30)
7
+
8
+ ### Features
9
+
10
+ - **eslint-config:** enable recommended `no-useless-` rules from unicorn plugin ([671581b](https://github.com/foray1010/common-presets/commit/671581b466aa788f2f9e82e6bbf8e324ba57b415))
11
+
12
+ ### Bug Fixes
13
+
14
+ - **eslint-config:** disable unicorn/prefer-spread ([004f937](https://github.com/foray1010/common-presets/commit/004f9377777a58ebc7ddfd579075b713fa3a468e))
15
+
16
+ ## [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)
17
+
18
+ ### Features
19
+
20
+ - **eslint-config:** enable more `prefer-` rules from unicorn plugin ([2c0b411](https://github.com/foray1010/common-presets/commit/2c0b411a1ab5585db01f321e000239cf13758a94))
21
+
6
22
  ## [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)
7
23
 
8
24
  ### Bug Fixes
package/bases/base.mjs CHANGED
@@ -280,6 +280,17 @@ 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 a subset of recommended rules as other rules are too strict
288
+ return (
289
+ ruleName.startsWith('unicorn/no-useless-') ||
290
+ ruleName.startsWith('unicorn/prefer-')
291
+ )
292
+ }),
293
+ ),
283
294
  // allow disable eslint rules for whole file without re-enable it in the end of the file
284
295
  '@eslint-community/eslint-comments/disable-enable-pair': [
285
296
  'error',
@@ -374,10 +385,16 @@ const baseConfig = [
374
385
  // use with `unicorn/throw-new-error`
375
386
  // disallow builtins to be created without `new` operator, to be consistent with es6 class syntax
376
387
  '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',
388
+ // `at()` is simpler to use in array and string
389
+ 'unicorn/prefer-at': 'error',
390
+ // EventTarget works on both node.js and browsers, but EventEmitter only works on node.js
391
+ 'unicorn/prefer-event-target': 'error',
392
+ // some legacy projects still use commonjs
393
+ 'unicorn/prefer-module': 'off',
394
+ // `Array.from(iterable)` is more readable than `[...iterable]`
395
+ 'unicorn/prefer-spread': 'off',
396
+ // it is cleaner than `.replace(//g)`
397
+ 'unicorn/prefer-string-replace-all': 'error',
381
398
  // use with `unicorn/new-for-builtins`
382
399
  'unicorn/throw-new-error': 'error',
383
400
  },
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.1",
4
+ "version": "10.4.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": "60e70bc680f7b1b43f4f45e4a7760306d1edc5ca"
67
+ "gitHead": "77efc0ef501281193755a7a4ff7991ae15c9fd6f"
68
68
  }