From a0d507de896d110baae8c59875aec5deba11f6d4 Mon Sep 17 00:00:00 2001 From: An Phi Date: Wed, 9 Oct 2024 14:09:52 -0400 Subject: [PATCH] bump dependencies (#3577) * bump dependencies * upgrade to eslint@9 * upgrade react-select@5 * upgrade react-router@6 * bump dependencies 2 --- .changeset/hot-pillows-tan.md | 3 + .changeset/late-pianos-care.md | 42 + .changeset/nasty-ducks-leave.md | 42 + .changeset/ninety-ghosts-invent.md | 42 + .changeset/perfect-bags-melt.md | 31 + .changeset/quick-balloons-prove.md | 42 + .eslintignore | 20 - .eslintrc.cjs | 84 - .vscode/settings.json | 11 +- eslint.config.js | 69 + fixtures/legend-mock-server/package.json | 4 +- package.json | 18 +- packages/babel-preset/index.js | 1 + packages/babel-preset/package.json | 18 +- packages/eslint-plugin/package.json | 20 +- .../src/configs/computationally-expensive.js | 40 +- packages/eslint-plugin/src/configs/custom.js | 28 + .../eslint-plugin/src/configs/recommended.js | 83 +- .../src/configs/scripts-override.js | 51 - packages/eslint-plugin/src/configs/scripts.js | 45 + .../eslint-plugin/src/configs/stylistic.js | 21 + packages/eslint-plugin/src/index.js | 17 +- .../rules/enforce-protocol-export-prefix.js | 2 +- .../src/rules/enforce-protocol-file-prefix.js | 2 +- .../package.json | 6 +- .../webpack.config.js | 1 + .../legend-application-pure-ide/package.json | 8 +- .../command-center/FileSearchCommand.tsx | 2 +- .../package.json | 8 +- .../package.json | 4 +- .../src/index.tsx | 2 +- .../webpack.config.js | 1 + .../legend-application-query/package.json | 8 +- .../src/components/CloneQueryServiceSetup.tsx | 12 +- .../Core_LegendQueryApplicationPlugin.tsx | 8 +- .../components/CreateMappingQuerySetup.tsx | 12 +- .../components/LegendQueryWebApplication.tsx | 116 +- .../src/components/QueryEditor.tsx | 34 +- ...yEdtiorExistingQueryVersionRevertModal.tsx | 4 +- .../UpdateExistingServiceQuerySetup.tsx | 2 +- .../QueryEditorComponentTestUtils.tsx | 16 +- .../data-cube/ExistingQueryDataCubeViewer.tsx | 7 +- .../data-space/DataSpaceQueryCreator.tsx | 10 +- .../data-space/DataSpaceQuerySetup.tsx | 2 +- .../DataSpaceTemplateQueryCreator.tsx | 16 +- .../package.json | 6 +- .../src/index.tsx | 2 +- .../webpack.config.js | 1 + packages/legend-application-repl/package.json | 8 +- .../src/components/LegendREPLApplication.tsx | 15 +- .../package.json | 8 +- .../package.json | 4 +- .../src/index.tsx | 2 +- .../webpack.config.js | 1 + .../legend-application-studio/package.json | 10 +- .../src/__lib__/LegendStudioNavigation.ts | 10 +- .../components/LegendStudioWebApplication.tsx | 233 +- .../LegendStudioWebApplication.test.tsx | 4 +- .../src/components/editor/Editor.tsx | 3 +- .../src/components/editor/QuickInput.tsx | 5 +- .../EditorComponentTestUtils.tsx | 59 +- .../command-center/ProjectSearchCommand.tsx | 7 +- .../GenerationSpecificationEditor.tsx | 9 +- .../editor/editor-group/RuntimeEditor.tsx | 28 +- .../RelationalDatabaseConnectionEditor.tsx | 20 +- .../data-editor/EmbeddedDataEditor.tsx | 19 +- .../database/IsolatedQueryDatabase.tsx | 6 +- .../FileGenerationEditor.tsx | 2 +- ...SL_ExternalFormat_BindingElementEditor.tsx | 34 +- .../function-activator/FunctionEditor.tsx | 19 +- .../HostedServiceFunctionActivatorEditor.tsx | 1 - .../SnowflakeAppFunctionActivatorEditor.tsx | 18 +- .../testable/FunctionTestableEditor.tsx | 2 +- .../EnumerationMappingEditor.tsx | 8 +- .../FlatDataPropertyMappingEditor.tsx | 11 +- ...ceSetImplementationSourceSelectorModal.tsx | 13 +- .../MappingExecutionBuilder.tsx | 6 +- .../MappingExecutionQueryBuilder.tsx | 3 + .../mapping-editor/MappingTestableEditor.tsx | 4 +- .../mapping-editor/NewMappingElementModal.tsx | 14 +- .../OperationSetImplementationEditor.tsx | 5 +- .../PurePropertyMappingEditor.tsx | 11 +- .../RelationalPropertyMappingEditor.tsx | 11 +- .../ProjectDependencyEditor.tsx | 10 +- .../BulkServiceRegistrationEditor.tsx | 2 +- .../service-editor/ServiceEditor.tsx | 2 - .../service-editor/ServiceExecutionEditor.tsx | 10 +- .../ServicePostValidationEditor.tsx | 4 +- .../ServiceRegistrationEditor.tsx | 2 +- .../testable/ServiceTestsEditor.tsx | 6 +- .../uml-editor/AssociationEditor.tsx | 6 +- .../editor-group/uml-editor/ClassEditor.tsx | 17 +- .../uml-editor/PropertyEditor.tsx | 2 +- .../uml-editor/StereotypeSelector.tsx | 8 +- .../uml-editor/TaggedValueEditor.tsx | 7 +- .../editor/panel-group/SQLPlaygroundPanel.tsx | 8 +- .../editor/side-bar/CreateNewElementModal.tsx | 16 +- .../components/editor/side-bar/Explorer.tsx | 6 +- .../editor/side-bar/ProjectOverview.tsx | 6 +- .../__tests__/DependencyTree.test.tsx | 2 +- .../lazy-text-editor/LazyTextEditor.tsx | 3 +- .../project-reviewer/ProjectReviewer.tsx | 5 +- .../__tests__/WorkspaceSetup.test.tsx | 21 +- .../src/stores/LegendStudioBaseStore.ts | 19 +- .../src/stores/editor/EditorStore.ts | 4 +- .../stores/showcase/ShowcaseViewerStore.ts | 2 +- .../workspace-setup/_project-selector.scss | 4 +- packages/legend-application/package.json | 13 +- .../components/BrowserEnvironmentProvider.tsx | 21 +- .../BrowserEnvironmentTestUtils.tsx | 39 +- .../src/stores/LegendApplicationPlugin.ts | 2 +- .../src/stores/navigation/BrowserNavigator.ts | 44 +- .../src/stores/platform/BrowserPlatform.ts | 6 +- packages/legend-art/package.json | 25 +- .../src/autocomplete/CJS__ReactSelect.cts | 39 - .../src/autocomplete/CustomSelectorInput.tsx | 207 +- packages/legend-art/src/card/BaseCard.tsx | 4 +- packages/legend-art/src/layout/Panel.tsx | 12 +- .../style/components/_selector-input.scss | 9 +- packages/legend-art/tsconfig.json | 9 +- packages/legend-code-editor/package.json | 8 +- packages/legend-data-cube/package.json | 38 +- packages/legend-dev-utils/CopyrightUtils.js | 2 +- packages/legend-dev-utils/JestConfigUtils.js | 1 + .../legend-dev-utils/TypescriptConfigUtils.js | 5 +- .../legend-dev-utils/WebpackConfigUtils.js | 14 +- packages/legend-dev-utils/package.json | 6 +- .../legend-extension-assortment/package.json | 8 +- .../package.json | 8 +- ...NewDataQualityServiceValidationElement.tsx | 2 +- .../DataQualityDataSpaceBuilder.tsx | 8 +- .../DataQualityMappingAndRuntimeBuilder.tsx | 11 +- .../src/components/DataQualitySideBar.tsx | 19 +- .../package.json | 8 +- ...ataSpace_LegendStudioApplicationPlugin.tsx | 2 +- .../DataSpaceTemplateQueryPromoteReview.tsx | 10 +- .../package.json | 8 +- .../DataSpaceAdvancedSearchModal.tsx | 2 +- .../query-builder/DataSpaceQueryBuilder.tsx | 6 +- .../legend-extension-dsl-diagram/package.json | 8 +- .../src/components/studio/DiagramEditor.tsx | 4 +- .../package.json | 8 +- .../legend-extension-dsl-service/package.json | 8 +- .../components/query/ServiceRegisterModal.tsx | 1 - ..._Service_LegendStudioApplicationPlugin.tsx | 10 +- .../components/studio/QueryProductionizer.tsx | 1 - .../components/studio/ServiceQueryEditor.tsx | 31 +- .../legend-extension-dsl-text/package.json | 8 +- .../package.json | 8 +- .../package.json | 8 +- .../package.json | 8 +- .../package.json | 4 +- packages/legend-graph/package.json | 4 +- .../__test-utils__/EngineTestSupport.ts | 2 +- .../graph/__test-utils__/GraphTestUtils.ts | 2 +- packages/legend-lego/package.json | 42 +- packages/legend-manual-tests/package.json | 6 +- packages/legend-query-builder/package.json | 12 +- .../src/components/QueryBuilderSideBar.tsx | 21 +- .../QueryBuilderComponentTestUtils.tsx | 10 +- .../QueryBuilderFilterPanel.test.tsx | 8 +- .../QueryBuilderPostFilterPanel.test.tsx | 9 +- .../QueryBuilderResultModifierPanel.tsx | 2 +- .../result/tds/QueryBuilderTDSGridResult.tsx | 17 +- .../shared/BasicValueSpecificationEditor.tsx | 36 +- .../components/shared/CustomDatePicker.tsx | 27 +- .../workflows/ClassQueryBuilder.tsx | 11 +- .../workflows/MappingQueryBuilder.tsx | 11 +- packages/legend-server-depot/package.json | 4 +- packages/legend-server-sdlc/package.json | 4 +- .../package.json | 4 +- .../webpack.config.js | 2 +- packages/legend-server-showcase/package.json | 4 +- packages/legend-shared/package.json | 6 +- packages/legend-storage/package.json | 4 +- .../package.json | 12 +- packages/stylelint-config/package.json | 2 +- scripts/github-bot/onboardNewIssue.js | 4 +- scripts/github-bot/package.json | 2 +- scripts/github-bot/trackNewMilestonedIssue.js | 2 +- scripts/release/concludeNewRelease.js | 4 +- .../release/createVersionBumpChangesetPR.js | 4 +- scripts/test/jest.config.base.js | 15 +- yarn.lock | 3464 ++++++++--------- 184 files changed, 3275 insertions(+), 2994 deletions(-) create mode 100644 .changeset/hot-pillows-tan.md create mode 100644 .changeset/late-pianos-care.md create mode 100644 .changeset/nasty-ducks-leave.md create mode 100644 .changeset/ninety-ghosts-invent.md create mode 100644 .changeset/perfect-bags-melt.md create mode 100644 .changeset/quick-balloons-prove.md delete mode 100644 .eslintignore delete mode 100644 .eslintrc.cjs create mode 100644 eslint.config.js create mode 100644 packages/eslint-plugin/src/configs/custom.js delete mode 100644 packages/eslint-plugin/src/configs/scripts-override.js create mode 100644 packages/eslint-plugin/src/configs/scripts.js create mode 100644 packages/eslint-plugin/src/configs/stylistic.js delete mode 100644 packages/legend-art/src/autocomplete/CJS__ReactSelect.cts diff --git a/.changeset/hot-pillows-tan.md b/.changeset/hot-pillows-tan.md new file mode 100644 index 0000000000..05ca6d5343 --- /dev/null +++ b/.changeset/hot-pillows-tan.md @@ -0,0 +1,3 @@ +--- +'@finos/eslint-plugin-legend-studio': major +--- diff --git a/.changeset/late-pianos-care.md b/.changeset/late-pianos-care.md new file mode 100644 index 0000000000..c561bcc26e --- /dev/null +++ b/.changeset/late-pianos-care.md @@ -0,0 +1,42 @@ +--- +'@finos/legend-application-pure-ide-deployment': patch +'@finos/legend-extension-dsl-data-space-studio': patch +'@finos/legend-application-studio-deployment': patch +'@finos/legend-extension-store-service-store': patch +'@finos/legend-vscode-extension-dependencies': patch +'@finos/legend-application-query-deployment': patch +'@finos/legend-application-studio-bootstrap': patch +'@finos/legend-application-query-bootstrap': patch +'@finos/legend-application-repl-deployment': patch +'@finos/legend-extension-dsl-data-quality': patch +'@finos/legend-extension-store-relational': patch +'@finos/legend-server-showcase-deployment': patch +'@finos/legend-extension-dsl-persistence': patch +'@finos/legend-extension-store-flat-data': patch +'@finos/legend-extension-dsl-data-space': patch +'@finos/legend-extension-tracer-zipkin': patch +'@finos/legend-extension-dsl-diagram': patch +'@finos/legend-extension-dsl-service': patch +'@finos/legend-application-pure-ide': patch +'@finos/legend-extension-assortment': patch +'@finos/legend-application-studio': patch +'@finos/legend-extension-dsl-text': patch +'@finos/legend-application-query': patch +'@finos/legend-application-repl': patch +'@finos/legend-server-showcase': patch +'@finos/legend-query-builder': patch +'@finos/legend-server-depot': patch +'@finos/legend-application': patch +'@finos/legend-code-editor': patch +'@finos/legend-server-sdlc': patch +'@finos/legend-data-cube': patch +'@finos/legend-dev-utils': patch +'@finos/stylelint-config-legend-studio': patch +'@finos/legend-storage': patch +'@finos/eslint-plugin-legend-studio': patch +'@finos/legend-shared': patch +'@finos/babel-preset-legend-studio': patch +'@finos/legend-graph': patch +'@finos/legend-lego': patch +'@finos/legend-art': patch +--- diff --git a/.changeset/nasty-ducks-leave.md b/.changeset/nasty-ducks-leave.md new file mode 100644 index 0000000000..c561bcc26e --- /dev/null +++ b/.changeset/nasty-ducks-leave.md @@ -0,0 +1,42 @@ +--- +'@finos/legend-application-pure-ide-deployment': patch +'@finos/legend-extension-dsl-data-space-studio': patch +'@finos/legend-application-studio-deployment': patch +'@finos/legend-extension-store-service-store': patch +'@finos/legend-vscode-extension-dependencies': patch +'@finos/legend-application-query-deployment': patch +'@finos/legend-application-studio-bootstrap': patch +'@finos/legend-application-query-bootstrap': patch +'@finos/legend-application-repl-deployment': patch +'@finos/legend-extension-dsl-data-quality': patch +'@finos/legend-extension-store-relational': patch +'@finos/legend-server-showcase-deployment': patch +'@finos/legend-extension-dsl-persistence': patch +'@finos/legend-extension-store-flat-data': patch +'@finos/legend-extension-dsl-data-space': patch +'@finos/legend-extension-tracer-zipkin': patch +'@finos/legend-extension-dsl-diagram': patch +'@finos/legend-extension-dsl-service': patch +'@finos/legend-application-pure-ide': patch +'@finos/legend-extension-assortment': patch +'@finos/legend-application-studio': patch +'@finos/legend-extension-dsl-text': patch +'@finos/legend-application-query': patch +'@finos/legend-application-repl': patch +'@finos/legend-server-showcase': patch +'@finos/legend-query-builder': patch +'@finos/legend-server-depot': patch +'@finos/legend-application': patch +'@finos/legend-code-editor': patch +'@finos/legend-server-sdlc': patch +'@finos/legend-data-cube': patch +'@finos/legend-dev-utils': patch +'@finos/stylelint-config-legend-studio': patch +'@finos/legend-storage': patch +'@finos/eslint-plugin-legend-studio': patch +'@finos/legend-shared': patch +'@finos/babel-preset-legend-studio': patch +'@finos/legend-graph': patch +'@finos/legend-lego': patch +'@finos/legend-art': patch +--- diff --git a/.changeset/ninety-ghosts-invent.md b/.changeset/ninety-ghosts-invent.md new file mode 100644 index 0000000000..c561bcc26e --- /dev/null +++ b/.changeset/ninety-ghosts-invent.md @@ -0,0 +1,42 @@ +--- +'@finos/legend-application-pure-ide-deployment': patch +'@finos/legend-extension-dsl-data-space-studio': patch +'@finos/legend-application-studio-deployment': patch +'@finos/legend-extension-store-service-store': patch +'@finos/legend-vscode-extension-dependencies': patch +'@finos/legend-application-query-deployment': patch +'@finos/legend-application-studio-bootstrap': patch +'@finos/legend-application-query-bootstrap': patch +'@finos/legend-application-repl-deployment': patch +'@finos/legend-extension-dsl-data-quality': patch +'@finos/legend-extension-store-relational': patch +'@finos/legend-server-showcase-deployment': patch +'@finos/legend-extension-dsl-persistence': patch +'@finos/legend-extension-store-flat-data': patch +'@finos/legend-extension-dsl-data-space': patch +'@finos/legend-extension-tracer-zipkin': patch +'@finos/legend-extension-dsl-diagram': patch +'@finos/legend-extension-dsl-service': patch +'@finos/legend-application-pure-ide': patch +'@finos/legend-extension-assortment': patch +'@finos/legend-application-studio': patch +'@finos/legend-extension-dsl-text': patch +'@finos/legend-application-query': patch +'@finos/legend-application-repl': patch +'@finos/legend-server-showcase': patch +'@finos/legend-query-builder': patch +'@finos/legend-server-depot': patch +'@finos/legend-application': patch +'@finos/legend-code-editor': patch +'@finos/legend-server-sdlc': patch +'@finos/legend-data-cube': patch +'@finos/legend-dev-utils': patch +'@finos/stylelint-config-legend-studio': patch +'@finos/legend-storage': patch +'@finos/eslint-plugin-legend-studio': patch +'@finos/legend-shared': patch +'@finos/babel-preset-legend-studio': patch +'@finos/legend-graph': patch +'@finos/legend-lego': patch +'@finos/legend-art': patch +--- diff --git a/.changeset/perfect-bags-melt.md b/.changeset/perfect-bags-melt.md new file mode 100644 index 0000000000..a77014558f --- /dev/null +++ b/.changeset/perfect-bags-melt.md @@ -0,0 +1,31 @@ +--- +'@finos/legend-application-pure-ide-deployment': patch +'@finos/legend-extension-dsl-data-space-studio': patch +'@finos/legend-extension-store-service-store': patch +'@finos/legend-vscode-extension-dependencies': patch +'@finos/legend-application-studio-bootstrap': patch +'@finos/legend-application-query-bootstrap': patch +'@finos/legend-application-repl-deployment': patch +'@finos/legend-extension-dsl-data-quality': patch +'@finos/legend-extension-store-relational': patch +'@finos/legend-extension-dsl-persistence': patch +'@finos/legend-extension-store-flat-data': patch +'@finos/legend-extension-dsl-data-space': patch +'@finos/legend-extension-dsl-diagram': patch +'@finos/legend-extension-dsl-service': patch +'@finos/legend-application-pure-ide': patch +'@finos/legend-extension-assortment': patch +'@finos/legend-application-studio': patch +'@finos/legend-extension-dsl-text': patch +'@finos/legend-application-query': patch +'@finos/legend-application-repl': patch +'@finos/legend-query-builder': patch +'@finos/legend-application': patch +'@finos/legend-code-editor': patch +'@finos/legend-data-cube': patch +'@finos/legend-dev-utils': patch +'@finos/eslint-plugin-legend-studio': patch +'@finos/babel-preset-legend-studio': patch +'@finos/legend-lego': patch +'@finos/legend-art': patch +--- diff --git a/.changeset/quick-balloons-prove.md b/.changeset/quick-balloons-prove.md new file mode 100644 index 0000000000..c561bcc26e --- /dev/null +++ b/.changeset/quick-balloons-prove.md @@ -0,0 +1,42 @@ +--- +'@finos/legend-application-pure-ide-deployment': patch +'@finos/legend-extension-dsl-data-space-studio': patch +'@finos/legend-application-studio-deployment': patch +'@finos/legend-extension-store-service-store': patch +'@finos/legend-vscode-extension-dependencies': patch +'@finos/legend-application-query-deployment': patch +'@finos/legend-application-studio-bootstrap': patch +'@finos/legend-application-query-bootstrap': patch +'@finos/legend-application-repl-deployment': patch +'@finos/legend-extension-dsl-data-quality': patch +'@finos/legend-extension-store-relational': patch +'@finos/legend-server-showcase-deployment': patch +'@finos/legend-extension-dsl-persistence': patch +'@finos/legend-extension-store-flat-data': patch +'@finos/legend-extension-dsl-data-space': patch +'@finos/legend-extension-tracer-zipkin': patch +'@finos/legend-extension-dsl-diagram': patch +'@finos/legend-extension-dsl-service': patch +'@finos/legend-application-pure-ide': patch +'@finos/legend-extension-assortment': patch +'@finos/legend-application-studio': patch +'@finos/legend-extension-dsl-text': patch +'@finos/legend-application-query': patch +'@finos/legend-application-repl': patch +'@finos/legend-server-showcase': patch +'@finos/legend-query-builder': patch +'@finos/legend-server-depot': patch +'@finos/legend-application': patch +'@finos/legend-code-editor': patch +'@finos/legend-server-sdlc': patch +'@finos/legend-data-cube': patch +'@finos/legend-dev-utils': patch +'@finos/stylelint-config-legend-studio': patch +'@finos/legend-storage': patch +'@finos/eslint-plugin-legend-studio': patch +'@finos/legend-shared': patch +'@finos/babel-preset-legend-studio': patch +'@finos/legend-graph': patch +'@finos/legend-lego': patch +'@finos/legend-art': patch +--- diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index d093599009..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,20 +0,0 @@ -# Dependencies -**/node_modules - -# Build -/build/ -/packages/*/build/ -/packages/*/dist/ -/packages/*/lib/ -/fixtures/*/build/ -/fixtures/*/dist/ -/fixtures/*/lib/ -/scripts/*/build/ -/scripts/*/lib/ - -# Yarn -.yarn/* -.pnp.* - -# Exceptions -/packages/legend-dev-utils/__tests__/fixtures/src/dummy.ts diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index fd4a19b855..0000000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright (c) 2020-present, Goldman Sachs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 specific language governing permissions and - * limitations under the License. - */ - -const OFF = 0; -const ERROR = 2; - -/** - * We need to detect environment for ESLint CLI because there are rules - * which are computationally expensive to perform during development. - * Therefore, for each environments, we will enable/disable these rules according: - * - For `development` mode (when watching for changes and re-compile): DISABLE - * - For `IDE` ESLint process (to keep the IDE snappy): DISABLE - * - For `production` mode (to produce bundled code): ENABLE - * - For `linting` process (to check code quality in CI): ENABLE - */ -const isIDE = process.env.NODE_ENV === undefined; - -// For debugging -// console.log(`Environment: ${process.env.NODE_ENV}`); -// console.log(`IDE (mode): ${isIDE}`); - -/** - * NOTE: this config is supposed to be used for both the IDE ESLint process - * and the CI ESLint process. However, since we have many Typescript projects, - * `typescript-eslint` does not seem to handle this well enough as it can end up - * throwing Out-Of-Memory error if we just call `eslint` from the root directory. - * As such, for CI, we will call `eslint` from each package separately as this is - * the only rules that runs the expensive linting rules - * - * See https://github.com/typescript-eslint/typescript-eslint/issues/1192 - */ -module.exports = { - root: true, // tell ESLint to stop looking further up in directory tree to resolve for parent configs - parserOptions: { - // `parserOptions.project` is required for generating parser service to run specific rules like - // `prefer-nullish-coalescing`, and `prefer-optional-chain` - project: !isIDE - ? ['./packages/*/tsconfig.json', './fixtures/*/tsconfig.json'] - : // this is required for VSCode ESLint extension to work properly - true, - tsconfigRootDir: !isIDE ? undefined : __dirname, - /** - * ESLint (and therefore typescript-eslint) is used in both "single run"/one-time contexts, - * such as an ESLint CLI invocation, and long-running sessions (such as continuous feedback - * on a file in an IDE). - * - * When typescript-eslint handles TypeScript Program management behind the scenes, this distinction - * is important because there is significant overhead to managing the so called Watch Programs - * needed for the long-running use-case. - * - * When allowAutomaticSingleRunInference is enabled, we will use common heuristics to infer - * whether or not ESLint is being used as part of a single run. - */ - allowAutomaticSingleRunInference: !isIDE, - // Use this experimental flag to improve memory usage while using Typescript project reference - // NOTE: Causes TS to use the source files for referenced projects instead of the compiled .d.ts files. - // This feature is not yet optimized, and is likely to cause OOMs for medium to large projects. - // See https://github.com/typescript-eslint/typescript-eslint/issues/2094 - EXPERIMENTAL_useSourceOfProjectReferenceRedirect: false, - }, - plugins: ['@finos/legend-studio'], - extends: [ - 'plugin:@finos/legend-studio/recommended', - !isIDE && 'plugin:@finos/legend-studio/computationally-expensive', - 'plugin:@finos/legend-studio/scripts-override', // must be called last to turn off rules which are not applicable for scripts - ].filter(Boolean), - rules: { - // turn off the prettier format check when running this in CI (i.e. production environment) to speed up pipeline - 'prettier/prettier': !isIDE ? OFF : ERROR, - }, -}; diff --git a/.vscode/settings.json b/.vscode/settings.json index ca1a349e92..111d3c9964 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,8 +9,15 @@ "typescript", "typescriptreact" ], - "eslint.options": { "overrideConfigFile": "./.eslintrc.cjs" }, - "stylelint.configFile": "./.stylelintrc.json", + "eslint.options": { + "overrideConfigFile": "./eslint.config.js", + "overrideConfig": { + "linterOptions": { + "reportUnusedDisableDirectives": false // disable this as some rules are disabled in IDE for better performance + } + } + }, + "eslint.useFlatConfig": true, "search.exclude": { "**/node_modules": true, "**/yarn.lock": true, diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000000..e518d6d772 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2020-present, Goldman Sachs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 specific language governing permissions and + * limitations under the License. + */ + +import { dirname } from 'path'; +import { fileURLToPath } from 'url'; +import legend_plugin from '@finos/eslint-plugin-legend-studio'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); + +/** + * We need to detect environment for ESLint CLI because there are rules + * which are computationally expensive to perform during development. + * Therefore, for each environments, we will enable/disable these rules according: + * - For `development` mode (when watching for changes and re-compile): DISABLE + * - For `IDE` ESLint process (to keep the IDE snappy): DISABLE + * - For `production` mode (to produce bundled code): ENABLE + * - For `linting` process (to check code quality in CI): ENABLE + */ +const isIDE = process.env.NODE_ENV === undefined; + +/** @type {import('eslint').Linter.Config} */ +const ignores = { + ignores: [ + // Dependencies + '**/node_modules', + + // Build + '/build/', + '/packages/*/build/', + '/packages/*/dist/', + '/packages/*/lib/', + '/fixtures/*/build/', + '/fixtures/*/dist/', + '/fixtures/*/lib/', + '/scripts/*/build/', + '/scripts/*/lib/', + + // Yarn + '.yarn/*', + '.pnp.*', + + // Exceptions + '/packages/legend-dev-utils/__tests__/fixtures/src/dummy.ts', + ], +}; + +export default [ + ignores, + legend_plugin.configs.recommended, + legend_plugin.configs.scripts, + // turn off computationally expensive rules (checking dependencies graph, types, etc.) when running in the IDE for better performance + !isIDE && legend_plugin.configs.computationally_expensive(__dirname), + // turn on the stylistic checks only when running in the IDE to speed up pipeline performance + // the formatting checks are done by Prettier in the pipeline separately and gated by lint-staged when comitting code + isIDE && legend_plugin.configs.stylistic, +].filter(Boolean); diff --git a/fixtures/legend-mock-server/package.json b/fixtures/legend-mock-server/package.json index 25f8496b32..d366acbb74 100644 --- a/fixtures/legend-mock-server/package.json +++ b/fixtures/legend-mock-server/package.json @@ -32,10 +32,10 @@ "devDependencies": { "@finos/legend-dev-utils": "workspace:*", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "nodemon": "3.1.7", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "typescript": "5.6.2" + "typescript": "5.6.3" } } diff --git a/package.json b/package.json index f2ae6ea230..9e2ad54548 100644 --- a/package.json +++ b/package.json @@ -91,22 +91,22 @@ "glob-parent": "^6.0.1" }, "devDependencies": { - "@actions/core": "1.10.1", + "@actions/core": "1.11.1", "@actions/github": "6.0.0", - "@babel/core": "7.25.2", - "@changesets/cli": "2.27.8", + "@babel/core": "7.25.7", + "@changesets/cli": "2.27.9", "@finos/babel-preset-legend-studio": "workspace:*", "@finos/eslint-plugin-legend-studio": "workspace:*", "@finos/legend-dev-utils": "workspace:*", "@finos/stylelint-config-legend-studio": "workspace:*", - "@types/node": "22.7.2", + "@types/node": "22.7.5", "chalk": "5.3.0", "cross-env": "7.0.3", "envinfo": "7.14.0", - "eslint": "8.57.1", + "eslint": "9.12.0", "fs-extra": "11.2.0", "husky": "9.1.6", - "inquirer": "11.0.2", + "inquirer": "12.0.0", "jest": "29.7.0", "lint-staged": "15.2.10", "micromatch": "4.0.8", @@ -114,12 +114,12 @@ "prettier": "3.3.3", "prettier-plugin-tailwindcss": "0.6.8", "rimraf": "6.0.1", - "sass": "1.79.3", + "sass": "1.79.4", "semver": "7.6.3", "sort-package-json": "2.10.1", "stylelint": "16.9.0", - "typedoc": "0.26.7", - "typescript": "5.6.2", + "typedoc": "0.26.8", + "typescript": "5.6.3", "yargs": "17.7.2" }, "packageManager": "yarn@4.5.0", diff --git a/packages/babel-preset/index.js b/packages/babel-preset/index.js index ec3f4c777f..06fc17fd44 100644 --- a/packages/babel-preset/index.js +++ b/packages/babel-preset/index.js @@ -32,6 +32,7 @@ module.exports = declare((api, opts) => { useReactFastRefresh = false, } = opts; + /** @type {import('@babel/core').TransformOptions} */ const config = { presets: [ [ diff --git a/packages/babel-preset/package.json b/packages/babel-preset/package.json index 7b0e7daaa8..532c6c0a33 100644 --- a/packages/babel-preset/package.json +++ b/packages/babel-preset/package.json @@ -30,20 +30,20 @@ "publish:snapshot": "node ../../scripts/release/publishDevSnapshot.js" }, "dependencies": { - "@babel/core": "7.25.2", - "@babel/helper-plugin-utils": "7.24.8", - "@babel/plugin-syntax-import-attributes": "7.25.6", - "@babel/preset-env": "7.25.4", - "@babel/preset-react": "7.24.7", - "@babel/preset-typescript": "7.24.7", - "@babel/runtime": "7.25.6", + "@babel/core": "7.25.7", + "@babel/helper-plugin-utils": "7.25.7", + "@babel/plugin-syntax-import-attributes": "7.25.7", + "@babel/preset-env": "7.25.7", + "@babel/preset-react": "7.25.7", + "@babel/preset-typescript": "7.25.7", + "@babel/runtime": "7.25.7", "react-refresh": "0.14.2" }, "devDependencies": { "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "rimraf": "6.0.1", - "typescript": "5.6.2" + "typescript": "5.6.3" }, "peerDependencies": { "@babel/core": "^7.0.0" diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6e47f6c248..ee6a662696 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -30,26 +30,28 @@ "publish:snapshot": "node ../../scripts/release/publishDevSnapshot.js" }, "dependencies": { - "@babel/core": "7.25.2", - "@babel/eslint-parser": "7.25.1", - "@typescript-eslint/eslint-plugin": "8.7.0", - "@typescript-eslint/parser": "8.7.0", - "eslint": "8.57.1", + "@babel/core": "7.25.7", + "@babel/eslint-parser": "7.25.7", + "@eslint/js": "9.12.0", + "@typescript-eslint/eslint-plugin": "8.8.1", + "@typescript-eslint/parser": "8.8.1", + "eslint": "9.12.0", "eslint-config-prettier": "9.1.0", - "eslint-plugin-import": "2.30.0", + "eslint-plugin-import": "2.31.0", "eslint-plugin-prettier": "5.2.1", - "eslint-plugin-react": "7.36.1", + "eslint-plugin-react": "7.37.1", "eslint-plugin-react-hooks": "4.6.2", + "globals": "15.11.0", "micromatch": "4.0.8", "prettier": "3.3.3", - "typescript": "5.6.2" + "typescript": "5.6.3" }, "devDependencies": { "cross-env": "7.0.3", "rimraf": "6.0.1" }, "peerDependencies": { - "eslint": "^8.0.0", + "eslint": "^9.0.0", "prettier": "^3.0.0" }, "publishConfig": { diff --git a/packages/eslint-plugin/src/configs/computationally-expensive.js b/packages/eslint-plugin/src/configs/computationally-expensive.js index 82c42178c3..7a6dec52aa 100644 --- a/packages/eslint-plugin/src/configs/computationally-expensive.js +++ b/packages/eslint-plugin/src/configs/computationally-expensive.js @@ -14,6 +14,10 @@ * limitations under the License. */ +const import_plugin = require('eslint-plugin-import'); +const typescript_eslint_plugin = require('@typescript-eslint/eslint-plugin'); +const typescript_eslint_parser = require('@typescript-eslint/parser'); + const OFF = 0; const WARN = 1; const ERROR = 2; @@ -62,7 +66,7 @@ const TYPESCRIPT_RULES = { }; /** - * The following rules are computationally expensive and should be turned off during development for better DX. + * This plugin consists of rules which are computationally expensive and should be turned off during development for better DX. * * There are a few major sources of performance hit for ESLint: * 1. Typescript type-ware check @@ -71,19 +75,29 @@ const TYPESCRIPT_RULES = { * 4. Wide file scope (e.g. accidentally include `node_modules`) * See https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#my-linting-feels-really-slow */ -const rules = { - ...IMPORT_RULES, - ...TYPESCRIPT_RULES, -}; - -const config = { - parser: '@typescript-eslint/parser', - parserOptions: { sourceType: 'module' }, - plugins: ['@typescript-eslint'], - rules, +const buildConfig = (tsconfigRootDir) => { + /** @type {import('eslint').Linter.Config} */ + const config = { + files: ['**/*.{ts,tsx,cts}'], + languageOptions: { + parser: typescript_eslint_parser, + parserOptions: { + tsconfigRootDir, + projectService: true, + }, + }, + plugins: { + '@typescript-eslint': typescript_eslint_plugin, + import: import_plugin, + }, + rules: { + ...IMPORT_RULES, + ...TYPESCRIPT_RULES, + }, + }; + return config; }; module.exports = { - rules, - config, + buildConfig, }; diff --git a/packages/eslint-plugin/src/configs/custom.js b/packages/eslint-plugin/src/configs/custom.js new file mode 100644 index 0000000000..cb793f467e --- /dev/null +++ b/packages/eslint-plugin/src/configs/custom.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2020-present, Goldman Sachs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 specific language governing permissions and + * limitations under the License. + */ + +module.exports = { + rules: { + 'enforce-module-import-hierarchy': require('../rules/enforce-module-import-hierarchy.js'), + 'enforce-protocol-export-prefix': require('../rules/enforce-protocol-export-prefix.js'), + 'enforce-protocol-file-prefix': require('../rules/enforce-protocol-file-prefix.js'), + 'no-cross-protocol-version-import': require('../rules/no-cross-protocol-version-import.js'), + 'no-cross-workspace-non-export-usage': require('../rules/no-cross-workspace-non-export-usage.js'), + 'no-cross-workspace-source-usage': require('../rules/no-cross-workspace-source-usage.js'), + 'no-same-workspace-absolute-import': require('../rules/no-same-workspace-absolute-import.js'), + 'no-same-workspace-index-import': require('../rules/no-same-workspace-index-import.js'), + }, +}; diff --git a/packages/eslint-plugin/src/configs/recommended.js b/packages/eslint-plugin/src/configs/recommended.js index 8ce0d88262..c9d7c935f9 100644 --- a/packages/eslint-plugin/src/configs/recommended.js +++ b/packages/eslint-plugin/src/configs/recommended.js @@ -14,6 +14,15 @@ * limitations under the License. */ +const globals = require('globals'); +const eslint_plugin = require('@eslint/js'); +const react_plugin = require('eslint-plugin-react'); +const react_hooks_plugin = require('eslint-plugin-react-hooks'); +const import_plugin = require('eslint-plugin-import'); +const typescript_eslint_plugin = require('@typescript-eslint/eslint-plugin'); +const typescript_eslint_parser = require('@typescript-eslint/parser'); +const custom_plugin = require('./custom'); + const OFF = 0; const WARN = 1; const ERROR = 2; @@ -24,7 +33,7 @@ const ERROR = 2; */ const ES_RULES = { 'array-bracket-spacing': [ERROR, 'never'], - 'arrow-body-style': [WARN, 'as-needed'], + 'arrow-body-style': OFF, 'array-callback-return': ERROR, 'arrow-parens': WARN, 'arrow-spacing': WARN, @@ -177,58 +186,58 @@ const REACT_RULES = { 'react/jsx-curly-spacing': [WARN, { when: 'never', allowMultiline: true }], }; -const STUDIO_RULES = { - '@finos/legend-studio/enforce-module-import-hierarchy': ERROR, - '@finos/legend-studio/enforce-protocol-export-prefix': ERROR, - '@finos/legend-studio/enforce-protocol-file-prefix': ERROR, - '@finos/legend-studio/no-cross-protocol-version-import': ERROR, - '@finos/legend-studio/no-cross-workspace-non-export-usage': ERROR, - '@finos/legend-studio/no-cross-workspace-source-usage': ERROR, - '@finos/legend-studio/no-same-workspace-absolute-import': ERROR, - '@finos/legend-studio/no-same-workspace-index-import': ERROR, +const LEGEND_RULES = { + '@finos/legend/enforce-module-import-hierarchy': ERROR, + '@finos/legend/enforce-protocol-export-prefix': ERROR, + '@finos/legend/enforce-protocol-file-prefix': ERROR, + '@finos/legend/no-cross-protocol-version-import': ERROR, + '@finos/legend/no-cross-workspace-non-export-usage': ERROR, + '@finos/legend/no-cross-workspace-source-usage': ERROR, + '@finos/legend/no-same-workspace-absolute-import': ERROR, + '@finos/legend/no-same-workspace-index-import': ERROR, }; +/** @type {import('eslint').Linter.Config} */ const config = { - parser: '@typescript-eslint/parser', - parserOptions: { extraFileExtensions: ['.mjs', '.cjs'] }, - env: { - browser: true, - node: true, - es6: true, - amd: true, - jest: true, + files: ['**/*.{ts,tsx,cts}'], + languageOptions: { + parser: typescript_eslint_parser, + globals: { + ...globals.browser, + ...globals.node, + ...globals.es6, + ...globals.amd, + ...globals.jest, + }, }, settings: { react: { version: 'detect', }, }, - plugins: ['prettier', 'react-hooks', '@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:prettier/recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react/recommended', - 'plugin:import/errors', // See https://github.com/benmosher/eslint-plugin-import/blob/master/config/errors.js - 'plugin:import/typescript', // See https://github.com/benmosher/eslint-plugin-import/blob/master/config/typescript.js - ], + plugins: { + eslint: eslint_plugin, + '@typescript-eslint': typescript_eslint_plugin, + react: react_plugin, + 'react-hooks': react_hooks_plugin, + import: import_plugin, + '@finos/legend': custom_plugin, + }, rules: { ...ES_RULES, + ...typescript_eslint_plugin.configs['eslint-recommended'].rules, + ...typescript_eslint_plugin.configs.recommended.rules, ...TYPESCRIPT_RULES, - ...IMPORT_RULES, + ...react_plugin.configs.flat.recommended.rules, + ...react_plugin.configs.flat['jsx-runtime'].rules, ...REACT_RULES, - ...STUDIO_RULES, + ...import_plugin.flatConfigs.errors.rules, + ...import_plugin.flatConfigs.typescript.rules, + ...IMPORT_RULES, + ...LEGEND_RULES, }, }; -const recommendedRules = { - typescript: TYPESCRIPT_RULES, - studio: STUDIO_RULES, - react: REACT_RULES, -}; - module.exports = { config, - recommendedRules, }; diff --git a/packages/eslint-plugin/src/configs/scripts-override.js b/packages/eslint-plugin/src/configs/scripts-override.js deleted file mode 100644 index 2f7ae38250..0000000000 --- a/packages/eslint-plugin/src/configs/scripts-override.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2020-present, Goldman Sachs - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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 specific language governing permissions and - * limitations under the License. - */ - -const COMPUTATIONALLY_EXPENSIVE_RULES = - require('./computationally-expensive.js').rules; -const RECOMMENDED_RULES = require('./recommended.js').recommendedRules; - -const OFF = 0; - -const config = { - overrides: [ - { - // relax linting rules for scripts - files: ['**.{mjs,cjs,js}'], - parser: '@babel/eslint-parser', // use this parser for non-ts files so it does not require `parserOptions.project` config like `@typescript-eslint/parser` - rules: { - 'no-console': OFF, - 'no-process-env': OFF, - 'no-process-exit': OFF, - 'import/no-default-export': OFF, // export default from script so we can use `require()` syntax - '@typescript-eslint/no-require-imports': OFF, - ...[ - ...Object.keys(RECOMMENDED_RULES.react), - ...Object.keys(RECOMMENDED_RULES.studio), - ...Object.keys(RECOMMENDED_RULES.typescript), - ...Object.keys(COMPUTATIONALLY_EXPENSIVE_RULES), - ].reduce((acc, val) => { - acc[val] = OFF; - return acc; - }, {}), - }, - }, - ], -}; - -module.exports = { - config, -}; diff --git a/packages/eslint-plugin/src/configs/scripts.js b/packages/eslint-plugin/src/configs/scripts.js new file mode 100644 index 0000000000..115eb46c85 --- /dev/null +++ b/packages/eslint-plugin/src/configs/scripts.js @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2020-present, Goldman Sachs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 specific language governing permissions and + * limitations under the License. + */ + +const globals = require('globals'); +const babel_parser = require('@babel/eslint-parser'); +const eslint_plugin = require('@eslint/js'); + +/** @type {import('eslint').Linter.Config} */ +const config = { + rules: { + ...eslint_plugin.configs.recommended.rules, + }, + plugins: { + eslint: eslint_plugin, + }, + files: ['**/*.{mjs,cjs,js}'], + languageOptions: { + parser: babel_parser, + parserOptions: { sourceType: 'module' }, + globals: { + ...globals.browser, + ...globals.node, + ...globals.es6, + ...globals.amd, + ...globals.jest, + }, + }, +}; + +module.exports = { + config, +}; diff --git a/packages/eslint-plugin/src/configs/stylistic.js b/packages/eslint-plugin/src/configs/stylistic.js new file mode 100644 index 0000000000..d3429d704a --- /dev/null +++ b/packages/eslint-plugin/src/configs/stylistic.js @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2020-present, Goldman Sachs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 specific language governing permissions and + * limitations under the License. + */ + +const prettier_plugin = require('eslint-plugin-prettier/recommended'); + +module.exports = { + config: prettier_plugin, +}; diff --git a/packages/eslint-plugin/src/index.js b/packages/eslint-plugin/src/index.js index 5bf672f9b6..158095bd0f 100644 --- a/packages/eslint-plugin/src/index.js +++ b/packages/eslint-plugin/src/index.js @@ -16,19 +16,10 @@ module.exports = { configs: { - 'computationally-expensive': - require('./configs/computationally-expensive.js').config, + computationally_expensive: require('./configs/computationally-expensive.js') + .buildConfig, recommended: require('./configs/recommended.js').config, - 'scripts-override': require('./configs/scripts-override.js').config, - }, - rules: { - 'enforce-module-import-hierarchy': require('./rules/enforce-module-import-hierarchy.js'), - 'enforce-protocol-export-prefix': require('./rules/enforce-protocol-export-prefix.js'), - 'enforce-protocol-file-prefix': require('./rules/enforce-protocol-file-prefix.js'), - 'no-cross-protocol-version-import': require('./rules/no-cross-protocol-version-import.js'), - 'no-cross-workspace-non-export-usage': require('./rules/no-cross-workspace-non-export-usage.js'), - 'no-cross-workspace-source-usage': require('./rules/no-cross-workspace-source-usage.js'), - 'no-same-workspace-absolute-import': require('./rules/no-same-workspace-absolute-import.js'), - 'no-same-workspace-index-import': require('./rules/no-same-workspace-index-import.js'), + scripts: require('./configs/scripts.js').config, + stylistic: require('./configs/stylistic.js').config, }, }; diff --git a/packages/eslint-plugin/src/rules/enforce-protocol-export-prefix.js b/packages/eslint-plugin/src/rules/enforce-protocol-export-prefix.js index 5af027cab3..e52b76bad7 100644 --- a/packages/eslint-plugin/src/rules/enforce-protocol-export-prefix.js +++ b/packages/eslint-plugin/src/rules/enforce-protocol-export-prefix.js @@ -34,7 +34,7 @@ module.exports = { }, }, create(context) { - function getFileProtocolVersion(node) { + function getFileProtocolVersion() { const filePath = context.getFilename(); if (!micromatch.isMatch(filePath, [PROTOCOL_FILE_PATTERN])) { return undefined; diff --git a/packages/eslint-plugin/src/rules/enforce-protocol-file-prefix.js b/packages/eslint-plugin/src/rules/enforce-protocol-file-prefix.js index 2d4e5a0ce1..91acda10a6 100644 --- a/packages/eslint-plugin/src/rules/enforce-protocol-file-prefix.js +++ b/packages/eslint-plugin/src/rules/enforce-protocol-file-prefix.js @@ -35,7 +35,7 @@ module.exports = { }, }, create(context) { - function getFileProtocolVersion(node) { + function getFileProtocolVersion() { const filePath = context.getFilename(); if (!micromatch.isMatch(filePath, [PROTOCOL_FILE_PATTERN])) { return undefined; diff --git a/packages/legend-application-pure-ide-deployment/package.json b/packages/legend-application-pure-ide-deployment/package.json index 716c06c0e1..b5a275b3b4 100644 --- a/packages/legend-application-pure-ide-deployment/package.json +++ b/packages/legend-application-pure-ide-deployment/package.json @@ -42,17 +42,17 @@ "@finos/legend-application-pure-ide": "workspace:*", "@finos/legend-art": "workspace:*", "@finos/legend-lego": "workspace:*", - "@types/react": "18.3.9", + "@types/react": "18.3.11", "react": "18.3.1" }, "devDependencies": { "@finos/legend-dev-utils": "workspace:*", "copy-webpack-plugin": "12.0.2", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "typescript": "5.6.2", + "typescript": "5.6.3", "webpack": "5.95.0", "webpack-bundle-analyzer": "4.10.2", "webpack-cli": "5.1.4", diff --git a/packages/legend-application-pure-ide-deployment/webpack.config.js b/packages/legend-application-pure-ide-deployment/webpack.config.js index 91bccb40df..ce8e442810 100644 --- a/packages/legend-application-pure-ide-deployment/webpack.config.js +++ b/packages/legend-application-pure-ide-deployment/webpack.config.js @@ -35,6 +35,7 @@ export default (env, arg) => { babelConfigPath: resolve(__dirname, '../../babel.config.cjs'), enableReactFastRefresh: isEnvDevelopment, }); + /** @type {import('webpack').Configuration} */ const config = { ...baseConfig, devServer: { diff --git a/packages/legend-application-pure-ide/package.json b/packages/legend-application-pure-ide/package.json index 16e54d0226..1d45e91734 100644 --- a/packages/legend-application-pure-ide/package.json +++ b/packages/legend-application-pure-ide/package.json @@ -50,7 +50,7 @@ "@finos/legend-graph": "workspace:*", "@finos/legend-lego": "workspace:*", "@finos/legend-shared": "workspace:*", - "@types/react": "18.3.9", + "@types/react": "18.3.11", "@types/react-dom": "18.3.0", "mobx": "6.13.3", "mobx-react-lite": "4.0.7", @@ -64,12 +64,12 @@ "@finos/legend-dev-utils": "workspace:*", "@jest/globals": "29.7.0", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "jest": "29.7.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "sass": "1.79.3", - "typescript": "5.6.2" + "sass": "1.79.4", + "typescript": "5.6.3" }, "peerDependencies": { "react": "^18.0.0" diff --git a/packages/legend-application-pure-ide/src/components/command-center/FileSearchCommand.tsx b/packages/legend-application-pure-ide/src/components/command-center/FileSearchCommand.tsx index a6f70c395b..8625e59920 100644 --- a/packages/legend-application-pure-ide/src/components/command-center/FileSearchCommand.tsx +++ b/packages/legend-application-pure-ide/src/components/command-center/FileSearchCommand.tsx @@ -81,7 +81,7 @@ export const FileSearchCommand = observer(() => {
Open file
({ label: option, value: option })) diff --git a/packages/legend-application-query-bootstrap/package.json b/packages/legend-application-query-bootstrap/package.json index 059f3421ff..2baedacf1a 100644 --- a/packages/legend-application-query-bootstrap/package.json +++ b/packages/legend-application-query-bootstrap/package.json @@ -58,17 +58,17 @@ "@finos/legend-graph": "workspace:*", "@finos/legend-lego": "workspace:*", "@finos/legend-shared": "workspace:*", - "@types/react": "18.3.9", + "@types/react": "18.3.11", "react": "18.3.1" }, "devDependencies": { "@finos/legend-dev-utils": "workspace:*", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "sass": "1.79.3", - "typescript": "5.6.2" + "sass": "1.79.4", + "typescript": "5.6.3" }, "publishConfig": { "directory": "build/publishContent" diff --git a/packages/legend-application-query-deployment/package.json b/packages/legend-application-query-deployment/package.json index 09216a4d30..7ca50505d5 100644 --- a/packages/legend-application-query-deployment/package.json +++ b/packages/legend-application-query-deployment/package.json @@ -42,11 +42,11 @@ "@finos/legend-dev-utils": "workspace:*", "copy-webpack-plugin": "12.0.2", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", "tailwindcss": "3.4.13", - "typescript": "5.6.2", + "typescript": "5.6.3", "webpack": "5.95.0", "webpack-bundle-analyzer": "4.10.2", "webpack-cli": "5.1.4", diff --git a/packages/legend-application-query-deployment/src/index.tsx b/packages/legend-application-query-deployment/src/index.tsx index 35d74150d8..2bfbb0c8d0 100644 --- a/packages/legend-application-query-deployment/src/index.tsx +++ b/packages/legend-application-query-deployment/src/index.tsx @@ -16,7 +16,7 @@ import { LegendQueryWebApplication } from '@finos/legend-application-query-bootstrap'; import config from '../query.config.js'; -import '../lib/tailwind.css'; // eslint-disable-line @finos/legend-studio/no-cross-workspace-non-export-usage +import '../lib/tailwind.css'; // eslint-disable-line @finos/legend/no-cross-workspace-non-export-usage import './index.css'; LegendQueryWebApplication.run(config.baseUrl); diff --git a/packages/legend-application-query-deployment/webpack.config.js b/packages/legend-application-query-deployment/webpack.config.js index cc9e40544d..7d9b335fd0 100644 --- a/packages/legend-application-query-deployment/webpack.config.js +++ b/packages/legend-application-query-deployment/webpack.config.js @@ -42,6 +42,7 @@ export default (env, arg) => { import: resolve(__dirname, './ServiceWorker.js'), }, }); + /** @type {import('webpack').Configuration} */ const config = { ...baseConfig, devServer: { diff --git a/packages/legend-application-query/package.json b/packages/legend-application-query/package.json index 027fdcef4f..e45f676521 100644 --- a/packages/legend-application-query/package.json +++ b/packages/legend-application-query/package.json @@ -56,7 +56,7 @@ "@finos/legend-storage": "workspace:*", "@testing-library/dom": "10.4.0", "@testing-library/react": "16.0.1", - "@types/react": "18.3.9", + "@types/react": "18.3.11", "@types/react-dom": "18.3.0", "mobx": "6.13.3", "mobx-react-lite": "4.0.7", @@ -68,12 +68,12 @@ "@finos/legend-dev-utils": "workspace:*", "@jest/globals": "29.7.0", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "jest": "29.7.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "sass": "1.79.3", - "typescript": "5.6.2" + "sass": "1.79.4", + "typescript": "5.6.3" }, "peerDependencies": { "react": "^18.0.0" diff --git a/packages/legend-application-query/src/components/CloneQueryServiceSetup.tsx b/packages/legend-application-query/src/components/CloneQueryServiceSetup.tsx index 2b63462190..d1be62f1d0 100644 --- a/packages/legend-application-query/src/components/CloneQueryServiceSetup.tsx +++ b/packages/legend-application-query/src/components/CloneQueryServiceSetup.tsx @@ -260,7 +260,11 @@ const CloneQueryServiceSetupContent = observer(() => { !projectOptions.length } isLoading={querySetupState.loadProjectsState.isInProgress} - onChange={onProjectOptionChange} + onChange={(option: ProjectOption | null) => { + onProjectOptionChange(option).catch( + applicationStore.alertUnhandledError, + ); + }} value={selectedProjectOption} placeholder={projectSelectorPlaceholder} isClearable={true} @@ -278,7 +282,11 @@ const CloneQueryServiceSetupContent = observer(() => { options={versionOptions} disabled={!querySetupState.currentProject} isLoading={fetchSelectedProjectVersionsStatus.isInProgress} - onChange={onVersionOptionChange} + onChange={(option: VersionOption | null) => { + onVersionOptionChange(option).catch( + applicationStore.alertUnhandledError, + ); + }} value={selectedVersionOption} placeholder={ fetchSelectedProjectVersionsStatus.isInProgress diff --git a/packages/legend-application-query/src/components/Core_LegendQueryApplicationPlugin.tsx b/packages/legend-application-query/src/components/Core_LegendQueryApplicationPlugin.tsx index bc175bbdfb..00f9e5404c 100644 --- a/packages/legend-application-query/src/components/Core_LegendQueryApplicationPlugin.tsx +++ b/packages/legend-application-query/src/components/Core_LegendQueryApplicationPlugin.tsx @@ -109,28 +109,28 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu { key: 'clone-service-query-setup-application-page', addressPatterns: [LEGEND_QUERY_ROUTE_PATTERN.CLONE_SERVICE_QUERY_SETUP], - renderer: CloneQueryServiceSetup, + renderer: () => , }, { key: 'query-productionizer-setup-application-page', addressPatterns: [ LEGEND_QUERY_ROUTE_PATTERN.QUERY_PRODUCTIONIZER_SETUP, ], - renderer: QueryProductionizerSetup, + renderer: () => , }, { key: 'update-existing-service-query-setup-application-page', addressPatterns: [ LEGEND_QUERY_ROUTE_PATTERN.UPDATE_EXISTING_SERVICE_QUERY_SETUP, ], - renderer: UpdateExistingServiceQuerySetup, + renderer: () => , }, { key: 'load-project-service-query-setup-application-page', addressPatterns: [ LEGEND_QUERY_ROUTE_PATTERN.LOAD_PROJECT_SERVICE_QUERY_SETUP, ], - renderer: LoadProjectServiceQuerySetup, + renderer: () => , }, ]; } diff --git a/packages/legend-application-query/src/components/CreateMappingQuerySetup.tsx b/packages/legend-application-query/src/components/CreateMappingQuerySetup.tsx index 7557c8b7cc..df481127d1 100644 --- a/packages/legend-application-query/src/components/CreateMappingQuerySetup.tsx +++ b/packages/legend-application-query/src/components/CreateMappingQuerySetup.tsx @@ -279,7 +279,11 @@ const CreateMappingQuerySetupContent = observer(() => { !projectOptions.length } isLoading={setupStore.loadProjectsState.isInProgress} - onChange={onProjectOptionChange} + onChange={(option: ProjectOption | null) => { + onProjectOptionChange(option).catch( + applicationStore.alertUnhandledError, + ); + }} value={selectedProjectOption} placeholder={projectSelectorPlaceholder} isClearable={true} @@ -297,7 +301,11 @@ const CreateMappingQuerySetupContent = observer(() => { options={versionOptions} disabled={!setupStore.currentProject} isLoading={fetchSelectedProjectVersionsStatus.isInProgress} - onChange={onVersionOptionChange} + onChange={(option: VersionOption | null) => { + onVersionOptionChange(option).catch( + applicationStore.alertUnhandledError, + ); + }} value={selectedVersionOption} placeholder={ fetchSelectedProjectVersionsStatus.isInProgress diff --git a/packages/legend-application-query/src/components/LegendQueryWebApplication.tsx b/packages/legend-application-query/src/components/LegendQueryWebApplication.tsx index 03b5c9f4b2..6397505789 100644 --- a/packages/legend-application-query/src/components/LegendQueryWebApplication.tsx +++ b/packages/legend-application-query/src/components/LegendQueryWebApplication.tsx @@ -25,9 +25,8 @@ import { import { BrowserEnvironmentProvider, Route, - Switch, + Routes, generateExtensionUrlPattern, - type TEMPORARY__ReactRouterComponentType, } from '@finos/legend-application/browser'; import { LegendQueryFrameworkProvider, @@ -59,125 +58,72 @@ const LegendQueryWebApplicationRouter = observer(() => { return (
{baseStore.initState.hasCompleted && ( - + } /> } /> } /> } /> } /> } /> } /> } /> } /> + {/* LEGACY DATA SPACE */} } /> } /> - {extraApplicationPageEntries.map((entry) => ( - - ))} - + {extraApplicationPageEntries.flatMap((entry) => + entry.addressPatterns + .map(generateExtensionUrlPattern) + .map((path) => ( + + )), + )} + )}
); diff --git a/packages/legend-application-query/src/components/QueryEditor.tsx b/packages/legend-application-query/src/components/QueryEditor.tsx index 2feb79c4ef..fb304ab50f 100644 --- a/packages/legend-application-query/src/components/QueryEditor.tsx +++ b/packages/legend-application-query/src/components/QueryEditor.tsx @@ -89,7 +89,11 @@ import { import { LATEST_VERSION_ALIAS } from '@finos/legend-server-depot'; import { buildVersionOption, type VersionOption } from './QuerySetup.js'; import { QueryEditorExistingQueryVersionRevertModal } from './QueryEdtiorExistingQueryVersionRevertModal.js'; -import { debounce, compareSemVerVersions } from '@finos/legend-shared'; +import { + debounce, + compareSemVerVersions, + guaranteeNonNullable, +} from '@finos/legend-shared'; import { LegendQueryInfo } from './LegendQueryAppInfo.js'; import { QueryEditorDataspaceInfoModal } from './data-space/DataSpaceInfo.js'; import { DataSpaceQueryBuilderState } from '@finos/legend-extension-dsl-data-space/application'; @@ -422,9 +426,7 @@ const QueryEditorExistingQueryInfoModal = observer( const selectedVersionOption = updateState.queryVersionId ? buildVersionOption(updateState.queryVersionId) : buildVersionOption(query.versionId); - const onVersionOptionChange = async ( - option: VersionOption | null, - ): Promise => { + const onVersionOptionChange = (option: VersionOption | null) => { if (option?.value && option.value !== updateState.queryVersionId) { updateState.setQueryVersionId(option.value); } @@ -816,7 +818,9 @@ const processQueryParams = ( export const ExistingQueryEditor = observer(() => { const applicationStore = useApplicationStore(); const params = useParams(); - const queryId = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID]; + const queryId = guaranteeNonNullable( + params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID], + ); const queryParams = applicationStore.navigationService.navigator.getCurrentLocationParameters(); const processed = processQueryParams(queryParams); @@ -839,8 +843,12 @@ export const ExistingQueryEditor = observer(() => { export const ServiceQueryCreator = observer(() => { const applicationStore = useApplicationStore(); const parameters = useParams(); - const gav = parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV]; - const servicePath = parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.SERVICE_PATH]; + const gav = guaranteeNonNullable( + parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV], + ); + const servicePath = guaranteeNonNullable( + parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.SERVICE_PATH], + ); const executionKey = applicationStore.navigationService.navigator.getCurrentLocationParameterValue( LEGEND_QUERY_QUERY_PARAM_TOKEN.SERVICE_EXECUTION_KEY, @@ -859,9 +867,15 @@ export const ServiceQueryCreator = observer(() => { export const MappingQueryCreator = observer(() => { const params = useParams(); - const gav = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV]; - const mappingPath = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.MAPPING_PATH]; - const runtimePath = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.RUNTIME_PATH]; + const gav = guaranteeNonNullable( + params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV], + ); + const mappingPath = guaranteeNonNullable( + params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.MAPPING_PATH], + ); + const runtimePath = guaranteeNonNullable( + params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.RUNTIME_PATH], + ); return ( => { + const onVersionOptionChange = (option: VersionOption | null) => { if (option?.value && option.value !== queryVersion) { setQueryVersion(option.value); } diff --git a/packages/legend-application-query/src/components/UpdateExistingServiceQuerySetup.tsx b/packages/legend-application-query/src/components/UpdateExistingServiceQuerySetup.tsx index 5da5847053..9d9a64b965 100644 --- a/packages/legend-application-query/src/components/UpdateExistingServiceQuerySetup.tsx +++ b/packages/legend-application-query/src/components/UpdateExistingServiceQuerySetup.tsx @@ -131,7 +131,7 @@ const UpdateExistingServiceQuerySetupContent = observer(() => {
- + - + + } + /> + , diff --git a/packages/legend-application-query/src/components/data-cube/ExistingQueryDataCubeViewer.tsx b/packages/legend-application-query/src/components/data-cube/ExistingQueryDataCubeViewer.tsx index d29c44314e..dfde1df308 100644 --- a/packages/legend-application-query/src/components/data-cube/ExistingQueryDataCubeViewer.tsx +++ b/packages/legend-application-query/src/components/data-cube/ExistingQueryDataCubeViewer.tsx @@ -29,6 +29,7 @@ import { useEffect } from 'react'; import { flowResult } from 'mobx'; import { DataCube, DataCubeProvider } from '@finos/legend-data-cube'; import { QueryBuilderDataCubeApplicationEngine } from '@finos/legend-query-builder'; +import { guaranteeNonNullable } from '@finos/legend-shared'; export const DataCubeWrapper = observer(() => { const applicationStore = useApplicationStore(); @@ -44,6 +45,7 @@ export const DataCubeWrapper = observer(() => { const _appEngine = new QueryBuilderDataCubeApplicationEngine( applicationStore, ); + return ( @@ -53,7 +55,10 @@ export const DataCubeWrapper = observer(() => { export const ExistingQueryDataCubeViewer = observer(() => { const params = useParams(); - const queryId = params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID]; + const queryId = guaranteeNonNullable( + params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID], + ); + return ( diff --git a/packages/legend-application-query/src/components/data-space/DataSpaceQueryCreator.tsx b/packages/legend-application-query/src/components/data-space/DataSpaceQueryCreator.tsx index ba2942baab..ef08ac8e03 100644 --- a/packages/legend-application-query/src/components/data-space/DataSpaceQueryCreator.tsx +++ b/packages/legend-application-query/src/components/data-space/DataSpaceQueryCreator.tsx @@ -88,14 +88,12 @@ const DataSpaceQueryCreatorStoreProvider: React.FC<{ export const DataSpaceQueryCreator = observer(() => { const applicationStore = useApplicationStore(); - const parameters = useParams(); - const gav = parameters?.[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV]; + const parameters = useParams(); + const gav = parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV]; const dataSpacePath = - parameters?.[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH]; + parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH]; const executionContext = - parameters?.[ - DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT - ]; + parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT]; const runtimePath = applicationStore.navigationService.navigator.getCurrentLocationParameterValue( DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.RUNTIME_PATH, diff --git a/packages/legend-application-query/src/components/data-space/DataSpaceQuerySetup.tsx b/packages/legend-application-query/src/components/data-space/DataSpaceQuerySetup.tsx index 2b21ebbb3a..889596977f 100644 --- a/packages/legend-application-query/src/components/data-space/DataSpaceQuerySetup.tsx +++ b/packages/legend-application-query/src/components/data-space/DataSpaceQuerySetup.tsx @@ -82,7 +82,7 @@ const DataSpaceQuerySetupSetupPanelContent = observer( { const parameters = useParams(); - const gav = - parameters[DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV]; - const dataSpacePath = + const gav = guaranteeNonNullable( + parameters[DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV], + ); + const dataSpacePath = guaranteeNonNullable( parameters[ DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH - ]; - const templateQueryId = + ], + ); + const templateQueryId = guaranteeNonNullable( parameters[ DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.TEMPLATE_QUERY_ID - ]; + ], + ); return ( { babelConfigPath: resolve(__dirname, '../../babel.config.cjs'), enableReactFastRefresh: isEnvDevelopment, }); + /** @type {import('webpack').Configuration} */ const config = { ...baseConfig, devServer: { diff --git a/packages/legend-application-repl/package.json b/packages/legend-application-repl/package.json index 8535e14ffc..dc6d82e457 100644 --- a/packages/legend-application-repl/package.json +++ b/packages/legend-application-repl/package.json @@ -48,7 +48,7 @@ "@finos/legend-data-cube": "workspace:*", "@finos/legend-graph": "workspace:*", "@finos/legend-shared": "workspace:*", - "@types/react": "18.3.9", + "@types/react": "18.3.11", "@types/react-dom": "18.3.0", "mobx": "6.13.3", "mobx-react-lite": "4.0.7", @@ -59,12 +59,12 @@ "@finos/legend-dev-utils": "workspace:*", "@jest/globals": "29.7.0", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "jest": "29.7.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "sass": "1.79.3", - "typescript": "5.6.2" + "sass": "1.79.4", + "typescript": "5.6.3" }, "peerDependencies": { "react": "^18.0.0" diff --git a/packages/legend-application-repl/src/components/LegendREPLApplication.tsx b/packages/legend-application-repl/src/components/LegendREPLApplication.tsx index fe81e1fdde..865e88905a 100644 --- a/packages/legend-application-repl/src/components/LegendREPLApplication.tsx +++ b/packages/legend-application-repl/src/components/LegendREPLApplication.tsx @@ -17,8 +17,7 @@ import { BrowserEnvironmentProvider, Route, - Switch, - type TEMPORARY__ReactRouterComponentType, + Routes, } from '@finos/legend-application/browser'; import { observer } from 'mobx-react-lite'; import { useMemo } from 'react'; @@ -71,16 +70,12 @@ export const LEGEND_REPL_GRID_CLIENT_ROUTE_PATTERN = Object.freeze({ export const LegendREPLRouter = observer(() => (
- + } /> - +
)); diff --git a/packages/legend-application-studio-bootstrap/package.json b/packages/legend-application-studio-bootstrap/package.json index c7cb83e26b..306cc914ca 100644 --- a/packages/legend-application-studio-bootstrap/package.json +++ b/packages/legend-application-studio-bootstrap/package.json @@ -59,17 +59,17 @@ "@finos/legend-graph": "workspace:*", "@finos/legend-lego": "workspace:*", "@finos/legend-shared": "workspace:*", - "@types/react": "18.3.9", + "@types/react": "18.3.11", "react": "18.3.1" }, "devDependencies": { "@finos/legend-dev-utils": "workspace:*", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "sass": "1.79.3", - "typescript": "5.6.2" + "sass": "1.79.4", + "typescript": "5.6.3" }, "publishConfig": { "directory": "build/publishContent" diff --git a/packages/legend-application-studio-deployment/package.json b/packages/legend-application-studio-deployment/package.json index 38ed5cca02..8ffd92183e 100644 --- a/packages/legend-application-studio-deployment/package.json +++ b/packages/legend-application-studio-deployment/package.json @@ -42,11 +42,11 @@ "@finos/legend-dev-utils": "workspace:*", "copy-webpack-plugin": "12.0.2", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", "tailwindcss": "3.4.13", - "typescript": "5.6.2", + "typescript": "5.6.3", "webpack": "5.95.0", "webpack-bundle-analyzer": "4.10.2", "webpack-cli": "5.1.4", diff --git a/packages/legend-application-studio-deployment/src/index.tsx b/packages/legend-application-studio-deployment/src/index.tsx index 1cc9b36267..797e21273b 100644 --- a/packages/legend-application-studio-deployment/src/index.tsx +++ b/packages/legend-application-studio-deployment/src/index.tsx @@ -15,7 +15,7 @@ */ import { LegendStudioWebApplication } from '@finos/legend-application-studio-bootstrap'; -import '../lib/tailwind.css'; // eslint-disable-line @finos/legend-studio/no-cross-workspace-non-export-usage +import '../lib/tailwind.css'; // eslint-disable-line @finos/legend/no-cross-workspace-non-export-usage import config from '../studio.config.js'; import './index.css'; diff --git a/packages/legend-application-studio-deployment/webpack.config.js b/packages/legend-application-studio-deployment/webpack.config.js index 05c7740210..d9f1939a21 100644 --- a/packages/legend-application-studio-deployment/webpack.config.js +++ b/packages/legend-application-studio-deployment/webpack.config.js @@ -42,6 +42,7 @@ export default (env, arg) => { import: resolve(__dirname, './ServiceWorker.js'), }, }); + /** @type {import('webpack').Configuration} */ const config = { ...baseConfig, devServer: { diff --git a/packages/legend-application-studio/package.json b/packages/legend-application-studio/package.json index 735cb8cf60..dfaaa1ff83 100644 --- a/packages/legend-application-studio/package.json +++ b/packages/legend-application-studio/package.json @@ -58,12 +58,12 @@ "@finos/legend-storage": "workspace:*", "@testing-library/dom": "10.4.0", "@testing-library/react": "16.0.1", - "@types/react": "18.3.9", + "@types/react": "18.3.11", "@types/react-dom": "18.3.0", "fast-xml-parser": "4.5.0", "mobx": "6.13.3", "mobx-react-lite": "4.0.7", - "mobx-utils": "6.0.8", + "mobx-utils": "6.1.0", "monaco-editor": "0.52.0", "node-diff3": "3.1.2", "react": "18.3.1", @@ -76,12 +76,12 @@ "@finos/legend-dev-utils": "workspace:*", "@jest/globals": "29.7.0", "cross-env": "7.0.3", - "eslint": "8.57.1", + "eslint": "9.12.0", "jest": "29.7.0", "npm-run-all": "4.1.5", "rimraf": "6.0.1", - "sass": "1.79.3", - "typescript": "5.6.2" + "sass": "1.79.4", + "typescript": "5.6.3" }, "peerDependencies": { "react": "^18.0.0" diff --git a/packages/legend-application-studio/src/__lib__/LegendStudioNavigation.ts b/packages/legend-application-studio/src/__lib__/LegendStudioNavigation.ts index d7d61216ca..eba06ed1dc 100644 --- a/packages/legend-application-studio/src/__lib__/LegendStudioNavigation.ts +++ b/packages/legend-application-studio/src/__lib__/LegendStudioNavigation.ts @@ -61,7 +61,7 @@ export const LEGEND_STUDIO_SDLC_BYPASSED_ROUTE_PATTERN = Object.freeze({ VIEW_BY_GAV: `/view/archive/:${LEGEND_STUDIO_ROUTE_PATTERN_TOKEN.GAV}`, VIEW_BY_GAV_ENTITY: `/view/archive/:${LEGEND_STUDIO_ROUTE_PATTERN_TOKEN.GAV}/entity/:${LEGEND_STUDIO_ROUTE_PATTERN_TOKEN.ENTITY_PATH}`, PREVIEW_BY_GAV_ENTITY: `/view/archive/:${LEGEND_STUDIO_ROUTE_PATTERN_TOKEN.GAV}/entity/:${LEGEND_STUDIO_ROUTE_PATTERN_TOKEN.ENTITY_PATH}/preview`, - SHOWCASE_PROJECT: `/showcase/*`, + SHOWCASE: `/showcase/:${LEGEND_STUDIO_ROUTE_PATTERN_TOKEN.SHOWCASE_PATH}`, PCT_REPORT: '/pct', }); @@ -79,7 +79,7 @@ export type ProjectViewerPathParams = { }; export type ShowcaseViewerPathParams = { - [0]?: string; + [LEGEND_STUDIO_ROUTE_PATTERN_TOKEN.SHOWCASE_PATH]?: string; }; export type WorkspaceEditorPathParams = { @@ -363,7 +363,7 @@ export const EXTERNAL_APPLICATION_NAVIGATION__generateServiceQueryCreatorUrl = ( versionId, )}/${servicePath}`; -export const generateShowcasePath = (projectPath: string): string => - generatePath(LEGEND_STUDIO_SDLC_BYPASSED_ROUTE_PATTERN.SHOWCASE_PROJECT, { - 0: projectPath, +export const generateShowcasePath = (showcasePath: string): string => + generatePath(LEGEND_STUDIO_SDLC_BYPASSED_ROUTE_PATTERN.SHOWCASE, { + showcasePath: encodeURIComponent(showcasePath), }); diff --git a/packages/legend-application-studio/src/components/LegendStudioWebApplication.tsx b/packages/legend-application-studio/src/components/LegendStudioWebApplication.tsx index 6e38361c0a..46a91745d8 100644 --- a/packages/legend-application-studio/src/components/LegendStudioWebApplication.tsx +++ b/packages/legend-application-studio/src/components/LegendStudioWebApplication.tsx @@ -36,8 +36,7 @@ import { BrowserEnvironmentProvider, generateExtensionUrlPattern, Route, - Switch, - type TEMPORARY__ReactRouterComponentType, + Routes, } from '@finos/legend-application/browser'; import { LEGEND_STUDIO_DOCUMENTATION_KEY } from '../__lib__/LegendStudioDocumentation.js'; import { LazyTextEditor } from './lazy-text-editor/LazyTextEditor.js'; @@ -122,138 +121,160 @@ export const LegendStudioWebApplicationRouter = observer(() => { <> {baseStore.isSDLCAuthorized === undefined && ( <> - + } /> } + /> + + } /> + } /> - - - - + + } /> + )} {baseStore.isSDLCAuthorized && ( <> - + } + /> + } + /> + } + /> + } /> } + /> + } + /> + + } /> + } /> } + /> + } /> } + /> + } + /> + } + /> + } + /> + } + /> + + } + /> + } + /> + + } + /> + } /> } + /> + } + /> + } + /> + } + /> + + } + /> + + } /> - {extraApplicationPageEntries.map((entry) => ( - - ))} - - - - + + {extraApplicationPageEntries.flatMap((entry) => + entry.addressPatterns + .map(generateExtensionUrlPattern) + .map((path) => ( + + )), + )} + + } /> + )} diff --git a/packages/legend-application-studio/src/components/__tests__/LegendStudioWebApplication.test.tsx b/packages/legend-application-studio/src/components/__tests__/LegendStudioWebApplication.test.tsx index 181cd64d79..5f6bc91141 100644 --- a/packages/legend-application-studio/src/components/__tests__/LegendStudioWebApplication.test.tsx +++ b/packages/legend-application-studio/src/components/__tests__/LegendStudioWebApplication.test.tsx @@ -64,7 +64,7 @@ test( const { queryByText } = render( - + @@ -111,7 +111,7 @@ test(integrationTest('Failed to authorize SDLC will redirect'), async () => { render( - + diff --git a/packages/legend-application-studio/src/components/editor/Editor.tsx b/packages/legend-application-studio/src/components/editor/Editor.tsx index 280d4a0bd2..c39f5ae533 100644 --- a/packages/legend-application-studio/src/components/editor/Editor.tsx +++ b/packages/legend-application-studio/src/components/editor/Editor.tsx @@ -59,7 +59,7 @@ import { ShowcaseManager } from '../ShowcaseManager.js'; export const Editor = withEditorStore( observer(() => { const params = useParams(); - const projectId = params.projectId; + const projectId = guaranteeNonNullable(params.projectId); const patchReleaseVersionId = params.patchReleaseVersionId; const workspaceType = params.groupWorkspaceId ? WorkspaceType.GROUP @@ -147,6 +147,7 @@ export const Editor = withEditorStore( useEffect(() => { editorStore.internalizeEntityPath(params); }, [editorStore, params]); + useEffect(() => { flowResult( editorStore.initialize( diff --git a/packages/legend-application-studio/src/components/editor/QuickInput.tsx b/packages/legend-application-studio/src/components/editor/QuickInput.tsx index 229c34a0ef..4523962f2e 100644 --- a/packages/legend-application-studio/src/components/editor/QuickInput.tsx +++ b/packages/legend-application-studio/src/components/editor/QuickInput.tsx @@ -43,7 +43,8 @@ function QuickInputDialog(props: { const filterOption = createFilter({ ignoreCase: true, ignoreAccents: false, - stringify: (option) => getSearchValue(option), + stringify: (option: { label: string; data: QuickInputOption }) => + getSearchValue({ label: option.label, value: option.data.value }), }); const onChange = (value: QuickInputOption): void => { onSelect(value); @@ -73,7 +74,7 @@ function QuickInputDialog(props: { >
- + - {viewerMode ? ( - - - - ) : ( - - - - )} + + {viewerMode ? ( + } + /> + ) : ( + } + /> + )} + , diff --git a/packages/legend-application-studio/src/components/editor/command-center/ProjectSearchCommand.tsx b/packages/legend-application-studio/src/components/editor/command-center/ProjectSearchCommand.tsx index 711c0b93bb..066683b184 100644 --- a/packages/legend-application-studio/src/components/editor/command-center/ProjectSearchCommand.tsx +++ b/packages/legend-application-studio/src/components/editor/command-center/ProjectSearchCommand.tsx @@ -67,8 +67,9 @@ export const ProjectSearchCommand = observer(() => { const filterOption = createFilter({ ignoreCase: true, ignoreAccents: false, - stringify: (option: PackageableElementOption): string => - option.value.path, + stringify: (option: { + data: PackageableElementOption; + }): string => option.data.value.path, }); const openElement = ( val: PackageableElementOption | null, @@ -141,7 +142,7 @@ export const ProjectSearchCommand = observer(() => {
; const onChange = ( val: PackageableElementOption | null, ): void => { @@ -202,7 +205,9 @@ const ModelGenerationItem = observer( /> [] + } onChange={onChange} value={value} darkMode={ diff --git a/packages/legend-application-studio/src/components/editor/editor-group/RuntimeEditor.tsx b/packages/legend-application-studio/src/components/editor/editor-group/RuntimeEditor.tsx index eb6c1ee4b9..f56cd1a198 100644 --- a/packages/legend-application-studio/src/components/editor/editor-group/RuntimeEditor.tsx +++ b/packages/legend-application-studio/src/components/editor/editor-group/RuntimeEditor.tsx @@ -74,7 +74,7 @@ import { ElementDragSource, } from '../../../stores/editor/utils/DnDUtils.js'; import { useDrop } from 'react-dnd'; -import { assertErrorThrown, guaranteeType } from '@finos/legend-shared'; +import { assertErrorThrown } from '@finos/legend-shared'; import type { ConnectionEditorState } from '../../../stores/editor/editor-state/element-editor-state/connection/ConnectionEditorState.js'; import { useEditorStore } from '../EditorStoreProvider.js'; import { @@ -504,7 +504,7 @@ const IdentifiedConnectionEditor = observer( ? [] : ([{ label: embeddedConnectionLabel }] as { label: string | React.ReactNode; - value?: PackageableConnection; + value: PackageableConnection; }[]); connectionOptions = connectionOptions.concat( currentRuntimeEditorTabState.packageableConnections.map( @@ -514,13 +514,16 @@ const IdentifiedConnectionEditor = observer( }), ), ); - const selectedConnectionOption = { - value: identifiedConnection.connection, - label: isEmbeddedConnection - ? embeddedConnectionLabel - : guaranteeType(identifiedConnection.connection, ConnectionPointer) - .packageableConnection.value.path, - }; + const selectedConnectionOption = + identifiedConnection.connection instanceof ConnectionPointer + ? { + value: identifiedConnection.connection.packageableConnection.value, + label: isEmbeddedConnection + ? embeddedConnectionLabel + : identifiedConnection.connection.packageableConnection.value + .path, + } + : null; const editorStore = useEditorStore(); const onConnectionSelectionChange = (val: { label: string | React.ReactNode; @@ -823,11 +826,12 @@ const RuntimeMappingEditor = observer( const filterOption = createFilter({ ignoreCase: true, ignoreAccents: false, - stringify: (option: PackageableElementOption): string => - option.value.path, + stringify: (option: { + data: PackageableElementOption; + }): string => option.data.value.path, }); const selectedMappingOption = { - value: mappingRef, + value: mappingRef.value, label: mappingRef.value.name, }; const changeMapping = (val: PackageableElementOption): void => diff --git a/packages/legend-application-studio/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx b/packages/legend-application-studio/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx index 105e7d29b1..ae25b49eae 100644 --- a/packages/legend-application-studio/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +++ b/packages/legend-application-studio/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx @@ -1162,7 +1162,7 @@ const RelationalConnectionStoreEditor = observer( const selectedStore = { value: store, label: isStoreEmpty ? noStoreLabel : store.path, - }; + } as PackageableElementOption; const onStoreChange = ( val: PackageableElementOption | null, ): void => { @@ -1195,7 +1195,7 @@ const RelationalConnectionStoreEditor = observer( .TEMPORARY__isLightColorThemeEnabled } disabled={isReadOnly} - hasError={isStoreEmpty} + hasError={Boolean(isStoreEmpty)} />