eslint-plugin-what 0.5.3 → 0.5.4

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 (2) hide show
  1. package/README.md +137 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # eslint-plugin-what
2
+
3
+ ESLint rules for [What Framework](https://whatfw.com). Catches common signal bugs and enforces framework patterns. Designed for ESLint 9+ flat config.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install eslint-plugin-what --save-dev
9
+ ```
10
+
11
+ Requires ESLint 9 or later.
12
+
13
+ ## Setup
14
+
15
+ ```js
16
+ // eslint.config.js
17
+ import what from 'eslint-plugin-what';
18
+
19
+ export default [
20
+ what.configs.recommended,
21
+ ];
22
+ ```
23
+
24
+ ## Configs
25
+
26
+ | Config | Description |
27
+ |---|---|
28
+ | `what.configs.recommended` | Balanced rules as warnings |
29
+ | `what.configs.strict` | All rules as errors + `prefer-set` |
30
+ | `what.configs.compiler` | For projects using the What compiler (disables rules the compiler handles) |
31
+
32
+ ## Rules
33
+
34
+ ### `what/no-signal-in-effect-deps`
35
+
36
+ Prevents passing signal getters as effect dependencies. Signals are already reactive -- including them in deps arrays causes effects to re-run on every render.
37
+
38
+ ```js
39
+ // Bad
40
+ useEffect(() => { ... }, [count()]);
41
+
42
+ // Good
43
+ useEffect(() => { ... }, []);
44
+ ```
45
+
46
+ ### `what/reactive-jsx-children`
47
+
48
+ Ensures dynamic values in JSX are wrapped in reactive functions so they update when signals change.
49
+
50
+ ```jsx
51
+ // Bad - won't update
52
+ <p>{count()}</p>
53
+
54
+ // Good
55
+ <p>{() => count()}</p>
56
+ ```
57
+
58
+ ### `what/no-signal-write-in-render`
59
+
60
+ Prevents writing to signals during component render, which can cause infinite re-render loops.
61
+
62
+ ```jsx
63
+ // Bad
64
+ function App() {
65
+ count.set(5); // writing during render
66
+ return <p>{count()}</p>;
67
+ }
68
+
69
+ // Good
70
+ function App() {
71
+ useEffect(() => { count.set(5); }, []);
72
+ return <p>{() => count()}</p>;
73
+ }
74
+ ```
75
+
76
+ ### `what/no-camelcase-events`
77
+
78
+ Enforces lowercase event handler names (`onclick` instead of `onClick`). What Framework uses lowercase events natively.
79
+
80
+ ```jsx
81
+ // Bad
82
+ <button onClick={handler}>
83
+
84
+ // Good
85
+ <button onclick={handler}>
86
+ ```
87
+
88
+ ### `what/prefer-set`
89
+
90
+ Suggests using `signal.set()` instead of reassignment for signal updates. Off by default.
91
+
92
+ ## Config Details
93
+
94
+ ### recommended
95
+
96
+ ```js
97
+ {
98
+ 'what/no-signal-in-effect-deps': 'warn',
99
+ 'what/reactive-jsx-children': 'warn',
100
+ 'what/no-signal-write-in-render': 'warn',
101
+ 'what/no-camelcase-events': 'warn',
102
+ 'what/prefer-set': 'off',
103
+ }
104
+ ```
105
+
106
+ ### strict
107
+
108
+ ```js
109
+ {
110
+ 'what/no-signal-in-effect-deps': 'error',
111
+ 'what/reactive-jsx-children': 'error',
112
+ 'what/no-signal-write-in-render': 'error',
113
+ 'what/no-camelcase-events': 'error',
114
+ 'what/prefer-set': 'warn',
115
+ }
116
+ ```
117
+
118
+ ### compiler
119
+
120
+ ```js
121
+ {
122
+ 'what/no-signal-in-effect-deps': 'warn',
123
+ 'what/reactive-jsx-children': 'off', // compiler handles reactive wrapping
124
+ 'what/no-signal-write-in-render': 'warn',
125
+ 'what/no-camelcase-events': 'off', // compiler normalizes events
126
+ 'what/prefer-set': 'off',
127
+ }
128
+ ```
129
+
130
+ ## Links
131
+
132
+ - [Documentation](https://whatfw.com)
133
+ - [GitHub](https://github.com/zvndev/what-fw)
134
+
135
+ ## License
136
+
137
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-what",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "ESLint rules for What Framework — catch signal bugs, enforce patterns",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -30,5 +30,5 @@
30
30
  "bugs": {
31
31
  "url": "https://github.com/zvndev/what-fw/issues"
32
32
  },
33
- "homepage": "https://whatframework.dev"
33
+ "homepage": "https://whatfw.com"
34
34
  }