Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion superset-frontend/packages/superset-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"react-loadable": "^5.5.0",
"tinycolor2": "*",
"lodash": "^4.17.21",
"antd": "^5.26.0"
"antd": "^5.26.0",
"jed": "^1.1.1"
},
"scripts": {
"clean": "rm -rf lib tsconfig.tsbuildinfo",
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/packages/superset-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
*/
export * from './api';
export * from './ui';
export * from './utils';
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
beforeEach(() => {
jest.resetModules();
jest.resetAllMocks();
});

it('should pipe to `console` methods', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should pipe to `console` methods', () => {
test('should pipe to `console` methods', () => {

const { logging } = require('@apache-superset/core');

jest.spyOn(logging, 'debug').mockImplementation();
jest.spyOn(logging, 'log').mockImplementation();
jest.spyOn(logging, 'info').mockImplementation();
expect(() => {
logging.debug();
logging.log();
logging.info();
}).not.toThrow();

jest.spyOn(logging, 'warn').mockImplementation(() => {
throw new Error('warn');
});
expect(() => logging.warn()).toThrow('warn');

jest.spyOn(logging, 'error').mockImplementation(() => {
throw new Error('error');
});
expect(() => logging.error()).toThrow('error');

jest.spyOn(logging, 'trace').mockImplementation(() => {
throw new Error('Trace:');
});
expect(() => logging.trace()).toThrow('Trace:');
});

it('should use noop functions when console unavailable', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should use noop functions when console unavailable', () => {
test('should use noop functions when console unavailable', () => {

Object.assign(window, { console: undefined });
const { logging } = require('@apache-superset/core');

expect(() => {
logging.debug();
logging.log();
logging.info();
logging.warn('warn');
logging.error('error');
logging.trace();
logging.table([
[1, 2],
[3, 4],
]);
}).not.toThrow();
Object.assign(window, { console });
});
1 change: 1 addition & 0 deletions superset-frontend/packages/superset-core/src/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@
*/
export * from './theme';
export * from './components';
export * from './translation';
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import UntypedJed from 'jed';
import logging from '../utils/logging';
import logging from '../../utils/logging';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The README file is still referencing @superset-ui/core.

Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The import path uses relative paths across multiple directory levels (../../). Consider using an absolute import from the package root for better maintainability and clarity.

Suggested change
import logging from '../../utils/logging';
import logging from 'src/utils/logging';

Copilot uses AI. Check for mistakes.
import {
Jed,
TranslatorConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

export * from './TranslatorSingleton';
export * from './types';
export { default as Translator } from './Translator';

export default {};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Expand All @@ -17,21 +17,4 @@
* under the License.
*/

import { LanguagePack } from '@superset-ui/core';

const languagePack: LanguagePack = {
domain: 'superset',
locale_data: {
superset: {
'': {
domain: 'superset',
plural_forms: 'nplurals=1; plural=0;',
lang: 'zh',
},
second: ['秒'],
'Copy of %s': ['%s 的副本'],
},
},
};

export default languagePack;
export { default as logging } from './logging';
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const logger = {
};

/**
* Superset frontend logger, currently just an alias to console.
* Superset logger, currently just an alias to console.
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment was updated from 'Superset frontend logger' to 'Superset logger', but this is still in the frontend package. The comment should clarify that this is for frontend logging to avoid confusion.

Suggested change
* Superset logger, currently just an alias to console.
* Superset frontend logger, currently just an alias to the browser console.

Copilot uses AI. Check for mistakes.
* This may be extended to support numerous console operations safely
* i.e.: https://developer.mozilla.org/en-US/docs/Web/API/Console
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { kebabCase } from 'lodash';
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { useTheme, styled } from '@apache-superset/core/ui';
import { Tooltip } from '@superset-ui/core/components';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* under the License.
*/
import { ReactNode } from 'react';
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { css, styled } from '@apache-superset/core/ui';
import { GenericDataType } from '@apache-superset/core/api/core';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { ReactNode } from 'react';
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { css } from '@apache-superset/core/ui';
import { InfoTooltip, Tooltip, Icons } from '@superset-ui/core/components';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
SQLEditor,
} from '@superset-ui/core/components';
import { CalculatorOutlined } from '@ant-design/icons';
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { css, styled, useTheme } from '@apache-superset/core/ui';

const StyledCalculatorIcon = styled(CalculatorOutlined)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { ReactNode, RefObject } from 'react';

import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { css, styled } from '@apache-superset/core/ui';
import { ColumnMeta, Metric } from '@superset-ui/chart-controls';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { DTTM_ALIAS, QueryColumn, QueryMode, t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { DTTM_ALIAS, QueryColumn, QueryMode } from '@superset-ui/core';
import { GenericDataType } from '@apache-superset/core/api/core';
import { ColumnMeta, SortSeriesData, SortSeriesType } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t, RollingType, ComparisonType } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { RollingType, ComparisonType } from '@superset-ui/core';

import { ControlSubSectionHeader } from '../components/ControlSubSectionHeader';
import { ControlPanelSectionConfig } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { ControlPanelSectionConfig } from '../types';

export const annotationLayers = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';

import { ControlSubSectionHeader } from '../components/ControlSubSectionHeader';
import { ControlPanelSectionConfig } from '../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { ControlPanelSectionConfig, ControlSetRow } from '../types';
import {
contributionModeControl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import {
legacyValidateInteger,
legacyValidateNumber,
t,
} from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { legacyValidateInteger, legacyValidateNumber } from '@superset-ui/core';
import { ControlPanelSectionConfig } from '../types';
import { displayTimeRelatedControls } from '../utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { ControlPanelSectionConfig } from '../types';

export const matrixifyEnableSection: ControlPanelSectionConfig = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { ControlPanelSectionConfig } from '../types';

// A few standard controls sections that are used internally.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t, ComparisonType } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { ComparisonType } from '@superset-ui/core';

import {
ControlPanelSectionConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* under the License.
*/
import { ReactNode } from 'react';
import { JsonValue, t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Importing the translation helper from the application-specific module instead of the shared UI core module couples this reusable chart-controls package to the app bundle and can cause runtime module resolution errors (or missing peer dependency issues) when @superset-ui/chart-controls is used outside the main Superset frontend; it should continue to import t from the shared @superset-ui/core package instead. [possible bug]

Severity Level: Critical 🚨

Suggested change
import { t } from '@apache-superset/core';
import { t } from '@superset-ui/core';
Why it matters? ⭐

The PR's final file imports t from '@apache-superset/core', which is an application-specific package.
This chart-controls package is intended to be a reusable library; depending on the app package will
couple the library to the superset frontend build and can cause resolution/peer-dependency issues for
external consumers. Importing t from '@superset-ui/core' (the shared UI core) is the correct choice
for a reusable package and fixes a real packaging/runtime coupling problem rather than being merely
cosmetic.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/components/RadioButtonControl.tsx
**Line:** 20:20
**Comment:**
	*Possible Bug: Importing the translation helper from the application-specific module instead of the shared UI core module couples this reusable chart-controls package to the app bundle and can cause runtime module resolution errors (or missing peer dependency issues) when `@superset-ui/chart-controls` is used outside the main Superset frontend; it should continue to import `t` from the shared `@superset-ui/core` package instead.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

Copy link
Member

@michael-s-molina michael-s-molina Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@superset-ui/chart-controls declares @apache-superset/core as its dependency.

import { JsonValue } from '@superset-ui/core';
import { Radio } from '@superset-ui/core/components';
import { ControlHeader } from '../../components/ControlHeader';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* under the License.
*/

import { t } from '@apache-superset/core';
import {
ContributionType,
ensureIsArray,
getColumnLabel,
getMetricLabel,
QueryFormColumn,
QueryFormMetric,
t,
} from '@superset-ui/core';
import { GenericDataType } from '@apache-superset/core/api/core';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { QueryColumn, t, validateNonEmpty } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { QueryColumn, validateNonEmpty } from '@superset-ui/core';
import { GenericDataType } from '@apache-superset/core/api/core';
import {
ExtraControlProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
* under the License.
*/

import { t, validateNonEmpty } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { validateNonEmpty } from '@superset-ui/core';
import { SharedControlConfig } from '../types';
import { dndAdhocMetricControl } from './dndControls';
import { defineSavedMetrics } from '../utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@apache-superset/core';
import {
ensureIsArray,
NO_TIME_RANGE,
QueryFormData,
t,
validateNonEmpty,
} from '@superset-ui/core';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
* control interface.
*/
import { isEmpty } from 'lodash';
import { t } from '@apache-superset/core';
import {
t,
getCategoricalSchemeRegistry,
getSequentialSchemeRegistry,
SequentialScheme,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import { t } from '@apache-superset/core';
import {
t,
SMART_DATE_ID,
NumberFormats,
getNumberFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { configure } from '@superset-ui/core';
import { configure } from '@apache-superset/core';
import {
Comparator,
getOpacity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { SupersetTheme } from '@apache-superset/core/ui';
import { FallbackPropsWithDimension } from './SuperChart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
*/

import { CSSProperties } from 'react';
import { css, styled } from '@apache-superset/core/ui';
import { t } from '../../translation';
import { css, styled, t } from '@apache-superset/core/ui';

const MESSAGE_STYLES: CSSProperties = { maxWidth: 800 };
const MIN_WIDTH_FOR_BODY = 250;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

/* eslint-disable react/jsx-sort-default-props */
import { PureComponent } from 'react';
import { t } from '@superset-ui/core';
import { t } from '@apache-superset/core';
import { createSelector } from 'reselect';
import getChartComponentRegistry from '../registries/ChartComponentRegistrySingleton';
import getChartTransformPropsRegistry from '../registries/ChartTransformPropsRegistrySingleton';
Expand Down
Loading
Loading