The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Clean up leftover JS-era config, deps, and docs after the TypeScript migration (#80032)
Andrei Chernykh68746a6d43b4
diff --git a/.claude/skills/typescript-write/SKILL.md b/.claude/skills/typescript-write/SKILL.mdindex 5d7cfc18134..d3f855ac1d8 100644--- a/.claude/skills/typescript-write/SKILL.md+++ b/.claude/skills/typescript-write/SKILL.md@@ -75,10 +75,6 @@ description: Write TypeScript and JavaScript code following Metabase coding stan- **No comments by default**. Well-named identifiers carry the `what`.- **Comments should be concise**. Add a short, concise comment only when the `why` is non-obvious: a workaround, a hidden invariant, a subtle ordering constraint, a clever reduction. Never document the actual implementation, focus on the intent and the why.-## TypeScript Migration--**When touching existing JavaScript files, propose to convert them to TypeScript first**. Create a separate PR for the conversion, then implement the changes.-## Verify before done- **Run the project type-check** when finished (see the shared TypeScript commands above).diff --git a/.github/workflows/emotion-stats-update.yml b/.github/workflows/emotion-stats-update.ymlindex f12c2888760..7d2a4673d96 100644--- a/.github/workflows/emotion-stats-update.yml+++ b/.github/workflows/emotion-stats-update.yml@@ -27,8 +27,6 @@ jobs:git grep -l -E "(from|import) ['\"]@emotion/" -- \'frontend/**/*.ts' \'frontend/**/*.tsx' \- 'frontend/**/*.js' \- 'frontend/**/*.jsx' \| wc -l || true)@@ -36,8 +34,6 @@ jobs:git grep -l -E "(from|import) ['\"]@emotion/" -- \'enterprise/frontend/**/*.ts' \'enterprise/frontend/**/*.tsx' \- 'enterprise/frontend/**/*.js' \- 'enterprise/frontend/**/*.jsx' \| wc -l || true)diff --git a/.storybook/main.ts b/.storybook/main.tsindex dc9a0ebe082..cbee25678e5 100644--- a/.storybook/main.ts+++ b/.storybook/main.ts@@ -9,8 +9,8 @@ const { CSS_CONFIG } = require("../frontend/build/shared/rspack/css-config");const mainAppStories = ["../frontend/**/*.mdx",- "../frontend/*/!(embedding-sdk-bundle|embedding-sdk-shared)/**/*.stories.@(js|jsx|ts|tsx)",- "../enterprise/frontend/*/!(embedding-sdk-ee|embedding-sdk-package)/**/*.stories.@(js|jsx|ts|tsx)",+ "../frontend/*/!(embedding-sdk-bundle|embedding-sdk-shared)/**/*.stories.@(ts|tsx)",+ "../enterprise/frontend/*/!(embedding-sdk-ee|embedding-sdk-package)/**/*.stories.@(ts|tsx)",];// Allow filtering to specific story files via env var (used by stress tests)diff --git a/CLAUDE.md b/CLAUDE.mdindex f9d4c1956b8..71ce53f498b 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -35,7 +35,7 @@ For detailed guidance on writing and reviewing code and documentation, see the s- **[analytics-events](.claude/skills/analytics-events/SKILL.md)** - Add product analytics events to track user interactions-**Important**: When working with frontend code, read [frontend/CLAUDE.md](frontend/CLAUDE.md) for project-specific guidelines on component preferences, styling, TypeScript migration, testing requirements, and available scripts.+**Important**: When working with frontend code, read [frontend/CLAUDE.md](frontend/CLAUDE.md) for project-specific guidelines on component preferences, styling, testing requirements, and available scripts.## Running Backend Testsdiff --git a/bin/i18n/update-translation-template b/bin/i18n/update-translation-templateindex 25a895c3798..7d104c8f565 100755--- a/bin/i18n/update-translation-template+++ b/bin/i18n/update-translation-template@@ -34,7 +34,7 @@ mkdir -p "locales"######################## NOTE: about twice as fast to call babel directly rather than a full webpack build-BABEL_ENV=extract ./node_modules/.bin/babel --quiet -x .js,.jsx,.ts,.tsx -o /dev/null {enterprise/,}frontend/src+BABEL_ENV=extract ./node_modules/.bin/babel --quiet -x .ts,.tsx -o /dev/null {enterprise/,}frontend/src# BABEL_ENV=extract BABEL_DISABLE_CACHE=1 bun run build# NOTE: replace ttag's "${ 0 }" style references with xgettext "{0}" style references for consistencydiff --git a/bun.lock b/bun.lockindex 54b171b244f..7744e34e062 100644--- a/bun.lock+++ b/bun.lock@@ -123,7 +123,6 @@"oxlint": "^1.58.0","prettier": "^3.3.3","process": "^0.11.10",- "prop-types": "^15.5.7","prosemirror-dropcursor": "1.8.2","prosemirror-state": "^1.4.4","prosemirror-view": "^1.40.1",@@ -257,7 +256,6 @@"@types/postcss-import": "^14.0.3","@types/postcss-url": "^10.0.4","@types/prettier": "1.19.1",- "@types/prop-types": "^15.7.4","@types/raf": "^3.4.0","@types/react": "^18.3.3","@types/react-color": "^2.17.6",@@ -1988,7 +1986,7 @@"@types/prettier": ["@types/[email protected]", "", {}, "sha512-5qOlnZscTn4xxM5MeGXAMOsIOIKIbh9e85zJWfBRVPlRMEVawzoPhINYbRGkBZCI8LxvBe7tJCdWiarA99OZfQ=="],- "@types/prop-types": ["@types/[email protected]", "", {}, "sha512-rZ5drC/jWjrArrS8BR6SIr4cWpW09RNTYt9AMZo3Jwwif+iacXAqgVjm0B0Bv/S1jhDXKHqRVNCbACkJ89RAnQ=="],+ "@types/prop-types": ["@types/[email protected]", "", {}, "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw=="],"@types/qs": ["@types/[email protected]", "", {}, "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw=="],@@ -6038,10 +6036,6 @@"@types/leaflet/@types/geojson": ["@types/[email protected]", "", {}, "sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA=="],- "@types/react/@types/prop-types": ["@types/[email protected]", "", {}, "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw=="],-- "@types/react-virtualized/@types/prop-types": ["@types/[email protected]", "", {}, "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw=="],-"@types/serve-index/@types/express": ["@types/[email protected]", "", { "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.18", "@types/qs": "*", "@types/serve-static": "*" } }, "sha512-6bSZTPaTIACxn48l50SR+axgrqm6qXFIxrdAKaG6PaJk3+zuUr35hBlgT7vOmJcum+OEaIBLtHV/qloEAFITeA=="],"@typescript-eslint/parser/@typescript-eslint/scope-manager": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@typescript-eslint/types": "8.60.0", "@typescript-eslint/visitor-keys": "8.60.0" } }, "sha512-pFzqhllJMs+jghLQWzV00ds39xLzuyqPSev5pd8f4Ir0rtKR3ZLUB4/4dhjOFighWb9larvtfJvqL+4yKDI3Xw=="],diff --git a/docs/developers-guide/frontend.md b/docs/developers-guide/frontend.mdindex 32e8934b54f..9d6ee68a124 100644--- a/docs/developers-guide/frontend.md+++ b/docs/developers-guide/frontend.md@@ -6,7 +6,7 @@ title: Frontend## Typescript-We are aggressively pressing toward having our entire frontend codebase in typescript. If you find yourself working on a javascript file, consider making a small initial PR to convert it to typescript before making further changes (and making it a functional component if you've happened upon a class component 😱).+The app codebase is fully TypeScript. New files must be `.ts` or `.tsx`. Prefer functional components over class components.Avoid typecasts, and avoid use of `any` at all costs.diff --git a/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.ts b/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.tsindex a9fa9deb2f1..cf1c1df67d4 100644--- a/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.ts+++ b/e2e/test/scenarios/admin/i18n/content-translation/dashboards.cy.spec.ts@@ -22,7 +22,7 @@ import {frenchNames,germanFieldNames,germanFieldValues,-} from "./constants";+} from "./helpers/constants";const { H } = cy;diff --git a/e2e/test/scenarios/admin/i18n/content-translation/constants.ts b/e2e/test/scenarios/admin/i18n/content-translation/helpers/constants.tssimilarity index 100%rename from e2e/test/scenarios/admin/i18n/content-translation/constants.tsrename to e2e/test/scenarios/admin/i18n/content-translation/helpers/constants.tsdiff --git a/e2e/test/scenarios/admin/i18n/content-translation/questions.cy.spec.ts b/e2e/test/scenarios/admin/i18n/content-translation/questions.cy.spec.tsindex 27611430d64..94692e72575 100644--- a/e2e/test/scenarios/admin/i18n/content-translation/questions.cy.spec.ts+++ b/e2e/test/scenarios/admin/i18n/content-translation/questions.cy.spec.ts@@ -2,7 +2,7 @@ import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";import { NORMAL_USER_ID } from "e2e/support/cypress_sample_instance_data";import { uploadTranslationDictionaryViaAPI } from "e2e/support/helpers/e2e-content-translation-helpers";-import { germanFieldNames } from "./constants";+import { germanFieldNames } from "./helpers/constants";const { PRODUCTS_ID } = SAMPLE_DATABASE;diff --git a/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.ts b/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.tsindex 2502a367bc2..1803cfa864e 100644--- a/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.ts+++ b/e2e/test/scenarios/admin/i18n/content-translation/upload-and-download.cy.spec.ts@@ -12,7 +12,7 @@ import {nonAsciiFieldNames,portugueseFieldNames,stringTranslatedTwice,-} from "./constants";+} from "./helpers/constants";import {assertOnlyTheseTranslationsAreStored,generateLargeCSV,diff --git a/e2e/validate-e2e-test-files.js b/e2e/validate-e2e-test-files.jsindex 25eb1d07ab1..39ffb59a7ae 100644--- a/e2e/validate-e2e-test-files.js+++ b/e2e/validate-e2e-test-files.js@@ -26,7 +26,8 @@ function validateE2EFileNames(files) {* @param {Array<string>} [files] Potential payload if used with `lint-staged`*/function validateStagedFiles(files) {- validateE2EFileNames(files || getStagedFiles());+ const stagedFiles = files || getStagedFiles();+ validateE2EFileNames(stagedFiles && stagedFiles.filter(isE2ETestFile));}function validateAllFiles() {@@ -35,10 +36,7 @@ function validateAllFiles() {}function getAllE2EFiles() {- // Will match all files in the scenarios dir, except the ones in helpers and shared directories- const PATTERN = `${E2E_HOME}*/{*.(js|ts),!(helpers|shared)/*.(js|ts)}`;-- return glob.sync(PATTERN);+ return glob.sync(`${E2E_HOME}**/*.{js,ts}`).filter(isE2ETestFile);}function getStagedFiles() {@@ -48,15 +46,14 @@ function getStagedFiles() {const hasRelevantFiles = stagedFiles.includes(E2E_HOME);if (hasRelevantFiles) {- return stagedFiles.split("\n").filter(isE2ETestFile);+ return stagedFiles.split("\n");}}function isE2ETestFile(fullPath) {- const dirName = path.dirname(fullPath);- const excludedPaths =- dirName.endsWith("/helpers") || dirName.endsWith("/shared");- return dirName.startsWith(E2E_HOME) && !excludedPaths;+ const isExcluded =+ fullPath.includes("/helpers/") || fullPath.includes("/shared/");+ return fullPath.includes(E2E_HOME) && !isExcluded;}function printHints() {diff --git a/eslint.config.mjs b/eslint.config.mjsindex 83ce3bab33b..0738bb545b0 100644--- a/eslint.config.mjs+++ b/eslint.config.mjs@@ -270,7 +270,7 @@ const configs = ["react/no-is-mounted": "error","react/prefer-es6-class": "error","react/display-name": "warn",- "react/prop-types": "error",+ "react/prop-types": "off","react/no-did-mount-set-state": "off","react/no-did-update-set-state": "off","react/no-find-dom-node": "off",@@ -440,7 +440,6 @@ const configs = [rules: {"metabase/no-unjustified-type-casts": "error","prefer-rest-params": "off",- "react/prop-types": "off","@typescript-eslint/explicit-module-boundary-types": "off","@typescript-eslint/no-inferrable-types": "off","@typescript-eslint/no-explicit-any": "off",@@ -689,7 +688,7 @@ const configs = [},},{- files: ["frontend/src/metabase/ui/**/*.{js,jsx,ts,tsx}"],+ files: ["frontend/src/metabase/ui/**/*.{ts,tsx}"],rules: {"no-restricted-imports": ["error",@@ -1052,8 +1051,8 @@ const configs = ["**/.storybook/**","**/jest/**","**/test/**",- "**/*.spec.{ts,tsx,js,jsx}",- "**/*.stories.{ts,tsx,js,jsx}",+ "**/*.spec.{ts,tsx}",+ "**/*.stories.{ts,tsx}",],rules: {"metabase/no-external-references-for-sdk-package-code": [@@ -1132,7 +1131,7 @@ const configs = [},},{- files: ["docs/**/snippets/**/*.{ts,tsx,js,jsx}"],+ files: ["docs/**/snippets/**/*.{ts,tsx}"],rules: {"@typescript-eslint/no-unused-vars": "off","@typescript-eslint/no-var-requires": "off",diff --git a/eslint.config.module-boundaries.mjs b/eslint.config.module-boundaries.mjsindex f8a961524c1..81e83f7bffa 100644--- a/eslint.config.module-boundaries.mjs+++ b/eslint.config.module-boundaries.mjs@@ -51,8 +51,8 @@ export default defineConfig([reportUnusedDisableDirectives: "off",},files: [- "frontend/src/**/*.{js,jsx,ts,tsx}",- "enterprise/frontend/src/**/*.{js,jsx,ts,tsx}",+ "frontend/src/**/*.{ts,tsx}",+ "enterprise/frontend/src/**/*.{ts,tsx}",],languageOptions: {parser: tseslint.parser,diff --git a/jest.config.js b/jest.config.jsindex 9280294bc8a..95abb61f7ca 100644--- a/jest.config.js+++ b/jest.config.js@@ -94,10 +94,7 @@ const baseConfig = {"<rootDir>/frontend/.*/.*.tz.unit.spec.{js,jsx,ts,tsx}","<rootDir>/release/.*",],- testMatch: [- "<rootDir>/**/*.unit.spec.js",- "<rootDir>/**/*.unit.spec.{js,jsx,ts,tsx}",- ],+ testMatch: ["<rootDir>/**/*.unit.spec.{js,jsx,ts,tsx}"],modulePaths: ["<rootDir>/frontend/test","<rootDir>/frontend/src",@@ -130,7 +127,6 @@ const baseConfig = {],coveragePathIgnorePatterns: ["/node_modules/",- "/frontend/src/metabase/visualizations/lib/errors.js","/target/cljs_dev/","/target/cljs_release/","/frontend/test/",@@ -156,9 +152,9 @@ const config = {displayName: "sdk",testMatch: [- "<rootDir>/frontend/src/embedding-sdk-{bundle,shared}/**/*.unit.spec.{js,jsx,ts,tsx}",- "<rootDir>/enterprise/frontend/src/embedding-sdk-package/**/*.unit.spec.{js,jsx,ts,tsx}",- "<rootDir>/enterprise/frontend/src/embedding-sdk-ee/**/*.unit.spec.{js,jsx,ts,tsx}",+ "<rootDir>/frontend/src/embedding-sdk-{bundle,shared}/**/*.unit.spec.{ts,tsx}",+ "<rootDir>/enterprise/frontend/src/embedding-sdk-package/**/*.unit.spec.{ts,tsx}",+ "<rootDir>/enterprise/frontend/src/embedding-sdk-ee/**/*.unit.spec.{ts,tsx}",],setupFiles: [diff --git a/jest.tz.unit.conf.js b/jest.tz.unit.conf.jsindex 38df112214e..22cfaee71e2 100644--- a/jest.tz.unit.conf.js+++ b/jest.tz.unit.conf.js@@ -36,10 +36,7 @@ module.exports = {coverageDirectory: "./",coverageReporters: ["text", "json-summary"],collectCoverageFrom: ["frontend/src/**/*.{js,ts,jsx,tsx}"],- coveragePathIgnorePatterns: [- "/node_modules/",- "/frontend/src/metabase/visualizations/lib/errors.js",- ],+ coveragePathIgnorePatterns: ["/node_modules/"],testEnvironment: "jest-environment-jsdom",testTimeout: 30000,};diff --git a/lint-staged.config.cjs b/lint-staged.config.cjsindex 3599110a29c..e3fcc22e92e 100644--- a/lint-staged.config.cjs+++ b/lint-staged.config.cjs@@ -11,7 +11,7 @@ module.exports = {"oxfmt --write","node ./bin/verify-doc-links",],- "e2e/**/!(cypress_sample_instance_data).{js,jsx,ts,jsx}": [+ "e2e/**/!(cypress_sample_instance_data).{js,jsx,ts,tsx}": ["eslint --no-warn-ignored --max-warnings 0 --fix","oxfmt --write",],@@ -19,9 +19,7 @@ module.exports = {"./bin/mage cljfmt-files","./bin/mage fix-unused-requires",],- "e2e/test/scenarios/*/{*.(js|ts),!(helpers|shared)/*.(js|ts)}": [- "node e2e/validate-e2e-test-files.js",- ],+ "e2e/test/scenarios/**/*.{js,ts}": ["node e2e/validate-e2e-test-files.js"],"enterprise/frontend/src/embedding-sdk-package/README.md": ["oxfmt --write",],diff --git a/package.json b/package.jsonindex 3892862d74a..bb3c1a27637 100644--- a/package.json+++ b/package.json@@ -132,7 +132,6 @@"oxlint": "^1.58.0","prettier": "^3.3.3","process": "^0.11.10",- "prop-types": "^15.5.7","prosemirror-dropcursor": "1.8.2","prosemirror-state": "^1.4.4","prosemirror-view": "^1.40.1",@@ -266,7 +265,6 @@"@types/postcss-import": "^14.0.3","@types/postcss-url": "^10.0.4","@types/prettier": "1.19.1",- "@types/prop-types": "^15.7.4","@types/raf": "^3.4.0","@types/react": "^18.3.3","@types/react-color": "^2.17.6",@@ -533,7 +531,7 @@"lint-css": "stylelint './frontend/**/*.css'","lint-eslint": "bun run build:cljs && bun run lint-eslint-pure","lint-eslint-pure": "eslint --cache --cache-strategy content --max-warnings 0 --report-unused-disable-directives enterprise/frontend frontend e2e",- "module-boundaries": "eslint --config eslint.config.module-boundaries.mjs 'frontend/src/**/*.{js,jsx,ts,tsx}' 'enterprise/frontend/src/**/*.{js,jsx,ts,tsx}'",+ "module-boundaries": "eslint --config eslint.config.module-boundaries.mjs 'frontend/src/**/*.{ts,tsx}' 'enterprise/frontend/src/**/*.{ts,tsx}'","lint-format": "bun install && bun lint-format-pure","lint-format-pure": "oxfmt --check '{frontend,enterprise/frontend,e2e}/**/*.{js,jsx,ts,tsx,css}'","lint-yaml": "yamllint **/*.{yaml,yml} --ignore=node_modules/**/*.{yaml,yml}",diff --git a/rspack.main.config.js b/rspack.main.config.jsindex 5b0480e2217..f187afcb9f1 100644--- a/rspack.main.config.js+++ b/rspack.main.config.js@@ -282,16 +282,7 @@ const config = {],},resolve: {- extensions: [- ".webpack.js",- ".web.js",- ".js",- ".jsx",- ".ts",- ".tsx",- ".css",- ".svg",- ],+ extensions: [".js", ".jsx", ".ts", ".tsx", ".css", ".svg"],alias: RESOLVE_ALIASES,fallback: {buffer: require.resolve("buffer/"),diff --git a/rspack.static-viz.config.js b/rspack.static-viz.config.jsindex 6ed0b6f7724..63a7adedf2a 100644--- a/rspack.static-viz.config.js+++ b/rspack.static-viz.config.js@@ -123,7 +123,7 @@ module.exports = (env) => {],},resolve: {- extensions: [".web.js", ".js", ".jsx", ".ts", ".tsx"],+ extensions: [".js", ".jsx", ".ts", ".tsx"],alias: {assets: ASSETS_PATH,metabase: SRC_PATH,