Reorganization in projects, fixed tsconfigs and eslint configurations
This commit is contained in:
parent
8b9c7bc6a3
commit
001eec66af
@ -1,30 +0,0 @@
|
||||
import pluginReact from "eslint-plugin-react";
|
||||
import pluginReactHooks from "eslint-plugin-react-hooks";
|
||||
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
||||
import pluginReactRecommended from "eslint-plugin-react/configs/recommended";
|
||||
import globals from "globals";
|
||||
import baseConfig from "../eslint.config";
|
||||
/** @type {import('eslint').Linter.FlatConfig[]} */
|
||||
export default [
|
||||
...baseConfig,
|
||||
pluginReactRecommended,
|
||||
pluginReactHooks,
|
||||
{
|
||||
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
||||
plugins: {
|
||||
react: pluginReact,
|
||||
"react-refresh": pluginReactRefresh,
|
||||
},
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaFeatures: "latest",
|
||||
sourceType: "module",
|
||||
project: ["./tsconfig.json"],
|
||||
tsconfigRootDir: "./",
|
||||
},
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
@ -1,26 +1,26 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/vite-react": "^3.0.0",
|
||||
"@types/react": "^18.2.56",
|
||||
"@types/react-dom": "^18.2.19",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"eslint-plugin-react": "^7.33.2",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.5",
|
||||
"vite": "^5.1.4"
|
||||
},
|
||||
"name": "@appname/client",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc && vite build",
|
||||
"dev": "vite",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"type": "module",
|
||||
"version": "0.0.0"
|
||||
"dependencies": {
|
||||
"@tailwindcss/forms": "^0.5.7",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/vite-react": "^3.0.0",
|
||||
"@types/react": "^18.2.56",
|
||||
"@types/react-dom": "^18.2.19",
|
||||
"@vitejs/plugin-react": "^4.2.1",
|
||||
"vite": "^5.1.4"
|
||||
},
|
||||
"name": "@appname/client",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "tsc && vite build",
|
||||
"dev": "vite",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"type": "module",
|
||||
"version": "0.0.0"
|
||||
}
|
||||
|
@ -1,4 +1,23 @@
|
||||
export default {
|
||||
content: ["./src/**/*.{js,ts,jsx,tsx}"],
|
||||
plugins: [require("daisyui")],
|
||||
import forms from "@tailwindcss/forms";
|
||||
import typography from "@tailwindcss/typography";
|
||||
import daisyUI from "daisyui";
|
||||
import type { Config } from "tailwindcss";
|
||||
import twanimate from "tailwindcss-animate";
|
||||
|
||||
const config: Config = {
|
||||
darkMode: "class",
|
||||
content: [
|
||||
"./pages/**/*.{ts,tsx}",
|
||||
"./components/**/*.{ts,tsx}",
|
||||
"./app/**/*.{ts,tsx}",
|
||||
"./src/**/*.{ts,tsx}",
|
||||
"./index.html",
|
||||
],
|
||||
prefix: "",
|
||||
plugins: [twanimate, forms, typography, daisyUI],
|
||||
daisyui: {
|
||||
themes: ["light", "dark"],
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
@ -1,39 +1,57 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Specifying ECMAScript targets for the compiler
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
// Enabling options for better interoperability and module handling
|
||||
"moduleResolution": "Bundler",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
// Configuring behavior for JSX, specific to React
|
||||
"jsx": "react-jsx", // Transform JSX for React 17+ JSX Transform
|
||||
// Strengthening type-checking and ensuring consistency
|
||||
"strict": true, // Enable all strict type-checking options
|
||||
"strictNullChecks": true, // Enable strict null checks
|
||||
"noUnusedLocals": true, // Disallow unused local variables
|
||||
"noUnusedParameters": true, // Disallow unused function parameters
|
||||
"noFallthroughCasesInSwitch": true, // Prevent fallthrough cases in switch statements
|
||||
"forceConsistentCasingInFileNames": true, // Ensure consistent file naming
|
||||
// Improving project robustness
|
||||
"isolatedModules": true, // Ensure correct transpiling of files
|
||||
"noErrorTruncation": true, // Show full type error messages
|
||||
"useDefineForClassFields": true, // Align class field behavior with the standard
|
||||
// Configuring project build process
|
||||
"allowJs": true, // Allow JavaScript files to be imported
|
||||
"skipLibCheck": true, // Skip type checking of declaration files
|
||||
"noEmit": true, // Vite handles the emitting of files
|
||||
"paths": {
|
||||
"@root/*": ["./*"],
|
||||
"@/*": ["./src/*"]
|
||||
} // Allow absolute imports from src. Create a path alias for the root directory - @root
|
||||
// Specifying ECMAScript targets for the compiler
|
||||
// "composite": true, // Enable project references
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"lib": [
|
||||
"DOM",
|
||||
"DOM.Iterable",
|
||||
"ESNext"
|
||||
],
|
||||
// Enabling options for better interoperability and module handling
|
||||
"moduleResolution": "Bundler",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"resolveJsonModule": true,
|
||||
// Configuring behavior for JSX, specific to React
|
||||
"jsx": "react-jsx", // Transform JSX for React 17+ JSX Transform
|
||||
// Strengthening type-checking and ensuring consistency
|
||||
"strict": true, // Enable all strict type-checking options
|
||||
"strictNullChecks": true, // Enable strict null checks
|
||||
"noUnusedLocals": true, // Disallow unused local variables
|
||||
"noUnusedParameters": true, // Disallow unused function parameters
|
||||
"noFallthroughCasesInSwitch": true, // Prevent fallthrough cases in switch statements
|
||||
"forceConsistentCasingInFileNames": true, // Ensure consistent file naming
|
||||
// Improving project robustness
|
||||
"isolatedModules": true, // Ensure correct transpiling of files
|
||||
"noErrorTruncation": true, // Show full type error messages
|
||||
"useDefineForClassFields": true, // Align class field behavior with the standard
|
||||
// Configuring project build process
|
||||
"allowJs": true, // Allow JavaScript files to be imported
|
||||
"skipLibCheck": true, // Skip type checking of declaration files
|
||||
"noEmit": true, // Vite handles the emitting of files
|
||||
"paths": {
|
||||
"@root/*": [
|
||||
"./*"
|
||||
],
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
]
|
||||
} // Allow absolute imports from src. Create a path alias for the root directory - @root
|
||||
},
|
||||
// Specifying folders and files to include in compilation
|
||||
"include": ["src/**/*", "server/index.ts", "server/services"],
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
// Excluding certain directories from the compilation
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
},
|
||||
"include": [
|
||||
"vite.config.ts",
|
||||
"tailwind.config.ts",
|
||||
],
|
||||
"ts-node": {
|
||||
"esm": true
|
||||
|
@ -1,10 +1,10 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import path from "path";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
|
||||
export default ({ mode }) => {
|
||||
export default defineConfig(({ mode }) => {
|
||||
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
|
||||
return defineConfig({
|
||||
resolve: {
|
||||
@ -16,4 +16,4 @@ export default ({ mode }) => {
|
||||
plugins: [react()],
|
||||
server: { proxy: { "/api": "http://localhost:3000" } },
|
||||
});
|
||||
};
|
||||
});
|
||||
|
@ -1,6 +1,10 @@
|
||||
import eslintPluginJs from "@eslint/js";
|
||||
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
||||
import pluginReactRefresh from "eslint-plugin-react-refresh";
|
||||
import pluginReact from "eslint-plugin-react";
|
||||
import tseslint from "typescript-eslint";
|
||||
import globals from "globals";
|
||||
|
||||
/** @type {import('eslint').Linter.FlatConfig[]} */
|
||||
export default [
|
||||
eslintPluginJs.configs.recommended,
|
||||
@ -8,6 +12,7 @@ export default [
|
||||
...tseslint.configs.stylistic,
|
||||
eslintPluginPrettierRecommended,
|
||||
{
|
||||
files: ["./server/**/*.{js,jsx,mjs,cjs,ts,tsx}", "./shared/**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
||||
ignores: ["node_modules/", "dist/", "build/", "coverage/", "public/", "**/eslint.config.js"],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
@ -16,4 +21,35 @@ export default [
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["./client/**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
||||
plugins: {
|
||||
react: pluginReact,
|
||||
"react-refresh": pluginReactRefresh,
|
||||
},
|
||||
ignores: [
|
||||
"client/**/node_modules/",
|
||||
"client/**/dist/**",
|
||||
"client/**/build/**",
|
||||
"client/**/coverage/**",
|
||||
"client/**/public/**",
|
||||
"client/*.{js,ts}",
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
project: ["./client/tsconfig.json"],
|
||||
tsconfigRootDir: "./client",
|
||||
},
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"reactPlugin/jsx-uses-react": "error",
|
||||
"reactPlugin/jsx-uses-vars": "error",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -11,6 +11,9 @@
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-react": "^7.34.0",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.5",
|
||||
"postcss": "^8.4.35",
|
||||
"prettier": "^3.2.5",
|
||||
"tailwindcss": "^3.4.1",
|
||||
|
@ -38,11 +38,12 @@
|
||||
"@client/*": [
|
||||
"./client/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": [
|
||||
"shared/**/*",
|
||||
"server/**/*",
|
||||
"server/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
Loading…
x
Reference in New Issue
Block a user