eslint-config-fabulator 6.1.0 → 7.0.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,25 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## v7.0.1 (2026-11-30)
5
+ ### Fixed
6
+ - [4c060d6](https://github.com/fabulator/eslint-config-fabulator/commit/4c060d6c0ba330008adc1b65d4337c7edea62220) Disable unicorn rule unicorn/no-await-expression (#249)
7
+
8
+ ## v7.0.0 (2026-11-24)
9
+ ### Changed
10
+ - [8bea450](https://github.com/fabulator/eslint-config-fabulator/commit/8bea450257b43d720a863cc94087c1f4d15bf818) BREAKING Stricter rules, unicorn instead of array-func, disable comments require description (#248)
11
+
12
+ - eslint-plugin-unicorn recommended (minus opinionated rules) replaces eslint-plugin-array-func
13
+ - @eslint-community/eslint-plugin-eslint-comments: disable comments need a description, key rules can't be disabled
14
+ - no-unused-vars in TS, no-non-null-assertion, prefer-nullish-coalescing, switch-exhaustiveness-check,
15
+ consistent-type-imports/exports, explicit-module-boundary-types
16
+ - core: eqeqeq, curly, no-nested-ternary, no-param-reassign, prefer-const, prefer-template, object-shorthand
17
+ - size limits: max-lines, max-lines-per-function, complexity, max-depth
18
+ - import-x/no-cycle limited to maxDepth 10
19
+ - tests with fixtures (npm test), package.json files field
20
+
21
+ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
22
+
4
23
  ## v6.1.0 (2026-11-24)
5
24
  ### Fixed
6
25
  - [2742a44](https://github.com/fabulator/eslint-config-fabulator/commit/2742a444067a61841fc50c7eea53a9c95446ce73) Apply Vitest rules only in projects that use Vitest (#247)
package/index.js CHANGED
@@ -1,14 +1,15 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import path from 'node:path';
3
+ import comments from '@eslint-community/eslint-plugin-eslint-comments/configs';
3
4
  import eslintReact from '@eslint-react/eslint-plugin';
4
5
  import js from '@eslint/js';
5
6
  import vitest from '@vitest/eslint-plugin';
6
7
  import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript';
7
- import arrayFunc from 'eslint-plugin-array-func';
8
8
  import { createNodeResolver, importX } from 'eslint-plugin-import-x';
9
9
  import jsxA11y from 'eslint-plugin-jsx-a11y-x';
10
10
  import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
11
11
  import reactHooks from 'eslint-plugin-react-hooks';
12
+ import unicorn from 'eslint-plugin-unicorn';
12
13
  import { defineConfig } from 'eslint/config';
13
14
  import globals from 'globals';
14
15
  import tseslint from 'typescript-eslint';
@@ -16,6 +17,29 @@ import tseslint from 'typescript-eslint';
16
17
  const JSX_FILES = ['**/*.jsx'];
17
18
  const TSX_FILES = ['**/*.tsx'];
18
19
  const TS_FILES = ['**/*.{ts,tsx,mts,cts}'];
20
+ const TEST_FILES = ['**/*.test.{js,ts,jsx,tsx}'];
21
+
22
+ // `_` prefix marks intentionally unused bindings, rest siblings omit properties from objects.
23
+ const UNUSED_VARS_OPTIONS = {
24
+ argsIgnorePattern: '^_',
25
+ caughtErrorsIgnorePattern: '^_',
26
+ destructuredArrayIgnorePattern: '^_',
27
+ ignoreRestSiblings: true,
28
+ varsIgnorePattern: '^_',
29
+ };
30
+
31
+ // Rules that guard type safety and React correctness – an `eslint-disable` comment must not
32
+ // silence them, the code has to be fixed instead.
33
+ const UNDISABLEABLE_RULES = [
34
+ '@typescript-eslint/ban-ts-comment',
35
+ '@typescript-eslint/no-explicit-any',
36
+ '@typescript-eslint/no-floating-promises',
37
+ '@typescript-eslint/no-misused-promises',
38
+ '@typescript-eslint/no-unsafe-*',
39
+ '@eslint-community/eslint-comments/*',
40
+ 'prettier/prettier',
41
+ 'react-hooks/rules-of-hooks',
42
+ ];
19
43
 
20
44
  /**
21
45
  * Vitest rules make sense only in projects that test with Vitest. Elsewhere (e.g. `node:test`)
@@ -61,17 +85,72 @@ const warningsToErrors = (rules) =>
61
85
 
62
86
  const config = defineConfig([
63
87
  {
64
- extends: [arrayFunc.configs.all],
65
- rules: { 'array-func/prefer-array-from': 'off' },
88
+ extends: [unicorn.configs.recommended],
89
+ rules: {
90
+ // Opinionated naming – conflicts with React (PascalCase components, `props`, `e`, `ref`).
91
+ 'unicorn/consistent-boolean-name': 'off',
92
+ 'unicorn/filename-case': 'off',
93
+ 'unicorn/name-replacements': 'off',
94
+ // React, DOM and JSON APIs use `null`, TypeScript distinguishes it from `undefined`.
95
+ 'unicorn/no-null': 'off',
96
+ 'unicorn/no-useless-undefined': 'off',
97
+ // Taste, not correctness.
98
+ 'unicorn/no-array-reduce': 'off',
99
+ // Entry points and config files legitimately have side effects.
100
+ 'unicorn/no-top-level-side-effects': 'off',
101
+ // TypeScript `private` (incl. constructor parameter properties used by DI) is fine.
102
+ 'unicorn/prefer-private-class-fields': 'off',
103
+ // Standard JSDoc ` * ` prefixes, generated by editors.
104
+ 'unicorn/no-asterisk-prefix-in-documentation-comments': 'off',
105
+ // Core `no-nested-ternary` is stricter (no nesting at all).
106
+ 'unicorn/no-nested-ternary': 'off',
107
+ // it is fine
108
+ 'unicorn/no-await-expression-member': 'off',
109
+ },
66
110
  },
67
111
  {
68
112
  extends: [js.configs.recommended],
69
- rules: { 'no-irregular-whitespace': 'off', 'no-console': 'error' },
113
+ rules: {
114
+ 'no-irregular-whitespace': 'off',
115
+ 'no-console': 'error',
116
+ 'no-unused-vars': ['error', UNUSED_VARS_OPTIONS],
117
+ eqeqeq: ['error', 'always'],
118
+ 'no-nested-ternary': 'error',
119
+ 'no-param-reassign': 'error',
120
+ 'object-shorthand': 'error',
121
+ 'prefer-const': 'error',
122
+ 'prefer-template': 'error',
123
+ // Small units are easier to review and cheaper to read for AI agents (less context).
124
+ complexity: ['error', 15],
125
+ 'max-depth': ['error', 4],
126
+ 'max-lines': [
127
+ 'error',
128
+ { max: 300, skipBlankLines: true, skipComments: true },
129
+ ],
130
+ 'max-lines-per-function': [
131
+ 'error',
132
+ { max: 80, skipBlankLines: true, skipComments: true },
133
+ ],
134
+ },
135
+ },
136
+ {
137
+ files: TEST_FILES,
138
+ rules: { 'max-lines-per-function': 'off' },
139
+ },
140
+ {
141
+ extends: [comments.recommended],
142
+ rules: {
143
+ '@eslint-community/eslint-comments/require-description': 'error',
144
+ '@eslint-community/eslint-comments/no-restricted-disable': [
145
+ 'error',
146
+ ...UNDISABLEABLE_RULES,
147
+ ],
148
+ },
70
149
  },
71
150
  ...(usesVitest
72
151
  ? [
73
152
  {
74
- files: ['**/*.test.{js,ts,jsx,tsx}'],
153
+ files: TEST_FILES,
75
154
  extends: [vitest.configs.recommended],
76
155
  },
77
156
  ]
@@ -91,7 +170,8 @@ const config = defineConfig([
91
170
  },
92
171
  ],
93
172
  'import-x/no-mutable-exports': 'error',
94
- 'import-x/no-cycle': 'error',
173
+ // Unlimited depth is slow on large projects, longer cycles are rare.
174
+ 'import-x/no-cycle': ['error', { maxDepth: 10, ignoreExternal: true }],
95
175
  'import-x/no-relative-packages': 'error',
96
176
  'import-x/no-self-import': 'error',
97
177
  'import-x/order': ['error', { 'newlines-between': 'never' }],
@@ -152,14 +232,18 @@ const config = defineConfig([
152
232
  allowNever: false,
153
233
  },
154
234
  ],
155
- '@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
156
- '@typescript-eslint/no-non-null-assertion': 'off',
157
235
  '@typescript-eslint/no-empty-function': 'off',
158
- '@typescript-eslint/no-unused-vars': 'off',
236
+ '@typescript-eslint/no-unused-vars': ['error', UNUSED_VARS_OPTIONS],
159
237
  '@typescript-eslint/no-empty-object-type': 'off',
160
- '@typescript-eslint/non-nullable-type-assertion-style': 'error',
238
+ // Prefers `value!` over `value as T`, which contradicts `no-non-null-assertion`.
239
+ '@typescript-eslint/non-nullable-type-assertion-style': 'off',
161
240
  '@typescript-eslint/prefer-optional-chain': 'error',
162
- '@typescript-eslint/prefer-nullish-coalescing': 'off',
241
+ '@typescript-eslint/consistent-type-exports': 'error',
242
+ '@typescript-eslint/consistent-type-imports': 'error',
243
+ // Explicit signatures let readers (and AI agents) understand a module without its implementation.
244
+ '@typescript-eslint/explicit-module-boundary-types': 'error',
245
+ '@typescript-eslint/no-import-type-side-effects': 'error',
246
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
163
247
  },
164
248
  },
165
249
  {
@@ -187,11 +271,13 @@ const config = defineConfig([
187
271
  singleQuote: true,
188
272
  },
189
273
  ],
274
+ // eslint-config-prettier turns `curly` off, but `all` does not conflict with Prettier.
275
+ curly: ['error', 'all'],
190
276
  },
191
277
  },
192
278
  ]);
193
279
 
194
- // eslint-disable-next-line import-x/no-default-export
280
+ // eslint-disable-next-line import-x/no-default-export -- ESLint loads shareable configs via default export
195
281
  export default config.map((item) =>
196
282
  item.rules ? { ...item, rules: warningsToErrors(item.rules) } : item,
197
283
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-fabulator",
3
- "version": "6.1.0",
3
+ "version": "7.0.1",
4
4
  "description": "Shared ESLint config for fabulator projects",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -19,22 +19,28 @@
19
19
  "license": "Apache-2.0",
20
20
  "author": "Michal Ozogán <michal@ozogan.eu>",
21
21
  "main": "index.js",
22
+ "files": [
23
+ "index.js",
24
+ "CHANGELOG.md"
25
+ ],
22
26
  "scripts": {
23
- "lint": "eslint ./ --ext .js --config index.js",
27
+ "lint": "eslint ./ --ext .js --config index.js --ignore-pattern test/fixtures/",
24
28
  "lint:fix": "npm run lint -- --fix",
29
+ "test": "node --test test/",
25
30
  "release": "semantic-release"
26
31
  },
27
32
  "dependencies": {
33
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
28
34
  "@eslint-react/eslint-plugin": "^5.30.6",
29
35
  "@eslint/js": "^10.0.1",
30
36
  "@vitest/eslint-plugin": "^1.6.28",
31
37
  "eslint-config-prettier": "^10.1.8",
32
38
  "eslint-import-resolver-typescript": "^4.4.5",
33
- "eslint-plugin-array-func": "5.1.1",
34
39
  "eslint-plugin-import-x": "^4.18.1",
35
40
  "eslint-plugin-jsx-a11y-x": "^0.2.0",
36
41
  "eslint-plugin-prettier": "^5.5.7",
37
42
  "eslint-plugin-react-hooks": "^7.1.1",
43
+ "eslint-plugin-unicorn": "^80.0.0",
38
44
  "globals": "^17.14.0",
39
45
  "prettier": "^3.10.1",
40
46
  "typescript-eslint": "^8.74.0"
package/renovate.json DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "extends": [
3
- "fabulator"
4
- ]
5
- }