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

chore(eslint): migrate to eslint 9 flat config #233

Merged
merged 7 commits into from
Jan 26, 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
39 changes: 0 additions & 39 deletions .eslintrc.cjs

This file was deleted.

31 changes: 31 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import importPlugin from 'eslint-plugin-import';
import jsxA11y from 'eslint-plugin-jsx-a11y';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import reactCompiler from 'eslint-plugin-react-compiler';

export default tseslint.config(
{ ignores: ['dist/', 'website/'] },
eslint.configs.recommended,
tseslint.configs.recommended,
importPlugin.flatConfigs.recommended,
jsxA11y.flatConfigs.recommended,
react.configs.flat.recommended,
react.configs.flat['jsx-runtime'],
reactHooks.configs['recommended-latest'],
reactCompiler.configs.recommended,
{
settings: {
'import/resolver': { typescript: true },
react: { version: 'detect' },
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
},
},
);
2 changes: 2 additions & 0 deletions examples/08_comparison/src/ContextWithMemo.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react-compiler/react-compiler */

import {
createContext,
memo,
Expand Down
2 changes: 2 additions & 0 deletions examples/08_comparison/src/ContextWithUseMemo.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react-compiler/react-compiler */

import { createContext, useContext, useReducer, useRef, useMemo } from 'react';
import type { Reducer } from 'react';

Expand Down
2 changes: 2 additions & 0 deletions examples/08_comparison/src/NaiveContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react-compiler/react-compiler */

import {
createContext,
useContext,
Expand Down
2 changes: 2 additions & 0 deletions examples/08_comparison/src/ReactTracked.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react-compiler/react-compiler */

import { useReducer, useRef, useEffect } from 'react';
import type { Reducer } from 'react';

Expand Down
2 changes: 2 additions & 0 deletions examples/08_comparison/src/SplitContext.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react-compiler/react-compiler */

import {
createContext,
memo,
Expand Down
2 changes: 1 addition & 1 deletion examples/12_async/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const asyncActionHandlers: AsyncActionHandlers<
const firstName = data.data.first_name;
if (typeof firstName !== 'string') throw new Error();
dispatch({ type: 'FINISH_FETCH_USER', firstName });
} catch (_e) {
} catch {
dispatch({ type: 'ERROR_FETCH_USER' });
}
},
Expand Down
3 changes: 1 addition & 2 deletions examples/13_saga/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
takeEvery,
all,
} from 'redux-saga/effects';
// eslint-disable-next-line import/no-named-as-default
import useSagaReducer from 'use-saga-reducer';
import { createContainer } from 'react-tracked';

Expand Down Expand Up @@ -93,7 +92,7 @@ function* userFetcher(action: AsyncActionFetch) {
const firstName = data.data.first_name;
if (typeof firstName !== 'string') throw new Error();
yield put<InnerAction>({ type: 'FINISH_FETCH_USER', firstName });
} catch (_e) {
} catch {
yield put<InnerAction>({ type: 'ERROR_FETCH_USER' });
}
}
Expand Down
53 changes: 27 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"src",
"dist"
],
"packageManager": "pnpm@8.15.0",
"packageManager": "pnpm@9.4.0",
"scripts": {
"compile": "rm -rf dist && pnpm run '/^compile:.*/'",
"compile:esm": "tsc -p tsconfig.esm.json",
Expand Down Expand Up @@ -89,37 +89,38 @@
"use-context-selector": "^2.0.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.4.5",
"@testing-library/react": "^15.0.6",
"@testing-library/user-event": "^14.5.2",
"@types/node": "^20.12.10",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"happy-dom": "^14.9.0",
"@eslint/js": "^9.19.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^22.10.10",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"eslint": "^9.19.0",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-compiler": "19.0.0-beta-decd7b8-20250118",
"eslint-plugin-react-hooks": "5.2.0-canary-de1eaa26-20250124",
"happy-dom": "^16.7.2",
"immer": "^10.1.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.2.5",
"puppeteer": "^22.8.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-tracked": "link:.",
"prettier": "^3.4.2",
"puppeteer": "^24.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-tracked": "link:",
"redux-saga": "^1.3.0",
"start-server-and-test": "^2.0.3",
"start-server-and-test": "^2.0.10",
"ts-expect": "^1.3.0",
"typescript": "^5.4.5",
"typescript": "^5.7.3",
"typescript-eslint": "^8.21.0",
"use-reducer-async": "^2.1.1",
"use-saga-reducer": "^3.0.0",
"vite": "^5.2.11",
"vitest": "^1.6.0"
"vite": "^6.0.11",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.0.4"
},
"peerDependencies": {
"react": ">=18.0.0",
Expand Down
Loading
Loading