Skip to content

Commit

Permalink
fix: switch to modern React env
Browse files Browse the repository at this point in the history
  • Loading branch information
swernerx committed Apr 5, 2024
1 parent ab0e157 commit d49652b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions generated/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@
}
],
"react/jsx-uses-react": [
"error"
"off"
],
"react/jsx-uses-vars": [
"error"
Expand Down Expand Up @@ -1407,7 +1407,7 @@
"off"
],
"react/react-in-jsx-scope": [
"error"
"off"
],
"react/require-default-props": [
"error",
Expand Down
8 changes: 4 additions & 4 deletions generated/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -5748,13 +5748,13 @@
</tr>
<tr>
<th style="text-align:left">react/jsx-uses-react</th>
<td style="background:#fdb5bb;padding:3px 6px"></td>
<td style="background:#ccc;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#fdb5bb;padding:3px 6px">✓</td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#fdb5bb;padding:3px 6px"></td>
<td style="background:#ccc;padding:3px 6px"></td>
<td style="background:#ffe0ad;padding:3px 6px">✓</td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#ffe0ad;padding:3px 6px">✓</td>
Expand Down Expand Up @@ -6207,13 +6207,13 @@
</tr>
<tr>
<th style="text-align:left">react/react-in-jsx-scope</th>
<td style="background:#fdb5bb;padding:3px 6px"></td>
<td style="background:#ccc;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#ccc;padding:3px 6px">✗</td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#fdb5bb;padding:3px 6px"></td>
<td style="background:#ccc;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#eee;padding:3px 6px"></td>
<td style="background:#ccc;padding:3px 6px">✗</td>
Expand Down
12 changes: 8 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ export const blockedRules = new Set([
])

export const deprecatedRules = new Set([
// With TypeScript we do not use PropTypes anymore
"react/prop-types",

// There is a TS variant for the same rule
"prefer-destructuring",

// The "eqeqeq" rule is a more powerful alternative
"no-eq-null"
"no-eq-null",

// With TypeScript we do not use PropTypes anymore
"react/prop-types",

// Some presets still define these legacy rules
"react/react-in-jsx-scope",
"react/jsx-uses-react"
])

export const dropPluginRules = [
Expand Down
6 changes: 5 additions & 1 deletion src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ export async function loadConfigs(combined: CombinedRules) {
await mergeConfig(
combined,
getConfig({
extends: ["plugin:react/recommended", "plugin:react-hooks/recommended"]
extends: [
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
]
}),
"react"
)
Expand Down

0 comments on commit d49652b

Please sign in to comment.