Skip to content

An open-source, faster Devin alternative

TypeScript
1.6 KB
Raw Blame
import js from '@eslint/js'
import globals from 'globals'
import tseslint from 'typescript-eslint'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import prettier from 'eslint-config-prettier'

export default tseslint.config(
  {
    ignores: ['dist'],
  },
  js.configs.recommended,
  ...tseslint.configs.recommendedTypeChecked,
  {
    languageOptions: {
      parserOptions: {
        projectService: {
          allowDefaultProject: ['*.config.ts', 'eslint.config.js'],
        },
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
  {
    // Config files aren't part of the app tsconfig → no type-aware linting.
    files: ['**/*.config.{ts,js}', 'eslint.config.js'],
    extends: [tseslint.configs.disableTypeChecked],
  },
  jsxA11y.flatConfigs.recommended,
  reactRefresh.configs.vite,
  {
    files: ['**/*.{ts,tsx}'],
    languageOptions: {
      ecmaVersion: 2020,
      globals: globals.browser,
    },
    // react-hooks 7 still exposes a legacy string-array `plugins` in its
    // recommended config, so register the plugin here and take its rules.
    plugins: { 'react-hooks': reactHooks },
    rules: { ...reactHooks.configs['recommended-latest'].rules },
  },
  {
    // shadcn-generated primitives: we own them but keep them close to upstream.
    // They co-export variant helpers (e.g. buttonVariants) alongside components.
    files: ['src/components/ui/**'],
    rules: {
      'react-refresh/only-export-components': 'off',
    },
  },
  prettier,
)