Skip to content

Commit 92017cf

Browse files
authored
Merge pull request #200 from pegasystems/bugfix/23-1-lib
update libs - lint and fix
2 parents 9efd726 + 4693048 commit 92017cf

File tree

100 files changed

+12558
-8045
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+12558
-8045
lines changed

.storybook/main.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import type { StorybookConfig } from '@storybook/react-webpack5';
22

33
const config: StorybookConfig = {
44
core: {
5-
disableTelemetry: true
5+
disableTelemetry: true,
66
},
77
framework: '@storybook/react-webpack5',
88
staticDirs: ['./static'],
99
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
1010
addons: ['@storybook/addon-a11y', '@storybook/addon-essentials'],
1111
docs: {
12-
autodocs: true
12+
autodocs: true,
1313
},
1414
typescript: {
15-
check: true
16-
}
15+
check: true,
16+
},
1717
};
1818

1919
export default config;

.storybook/manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ addons.setConfig({
66
enableShortcuts: false,
77
showToolbar: true,
88
sidebar: {
9-
showRoots: false
10-
}
9+
showRoots: false,
10+
},
1111
});

.storybook/preview.tsx

Lines changed: 30 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { useEffect as useReactEffect } from 'react';
22
import { configureActions } from '@storybook/addon-actions';
33
import { css } from '@storybook/theming';
4-
import {
5-
useEffect as useStorybookEffect,
6-
useMemo as useStorybookMemo
7-
} from '@storybook/preview-api';
4+
import { useEffect as useStorybookEffect, useMemo as useStorybookMemo } from '@storybook/preview-api';
85
import type { Preview } from '@storybook/react';
96
import {
107
Configuration,
@@ -14,7 +11,7 @@ import {
1411
Aries2023Theme,
1512
Aries2023DarkTheme,
1613
ThemeMachine,
17-
BaseThemeMachine
14+
BaseThemeMachine,
1815
} from '@pega/cosmos-react-core';
1916
import type { DefaultSettableTheme, DefaultThemeDefinition } from '@pega/cosmos-react-core';
2017
import * as MantisTheme from './MantisTheme.json';
@@ -23,22 +20,22 @@ import * as HoneyFlowerTheme from './HoneyFlowerTheme.json';
2320

2421
configureActions({
2522
depth: 5,
26-
limit: 20
23+
limit: 20,
2724
});
2825

2926
const themes: Record<string, DefaultSettableTheme | undefined> = {
3027
Default: Aries2023Theme,
3128
Dark: Aries2023DarkTheme,
3229
Mantis: MantisTheme,
3330
Flame: FlameTheme,
34-
HoneyFlower: HoneyFlowerTheme
31+
HoneyFlower: HoneyFlowerTheme,
3532
};
3633

3734
const themeMachines = Object.fromEntries(
3835
Object.entries(themes).map(([name, theme]) => [
3936
name,
40-
new ThemeMachine<DefaultThemeDefinition>({ theme, parent: BaseThemeMachine })
41-
])
37+
new ThemeMachine<DefaultThemeDefinition>({ theme, parent: BaseThemeMachine }),
38+
]),
4239
);
4340

4441
window.addEventListener('error', console.error);
@@ -48,13 +45,13 @@ const preview: Preview = {
4845
backgrounds: {
4946
disable: true,
5047
grid: {
51-
disable: true
52-
}
48+
disable: true,
49+
},
5350
},
5451
outline: {
55-
disable: true
52+
disable: true,
5653
},
57-
controls: { hideNoControlsWarning: true }
54+
controls: { hideNoControlsWarning: true },
5855
},
5956

6057
decorators: [
@@ -87,8 +84,7 @@ const preview: Preview = {
8784
// Sets up shadow DOM rendering
8885
(Story, context) => {
8986
const backgroundStyles = useStorybookMemo(() => {
90-
const selector =
91-
context.viewMode === 'docs' ? `#anchor--${context.id} .docs-story` : '.sb-show-main';
87+
const selector = context.viewMode === 'docs' ? `#anchor--${context.id} .docs-story` : '.sb-show-main';
9288

9389
const maxWidth = context.globals['fullscreen'] !== 'On' ? '1000px' : 'none';
9490

@@ -126,12 +122,8 @@ const preview: Preview = {
126122
}
127123
128124
:root {
129-
--addon-backgrounds-gradient-primary: ${themeMachine.theme.base.palette[
130-
'app-background'
131-
]};
132-
--addon-backgrounds-gradient-secondary: ${themeMachine.theme.base.palette[
133-
'primary-background'
134-
]};
125+
--addon-backgrounds-gradient-primary: ${themeMachine.theme.base.palette['app-background']};
126+
--addon-backgrounds-gradient-secondary: ${themeMachine.theme.base.palette['primary-background']};
135127
background: repeating-conic-gradient(
136128
var(--addon-backgrounds-gradient-primary) 0% 25%,
137129
var(--addon-backgrounds-gradient-secondary) 0% 50%
@@ -152,18 +144,10 @@ const preview: Preview = {
152144
max-width: ${maxWidth}!important;
153145
}
154146
`.styles;
155-
}, [
156-
context.viewMode,
157-
context.globals['theme'],
158-
context.globals['backgrounds'],
159-
context.globals['fullscreen']
160-
]);
147+
}, [context.viewMode, context.globals['theme'], context.globals['backgrounds'], context.globals['fullscreen']]);
161148

162149
useStorybookEffect(() => {
163-
const id =
164-
context.viewMode === 'docs'
165-
? `addon-backgrounds-docs-${context.id}`
166-
: 'addon-backgrounds-color';
150+
const id = context.viewMode === 'docs' ? `addon-backgrounds-docs-${context.id}` : 'addon-backgrounds-color';
167151

168152
const existingStyleEl = document.getElementById(id);
169153
if (existingStyleEl) {
@@ -181,7 +165,7 @@ const preview: Preview = {
181165
}, [backgroundStyles, context.viewMode, context.id]);
182166

183167
return <Story {...context} />;
184-
}
168+
},
185169
],
186170

187171
globalTypes: {
@@ -191,26 +175,26 @@ const preview: Preview = {
191175
defaultValue: 'Default',
192176
toolbar: {
193177
icon: 'paintbrush',
194-
items: Object.keys(themes)
195-
}
178+
items: Object.keys(themes),
179+
},
196180
},
197181
backgrounds: {
198182
name: 'Backgrounds',
199183
description: 'Change the background of the preview',
200184
defaultValue: 'Clear',
201185
toolbar: {
202186
icon: 'photo',
203-
items: ['Clear', 'App Background', 'Primary Background', 'Secondary Background']
204-
}
187+
items: ['Clear', 'App Background', 'Primary Background', 'Secondary Background'],
188+
},
205189
},
206190
fullscreen: {
207191
name: 'Fullscreen',
208192
description: 'Use all space',
209193
defaultValue: 'Off',
210194
toolbar: {
211195
icon: 'grow',
212-
items: ['Off', 'On']
213-
}
196+
items: ['Off', 'On'],
197+
},
214198
},
215199
locale: {
216200
name: 'Locale',
@@ -222,9 +206,9 @@ const preview: Preview = {
222206
{ value: 'en-US', right: '🇺🇸', title: 'English (US)' },
223207
{ value: 'pl', right: '🇵🇱', title: 'Polish' },
224208
{ value: 'fr', right: '🇫🇷', title: 'Français' },
225-
{ value: 'ar', right: '🇦🇪', title: 'عربي' }
226-
]
227-
}
209+
{ value: 'ar', right: '🇦🇪', title: 'عربي' },
210+
],
211+
},
228212
},
229213
direction: {
230214
name: 'Directionality',
@@ -233,11 +217,11 @@ const preview: Preview = {
233217
toolbar: {
234218
items: [
235219
{ value: 'ltr', icon: 'arrowrightalt', title: 'Left to Right' },
236-
{ value: 'rtl', icon: 'arrowleftalt', title: 'Right to Left' }
237-
]
238-
}
239-
}
240-
}
220+
{ value: 'rtl', icon: 'arrowleftalt', title: 'Right to Left' },
221+
],
222+
},
223+
},
224+
},
241225
};
242226

243227
export default preview;

.storybook/test-runner.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ const config: TestRunnerConfig = {
1717

1818
// Apply story-level a11y rules
1919
await configureAxe(page, {
20-
rules: storyContext.parameters?.a11y?.config?.rules
20+
rules: storyContext.parameters?.a11y?.config?.rules,
2121
});
2222

2323
await checkA11y(page, '#storybook-root', {
2424
detailedReport: true,
2525
detailedReportOptions: {
26-
html: true
27-
}
26+
html: true,
27+
},
2828
});
29-
}
29+
},
3030
};
3131

3232
export default config;

.storybook/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ export default create({
3939

4040
brandTitle: 'Constellation UI Gallery',
4141
brandUrl: 'https://github.com/pegasystems/constellation-ui-gallery',
42-
brandImage: './pega-logo.svg'
42+
brandImage: './pega-logo.svg',
4343
});

babel.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ module.exports = function (api) {
66
{
77
targets: {
88
esmodules: true,
9-
node: true
10-
}
11-
}
9+
node: true,
10+
},
11+
},
1212
],
1313
'@babel/preset-typescript',
14-
['@babel/preset-react', { runtime: 'automatic' }]
14+
['@babel/preset-react', { runtime: 'automatic' }],
1515
];
1616
const plugins = [];
1717

1818
return {
1919
presets,
20-
plugins
20+
plugins,
2121
};
2222
};

jest.config.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@ const packagesToTranspile = [
44
'@pega/cosmos-react-rte',
55
'@pega/cosmos-react-work',
66
'shortcuts',
7-
'preact'
7+
'preact',
88
];
9-
const packagesToTranspileStr = packagesToTranspile.map(p => `${p}`).join('|');
9+
const packagesToTranspileStr = packagesToTranspile.map((p) => `${p}`).join('|');
1010

1111
module.exports = {
1212
preset: 'ts-jest',
1313
verbose: true,
1414
moduleNameMapper: {
15-
shortcuts: '<rootDir>/node_modules/shortcuts/dist/index.js'
15+
shortcuts: '<rootDir>/node_modules/shortcuts/dist/index.js',
1616
},
17-
collectCoverageFrom: [
18-
'src/components/**/*.{ts,tsx,js,jsx}',
19-
'!**/*.(test|stories).{ts,tsx,js,jsx}'
20-
],
17+
collectCoverageFrom: ['src/components/**/*.{ts,tsx,js,jsx}', '!**/*.(test|stories).{ts,tsx,js,jsx}'],
2118
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
2219
moduleDirectories: ['node_modules', 'src'],
2320
setupFiles: ['./setupFiles.ts'],
@@ -26,6 +23,6 @@ module.exports = {
2623
testEnvironment: 'jsdom',
2724
transform: {
2825
'\\.[jt]sx?$': 'babel-jest',
29-
'^.+\\.(ts|tsx)?$': 'ts-jest'
30-
}
26+
'^.+\\.(ts|tsx)?$': 'ts-jest',
27+
},
3128
};

0 commit comments

Comments
 (0)