Skip to content
Open
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
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

48 changes: 0 additions & 48 deletions .eslintrc.js

This file was deleted.

79 changes: 79 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import jest from 'eslint-plugin-jest';
import prettierRecommended from 'eslint-plugin-prettier/recommended';

export default tseslint.config(
{
ignores: [
'lib/',
'node_modules/',
'examples/iife/demo.js',
'src/third-party/',
],
},
eslint.configs.recommended,
react.configs.flat.recommended,
{
settings: {
react: {
version: '19',
},
},
},
// react hooks plugin doesn't have a flat config :/
{
plugins: {
'react-hooks': reactHooks,
},
rules: reactHooks.configs.recommended.rules,
},
tseslint.configs.recommendedTypeChecked,
prettierRecommended,
{
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// Disable type aware linting for config files, don't expect them to be mjs
{
files: ['*.{js,mjs,ts}'],
extends: [tseslint.configs.disableTypeChecked],
rules: {
'no-undef': 'off',
},
},
// Jest config
{
files: ['src/**/*.test.tsx'],
...jest.configs['flat/recommended'],
},
// Lastly, override recommended rules that aren't ideal
{
rules: {
// Will use the TS version
// 'no-unused-vars': ['error', {ignoreRestSiblings: true}],
// Meh - don't agree with it
'react/no-unescaped-entities': 'off',
// This rule doesn't seem to be compatible with forwardRef
'react/prop-types': 'off',
// Meh - I don't feel the need for all things to be const
'prefer-const': 'off',
// Not as helpful as it seems. I wa
// '@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': [
'error',
{ignoreRestSiblings: true},
],
'@typescript-eslint/no-inferrable-types': [
'error',
{ignoreParameters: true},
],
},
}
);
2 changes: 1 addition & 1 deletion examples/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function Demo() {
// handle back/forward navigation
useEffect(() => {
function handlePopState(e: PopStateEvent) {
setDemo(e.state?.demo || 'full');
setDemo((e.state as {demo?: DemoComponentKeys} | null)?.demo || 'full');
}
window.addEventListener('popstate', handlePopState);
return () => {
Expand Down
51 changes: 28 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,35 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@eslint/js": "^9.23.0",
"@jest/globals": "^29.7.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.1.0",
"@types/node": "^20.4.10",
"@types/react": "^19.0.1",
"@types/react-dom": "^19.0.2",
"@typescript-eslint/eslint-plugin": "^6.3.0",
"@typescript-eslint/parser": "^6.3.0",
"eslint": "^8.6.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.5.0",
"gh-pages": "^6.0.0",
"jest": "^29.2.2",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@types/node": "^22.13.14",
"@types/react": "^19.0.12",
"@types/react-dom": "^19.0.4",
"eslint": "^9.23.0",
"eslint-plugin-jest": "^28.11.0",
"eslint-plugin-prettier": "^5.2.5",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.2.0",
"gh-pages": "^6.3.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.0.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"ts-jest": "^29.1.0",
"tsup": "^8.0.2",
"typescript": "^5.0.4"
"prettier": "^3.5.3",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"ts-jest": "^29.3.0",
"tsup": "^8.4.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.28.0"
},
"packageManager": "pnpm@9.8.0+sha512.8e4c3550fb500e808dbc30bb0ce4dd1eb614e30b1c55245f211591ec2cdf9c611cabd34e1364b42f564bd54b3945ed0f49d61d1bbf2ec9bd74b866fcdc723276"
"packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6",
"pnpm": {
"onlyBuiltDependencies": [
"canvas",
"esbuild"
]
}
}
Loading
Loading