mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
a1bee1d825
Adopt React 19 idioms across the codebase. The runtime was already on
react@19.2.5 but no React 19 APIs were in use.
- forwardRef -> ref-as-prop in 7 layout/component files
(NitroInput/Button/ItemCountBadge/Card×5/InfiniteGridItem,
ToolbarItemView, AvatarEditorIcon)
- <Ctx.Provider> -> <Ctx> in 6 contexts (CatalogAdmin, FloorplanEditor,
UiSettings, GridContext, NitroCardContext, NitroCardAccordionContext)
- Native <script> hoisting for Turnstile, ExternalPluginLoader, GoogleAdsView
(React 19 dedupes by src; removes manual document.head.appendChild +
module-level promise caches)
- React Compiler enabled at build time via babel-plugin-react-compiler
in vite.config.mjs (target: '19'), plus eslint-plugin-react-compiler
in lint mode
- Global <ErrorBoundary> + <Suspense> in src/index.tsx using
react-error-boundary, with LoadingView as fallback
- BackgroundsView migrated to use(promise) as a demonstrator pattern
for Suspense-driven config loading
- ESLint react setting bumped 18.3.1 -> 19.2; legacy
@typescript-eslint/ban-types replaced with no-restricted-types
(the old rule was removed in @typescript-eslint v8)
- Refresh public/configuration/{asset-loader,bootstrap}.js to match
current write-asset-loader.mjs output
Phase 3 (login forms -> useActionState/useFormStatus) deferred:
LoginView is 1623 lines with lockout + Turnstile + heartbeat
interleaving; safer as its own PR.
https://claude.ai/code/session_01GrR87LAqnAEyKG2ZbmQt5Q
137 lines
4.5 KiB
JavaScript
137 lines
4.5 KiB
JavaScript
import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
|
|
import typescriptEslintParser from "@typescript-eslint/parser";
|
|
import reactPlugin from "eslint-plugin-react";
|
|
import reactCompilerPlugin from "eslint-plugin-react-compiler";
|
|
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
export default [
|
|
{
|
|
files: ["**/*.jsx", "**/*.js", "**/*.tsx", "**/*.ts"],
|
|
plugins: {
|
|
react: reactPlugin,
|
|
"react-hooks": reactHooksPlugin,
|
|
"react-compiler": reactCompilerPlugin,
|
|
"@typescript-eslint": typescriptEslintPlugin,
|
|
},
|
|
languageOptions: {
|
|
parser: typescriptEslintParser,
|
|
ecmaVersion: "latest",
|
|
parserOptions: {
|
|
sourceType: "module",
|
|
project: "./tsconfig.json",
|
|
tsconfigRootDir: __dirname,
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
},
|
|
rules: {
|
|
...reactPlugin.configs.recommended.rules,
|
|
...reactHooksPlugin.configs.recommended.rules,
|
|
...typescriptEslintPlugin.configs.recommended.rules,
|
|
...typescriptEslintPlugin.configs[
|
|
"recommended-requiring-type-checking"
|
|
].rules,
|
|
'indent': [
|
|
'error',
|
|
4,
|
|
{
|
|
'SwitchCase': 1
|
|
}
|
|
],
|
|
'no-multi-spaces': [
|
|
'error'
|
|
],
|
|
'no-trailing-spaces': [
|
|
'error',
|
|
{
|
|
'skipBlankLines': false,
|
|
'ignoreComments': true
|
|
}
|
|
],
|
|
'linebreak-style': [
|
|
'off'
|
|
],
|
|
'quotes': [
|
|
'error',
|
|
'single'
|
|
],
|
|
'semi': [
|
|
'error',
|
|
'always'
|
|
],
|
|
'brace-style': [
|
|
'error',
|
|
'allman'
|
|
],
|
|
'object-curly-spacing': [
|
|
'error',
|
|
'always'
|
|
],
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
'@typescript-eslint/no-unsafe-call': 'off',
|
|
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
'@typescript-eslint/no-floating-promises': 'off',
|
|
'@typescript-eslint/require-await': 'off',
|
|
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
'@typescript-eslint/no-unsafe-return': 'off',
|
|
'@typescript-eslint/no-misused-promises': 'off',
|
|
'@typescript-eslint/explicit-module-boundary-types': [
|
|
'off',
|
|
{
|
|
'allowedNames': [
|
|
'getMessageArray'
|
|
]
|
|
}
|
|
],
|
|
'@typescript-eslint/unbound-method': [
|
|
'off'
|
|
],
|
|
'@typescript-eslint/ban-ts-comment': [
|
|
'off'
|
|
],
|
|
'@typescript-eslint/no-empty-function': [
|
|
'error',
|
|
{
|
|
'allow': [
|
|
'functions',
|
|
'arrowFunctions',
|
|
'generatorFunctions',
|
|
'methods',
|
|
'generatorMethods',
|
|
'constructors'
|
|
]
|
|
}
|
|
],
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'off'
|
|
],
|
|
'@typescript-eslint/no-restricted-types': [
|
|
'error',
|
|
{
|
|
'types':
|
|
{
|
|
'String': { message: 'Use string instead', fixWith: 'string' },
|
|
'Boolean': { message: 'Use boolean instead', fixWith: 'boolean' },
|
|
'Number': { message: 'Use number instead', fixWith: 'number' },
|
|
'Symbol': { message: 'Use symbol instead', fixWith: 'symbol' }
|
|
}
|
|
}
|
|
],
|
|
'react/react-in-jsx-scope': 'off',
|
|
'react-compiler/react-compiler': 'warn'
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: "19.2",
|
|
},
|
|
},
|
|
},
|
|
];
|