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

WIP: setup react-compiler-eslint #1748

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
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
42 changes: 30 additions & 12 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@

import url from 'node:url';
import eslint from '@eslint/js';
import { fixupPluginRules } from '@eslint/compat'
import tseslint from 'typescript-eslint';
import reactPlugin from 'eslint-plugin-react';
import storybookPlugin from 'eslint-plugin-storybook';
import eslintPluginReact from 'eslint-plugin-react';
import eslintPluginReactCompiler from 'eslint-plugin-react-compiler';
import eslintPluginStorybook from 'eslint-plugin-storybook';
import globals from 'globals';

import { FlatCompat } from '@eslint/eslintrc';

const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
const compat = new FlatCompat({ baseDirectory: __dirname });

export default tseslint.config(
{
plugins: {
'@typescript-eslint': tseslint.plugin,
'react': reactPlugin,
},
},

// ignore in all configs
{
Expand All @@ -42,17 +39,33 @@ export default tseslint.config(
],
},



// extends
eslint.configs.recommended,
...tseslint.configs.recommended,

{
plugins: {
'@typescript-eslint': tseslint.plugin,
},
},

//
// base config
//
{
languageOptions: {
parserOptions: {
globals: {
...globals.browser,
...globals.node,
},
allowAutommaticSingleRunInference: true,
ecmaVersion: 'latest',
ecmaFeatures: {
jsx: true,
},
cacheLiftetime: {
// We never create/change tsconfig structure - so no need to ever evict the cache
// In the rare case that we do - just manually restart IDE
Expand Down Expand Up @@ -128,9 +141,9 @@ export default tseslint.config(
// config for storybook
{
files: ['**/*.stories.tsx'],
extends: [
...compat.config(storybookPlugin.configs.recommended)
],
rules: {
...eslintPluginStorybook.configs.recommended.rules
}
},

// config for tests
Expand All @@ -149,10 +162,15 @@ export default tseslint.config(
// config for react packages
{
files: ['packages/lib-components/**/*.{ts,tsx,mts,cts,js,jsx}', 'packages/web-main/**/*.{ts,tsx,mts,cts,js,jsx}'],
plugins: {
'react-compiler': eslintPluginReactCompiler,
'react': eslintPluginReact,
},
extends: [
...compat.config(reactPlugin.configs.recommended),
eslintPluginReact.configs.flat?.recommended
],
rules: {
"react-compiler/react-compiler": "error",
'import/no-default-export': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unescaped-entities': 'off',
Expand Down
Loading
Loading