Created
May 30, 2025 12:22
-
-
Save vladimir-ivanov/f3f22feee0708e79c93d2794b7b897ea to your computer and use it in GitHub Desktop.
eslint configs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @ts-check | |
import { fixupPluginRules } from '@eslint/compat'; | |
import pluginCypress from 'eslint-plugin-cypress/flat'; | |
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; | |
import reactPlugin from 'eslint-plugin-react'; | |
import reactHookPlugin from 'eslint-plugin-react-hooks'; | |
import simpleImportSort from 'eslint-plugin-simple-import-sort'; | |
import eslintPluginUnicorn from 'eslint-plugin-unicorn'; | |
import tseslint from 'typescript-eslint'; | |
export default tseslint.config( | |
{ | |
ignores: [ | |
'app', | |
'examples', | |
'node_modules', | |
'dist', | |
'coverage', | |
'src/types/global.d.ts', | |
'!.*.js', | |
'reports', | |
'scripts/README', | |
], | |
}, | |
reactPlugin.configs.flat.recommended, | |
...tseslint.configs.recommended, | |
eslintPluginPrettierRecommended, | |
pluginCypress.configs.recommended, | |
eslintPluginUnicorn.configs.all, | |
{ | |
plugins: { | |
'react-hooks': fixupPluginRules(reactHookPlugin), | |
'simple-import-sort': simpleImportSort, | |
}, | |
languageOptions: { | |
ecmaVersion: 2020, | |
sourceType: 'module', | |
parserOptions: { | |
ecmaFeatures: { | |
jsx: true, | |
}, | |
}, | |
}, | |
settings: { | |
react: { | |
pragma: 'React', | |
version: 'detect', | |
}, | |
}, | |
rules: { | |
curly: 'error', | |
'no-extra-boolean-cast': 'error', | |
'cypress/unsafe-to-chain-command': 'off', | |
'@typescript-eslint/no-non-null-assertion': 'off', | |
'@typescript-eslint/no-empty-function': 'off', | |
'@typescript-eslint/ban-ts-comment': 'warn', | |
'@typescript-eslint/ban-types': 'off', | |
'@typescript-eslint/no-explicit-any': 'off', | |
'@typescript-eslint/explicit-module-boundary-types': 'off', | |
'@typescript-eslint/no-unused-vars': [ | |
'warn', | |
{ ignoreRestSiblings: true }, | |
], | |
'cypress/no-unnecessary-waiting': 'off', | |
'react-hooks/rules-of-hooks': 'error', | |
'react-hooks/exhaustive-deps': 'error', | |
'react-hooks/react-compiler': 'error', | |
'react/display-name': 'warn', | |
'react/prop-types': 'off', | |
'no-console': ['error'], | |
'unicorn/prefer-array-index-of': 'error', | |
'simple-import-sort/imports': [ | |
'error', | |
{ | |
groups: [ | |
// Side effect imports. | |
[String.raw`^\u0000`], | |
// Packages. `react` related packages come first. | |
['^react', String.raw`^@?\w`], | |
// Parent imports. Put `..` last. | |
[String.raw`^\.\.(?!/?$)`, String.raw`^\.\./?$`], | |
// Other relative imports. Put same-folder imports and `.` last. | |
[ | |
String.raw`^\./(?=.*/)(?!/?$)`, | |
String.raw`^\.(?!/?$)`, | |
String.raw`^\./?$`, | |
], | |
], | |
}, | |
], | |
'simple-import-sort/exports': 'error', | |
}, | |
}, | |
{ | |
files: ['*.test.ts', '*.test.tsx'], | |
rules: { | |
// Allow testing runtime errors to suppress TS errors | |
'@typescript-eslint/ban-ts-comment': 'off', | |
}, | |
}, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test", | |
"scripts": { | |
}, | |
"license": "MIT", | |
"devDependencies": { | |
"@eslint/compat": "^1.2.8", | |
"@microsoft/api-extractor": "^7.52.3", | |
"@rollup/plugin-commonjs": "^26.0.3", | |
"@rollup/plugin-node-resolve": "^15.3.1", | |
"@rollup/plugin-terser": "^0.4.4", | |
"@swc/core": "^1.11.20", | |
"@swc/jest": "^0.2.37", | |
"@testing-library/jest-dom": "^6.6.3", | |
"@testing-library/react": "^16.3.0", | |
"@types/jest": "^29.5.14", | |
"@types/react": "^19.1.1", | |
"@types/react-dom": "^18.3.6", | |
"@types/testing-library__jest-dom": "^5.14.9", | |
"bundlewatch": "^0.3.3", | |
"cypress": "^13.17.0", | |
"eslint": "^9.24.0", | |
"eslint-config-prettier": "^9.1.0", | |
"eslint-plugin-cypress": "^3.6.0", | |
"eslint-plugin-prettier": "^5.2.6", | |
"eslint-plugin-react": "^7.37.5", | |
"eslint-plugin-react-hooks": "6.0.0-rc.1", | |
"eslint-plugin-simple-import-sort": "^12.1.1", | |
"husky": "^9.1.7", | |
"jest": "^29.7.0", | |
"jest-environment-jsdom": "^29.7.0", | |
"jest-fixed-jsdom": "^0.0.9", | |
"jest-preview": "^0.3.1", | |
"lint-staged": "^15.5.1", | |
"msw": "^2.7.4", | |
"prettier": "^3.5.3", | |
"react": "^19.1.0", | |
"react-dom": "^19.1.0", | |
"react-test-renderer": "^18.3.1", | |
"rimraf": "^5.0.10", | |
"rollup": "^4.39.0", | |
"rollup-plugin-typescript2": "^0.36.0", | |
"tsd": "^0.31.2", | |
"typescript": "^5.8.3", | |
"typescript-eslint": "^7.18.0", | |
"whatwg-fetch": "^3.6.20", | |
"zod": "^3.24.2" | |
}, | |
"lint-staged": { | |
"*.{js,ts,tsx}": [ | |
"pnpm lint:fix", | |
"pnpm prettier:fix" | |
], | |
"*.{md,json,yml}": [ | |
"prettier --write" | |
] | |
}, | |
"funding": { | |
"type": "opencollective", | |
"url": "https://opencollective.com/react-hook-form" | |
}, | |
"engines": { | |
"node": ">=18.0.0" | |
}, | |
"dependencies": { | |
"eslint-plugin-unicorn": "^59.0.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment