You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## <aname="jsx-reference-tracking"></a> JSX references are now tracked
109
+
110
+
ESLint v10.0.0 now tracks JSX references, enabling correct scope analysis of JSX elements.
111
+
112
+
Previously, ESLint did not track references created by JSX identifiers, which could lead to incorrect results from rules that rely on scope information. For example:
113
+
114
+
```jsx
115
+
import { Card } from"./card.jsx";
116
+
117
+
exportfunctioncreateCard(name) {
118
+
return<Card name={name} />;
119
+
}
120
+
```
121
+
122
+
Prior to v10.0.0, ESLint did not recognize that `<Card>` is a reference to the imported `Card`, which could result in false positives such as reporting `Card` as "defined but never used" ([`no-unused-vars`](../rules/no-unused-vars)) or false negatives such as failing to report `Card` as undefined ([`no-undef`](../rules/no-undef)) if the import is removed. Starting with v10.0.0, `<Card>` is treated as a normal reference to the variable in scope. This brings JSX handling in line with developer expectations and improves the linting experience for modern JavaScript applications using JSX.
123
+
124
+
**To address:**
125
+
126
+
- For users:
127
+
- New linting reports may appear in files with JSX. Update your code accordingly or adjust rule configurations if needed.
128
+
- Rules previously used to work around ESLint’s lack of JSX reference tracking (for example, [`@eslint-react/jsx-uses-vars`](https://www.eslint-react.xyz/docs/rules/jsx-uses-vars)) are no longer needed. Remove or disable them in your configuration.
129
+
- For plugin developers: Custom rules relying on scope analysis may now encounter `JSXIdentifier` references. Update rules to handle these correctly.
## <aname="eslint-env-comments"></a> `eslint-env` comments are reported as errors
107
134
108
135
In the now obsolete ESLint v8 configuration system, `/* eslint-env */` comments could be used to define globals for a file. The current configuration system does not support such comments, and starting with ESLint v10.0.0, they are reported as errors during linting.
0 commit comments