const js = require('@eslint/js'); const tsParser = require('@typescript-eslint/parser'); const tsPlugin = require('@typescript-eslint/eslint-plugin'); const globals = require('globals'); const reactPlugin = require('eslint-plugin-react'); const reactHooksPlugin = require('eslint-plugin-react-hooks'); module.exports = [ { ignores: ['dist/**', 'node_modules/**'], linterOptions: { reportUnusedDisableDirectives: false, }, }, js.configs.recommended, { files: ['src/**/*.{ts,tsx}'], languageOptions: { parser: tsParser, parserOptions: { ecmaFeatures: { jsx: true, }, ecmaVersion: 'latest', sourceType: 'module', }, globals: { ...globals.browser, ...globals.es2021, }, }, plugins: { '@typescript-eslint': tsPlugin, react: reactPlugin, 'react-hooks': reactHooksPlugin, }, settings: { react: { version: 'detect', }, }, rules: { ...reactPlugin.configs.recommended.rules, ...tsPlugin.configs.recommended.rules, 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn', 'react/react-in-jsx-scope': 'off', 'react/prop-types': 'off', 'no-undef': 'off', '@typescript-eslint/no-require-imports': 'off', '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], }, }, ];