From 469e5aedc3ea926f48d05d91fd130f6694a793c9 Mon Sep 17 00:00:00 2001 From: PeterYurkovich Date: Wed, 13 May 2026 18:19:58 -0400 Subject: [PATCH] feat: don't allow direct react imports --- web/eslint.config.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/eslint.config.ts b/web/eslint.config.ts index d32630364..7f59b209c 100644 --- a/web/eslint.config.ts +++ b/web/eslint.config.ts @@ -78,6 +78,21 @@ export default defineConfig([ 'react-hooks/set-state-in-render': 'off', 'react-hooks/incompatible-library': 'off', '@typescript-eslint/no-explicit-any': 'off', + + // Prevent directly importing react as a lint rule + 'no-restricted-syntax': [ + 'error', + { + selector: 'ImportDeclaration[source.value="react"] ImportDefaultSpecifier', + message: + 'Do not directly import React. Add specific named imports instead (`import { useState, FC } from "react"`).', + }, + { + selector: 'ImportDeclaration[source.value="react"] ImportNamespaceSpecifier', + message: + 'Do not directly namespace import React (`import * as React`). Add specific named imports instead (`import { useState, FC } from "react"`).', + }, + ], }, }, ]);