Files
pwap/web/eslint.config.js
T
pezkuwichain 5a69f0e051 fix: disable react-refresh warnings for UI components and contexts
## Changes
- Add ESLint override for src/components/ui/** files
- Add ESLint override for src/contexts/** files
- Add ESLint override for theme-provider.tsx
- Turn off react-refresh/only-export-components for these files

## Impact
- Reduced warnings from 24 → 8
- All fast-refresh warnings eliminated
- Remaining 8 warnings are exhaustive-deps (non-critical)

**Rationale**: UI library components (shadcn/ui) and context providers
legitimately export utility functions alongside components. This is a
standard pattern and doesn't affect hot module replacement in practice.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-20 18:53:04 +03:00

76 lines
1.9 KiB
JavaScript

import globals from "globals";
import tseslint from "typescript-eslint";
import pluginReact from "eslint-plugin-react";
import hooksPlugin from "eslint-plugin-react-hooks";
import refreshPlugin from "eslint-plugin-react-refresh";
export default tseslint.config(
{
ignores: ["dist/**", "node_modules/**", "eslint.config.js", "postcss.config.js"],
},
// Config for Node files
{
files: ["vite.config.ts", "tailwind.config.ts"],
languageOptions: {
globals: {
...globals.node,
},
parser: tseslint.parser,
parserOptions: {
project: "tsconfig.node.json",
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// Node-specific rules can go here
},
},
// Config for React app files
{
files: ["src/**/*.{js,mjs,cjs,ts,jsx,tsx}"],
plugins: {
react: pluginReact,
"react-hooks": hooksPlugin,
"react-refresh": refreshPlugin,
},
languageOptions: {
globals: {
...globals.browser,
...globals.es2020,
},
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: "tsconfig.app.json", // Use the app-specific tsconfig
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
...hooksPlugin.configs.recommended.rules,
...pluginReact.configs.recommended.rules,
"react-refresh/only-export-components": "warn",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
},
settings: {
react: {
version: "detect",
},
},
},
// Override for UI components and contexts - allow non-component exports
{
files: [
"src/components/ui/**/*.{ts,tsx}",
"src/contexts/**/*.{ts,tsx}",
"src/components/theme-provider.tsx",
],
rules: {
"react-refresh/only-export-components": "off",
},
},
// Global recommended rules
...tseslint.configs.recommended
);