Commit deb62e0
fix(eslint-plugin): normalize whitespace in allowList variable matching for multiline expressions (#10337)
* fix(eslint-plugin): normalize whitespace in allowList variable matching
When a member expression spans multiple lines (e.g. `ignored\n .run()`),
`sourceCode.getText()` preserves the newline. The root segment extracted
by splitting on `.'` then becomes `'ignored\n '`, which never matches
the allowlisted variable name `'ignored'`.
Fix: extend `normalizeChain` to also collapse all whitespace, so
multi-line chains produce the same identifier path as single-line ones.
Fixes #10334
* changeset
---------
Co-authored-by: Maks Pikov <mixelburg@users.noreply.github.com>
Co-authored-by: Dominik Dorfmeister 🔮 <office@dorfmeister.cc>1 parent 67b12ae commit deb62e0
File tree
3 files changed
+20
-1
lines changed- .changeset
- packages/eslint-plugin-query/src
- __tests__
- rules/exhaustive-deps
3 files changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2160 | 2160 | | |
2161 | 2161 | | |
2162 | 2162 | | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
2163 | 2177 | | |
2164 | 2178 | | |
2165 | 2179 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| |||
0 commit comments