diff --git a/.github/workflows/superset-frontend.yml b/.github/workflows/superset-frontend.yml index 308d1f4d6bd..93434990e41 100644 --- a/.github/workflows/superset-frontend.yml +++ b/.github/workflows/superset-frontend.yml @@ -143,7 +143,7 @@ jobs: - name: tsc run: | docker run --rm $TAG bash -c \ - "npm run type" + "npm run plugins:build && npm run type" validate-frontend: needs: frontend-build diff --git a/superset-frontend/jest.config.js b/superset-frontend/jest.config.js index 3062fe4e5bf..6dac54a094f 100644 --- a/superset-frontend/jest.config.js +++ b/superset-frontend/jest.config.js @@ -33,6 +33,7 @@ module.exports = { '^@superset-ui/([^/]+)$': '/node_modules/@superset-ui/$1/src', // mapping @apache-superset/core to local package '^@apache-superset/core$': '/packages/superset-core/src', + '^@apache-superset/core/(.*)$': '/packages/superset-core/src/$1', }, testEnvironment: '/spec/helpers/jsDomWithFetchAPI.ts', modulePathIgnorePatterns: ['/packages/generator-superset'], diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index 005cd93e601..f40a8105f03 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -63387,6 +63387,7 @@ "version": "0.20.3", "license": "Apache-2.0", "dependencies": { + "@apache-superset/core": "*", "@react-icons/all-files": "^4.1.0", "@types/react": "*", "lodash": "^4.17.21" @@ -63414,6 +63415,7 @@ "license": "Apache-2.0", "dependencies": { "@ant-design/icons": "^5.2.6", + "@apache-superset/core": "*", "@babel/runtime": "^7.28.2", "@fontsource/fira-code": "^5.2.6", "@fontsource/inter": "^5.2.6", @@ -65460,6 +65462,7 @@ }, "peerDependencies": { "@ant-design/icons": "^5.2.6", + "@apache-superset/core": "*", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", "@testing-library/dom": "^8.20.1", @@ -65511,6 +65514,7 @@ "lodash": "^4.17.21" }, "peerDependencies": { + "@apache-superset/core": "*", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", "echarts": "*", @@ -66688,6 +66692,7 @@ }, "peerDependencies": { "@ant-design/icons": "^5.2.6", + "@apache-superset/core": "*", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", "lodash": "^4.17.11", @@ -67819,6 +67824,7 @@ }, "peerDependencies": { "@ant-design/icons": "^5.2.6", + "@apache-superset/core": "*", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", "@testing-library/dom": "^8.20.1", diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/README.erb b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/README.erb index adb55c9deb9..2a1f7aff8eb 100644 --- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/README.erb +++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/README.erb @@ -22,19 +22,6 @@ To add the package to Superset, go to the `superset-frontend` subdirectory in yo npm i -S ../../<%= packageName %> ``` -If your Superset plugin exists in the `superset-frontend` directory and you wish to resolve TypeScript errors about `@superset-ui/core` not being resolved correctly, add the following to your `tsconfig.json` file: - -``` -"references": [ - { - "path": "../../packages/superset-ui-chart-controls" - }, - { - "path": "../../packages/superset-ui-core" - } -] -``` - You may also wish to add the following to the `include` array in `tsconfig.json` to make Superset types available to your plugin: ``` diff --git a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/tsconfig.json b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/tsconfig.json index 5cb0a18b6c9..dbb41676434 100644 --- a/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/tsconfig.json +++ b/superset-frontend/packages/generator-superset/generators/plugin-chart/templates/tsconfig.json @@ -1,44 +1,19 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "allowSyntheticDefaultImports": true, - "declaration": true, - "declarationDir": "lib", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "isolatedModules": false, - "jsx": "react", - "lib": [ - "dom", - "esnext" - ], - "module": "esnext", - "moduleResolution": "node", - "noEmitOnError": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "outDir": "lib", - "pretty": true, - "removeComments": false, - "strict": true, - "target": "es2015", - "useDefineForClassFields": false, - "composite": true, - "declarationMap": true, - "rootDir": "src", - "skipLibCheck": true, - "emitDeclarationOnly": true, - "resolveJsonModule": true, - "types": ["jest"], - "typeRoots": [ - "./node_modules/@types" - ] + "baseUrl": "../..", + "outDir": "lib" }, + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], "exclude": [ - "lib", - "test" + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" ], - "include": [ - "src/**/*", - "types/**/*" + "references": [ + { "path": "../../packages/superset-core" }, + { "path": "../../packages/superset-ui-core" }, + { "path": "../../packages/superset-ui-chart-controls" } ] } diff --git a/superset-frontend/packages/superset-core/tsconfig.json b/superset-frontend/packages/superset-core/tsconfig.json index a84e6817ce6..168df671bd3 100644 --- a/superset-frontend/packages/superset-core/tsconfig.json +++ b/superset-frontend/packages/superset-core/tsconfig.json @@ -1,19 +1,9 @@ { + "extends": "../../tsconfig.json", "compilerOptions": { - "allowSyntheticDefaultImports": true, - "declaration": true, - "declarationDir": "lib", - "outDir": "lib", - "strict": true, - "rootDir": "src", - "jsx": "preserve", - "baseUrl": ".", - "module": "esnext", - "moduleResolution": "node", - "skipLibCheck": true, - "target": "es2020", - "esModuleInterop": true + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*.ts*"], - "exclude": ["lib"] + "include": ["src/**/*", "types/**/*"], + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"] } diff --git a/superset-frontend/packages/superset-ui-chart-controls/package.json b/superset-frontend/packages/superset-ui-chart-controls/package.json index 0c368ce6fdd..93d06daaaa2 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/package.json +++ b/superset-frontend/packages/superset-ui-chart-controls/package.json @@ -24,6 +24,7 @@ "lib" ], "dependencies": { + "@apache-superset/core": "*", "@react-icons/all-files": "^4.1.0", "@types/react": "*", "lodash": "^4.17.21" diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/utils/checkColumnType.ts b/superset-frontend/packages/superset-ui-chart-controls/src/utils/checkColumnType.ts index 202b9605d54..5ce1d28b757 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/src/utils/checkColumnType.ts +++ b/superset-frontend/packages/superset-ui-chart-controls/src/utils/checkColumnType.ts @@ -17,11 +17,7 @@ * under the License. */ import { ensureIsArray, GenericDataType, ValueOf } from '@superset-ui/core'; -import { - ControlPanelState, - isDataset, - isQueryResponse, -} from '@superset-ui/chart-controls'; +import { ControlPanelState, isDataset, isQueryResponse } from '../types'; export function checkColumnType( columnName: string, diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/tsconfig.json b/superset-frontend/packages/superset-ui-chart-controls/test/tsconfig.json index 481ca5b4db9..42fa49ba514 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/test/tsconfig.json +++ b/superset-frontend/packages/superset-ui-chart-controls/test/tsconfig.json @@ -2,18 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": ".." - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/packages/superset-ui-chart-controls/tsconfig.json b/superset-frontend/packages/superset-ui-chart-controls/tsconfig.json index f70c2033ec0..03f6268db6a 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/tsconfig.json +++ b/superset-frontend/packages/superset-ui-chart-controls/tsconfig.json @@ -1,22 +1,13 @@ { - "compilerOptions": { - "declarationDir": "lib", - "outDir": "lib", - "rootDir": "src" - }, - "exclude": [ - "lib", - "test" - ], "extends": "../../tsconfig.json", - "include": [ - "src/**/*", - "types/**/*", - "../../types/**/*" - ], + "compilerOptions": { + "baseUrl": "../..", + "outDir": "lib" + }, + "include": ["src/**/*", "types/**/*"], + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"], "references": [ - { - "path": "../superset-ui-core" - } + { "path": "../superset-core" }, + { "path": "../superset-ui-core" } ] } diff --git a/superset-frontend/packages/superset-ui-core/package.json b/superset-frontend/packages/superset-ui-core/package.json index c3da5522d6a..e41ed718ab3 100644 --- a/superset-frontend/packages/superset-ui-core/package.json +++ b/superset-frontend/packages/superset-ui-core/package.json @@ -24,6 +24,7 @@ "lib" ], "dependencies": { + "@apache-superset/core": "*", "@ant-design/icons": "^5.2.6", "@babel/runtime": "^7.28.2", "@fontsource/fira-code": "^5.2.6", diff --git a/superset-frontend/packages/superset-ui-core/src/components/LastUpdated/index.tsx b/superset-frontend/packages/superset-ui-core/src/components/LastUpdated/index.tsx index 1ff09f4b20b..555378ca125 100644 --- a/superset-frontend/packages/superset-ui-core/src/components/LastUpdated/index.tsx +++ b/superset-frontend/packages/superset-ui-core/src/components/LastUpdated/index.tsx @@ -19,8 +19,10 @@ import { useEffect, useState, FunctionComponent } from 'react'; import { t, styled, css, useTheme } from '@superset-ui/core'; -import dayjs from 'dayjs'; +import { Dayjs } from 'dayjs'; import { extendedDayjs } from '../../utils/dates'; +import 'dayjs/plugin/updateLocale'; +import 'dayjs/plugin/calendar'; import { Icons } from '../Icons'; import type { LastUpdatedProps } from './types'; @@ -46,9 +48,7 @@ export const LastUpdated: FunctionComponent = ({ update, }) => { const theme = useTheme(); - const [timeSince, setTimeSince] = useState( - extendedDayjs(updatedAt), - ); + const [timeSince, setTimeSince] = useState(extendedDayjs(updatedAt)); useEffect(() => { setTimeSince(() => extendedDayjs(updatedAt)); diff --git a/superset-frontend/packages/superset-ui-core/src/utils/dates.ts b/superset-frontend/packages/superset-ui-core/src/utils/dates.ts index 8124490fdbe..44bf28ac7dd 100644 --- a/superset-frontend/packages/superset-ui-core/src/utils/dates.ts +++ b/superset-frontend/packages/superset-ui-core/src/utils/dates.ts @@ -43,6 +43,7 @@ dayjs.updateLocale('en', { }); export const extendedDayjs = dayjs; +export type { Dayjs }; export const fDuration = function ( t1: number, diff --git a/superset-frontend/packages/superset-ui-core/test/tsconfig.json b/superset-frontend/packages/superset-ui-core/test/tsconfig.json index 8f8d3946517..42fa49ba514 100644 --- a/superset-frontend/packages/superset-ui-core/test/tsconfig.json +++ b/superset-frontend/packages/superset-ui-core/test/tsconfig.json @@ -2,14 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": ["**/*", "../types/**/*", "../../../types/**/*"], - "references": [ - { - "path": ".." - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/packages/superset-ui-core/tsconfig.json b/superset-frontend/packages/superset-ui-core/tsconfig.json index 4e39d068d5f..89a862a072d 100644 --- a/superset-frontend/packages/superset-ui-core/tsconfig.json +++ b/superset-frontend/packages/superset-ui-core/tsconfig.json @@ -1,24 +1,10 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "declarationDir": "lib", - "outDir": "lib", - "rootDir": "src", - "baseUrl": ".", - "paths": { - "src/*": ["./src/*"], - "@superset-ui/core": ["src"], - "@superset-ui/core/*": ["src/*"] - } + "baseUrl": "../..", + "outDir": "lib" }, - "exclude": [ - "lib", - "test" - ], - "include": [ - "src/**/*", - "spec/**/*", - "types/**/*" - ], - "references": [] + "include": ["src/**/*", "types/**/*"], + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"], + "references": [{ "path": "../superset-core" }] } diff --git a/superset-frontend/packages/superset-ui-core/types/assets.d.ts b/superset-frontend/packages/superset-ui-core/types/assets.d.ts index 76f6dc1a771..b95944d3dba 100644 --- a/superset-frontend/packages/superset-ui-core/types/assets.d.ts +++ b/superset-frontend/packages/superset-ui-core/types/assets.d.ts @@ -19,3 +19,5 @@ declare module '*.gif'; declare module '*.svg'; declare module '*.png'; +declare module '*.jpg'; +declare module '*.jpeg'; diff --git a/superset-frontend/packages/superset-ui-switchboard/tsconfig.json b/superset-frontend/packages/superset-ui-switchboard/tsconfig.json index d26e1abe07f..168df671bd3 100644 --- a/superset-frontend/packages/superset-ui-switchboard/tsconfig.json +++ b/superset-frontend/packages/superset-ui-switchboard/tsconfig.json @@ -1,18 +1,9 @@ { - "compilerOptions": { - "declarationDir": "lib", - "outDir": "lib", - "rootDir": "src" - }, - "exclude": [ - "lib", - "src/**/*.test.ts" - ], "extends": "../../tsconfig.json", - "include": [ - "src/**/*", - "types/**/*", - "../../types/**/*" - ], - "references": [] + "compilerOptions": { + "baseUrl": "../..", + "outDir": "lib" + }, + "include": ["src/**/*", "types/**/*"], + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"] } diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-calendar/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-calendar/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-chord/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-chord/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-chord/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-chord/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-country-map/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-country-map/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-country-map/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-horizon/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-horizon/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-horizon/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-horizon/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/test/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-map-box/test/tsconfig.json index 481ca5b4db9..42fa49ba514 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-map-box/test/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/test/tsconfig.json @@ -2,18 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": ".." - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-map-box/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-map-box/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-paired-t-test/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/tsconfig.json index e7088b6c760..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/tsconfig.json @@ -1,19 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": ".", - "paths": { - "d3v3": ["./types/d3v3"] - } - - + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/test/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-partition/test/tsconfig.json index 481ca5b4db9..42fa49ba514 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-partition/test/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-partition/test/tsconfig.json @@ -2,18 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": ".." - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-partition/tsconfig.json index b5b28fc6189..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-partition/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-partition/tsconfig.json @@ -1,17 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": ".", - "paths": { - "@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"] - } + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-rose/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-rose/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-rose/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-rose/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/tsconfig.json b/superset-frontend/plugins/legacy-plugin-chart-world-map/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/legacy-plugin-chart-world-map/tsconfig.json +++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx index 1965eae717b..7c7d0e9567d 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utilities/HandlebarsRenderer.tsx @@ -18,9 +18,9 @@ */ import { useEffect, useState, memo } from 'react'; import { styled, t } from '@superset-ui/core'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import { SafeMarkdown } from '@superset-ui/core/components'; import Handlebars from 'handlebars'; -import dayjs from 'dayjs'; import { isPlainObject } from 'lodash'; export interface HandlebarsRendererProps { diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/tsconfig.json b/superset-frontend/plugins/legacy-preset-chart-deckgl/tsconfig.json index b5b28fc6189..d530f32823e 100644 --- a/superset-frontend/plugins/legacy-preset-chart-deckgl/tsconfig.json +++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/tsconfig.json @@ -1,17 +1,13 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": ".", - "paths": { - "@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"] - } + "baseUrl": "../..", + "outDir": "lib" }, "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js index 0620103c7f8..db67811f374 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js @@ -19,7 +19,6 @@ */ import { kebabCase, throttle } from 'lodash'; import d3 from 'd3'; -import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import nv from 'nvd3-fork'; import PropTypes from 'prop-types'; @@ -34,6 +33,7 @@ import { t, VizType, } from '@superset-ui/core'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import 'nvd3-fork/build/nv.d3.css'; diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/tsconfig.json b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/tsconfig.json index 481ca5b4db9..42fa49ba514 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/tsconfig.json +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/tsconfig.json @@ -2,18 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": ".." - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/tsconfig.json b/superset-frontend/plugins/legacy-preset-chart-nvd3/tsconfig.json index b3af9a1d193..d530f32823e 100644 --- a/superset-frontend/plugins/legacy-preset-chart-nvd3/tsconfig.json +++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/tsconfig.json @@ -1,14 +1,13 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json b/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json index 0771430ecd2..10f5d9cf967 100644 --- a/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json +++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json @@ -36,6 +36,7 @@ "xss": "^1.0.15" }, "peerDependencies": { + "@apache-superset/core": "*", "@ant-design/icons": "^5.2.6", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/tsconfig.json b/superset-frontend/plugins/plugin-chart-ag-grid-table/tsconfig.json index f60297e2489..dbb41676434 100644 --- a/superset-frontend/plugins/plugin-chart-ag-grid-table/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/tsconfig.json @@ -1,18 +1,19 @@ { - "compilerOptions": { - "declarationDir": "lib", - "outDir": "lib", - "rootDir": "src" - }, - "exclude": ["lib", "test"], "extends": "../../tsconfig.json", - "include": ["src/**/*", "types/**/*", "../../types/**/*"], + "compilerOptions": { + "baseUrl": "../..", + "outDir": "lib" + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ - { - "path": "../../packages/superset-ui-chart-controls" - }, - { - "path": "../../packages/superset-ui-core" - } + { "path": "../../packages/superset-core" }, + { "path": "../../packages/superset-ui-core" }, + { "path": "../../packages/superset-ui-chart-controls" } ] } diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/tsconfig.json b/superset-frontend/plugins/plugin-chart-cartodiagram/test/tsconfig.json index 07351e5038c..42fa49ba514 100644 --- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/tsconfig.json @@ -2,21 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": "../../../packages/superset-ui-chart-controls" - }, - { - "path": "../../../packages/superset-ui-core" - }, - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/tsconfig.json b/superset-frontend/plugins/plugin-chart-cartodiagram/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/plugin-chart-cartodiagram/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-cartodiagram/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/plugin-chart-echarts/package.json b/superset-frontend/plugins/plugin-chart-echarts/package.json index 388fc8f7222..f48e4f3c408 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/package.json +++ b/superset-frontend/plugins/plugin-chart-echarts/package.json @@ -30,6 +30,7 @@ "lodash": "^4.17.21" }, "peerDependencies": { + "@apache-superset/core": "*", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", "echarts": "*", diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts index 5da1a8c65cc..b374678d05b 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberPeriodOverPeriod/transformProps.ts @@ -16,8 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -import dayjs from 'dayjs'; -import utc from 'dayjs/plugin/utc'; import { Metric } from '@superset-ui/chart-controls'; import { ChartProps, @@ -27,6 +25,8 @@ import { SimpleAdhocFilter, ensureIsArray, } from '@superset-ui/core'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; +import 'dayjs/plugin/utc'; import { getComparisonFontSize, getHeaderFontSize, @@ -35,8 +35,6 @@ import { import { getOriginalLabel } from '../utils'; -dayjs.extend(utc); - export const parseMetricValue = (metricValue: number | string | null) => { if (typeof metricValue === 'string') { const dateObject = dayjs.utc(metricValue, undefined, true); diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/utils.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/utils.ts index ecad4d9ed96..ebba6fd2c01 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/utils.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/utils.ts @@ -17,7 +17,6 @@ * under the License. */ -import dayjs from 'dayjs'; import utc from 'dayjs/plugin/utc'; import { getTimeFormatter, @@ -29,6 +28,7 @@ import { SMART_DATE_ID, TimeGranularity, } from '@superset-ui/core'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; dayjs.extend(utc); diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts b/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts index 77877409f99..866b2024605 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts @@ -33,8 +33,8 @@ import { t, tooltipHtml, } from '@superset-ui/core'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import { CallbackDataParams } from 'echarts/types/src/util/types'; -import dayjs from 'dayjs'; import { Cartesian2dCoordSys, EchartsGanttChartProps, diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts index f45e9056c88..9433948bfa9 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts @@ -23,8 +23,7 @@ import { SqlaFormData, supersetTheme, } from '@superset-ui/core'; -import { EchartsBubbleChartProps } from 'plugins/plugin-chart-echarts/src/Bubble/types'; - +import { EchartsBubbleChartProps } from '../../src/Bubble/types'; import transformProps, { formatTooltip } from '../../src/Bubble/transformProps'; const defaultFormData: SqlaFormData = { diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/tsconfig.json b/superset-frontend/plugins/plugin-chart-echarts/test/tsconfig.json index a46726fa364..42fa49ba514 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-echarts/test/tsconfig.json @@ -2,21 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": "../../../packages/superset-ui-chart-controls" - }, - { - "path": "../../../packages/superset-ui-core" - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/plugins/plugin-chart-echarts/tsconfig.json b/superset-frontend/plugins/plugin-chart-echarts/tsconfig.json index b5b28fc6189..dbb41676434 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-echarts/tsconfig.json @@ -1,17 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": ".", - "paths": { - "@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"] - } + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx b/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx index c897605f570..a1e9c661899 100644 --- a/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx +++ b/superset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx @@ -18,8 +18,8 @@ */ import { styled, t } from '@superset-ui/core'; import { SafeMarkdown } from '@superset-ui/core/components'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import Handlebars from 'handlebars'; -import dayjs from 'dayjs'; import { useMemo, useState } from 'react'; import { isPlainObject } from 'lodash'; import Helpers from 'just-handlebars-helpers'; diff --git a/superset-frontend/plugins/plugin-chart-handlebars/tsconfig.json b/superset-frontend/plugins/plugin-chart-handlebars/tsconfig.json index b5b28fc6189..dbb41676434 100644 --- a/superset-frontend/plugins/plugin-chart-handlebars/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-handlebars/tsconfig.json @@ -1,17 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": ".", - "paths": { - "@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"] - } + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/package.json b/superset-frontend/plugins/plugin-chart-pivot-table/package.json index fc08bd6b8a8..ed10ba62ad9 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/package.json +++ b/superset-frontend/plugins/plugin-chart-pivot-table/package.json @@ -27,6 +27,7 @@ "access": "public" }, "peerDependencies": { + "@apache-superset/core": "*", "@ant-design/icons": "^5.2.6", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/tsconfig.json b/superset-frontend/plugins/plugin-chart-pivot-table/tsconfig.json index b3af9a1d193..d530f32823e 100644 --- a/superset-frontend/plugins/plugin-chart-pivot-table/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-pivot-table/tsconfig.json @@ -1,14 +1,13 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "exclude": ["src/**/*.test.*", "src/**/*.stories.*"], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/plugin-chart-table/package.json b/superset-frontend/plugins/plugin-chart-table/package.json index 4abf7dacfe7..b5202aa0ea3 100644 --- a/superset-frontend/plugins/plugin-chart-table/package.json +++ b/superset-frontend/plugins/plugin-chart-table/package.json @@ -36,6 +36,7 @@ "xss": "^1.0.15" }, "peerDependencies": { + "@apache-superset/core": "*", "@ant-design/icons": "^5.2.6", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", diff --git a/superset-frontend/plugins/plugin-chart-table/test/tsconfig.json b/superset-frontend/plugins/plugin-chart-table/test/tsconfig.json index 237243534a9..e24cb207084 100644 --- a/superset-frontend/plugins/plugin-chart-table/test/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-table/test/tsconfig.json @@ -2,18 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "../../../" }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": ".." - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/plugins/plugin-chart-table/tsconfig.json b/superset-frontend/plugins/plugin-chart-table/tsconfig.json index b5b28fc6189..dbb41676434 100644 --- a/superset-frontend/plugins/plugin-chart-table/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-table/tsconfig.json @@ -1,17 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": ".", - "paths": { - "@superset-ui/core/components": ["../../packages/superset-ui-core/src/components"] - } + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/plugins/plugin-chart-word-cloud/test/tsconfig.json b/superset-frontend/plugins/plugin-chart-word-cloud/test/tsconfig.json index 481ca5b4db9..42fa49ba514 100644 --- a/superset-frontend/plugins/plugin-chart-word-cloud/test/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-word-cloud/test/tsconfig.json @@ -2,18 +2,8 @@ "compilerOptions": { "composite": false, "emitDeclarationOnly": false, - "noEmit": true, "rootDir": "." }, "extends": "../../../tsconfig.json", - "include": [ - "**/*", - "../types/**/*", - "../../../types/**/*" - ], - "references": [ - { - "path": ".." - } - ] + "include": ["**/*", "../types/**/*", "../../../types/**/*"] } diff --git a/superset-frontend/plugins/plugin-chart-word-cloud/tsconfig.json b/superset-frontend/plugins/plugin-chart-word-cloud/tsconfig.json index b3af9a1d193..dbb41676434 100644 --- a/superset-frontend/plugins/plugin-chart-word-cloud/tsconfig.json +++ b/superset-frontend/plugins/plugin-chart-word-cloud/tsconfig.json @@ -1,14 +1,18 @@ { - "extends": "../../tsconfig.base.json", + "extends": "../../tsconfig.json", "compilerOptions": { - "composite": true, - "rootDir": "src", - "outDir": "lib", - "baseUrl": "." + "baseUrl": "../..", + "outDir": "lib" }, - "include": ["src/**/*", "types/**/*"], - "exclude": ["lib", "test"], + "include": ["src/**/*.ts", "src/**/*.tsx", "types/**/*"], + "exclude": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.test.*", + "src/**/*.stories.*" + ], "references": [ + { "path": "../../packages/superset-core" }, { "path": "../../packages/superset-ui-core" }, { "path": "../../packages/superset-ui-chart-controls" } ] diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx index 3f9a59a5d4c..94332a834f7 100644 --- a/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx +++ b/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx @@ -42,8 +42,8 @@ import { FeatureFlag, isFeatureEnabled, } from '@superset-ui/core'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import { useSelector, useDispatch } from 'react-redux'; -import dayjs from 'dayjs'; import rison from 'rison'; import { createDatasource } from 'src/SqlLab/actions/sqlLab'; import { addDangerToast } from 'src/components/MessageToasts/actions'; diff --git a/superset-frontend/src/components/ListView/CardCollection.tsx b/superset-frontend/src/components/ListView/CardCollection.tsx index 82c35b13a4e..eeea6475eeb 100644 --- a/superset-frontend/src/components/ListView/CardCollection.tsx +++ b/superset-frontend/src/components/ListView/CardCollection.tsx @@ -17,7 +17,7 @@ * under the License. */ import { ReactNode, MouseEvent as ReactMouseEvent } from 'react'; -import { TableInstance, Row } from 'react-table'; +import { TableInstance, Row, UseRowSelectRowProps } from 'react-table'; import { styled } from '@superset-ui/core'; import cx from 'classnames'; @@ -65,7 +65,7 @@ export default function CardCollection({ }: CardCollectionProps) { function handleClick( event: ReactMouseEvent, - toggleRowSelected: Row['toggleRowSelected'], + toggleRowSelected: (value?: boolean) => void, ) { if (bulkSelectEnabled) { event.preventDefault(); @@ -89,11 +89,18 @@ export default function CardCollection({ return ( ).isSelected, 'bulk-select': bulkSelectEnabled, })} key={row.id} - onClick={e => handleClick(e, row.toggleRowSelected)} + onClick={e => + handleClick( + e, + (row as Row & UseRowSelectRowProps).toggleRowSelected, + ) + } role="none" > {renderCard({ ...row.original, loading })} diff --git a/superset-frontend/src/components/ListView/ListView.tsx b/superset-frontend/src/components/ListView/ListView.tsx index b156a3e371c..8b3a8a13165 100644 --- a/superset-frontend/src/components/ListView/ListView.tsx +++ b/superset-frontend/src/components/ListView/ListView.tsx @@ -419,7 +419,7 @@ export function ListView({ cta onClick={() => action.onSelect( - selectedFlatRows.map(r => r.original), + selectedFlatRows.map((r: any) => r.original), ) } > @@ -475,10 +475,10 @@ export function ListView({ bulkSelectEnabled={bulkSelectEnabled} selectedFlatRows={selectedFlatRows} toggleRowSelected={(rowId, value) => { - const row = rows.find(r => r.id === rowId); + const row = rows.find((r: any) => r.id === rowId); if (row) { prepareRow(row); - row.toggleRowSelected(value); + (row as any).toggleRowSelected(value); } }} toggleAllRowsSelected={toggleAllRowsSelected} diff --git a/superset-frontend/src/components/ListView/utils.ts b/superset-frontend/src/components/ListView/utils.ts index 5329f2fa897..69a82f0d645 100644 --- a/superset-frontend/src/components/ListView/utils.ts +++ b/superset-frontend/src/components/ListView/utils.ts @@ -273,23 +273,23 @@ export function useListViewState({ } = useTable( { columns: columnsWithSelect, - count, data, disableFilters: true, disableSortRemove: true, - initialState, + initialState: initialState as any, manualFilters: true, manualPagination: true, manualSortBy: true, autoResetFilters: false, pageCount: Math.ceil(count / initialPageSize), + ...({ count } as any), }, useFilters, useSortBy, usePagination, useRowState, useRowSelect, - ); + ) as any; const [internalFilters, setInternalFilters] = useState( query.filters && initialFilters.length diff --git a/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx b/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx index 5ac9f527ad7..23fa5bda8bf 100644 --- a/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx +++ b/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx @@ -206,7 +206,7 @@ export default function TimeOffsetControls({ .subtract(1, 'day'); setStartDate(resetDate.toString()); setFormatedDate(resetDate); - onChange(extendedDayjs.utc(resetDate).format(DAYJS_FORMAT)); + onChange(extendedDayjs(resetDate).utc().format(DAYJS_FORMAT)); setIsDateSelected(true); } }, [formatedFilterDate, formatedDate, customStartDateInFilter]); diff --git a/superset-frontend/src/explore/components/controls/TimeRangeControl/index.tsx b/superset-frontend/src/explore/components/controls/TimeRangeControl/index.tsx index 8956d3d4dc2..34350b08bea 100644 --- a/superset-frontend/src/explore/components/controls/TimeRangeControl/index.tsx +++ b/superset-frontend/src/explore/components/controls/TimeRangeControl/index.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import dayjs from 'dayjs'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; +import { Dayjs } from 'dayjs'; import { TimeRangePicker } from 'src/components/TimePicker'; import ControlHeader, { ControlHeaderProps } from '../../ControlHeader'; @@ -38,7 +39,7 @@ export default function TimeRangeControl({ allowEmpty, ...rest }: TimeRangeControlProps) { - const dayjsValue: [dayjs.Dayjs | null, dayjs.Dayjs | null] = [ + const dayjsValue: [Dayjs | null, Dayjs | null] = [ stringValue?.[0] ? dayjs.utc(stringValue[0], 'HH:mm:ss') : null, stringValue?.[1] ? dayjs.utc(stringValue[1], 'HH:mm:ss') : null, ]; diff --git a/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx index 56565cd11e0..88be0b0ca33 100644 --- a/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx +++ b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx @@ -73,7 +73,7 @@ export default function AllEntitiesTable({ const renderTable = (type: objectType) => { const data = objects[type].map((o: TaggedObject) => ({ [type]: {o.name}, - modified: extendedDayjs.utc(o.changed_on).fromNow(), + modified: o.changed_on ? extendedDayjs.utc(o.changed_on).fromNow() : '', tags: o.tags, owners: o.owners, })); diff --git a/superset-frontend/src/hooks/useLocale.ts b/superset-frontend/src/hooks/useLocale.ts index c17b528fc7f..40a3522e4a6 100644 --- a/superset-frontend/src/hooks/useLocale.ts +++ b/superset-frontend/src/hooks/useLocale.ts @@ -16,8 +16,7 @@ * specific language governing permissions and limitations * under the License. */ - -import dayjs from 'dayjs'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import { useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; import { ExplorePageState } from 'src/explore/types'; diff --git a/superset-frontend/src/pages/AnnotationList/index.tsx b/superset-frontend/src/pages/AnnotationList/index.tsx index 9c6229b2b32..898af7f523c 100644 --- a/superset-frontend/src/pages/AnnotationList/index.tsx +++ b/superset-frontend/src/pages/AnnotationList/index.tsx @@ -26,7 +26,7 @@ import { SupersetClient, getClientErrorObject, } from '@superset-ui/core'; -import dayjs from 'dayjs'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import rison from 'rison'; import { ConfirmStatusChange, DeleteModal } from '@superset-ui/core/components'; diff --git a/superset-frontend/src/pages/ExecutionLogList/index.tsx b/superset-frontend/src/pages/ExecutionLogList/index.tsx index f32dc606cf9..86a9012f0de 100644 --- a/superset-frontend/src/pages/ExecutionLogList/index.tsx +++ b/superset-frontend/src/pages/ExecutionLogList/index.tsx @@ -18,14 +18,16 @@ */ import { css, styled, t } from '@superset-ui/core'; -import dayjs from 'dayjs'; +import { + extendedDayjs as dayjs, + fDuration, +} from '@superset-ui/core/utils/dates'; import { useEffect, useMemo } from 'react'; import { Link, useParams } from 'react-router-dom'; import { Tooltip } from '@superset-ui/core/components'; import { ListView } from 'src/components'; import SubMenu from 'src/features/home/SubMenu'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { fDuration } from '@superset-ui/core/utils/dates'; import AlertStatusIcon from 'src/features/alerts/components/AlertStatusIcon'; import { useListViewResource, diff --git a/superset-frontend/src/pages/QueryHistoryList/index.tsx b/superset-frontend/src/pages/QueryHistoryList/index.tsx index e2291678ff2..a72cc760dae 100644 --- a/superset-frontend/src/pages/QueryHistoryList/index.tsx +++ b/superset-frontend/src/pages/QueryHistoryList/index.tsx @@ -12,7 +12,7 @@ * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ diff --git a/superset-frontend/src/preamble.ts b/superset-frontend/src/preamble.ts index 136856db328..824bde3c15f 100644 --- a/superset-frontend/src/preamble.ts +++ b/superset-frontend/src/preamble.ts @@ -17,7 +17,6 @@ * under the License. */ import { setConfig as setHotLoaderConfig } from 'react-hot-loader'; -import dayjs from 'dayjs'; // eslint-disable-next-line no-restricted-imports import { configure, @@ -26,6 +25,7 @@ import { SupersetClient, LanguagePack, } from '@superset-ui/core'; +import { extendedDayjs as dayjs } from '@superset-ui/core/utils/dates'; import setupClient from './setup/setupClient'; import setupColors from './setup/setupColors'; import setupFormatters from './setup/setupFormatters'; @@ -34,6 +34,17 @@ import { User } from './types/bootstrapTypes'; import getBootstrapData, { applicationRoot } from './utils/getBootstrapData'; import './hooks/useLocale'; +// Import dayjs plugin types for global TypeScript support +import 'dayjs/plugin/utc'; +import 'dayjs/plugin/timezone'; +import 'dayjs/plugin/calendar'; +import 'dayjs/plugin/relativeTime'; +import 'dayjs/plugin/customParseFormat'; +import 'dayjs/plugin/duration'; +import 'dayjs/plugin/updateLocale'; +import 'dayjs/plugin/localizedFormat'; +import 'dayjs/plugin/isSameOrBefore'; + configure(); // Set hot reloader config diff --git a/superset-frontend/src/types/files.d.ts b/superset-frontend/src/types/files.d.ts index c4f304b57f6..1215ea8d5ac 100644 --- a/superset-frontend/src/types/files.d.ts +++ b/superset-frontend/src/types/files.d.ts @@ -19,3 +19,6 @@ declare module '*.svg'; declare module '*.gif'; +declare module '*.png'; +declare module '*.jpg'; +declare module '*.jpeg'; diff --git a/superset-frontend/tsconfig.base.json b/superset-frontend/tsconfig.base.json deleted file mode 100644 index 061d4ab9476..00000000000 --- a/superset-frontend/tsconfig.base.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "compilerOptions": { - /* Type Checking */ - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "strictNullChecks": true, - "module": "esnext", - "moduleResolution": "node", - - "types": ["jest", "node", "@testing-library/jest-dom"], - "typeRoots": ["node_modules/@types"], - - /* Emit */ - "declaration": true, - "declarationMap": true, - "importHelpers": false, - "noEmitOnError": true, - "outDir": "./dist", - "sourceMap": true, - - /* JavaScript Support */ - "allowJs": true, - - /* Interop Constraints */ - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - - /* Language and Environment */ - "target": "esnext", - "jsx": "react-jsx", - "jsxImportSource": "@emotion/react", - "lib": ["dom", "dom.iterable", "esnext"], - - /* Projects */ - "composite": true, - - /* Completeness */ - "skipLibCheck": true - } -} diff --git a/superset-frontend/tsconfig.json b/superset-frontend/tsconfig.json index 75c6acaeecb..98511535f83 100644 --- a/superset-frontend/tsconfig.json +++ b/superset-frontend/tsconfig.json @@ -1,6 +1,47 @@ { - "extends": "./tsconfig.base.json", "compilerOptions": { + /* Type Checking */ + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "strictNullChecks": true, + "module": "esnext", + "moduleResolution": "bundler", + + "types": ["jest", "node", "@testing-library/jest-dom"], + "typeRoots": ["src/types", "node_modules/@types"], + + /* Emit */ + "declaration": true, + "declarationMap": true, + "importHelpers": false, + "noEmitOnError": true, + "outDir": "./dist", + "rootDir": ".", + "declarationDir": "lib", + "sourceMap": true, + + /* JavaScript Support */ + "allowJs": true, + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + + /* Language and Environment */ + "target": "es2020", + "jsx": "react-jsx", + "jsxImportSource": "@emotion/react", + "lib": ["dom", "dom.iterable", "esnext"], + + /* Projects */ + "composite": true, + + /* Completeness */ + "skipLibCheck": true, + "baseUrl": ".", "paths": { "@superset-ui/core": ["./packages/superset-ui-core/src"], @@ -8,29 +49,44 @@ "@superset-ui/chart-controls": [ "./packages/superset-ui-chart-controls/src" ], - "@superset-ui/legacy-plugin-chart-*": [ - "./plugins/legacy-plugin-chart-*/src" + "@superset-ui/chart-controls/*": [ + "./packages/superset-ui-chart-controls/src/*" ], - "@superset-ui/legacy-preset-chart-*": [ - "./plugins/legacy-preset-chart-*/src" - ], - "@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"], - "@superset-ui/preset-chart-*": ["./plugins/preset-chart-*/src"], "@superset-ui/switchboard": ["./packages/superset-ui-switchboard/src"], - "@apache-superset/core": ["./packages/superset-core/src"] - }, - "typeRoots": ["src/types", "node_modules/@types"] - + "@apache-superset/core": ["./packages/superset-core/src"], + "@apache-superset/core/*": ["./packages/superset-core/src/*"], + "@superset-ui/plugin-chart-*": ["./plugins/plugin-chart-*/src"], + "echarts/types/src/*": ["./node_modules/echarts/types/src/*"] + } }, - "exclude": ["./packages/generator-superset/test/**/*"], "include": [ "./src/**/*", - "./spec/**/*", - "./packages/*/src/**/*", - "./packages/*/types/**/*", - "./plugins/*/src/**/*", - "./plugins/*/types/**/*", - "./packages/*/test/**/*", - "./plugins/*/test/**/*" - ] + "./spec/**/*" + ], + "references": [ + { "path": "./packages/superset-core" }, + { "path": "./packages/superset-ui-core" }, + { "path": "./packages/superset-ui-chart-controls" }, + { "path": "./packages/superset-ui-switchboard" }, + { "path": "./plugins/legacy-plugin-chart-calendar" }, + { "path": "./plugins/legacy-plugin-chart-chord" }, + { "path": "./plugins/legacy-plugin-chart-country-map" }, + { "path": "./plugins/legacy-plugin-chart-horizon" }, + { "path": "./plugins/legacy-plugin-chart-map-box" }, + { "path": "./plugins/legacy-plugin-chart-paired-t-test" }, + { "path": "./plugins/legacy-plugin-chart-parallel-coordinates" }, + { "path": "./plugins/legacy-plugin-chart-partition" }, + { "path": "./plugins/legacy-plugin-chart-rose" }, + { "path": "./plugins/legacy-plugin-chart-world-map" }, + { "path": "./plugins/legacy-preset-chart-deckgl" }, + { "path": "./plugins/legacy-preset-chart-nvd3" }, + { "path": "./plugins/plugin-chart-ag-grid-table" }, + { "path": "./plugins/plugin-chart-cartodiagram" }, + { "path": "./plugins/plugin-chart-echarts" }, + { "path": "./plugins/plugin-chart-handlebars" }, + { "path": "./plugins/plugin-chart-pivot-table" }, + { "path": "./plugins/plugin-chart-table" }, + { "path": "./plugins/plugin-chart-word-cloud" } + ], + "exclude": [] }