Skip to content
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

Add the React Compiler linter #11139

Merged
merged 1 commit into from
Nov 8, 2024
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
5 changes: 4 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { fixupPluginRules } from '@eslint/compat';
import js from '@eslint/js';
import patternflyReact from 'eslint-plugin-patternfly-react';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import reactCompiler from 'eslint-plugin-react-compiler';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRecommended from 'eslint-plugin-react/configs/recommended.js';
import testingLibrary from 'eslint-plugin-testing-library';
Expand All @@ -27,7 +28,8 @@ export default [
{
plugins: {
'patternfly-react': fixupPluginRules(patternflyReact),
'react-hooks': fixupPluginRules(reactHooks)
'react-hooks': fixupPluginRules(reactHooks),
'react-compiler': reactCompiler
},
languageOptions: {
globals: {
Expand Down Expand Up @@ -119,6 +121,7 @@ export default [
radix: ['error', 'as-needed'],
'react/prop-types': 0,
'react/display-name': 0,
'react-compiler/react-compiler': 'warn',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume at some point we want to change this to error out when we move to react 19? @tlabaj Do we need a story to revisit this in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already logged it, see #11138 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error value can be set once all warnings are fixed, no need to wait for React 19. It only notifies you of patterns that are incompatible with the React Compiler, but does not introduce anything incompatible.

'react-hooks/exhaustive-deps': 'warn',
'react/no-unescaped-entities': ['error', { forbid: ['>', '}'] }],
'spaced-comment': 'error',
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"eslint-plugin-markdown": "^5.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-compiler": "19.0.0-beta-63b359f-20241101",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-testing-library": "^6.3.0",
"fs-extra": "^11.2.0",
Expand Down
Loading
Loading