Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Simplify staff tooling config

Manav Rathi226706d947ee
diff --git a/infra/staff/.env b/infra/staff/.env
index e5d8beabbe..2499c68326 100644
--- a/infra/staff/.env
+++ b/infra/staff/.env
@@ -1,9 +1,5 @@
-# This is a sample .env file. The env vars defined here can be used to configure
-# the app.
+# Sample env file. Put local overrides in `.env.local`.
#
-# For local development, create a new file named `.env.local` and add the
-# variables you need there instead of uncommenting them below.
-#
-# For documentation about the variables, see `src/vite-env.d.ts`.
+# For documentation about each variable, see `src/vite-env.d.ts`.
-# VITE_ENTE_API_ORIGIN = http://localhost:8080
+# VITE_ENTE_API_ORIGIN=http://localhost:8080
diff --git a/infra/staff/eslint.config.mjs b/infra/staff/eslint.config.mjs
index 1a1f997e5c..98338d5ad1 100644
--- a/infra/staff/eslint.config.mjs
+++ b/infra/staff/eslint.config.mjs
@@ -4,17 +4,18 @@ import eslint from "@eslint/js";
import reactPlugin from "eslint-plugin-react";
import hooksPlugin from "eslint-plugin-react-hooks";
import reactRefreshPlugin from "eslint-plugin-react-refresh";
+import { defineConfig, globalIgnores } from "eslint/config";
import tseslint from "typescript-eslint";
-export default tseslint.config(
+export default defineConfig(
eslint.configs.recommended,
- tseslint.configs.strictTypeChecked,
- tseslint.configs.stylisticTypeChecked,
+ ...tseslint.configs.strictTypeChecked,
+ ...tseslint.configs.stylisticTypeChecked,
{
languageOptions: { parserOptions: { projectService: true } },
linterOptions: { reportUnusedDisableDirectives: "error" },
},
- { ignores: ["dist", ".env*", "eslint.config.mjs"] },
+ globalIgnores(["dist", ".env*", "eslint.config.mjs"]),
{
rules: {
"@typescript-eslint/restrict-template-expressions": [
@@ -51,8 +52,8 @@ export default tseslint.config(
{
files: ["**/*.{jsx,tsx}"],
plugins: {
- "react-hooks": hooksPlugin,
- "react-refresh": reactRefreshPlugin,
+ "react-hooks": { rules: hooksPlugin.rules },
+ "react-refresh": { rules: reactRefreshPlugin.rules },
},
rules: {
...hooksPlugin.configs.recommended.rules,
diff --git a/infra/staff/package-lock.json b/infra/staff/package-lock.json
index 76671d4d68..31b3d1b00a 100644
--- a/infra/staff/package-lock.json
+++ b/infra/staff/package-lock.json
@@ -23,7 +23,6 @@
},
"devDependencies": {
"@eslint/js": "9.39.4",
- "@rollup/plugin-node-resolve": "16.0.3",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "6.0.2",
@@ -1564,70 +1563,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@rollup/plugin-node-resolve": {
- "version": "16.0.3",
- "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.3.tgz",
- "integrity": "sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@rollup/pluginutils": "^5.0.1",
- "@types/resolve": "1.20.2",
- "deepmerge": "^4.2.2",
- "is-module": "^1.0.0",
- "resolve": "^1.22.1"
- },
- "engines": {
- "node": ">=14.0.0"
- },
- "peerDependencies": {
- "rollup": "^2.78.0||^3.0.0||^4.0.0"
- },
- "peerDependenciesMeta": {
- "rollup": {
- "optional": true
- }
- }
- },
- "node_modules/@rollup/plugin-node-resolve/node_modules/resolve": {
- "version": "1.22.8",
- "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
- "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
- "dev": true,
- "dependencies": {
- "is-core-module": "^2.13.0",
- "path-parse": "^1.0.7",
- "supports-preserve-symlinks-flag": "^1.0.0"
- },
- "bin": {
- "resolve": "bin/resolve"
- },
- "funding": {
- "url": "https://github.com/sponsors/ljharb"
- }
- },
- "node_modules/@rollup/pluginutils": {
- "version": "5.1.0",
- "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz",
- "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==",
- "dev": true,
- "dependencies": {
- "@types/estree": "^1.0.0",
- "estree-walker": "^2.0.2",
- "picomatch": "^2.3.1"
- },
- "engines": {
- "node": ">=14.0.0"
- },
- "peerDependencies": {
- "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
- },
- "peerDependenciesMeta": {
- "rollup": {
- "optional": true
- }
- }
- },
"node_modules/@tybys/wasm-util": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz",
@@ -1639,12 +1574,6 @@
"tslib": "^2.4.0"
}
},
- "node_modules/@types/estree": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
- "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
- "dev": true
- },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -1692,12 +1621,6 @@
"@types/react": "*"
}
},
- "node_modules/@types/resolve": {
- "version": "1.20.2",
- "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz",
- "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
- "dev": true
- },
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.59.3",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.3.tgz",
@@ -2518,15 +2441,6 @@
"integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
"dev": true
},
- "node_modules/deepmerge": {
- "version": "4.3.1",
- "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
- "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/define-data-property": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
@@ -3207,12 +3121,6 @@
"node": ">=4.0"
}
},
- "node_modules/estree-walker": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
- "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
- "dev": true
- },
"node_modules/esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
@@ -3860,12 +3768,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/is-module": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz",
- "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==",
- "dev": true
- },
"node_modules/is-negative-zero": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz",
@@ -4814,19 +4716,6 @@
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
- "node_modules/picomatch": {
- "version": "2.3.2",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
- "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=8.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
- }
- },
"node_modules/possible-typed-array-names": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
diff --git a/infra/staff/package.json b/infra/staff/package.json
index 6a389b157e..d14beb134c 100644
--- a/infra/staff/package.json
+++ b/infra/staff/package.json
@@ -26,7 +26,6 @@
},
"devDependencies": {
"@eslint/js": "9.39.4",
- "@rollup/plugin-node-resolve": "16.0.3",
"@types/react": "19.2.14",
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "6.0.2",
diff --git a/infra/staff/src/vite-env.d.ts b/infra/staff/src/vite-env.d.ts
index 3bafdbc61f..185a374417 100644
--- a/infra/staff/src/vite-env.d.ts
+++ b/infra/staff/src/vite-env.d.ts
@@ -9,9 +9,7 @@ interface ImportMetaEnv {
* Override the origin (scheme://host:port) of Ente's API to connect to.
*
* Default is "https://api.ente.io".
-
-*/
-
+ */
readonly VITE_ENTE_API_ORIGIN: string | undefined;
}
diff --git a/infra/staff/tsconfig.json b/infra/staff/tsconfig.json
index ce1d1c03cc..4c7f6426a1 100644
--- a/infra/staff/tsconfig.json
+++ b/infra/staff/tsconfig.json
@@ -1,48 +1,27 @@
{
- /* TSConfig file used for typechecking the files in src/.
- *
- * The base configuration was generated using create-vite. This was
- * already almost the same as the `tsconfig-typecheck.json` we use
- * elsewhere, with one or two differences.
- *
- * For more details about the flags vite cares about, see
- * https://vitejs.dev/guide/features.html#typescript-compiler-options
- */
"compilerOptions": {
"target": "ES2020",
- "useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "esnext",
"skipLibCheck": true,
/* Bundler mode. */
"moduleResolution": "bundler",
- "allowImportingTsExtensions": true,
- "resolveJsonModule": true,
+ "moduleDetection": "force",
"isolatedModules": true,
+ "noUncheckedSideEffectImports": true,
"noEmit": true,
"jsx": "react-jsx",
- /* Linting. */
+ /* Typechecking. */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
-
- /*
- * On top of the generated configuration, we've mostly added additional
- * strictness checks.
- */
-
- /* Require the `type` modifier when importing types. */
"verbatimModuleSyntax": true,
-
- /* Stricter than strict. */
"noImplicitReturns": true,
- /* e.g. makes array indexing returns undefined. */
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true
},
- "include": ["src"],
- "references": [{ "path": "./tsconfig.node.json" }]
+ "include": ["src", "vite.config.ts"]
}
diff --git a/infra/staff/tsconfig.node.json b/infra/staff/tsconfig.node.json
deleted file mode 100644
index 326a834752..0000000000
--- a/infra/staff/tsconfig.node.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- /* TSConfig file used for typechecking vite's config file itself.
- *
- * These are vite defaults, generated using create-vite.
- */
- "compilerOptions": {
- "composite": true,
- "skipLibCheck": true,
- "module": "ESNext",
- "moduleResolution": "bundler",
- "allowSyntheticDefaultImports": true,
- "strict": true
- },
- "include": ["vite.config.ts"]
-}