Skip to content

feat(react-x): add 'jsx-no-iife' rule, closes #1112 #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pkgs/configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"eslint-plugin-perfectionist": "^4.13.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-unicorn": "^59.0.1",
"typescript-eslint": "^8.32.1"
"typescript-eslint": "^8.33.0"
}
}
10 changes: 5 additions & 5 deletions .pkgs/eslint-plugin-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"@eslint-react/var": "workspace:*",
"@eslint/js": "^9.27.0",
"@stylistic/eslint-plugin": "^4.4.0",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/type-utils": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/type-utils": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"eslint-plugin-de-morgan": "^1.2.1",
"eslint-plugin-jsdoc": "^50.6.17",
"eslint-plugin-perfectionist": "^4.13.0",
Expand All @@ -42,7 +42,7 @@
},
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"tsup": "^8.5.0"
},
Expand Down
1 change: 1 addition & 0 deletions apps/website/content/docs/rules/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"---X Rules---",
"jsx-key-before-spread",
"jsx-no-duplicate-props",
"jsx-no-iife",
"jsx-no-undef",
"jsx-uses-react",
"jsx-uses-vars",
Expand Down
1 change: 1 addition & 0 deletions apps/website/content/docs/rules/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The `jsx-*` rules check for issues exclusive to JSX syntax, which are absent fro
| :----------------------------------------------------------------------------------- | :-- | :-------: | :-------------------------------------------------------------------------------------------------- | :------: |
| [`jsx-key-before-spread`](./jsx-key-before-spread) | 1️⃣ | | Enforces that the `key` attribute is placed before the spread attribute in JSX elements | |
| [`jsx-no-duplicate-props`](./jsx-no-duplicate-props) | 1️⃣ | | Disallow duplicate props in JSX elements | |
| [`jsx-no-iife`](./jsx-no-iife) | 0️⃣ | | Disallows `IIFE` in JSX elements | |
| [`jsx-no-undef`](./jsx-no-undef) | 0️⃣ | | Disallow undefined variables in JSX elements | |
| [`jsx-uses-react`](./jsx-uses-react) | 1️⃣ | | Marks React variables as used when JSX is used | |
| [`jsx-uses-vars`](./jsx-uses-vars) | 1️⃣ | | Marks variables used in JSX elements as used | |
Expand Down
16 changes: 8 additions & 8 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"@eslint-react/eff": "workspace:*",
"bsky-react-post": "^0.1.7",
"clsx": "^2.1.1",
"fumadocs-core": "15.4.0",
"fumadocs-core": "15.4.2",
"fumadocs-docgen": "2.0.0",
"fumadocs-mdx": "11.6.6",
"fumadocs-twoslash": "3.1.3",
"fumadocs-typescript": "4.0.5",
"fumadocs-ui": "15.4.0",
"fumadocs-ui": "15.4.2",
"lucide-react": "^0.511.0",
"next": "^15.3.2",
"next-view-transitions": "^0.3.4",
Expand All @@ -37,15 +37,15 @@
"@eslint/markdown": "^6.4.0",
"@local/configs": "workspace:*",
"@mdx-js/mdx": "^3.1.0",
"@tailwindcss/postcss": "^4.1.7",
"@tailwindcss/postcss": "^4.1.8",
"@theguild/remark-mermaid": "^0.3.0",
"@tsconfig/next": "^2.0.3",
"@tsconfig/node22": "^22.0.2",
"@tsconfig/strictest": "^2.0.5",
"@types/hast": "^3.0.4",
"@types/mdx": "^2.0.13",
"@types/node": "^22.15.21",
"@types/react": "^19.1.5",
"@types/node": "^22.15.24",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"autoprefixer": "^10.4.21",
"dedent": "^1.6.0",
Expand All @@ -57,10 +57,10 @@
"eslint-plugin-react-refresh": "^0.4.20",
"eslint-plugin-unicorn": "^59.0.1",
"importx": "^0.5.2",
"postcss": "^8.5.3",
"tailwindcss": "^4.1.7",
"postcss": "^8.5.4",
"tailwindcss": "^4.1.8",
"tailwindcss-animated": "^2.0.0",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1"
"typescript-eslint": "^8.33.0"
}
}
6 changes: 3 additions & 3 deletions examples/next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
"@tsconfig/next": "^2.0.3",
"@tsconfig/node22": "^22.0.2",
"@tsconfig/strictest": "^2.0.5",
"@types/node": "^22.15.21",
"@types/react": "^19.1.5",
"@types/node": "^22.15.24",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"eslint": "^9.27.0",
"eslint-config-flat-gitignore": "^2.1.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1"
"typescript-eslint": "^8.33.0"
},
"engines": {
"node": ">=18.18.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/vite-react-dom-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"@tsconfig/node22": "^22.0.2",
"@tsconfig/strictest": "^2.0.5",
"@tsconfig/vite-react": "^6.3.5",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"@vitejs/plugin-react": "^4.5.0",
"eslint": "^9.27.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1",
"typescript-eslint": "^8.33.0",
"vite": "^6.3.5"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-react-dom-js-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@eslint-react/eslint-plugin": "workspace:*",
"@eslint/config-inspector": "^1.0.2",
"@eslint/js": "^9.27.0",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"@vitejs/plugin-react": "^4.5.0",
"eslint": "^9.27.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"react-dom": "^19.1.0"
},
"devDependencies": {
"@babel/core": "^7.27.1",
"@babel/core": "^7.27.3",
"@babel/eslint-parser": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/preset-react": "^7.27.1",
"@eslint/config-inspector": "^1.0.2",
"@eslint/js": "^9.27.0",
"@types/babel__core": "~7.20.5",
"@types/babel__preset-env": "~7.10.0",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"@vitejs/plugin-react": "^4.5.0",
"eslint": "^9.27.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@tsconfig/node22": "^22.0.2",
"@tsconfig/strictest": "^2.0.5",
"@tsconfig/vite-react": "^6.3.5",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"@vitejs/plugin-react": "^4.5.0",
"eslint": "^9.27.0",
Expand All @@ -32,7 +32,7 @@
"globals": "^16.2.0",
"ts-blank-eslint-parser": "^0.4.3",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1",
"typescript-eslint": "^8.33.0",
"vite": "^6.3.5"
},
"engines": {
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@
"@swc/core": "^1.11.29",
"@tsconfig/node22": "^22.0.2",
"@tsconfig/strictest": "^2.0.5",
"@types/node": "^22.15.21",
"@types/react": "^19.1.5",
"@types/node": "^22.15.24",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"@typescript-eslint/parser": "^8.32.1",
"@typescript-eslint/rule-tester": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"ansis": "^4.0.0",
"@typescript-eslint/parser": "^8.33.0",
"@typescript-eslint/rule-tester": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"ansis": "^4.1.0",
"cspell": "^9.0.2",
"dedent": "^1.6.0",
"dprint": "^0.50.0",
"esbuild": "^0.25.4",
"esbuild": "^0.25.5",
"eslint": "^9.27.0",
"eslint-config-flat-gitignore": "^2.1.0",
"eslint-plugin-vitest": "^0.5.4",
Expand All @@ -92,7 +92,7 @@
"typedoc-plugin-markdown": "^4.6.3",
"typedoc-plugin-mdn-links": "^5.0.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1",
"typescript-eslint": "^8.33.0",
"vitest": "^3.1.4"
},
"packageManager": "[email protected]",
Expand All @@ -109,10 +109,10 @@
"sharp"
],
"overrides": {
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"cross-spawn": "^7.0.6",
"esbuild": "^0.25.4",
"esbuild": "^0.25.5",
"lucide-react": "^0.511.0",
"next": "^15.3.2",
"react": "^19.1.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"@eslint-react/kit": "workspace:*",
"@eslint-react/shared": "workspace:*",
"@eslint-react/var": "workspace:*",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/type-utils": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/type-utils": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"birecord": "^0.1.1",
"ts-pattern": "^5.7.1"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/eslint-plugin-react-debug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@
"@eslint-react/kit": "workspace:*",
"@eslint-react/shared": "workspace:*",
"@eslint-react/var": "workspace:*",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/type-utils": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/type-utils": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"string-ts": "^2.2.1",
"ts-pattern": "^5.7.1"
},
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"tsup": "^8.5.0"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/plugins/eslint-plugin-react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@
"@eslint-react/kit": "workspace:*",
"@eslint-react/shared": "workspace:*",
"@eslint-react/var": "workspace:*",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"compare-versions": "^6.1.1",
"string-ts": "^2.2.1",
"ts-pattern": "^5.7.1"
},
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"tsup": "^8.5.0"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/eslint-plugin-react-hooks-extra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@
"@eslint-react/kit": "workspace:*",
"@eslint-react/shared": "workspace:*",
"@eslint-react/var": "workspace:*",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/type-utils": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/type-utils": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"string-ts": "^2.2.1",
"ts-pattern": "^5.7.1"
},
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"tsup": "^8.5.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,16 @@
"@eslint-react/kit": "workspace:*",
"@eslint-react/shared": "workspace:*",
"@eslint-react/var": "workspace:*",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/type-utils": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/type-utils": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"string-ts": "^2.2.1",
"ts-pattern": "^5.7.1"
},
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"tsup": "^8.5.0"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/plugins/eslint-plugin-react-web-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@
"@eslint-react/kit": "workspace:*",
"@eslint-react/shared": "workspace:*",
"@eslint-react/var": "workspace:*",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"string-ts": "^2.2.1",
"ts-pattern": "^5.7.1"
},
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"tsup": "^8.5.0"
},
Expand Down
10 changes: 5 additions & 5 deletions packages/plugins/eslint-plugin-react-x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@
"@eslint-react/kit": "workspace:*",
"@eslint-react/shared": "workspace:*",
"@eslint-react/var": "workspace:*",
"@typescript-eslint/scope-manager": "^8.32.1",
"@typescript-eslint/type-utils": "^8.32.1",
"@typescript-eslint/types": "^8.32.1",
"@typescript-eslint/utils": "^8.32.1",
"@typescript-eslint/scope-manager": "^8.33.0",
"@typescript-eslint/type-utils": "^8.33.0",
"@typescript-eslint/types": "^8.33.0",
"@typescript-eslint/utils": "^8.33.0",
"compare-versions": "^6.1.1",
"is-immutable-type": "^5.0.1",
"string-ts": "^2.2.1",
"ts-pattern": "^5.7.1"
},
"devDependencies": {
"@local/configs": "workspace:*",
"@types/react": "^19.1.5",
"@types/react": "^19.1.6",
"@types/react-dom": "^19.1.5",
"ts-api-utils": "^2.1.0",
"tsup": "^8.5.0"
Expand Down
2 changes: 2 additions & 0 deletions packages/plugins/eslint-plugin-react-x/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import avoidShorthandBoolean from "./rules/avoid-shorthand-boolean";
import avoidShorthandFragment from "./rules/avoid-shorthand-fragment";
import jsxKeyBeforeSpread from "./rules/jsx-key-before-spread";
import jsxNoDuplicateProps from "./rules/jsx-no-duplicate-props";
import jsxNoIife from "./rules/jsx-no-iife";
import jsxNoUndef from "./rules/jsx-no-undef";
import jsxUsesReact from "./rules/jsx-uses-react";
import jsxUsesVars from "./rules/jsx-uses-vars";
Expand Down Expand Up @@ -119,6 +120,7 @@ export const plugin = {
// Part: JSX only rules
"jsx-key-before-spread": jsxKeyBeforeSpread,
"jsx-no-duplicate-props": jsxNoDuplicateProps,
"jsx-no-iife": jsxNoIife,
"jsx-no-undef": jsxNoUndef,
"jsx-uses-react": jsxUsesReact,
"jsx-uses-vars": jsxUsesVars,
Expand Down
Loading