UNPKG

@nexusui/eslint-config

Version:
76 lines (73 loc) 2.61 kB
// Flat Config for @nexusui/eslint-config with React (ESM) import js from '@eslint/js'; // eslint-disable-next-line import/no-unresolved import tseslint from 'typescript-eslint'; import reactRecommended from 'eslint-plugin-react/configs/recommended.js'; import reactPlugin from 'eslint-plugin-react'; import reactHooksPlugin from 'eslint-plugin-react-hooks'; import importPlugin from 'eslint-plugin-import'; import typescriptEslintParser from '@typescript-eslint/parser'; export default [ js.configs.recommended, ...tseslint.configs.recommended, reactRecommended, { plugins: { import: importPlugin, '@typescript-eslint': tseslint.plugin, react: reactPlugin, 'react-hooks': reactHooksPlugin, }, files: ['**/*.{ts,tsx,js,jsx}'], languageOptions: { parser: typescriptEslintParser, parserOptions: { project: ['./tsconfig.json'], ecmaVersion: 'latest', sourceType: 'module', ecmaFeatures: { jsx: true }, }, }, rules: { // TypeScript rules '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], '@typescript-eslint/no-floating-promises': 'warn', '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }], '@typescript-eslint/consistent-type-exports': ['error', { fixMixedExportsWithInlineTypeSpecifier: true }], // JS/React rules 'no-console': ['warn', { allow: ['warn', 'error'] }], 'no-plusplus': ['warn', { allowForLoopAfterthoughts: true }], 'no-param-reassign': 'off', 'no-else-return': 'off', 'no-nested-ternary': 'off', 'spaced-comment': 'off', 'func-names': 'off', 'prefer-destructuring': 'off', 'consistent-return': 'off', 'operator-assignment': 'off', 'global-require': 'off', 'import/prefer-default-export': 'off', 'import/no-unresolved': 'off', // React/React Hooks rules 'react/react-in-jsx-scope': 'off', 'react/prop-types': 'off', 'react/no-unescaped-entities': 'off', 'react/no-unknown-property': ['error', { ignore: ['sx'] }], ...reactHooksPlugin.configs.recommended.rules, }, settings: { react: { version: 'detect', runtime: 'automatic', }, 'import/resolver': { node: { extensions: ['.js', '.jsx', '.ts', '.tsx'], }, }, }, }, ];