- Create validate-handlers.js script to check for undefined event handlers - Add npm run validate:handlers command - Add prebuild hook to run validation before builds - Add ESLint no-undef rule to catch undefined references - Add documentation in scripts/README-validation.md Prevents issues like 'ReferenceError: handleSaveEditGuestbook is not defined' by validating all onClick/onChange/onSubmit handlers are defined before use. The script: - Scans all React components for event handlers - Verifies functions are defined in component scope - Excludes props and imported functions - Runs automatically before builds - Can be run manually: npm run validate:handlers
37 lines
729 B
JSON
37 lines
729 B
JSON
{
|
|
"extends": [
|
|
"next/core-web-vitals",
|
|
"next/typescript"
|
|
],
|
|
"rules": {
|
|
"@typescript-eslint/no-explicit-any": "warn",
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"warn",
|
|
{
|
|
"argsIgnorePattern": "^_",
|
|
"varsIgnorePattern": "^_"
|
|
}
|
|
],
|
|
"@typescript-eslint/no-require-imports": "off",
|
|
"@typescript-eslint/no-undef": "error",
|
|
"react-hooks/exhaustive-deps": "warn",
|
|
"react/no-unescaped-entities": "off",
|
|
"no-undef": "error",
|
|
"no-console": [
|
|
"warn",
|
|
{
|
|
"allow": ["warn", "error"]
|
|
}
|
|
]
|
|
},
|
|
"ignorePatterns": [
|
|
"node_modules/",
|
|
".next/",
|
|
"out/",
|
|
"build/",
|
|
"coverage/",
|
|
"*.config.js",
|
|
"*.config.ts"
|
|
]
|
|
}
|