-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Problem
The plugin is not compatible with ESLint 9 due to usage of deprecated APIs.
Error Message
TypeError: context.getScope is not a function Occurred while linting .../src/Button.tsx:1 Rule: react-server-components/use-client at Program (...node_modules/eslint-plugin-react-server-components/dist/index.cjs:289:31)
Details
- ESLint version: 9.25.1
- eslint-plugin-react-server-components version: 1.2.0
- @eslint/eslintrc: latest
The plugin is using context.getScope() which has been removed in ESLint 9's new flat config system. Even though I'm using FlatCompat to properly load the legacy config, the internal implementation of the rule is still using deprecated APIs.
Reproduction
import { FlatCompat } from '@eslint/eslintrc';
import reactPlugin from 'eslint-plugin-react';
// Other imports...
// Using FlatCompat to convert legacy configs
const compat = new FlatCompat({
baseDirectory: import.meta.dirname,
});
// Loading the recommended config using FlatCompat
const rscConfig = compat.extends('plugin:react-server-components/recommended');
export default [
{
// ...other config
plugins: {
'react': reactPlugin,
// Using the plugin from the converted config
'react-server-components': rscConfig[0].plugins['react-server-components'],
},
rules: {
// ...other rules
// Using rules from the converted config
...rscConfig[0].rules,
// Custom rule config
"react-server-components/use-client": ["error", { allowedServerHooks: ["useMemo"] }],
},
}
];aakobracket, artemisclyde, alexkunin, fadomire, cwojcik-ifthen and 1 more
Metadata
Metadata
Assignees
Labels
No labels