eslint-config-fabulator 6.0.1 → 6.1.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/index.js +24 -4
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## v6.1.0 (2026-11-24)
5
+ ### Fixed
6
+ - [2742a44](https://github.com/fabulator/eslint-config-fabulator/commit/2742a444067a61841fc50c7eea53a9c95446ce73) Apply Vitest rules only in projects that use Vitest (#247)
7
+
8
+ Projects testing with node:test got Vitest errors on *.test.js files and the autofix
9
+ rewrote node:test imports to vitest. Vitest rules are now enabled only when vitest
10
+ is resolvable from the project root.
11
+
12
+ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
13
+
4
14
  ## v6.0.1 (2026-11-24)
5
15
  ### Fixed
6
16
  - [3fd8792](https://github.com/fabulator/eslint-config-fabulator/commit/3fd8792ad28c313952e9e0d127fa1f5f655bee95) Publish to npm via trusted publishing (#245)
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { createRequire } from 'node:module';
2
+ import path from 'node:path';
1
3
  import eslintReact from '@eslint-react/eslint-plugin';
2
4
  import js from '@eslint/js';
3
5
  import vitest from '@vitest/eslint-plugin';
@@ -15,6 +17,20 @@ const JSX_FILES = ['**/*.jsx'];
15
17
  const TSX_FILES = ['**/*.tsx'];
16
18
  const TS_FILES = ['**/*.{ts,tsx,mts,cts}'];
17
19
 
20
+ /**
21
+ * Vitest rules make sense only in projects that test with Vitest. Elsewhere (e.g. `node:test`)
22
+ * they would report false positives and their autofix would rewrite imports to `vitest`.
23
+ * ESLint runs from the project root, so Vitest is resolved from there.
24
+ */
25
+ const usesVitest = (() => {
26
+ try {
27
+ createRequire(path.join(process.cwd(), 'package.json')).resolve('vitest');
28
+ return true;
29
+ } catch {
30
+ return false;
31
+ }
32
+ })();
33
+
18
34
  // Rules covered by eslint-plugin-react-hooks (official, React Compiler based) are
19
35
  // turned off in @eslint-react so that each problem is reported only once.
20
36
  const reactHooksDuplicates = Object.fromEntries(
@@ -52,10 +68,14 @@ const config = defineConfig([
52
68
  extends: [js.configs.recommended],
53
69
  rules: { 'no-irregular-whitespace': 'off', 'no-console': 'error' },
54
70
  },
55
- {
56
- files: ['**/*.test.{js,ts,jsx,tsx}'],
57
- extends: [vitest.configs.recommended],
58
- },
71
+ ...(usesVitest
72
+ ? [
73
+ {
74
+ files: ['**/*.test.{js,ts,jsx,tsx}'],
75
+ extends: [vitest.configs.recommended],
76
+ },
77
+ ]
78
+ : []),
59
79
  {
60
80
  extends: [importX.flatConfigs.recommended],
61
81
  rules: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-fabulator",
3
- "version": "6.0.1",
3
+ "version": "6.1.0",
4
4
  "description": "Shared ESLint config for fabulator projects",
5
5
  "type": "module",
6
6
  "keywords": [