| 1 |
module.exports = { |
| 2 |
env: { |
| 3 |
browser: true, |
| 4 |
es2020: true, |
| 5 |
node: true, |
| 6 |
}, |
| 7 |
parser: '@typescript-eslint/parser', |
| 8 |
parserOptions: { |
| 9 |
ecmaVersion: 2020, |
| 10 |
sourceType: 'module', |
| 11 |
ecmaFeatures: { |
| 12 |
jsx: true, |
| 13 |
}, |
| 14 |
}, |
| 15 |
plugins: [ |
| 16 |
'@typescript-eslint', |
| 17 |
'react-hooks', |
| 18 |
], |
| 19 |
rules: { |
| 20 |
// TypeScript specific rules |
| 21 |
'@typescript-eslint/no-unused-vars': 'off', // Allow unused vars for WordPress patterns |
| 22 |
'@typescript-eslint/no-explicit-any': 'off', // Allow any types for WordPress compatibility |
| 23 |
'@typescript-eslint/explicit-function-return-type': 'off', |
| 24 |
'@typescript-eslint/explicit-module-boundary-types': 'off', |
| 25 |
'@typescript-eslint/no-non-null-assertion': 'off', // Allow for WordPress patterns |
| 26 |
|
| 27 |
// React hooks rules — register so `eslint-disable-next-line react-hooks/exhaustive-deps` |
| 28 |
// directives resolve under --report-unused-disable-directives. |
| 29 |
'react-hooks/rules-of-hooks': 'error', |
| 30 |
'react-hooks/exhaustive-deps': 'warn', |
| 31 |
|
| 32 |
// General rules |
| 33 |
'no-console': 'off', // Allow console for debugging |
| 34 |
'no-debugger': 'error', |
| 35 |
'prefer-const': 'off', // Allow let for WordPress patterns |
| 36 |
'no-var': 'error', |
| 37 |
|
| 38 |
// Allow unused variables with underscore prefix |
| 39 |
'no-unused-vars': 'off', |
| 40 |
}, |
| 41 |
}; |
| 42 |
|