Skip to content

Commit

Permalink
fix: update @trivago/prettier-plugin-sort-imports to fix babel vuln…
Browse files Browse the repository at this point in the history
…erable to arbitrary code execution (#1002)

* fix: `babel` vulnerable to arbitrary code execution when compiling specifically crafted malicious code

* style: run prettier format

---------

Co-authored-by: Sarin-Udompanish <[email protected]>
  • Loading branch information
wsuwt and Sarin-Udompanish authored Oct 26, 2023
1 parent b039d0c commit e96385f
Show file tree
Hide file tree
Showing 69 changed files with 206 additions and 196 deletions.
101 changes: 80 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/configurations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"author": "LSEG",
"license": "Apache-2.0",
"peerDependencies": {
"@trivago/prettier-plugin-sort-imports": "4.1.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"eslint": "^8.49.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/configurations/prettier-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"^@refinitiv-ui/core",
"^@refinitiv-ui/elements",
"^@refinitiv-ui/(.*)$",
"^[./]",
"<TS_TYPES>"
"^[./]"
],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/decorators/custom-element.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { ElementConstructor } from '../interfaces/ElementConstructor';
import { CustomStyleRegistry } from '../registries/CustomStyleRegistry.js';
import { ElementRegistry } from '../registries/ElementRegistry.js';

import type { ElementConstructor } from '../interfaces/ElementConstructor';

interface ElementOptions {
/**
* External theme is required for this element.
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/elements/BasicElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { CSSResultArray, LitElement, unsafeCSS } from 'lit';
import { property } from '../decorators/property.js';
import { ElementRegistry } from '../registries/ElementRegistry.js';
import { FocusRegistry } from '../registries/FocusRegistry.js';
import type { CSSValue } from '../types/base';
import { FocusableHelper } from '../utils/focusableHelper.js';
import { BasicElementSymbol } from '../utils/helpers.js';

import type { CSSValue } from '../types/base';

const CSS_VARIABLE_REGEXP = /^--\w/;
const CSS_VARIABLE_REPLACE_REGEXP = /['"]([^'"]+?)['"]/g;
const NOTIFY_REGEXP = /([a-zA-Z])(?=[A-Z])/g;
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/elements/ControlElement.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { PropertyValues } from 'lit';

import { property } from '../decorators/property.js';
import type { ControlProperties as IControlProperties } from '../interfaces/ControlProperties';
import { WarningNotice } from '../notices/WarningNotice.js';
import { BasicElement } from './BasicElement.js';

import type { ControlProperties as IControlProperties } from '../interfaces/ControlProperties';
import type { PropertyValues } from 'lit';

/**
* Control element base class.
* Usually used for creating form-style elements.
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* Export element base classes
*/
import { BasicElement } from './elements/BasicElement.js';
import { CustomStyleRegistry } from './registries/CustomStyleRegistry.js';
import { NativeStyleRegistry } from './registries/NativeStyleRegistry.js';
import { global } from './utils/global.js';

/**
* Export common interfaces
*/
import type { MultiValue } from './interfaces/MultiValue';
import type { StyleInfo } from './interfaces/StyleInfo';
import type { StyleMap } from './interfaces/StyleMap';
import { CustomStyleRegistry } from './registries/CustomStyleRegistry.js';
import { NativeStyleRegistry } from './registries/NativeStyleRegistry.js';
import type { FocusedChangedEvent } from './types/events';
import { global } from './utils/global.js';

/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/registries/ElementRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { DuplicateElementError } from '../errors/DuplicateElementError.js';
import type { ElementConstructor } from '../interfaces/ElementConstructor';
import { ready } from '../utils/elementReady.js';
import { CustomStyleRegistry } from './CustomStyleRegistry.js';

import type { ElementConstructor } from '../interfaces/ElementConstructor';

class ElementRegistrationItem {
creations = 0;
connections = 0;
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/registries/FocusRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { isBasicElement } from '../utils/helpers.js';

import type { BasicElement } from '../elements/BasicElement';
import type { FocusedChangedEvent } from '../types/events';
import { isBasicElement } from '../utils/helpers.js';

const register = new Set<BasicElement>(); /* Track all active elements */
const focusedMap = new Map<BasicElement, 'visible' | ''>(); /* Track all focused elements */
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/utils/focusableHelper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { isBasicElement } from './helpers.js';

import type { BasicElement } from '../elements/BasicElement';
import { isBasicElement } from './helpers.js';

type DelegatedList = {
element: BasicElement;
Expand Down
3 changes: 1 addition & 2 deletions packages/elements/src/autosuggest/helpers/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { uuid } from '@refinitiv-ui/utils/uuid.js';

import { updateElementContent } from './utils.js';

import type { AutosuggestItem, AutosuggestQuery, AutosuggestRenderer, Suggestion } from './types';
import { updateElementContent } from './utils.js';

/**
* Build item element from data object
Expand Down
5 changes: 2 additions & 3 deletions packages/elements/src/autosuggest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ import { TranslateDirective, TranslatePropertyKey, translate } from '@refinitiv-
import { AnimationTaskRunner, TimeoutTaskRunner } from '@refinitiv-ui/utils/async.js';
import { isMobile } from '@refinitiv-ui/utils/browser.js';

import type { TapEvent } from '../events';
import '../item/index.js';
import '../loader/index.js';
import { Overlay } from '../overlay/index.js';
import { VERSION } from '../version.js';
import { renderer } from './helpers/renderer.js';
import { escapeRegExp, itemHighlightable, queryWordSelect } from './helpers/utils.js';

import type { TapEvent } from '../events';
import type {
AutosuggestHighlightItemEvent,
AutosuggestHighlightable,
Expand All @@ -40,6 +38,7 @@ import type {
SuggestionsFetchRequestedEvent,
SuggestionsQueryEvent
} from './helpers/types';
import { escapeRegExp, itemHighlightable, queryWordSelect } from './helpers/utils.js';

export type {
AutosuggestTargetElement,
Expand Down
7 changes: 3 additions & 4 deletions packages/elements/src/calendar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ import {
up
} from '@refinitiv-ui/utils/navigation.js';

import type { Button } from '../button';
import '../button/index.js';
import type { TapEvent } from '../events';
import { VERSION } from '../version.js';
import {
CalendarLocaleScope,
Expand All @@ -68,10 +70,6 @@ import {
YEAR_VIEW
} from './constants.js';
import './locales.js';
import { ViewFormatTranslateParams, monthInfo, monthsNames, toCalendarCell, weekdaysNames } from './utils.js';

import type { Button } from '../button';
import type { TapEvent } from '../events';
import type {
BeforeCellRenderEvent,
CalendarFilter,
Expand All @@ -83,6 +81,7 @@ import type {
Row,
WeekdayName
} from './types';
import { ViewFormatTranslateParams, monthInfo, monthsNames, toCalendarCell, weekdaysNames } from './utils.js';

export { CalendarRenderView };
export type { CalendarCell } from './types';
Expand Down
7 changes: 3 additions & 4 deletions packages/elements/src/card/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ import '@refinitiv-ui/phrasebook/locale/en/card.js';
import { Translate, translate } from '@refinitiv-ui/translate';
import { isSlotEmpty } from '@refinitiv-ui/utils/is-slot-empty.js';

import type { Button } from '../button';
import '../button/index.js';
import type { ItemTriggerEvent, OpenedChangedEvent } from '../events';
import '../label/index.js';
import type { OverlayMenu, OverlayMenuData } from '../overlay-menu';
import '../overlay-menu/index.js';
import { VERSION } from '../version.js';

import type { Button } from '../button';
import type { ItemTriggerEvent, OpenedChangedEvent } from '../events';
import type { OverlayMenu, OverlayMenuData } from '../overlay-menu';
import type { CardConfig } from './helpers/types';

export type { CardConfig };
Expand Down
23 changes: 11 additions & 12 deletions packages/elements/src/chart/elements/chart.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { Chart as ChartJS } from 'chart.js';
import type {
ChartConfiguration,
ChartDataset,
ChartOptions,
ChartType,
Color,
LegendItem,
LineControllerDatasetOptions,
Plugin,
UpdateMode
} from 'chart.js';
import 'chartjs-adapter-date-fns';

import {
Expand All @@ -20,18 +31,6 @@ import '../../header/index.js';
import { VERSION } from '../../version.js';
import { DatasetColors, MergeObject, merge } from '../helpers/index.js';

import type {
ChartConfiguration,
ChartDataset,
ChartOptions,
ChartType,
Color,
LegendItem,
LineControllerDatasetOptions,
Plugin,
UpdateMode
} from 'chart.js';

const CSS_COLOR_PREFIX = '--chart-color-';

/* Make ChartJS to know our plugin
Expand Down
Loading

0 comments on commit e96385f

Please sign in to comment.