Skip to content

Commit 513bb66

Browse files
committed
apply sorting to code
1 parent faa0cd5 commit 513bb66

File tree

1,564 files changed

+5108
-3337
lines changed

Some content is hidden

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

1,564 files changed

+5108
-3337
lines changed

code/.eslintrc.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ module.exports = {
1919
},
2020
plugins: ['local-rules'],
2121
rules: {
22+
'import/no-extraneous-dependencies': [
23+
'error',
24+
{ devDependencies: true, peerDependencies: true },
25+
],
2226
'import/no-unresolved': 'off', // covered by typescript
2327
'eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
2428
'eslint-comments/no-unused-disable': 'error',
@@ -55,7 +59,13 @@ module.exports = {
5559
},
5660
},
5761
{
58-
files: ['**/template/**/*', '**/vitest.config.ts', '**/addons/docs/**/*'],
62+
files: [
63+
'*.test.*',
64+
'*.spec.*',
65+
'**/template/**/*',
66+
'**/vitest.config.ts',
67+
'**/addons/docs/**/*',
68+
],
5969
rules: {
6070
'import/no-extraneous-dependencies': 'off',
6171
},

code/.storybook/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'path';
22
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
33
import { mergeConfig } from 'vite';
4+
45
import type { StorybookConfig } from '../frameworks/react-vite';
56

67
const componentsPath = path.join(__dirname, '../core/src/components');

code/.storybook/manager.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { addons } from 'storybook/internal/manager-api';
2+
23
import startCase from 'lodash/startCase.js';
34

45
addons.setConfig({

code/.storybook/preview-head.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
<script>
2-
// eslint-d bal = window;
3-
</script>
1+
<script>// eslint-d bal = window;
2+
</script>;

code/.storybook/preview.tsx

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
import { global } from '@storybook/global';
21
import React, { Fragment, useEffect } from 'react';
3-
import { isChromatic } from './isChromatic';
2+
3+
import type { Channel } from 'storybook/internal/channels';
4+
import { DocsContext as DocsContextProps, useArgs } from 'storybook/internal/preview-api';
5+
import type { PreviewWeb } from 'storybook/internal/preview-api';
46
import {
57
Global,
68
ThemeProvider,
7-
themes,
8-
createReset,
99
convert,
10+
createReset,
1011
styled,
12+
themes,
1113
useTheme,
1214
} from 'storybook/internal/theming';
13-
import { useArgs, DocsContext as DocsContextProps } from 'storybook/internal/preview-api';
14-
import type { PreviewWeb } from 'storybook/internal/preview-api';
15-
import type { ReactRenderer, Decorator } from '@storybook/react';
16-
import type { Channel } from 'storybook/internal/channels';
1715

1816
import { DocsContext } from '@storybook/blocks';
17+
import { global } from '@storybook/global';
18+
import type { Decorator, ReactRenderer } from '@storybook/react';
19+
1920
import { MINIMAL_VIEWPORTS } from '@storybook/addon-viewport';
2021

2122
import { DocsPageWrapper } from '../lib/blocks/src/components';
23+
import { isChromatic } from './isChromatic';
2224

2325
const { document } = global;
2426

code/addons/a11y/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ You can override these options [at story level too](https://storybook.js.org/doc
168168

169169
```js
170170
import React from 'react';
171-
import { storiesOf, addDecorator, addParameters } from '@storybook/react';
171+
import { addDecorator, addParameters, storiesOf } from '@storybook/react';
172172

173173
export default {
174174
title: 'button',

code/addons/a11y/src/a11yRunner.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { Mock } from 'vitest';
2-
import { describe, beforeEach, it, expect, vi } from 'vitest';
2+
import { beforeEach, describe, expect, it, vi } from 'vitest';
3+
34
import { addons } from 'storybook/internal/preview-api';
5+
46
import { EVENTS } from './constants';
57

68
vi.mock('storybook/internal/preview-api');

code/addons/a11y/src/a11yRunner.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { global } from '@storybook/global';
21
import { addons } from 'storybook/internal/preview-api';
2+
3+
import { global } from '@storybook/global';
4+
35
import { EVENTS } from './constants';
46
import type { A11yParameters } from './params';
57

code/addons/a11y/src/components/A11YPanel.test.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// @vitest-environment happy-dom
2+
import { act, cleanup, fireEvent, render, waitFor } from '@testing-library/react';
3+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
24

3-
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
45
import React from 'react';
5-
import { render, waitFor, fireEvent, act, cleanup } from '@testing-library/react';
66

7-
import { ThemeProvider, themes, convert } from 'storybook/internal/theming';
87
import * as api from 'storybook/internal/manager-api';
8+
import { ThemeProvider, convert, themes } from 'storybook/internal/theming';
99

10-
import { A11YPanel } from './A11YPanel';
1110
import { EVENTS } from '../constants';
11+
import { A11YPanel } from './A11YPanel';
1212

1313
vi.mock('storybook/internal/manager-api');
1414

code/addons/a11y/src/components/A11YPanel.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
import React, { useCallback, useMemo, useState } from 'react';
22

3-
import { styled } from 'storybook/internal/theming';
4-
53
import { ActionBar, ScrollArea } from 'storybook/internal/components';
6-
import { SyncIcon, CheckIcon } from '@storybook/icons';
7-
8-
import type { AxeResults } from 'axe-core';
94
import {
105
useChannel,
116
useParameter,
127
useStorybookApi,
138
useStorybookState,
149
} from 'storybook/internal/manager-api';
10+
import { styled } from 'storybook/internal/theming';
1511

16-
import { Report } from './Report';
12+
import { CheckIcon, SyncIcon } from '@storybook/icons';
1713

18-
import { Tabs } from './Tabs';
14+
import type { AxeResults } from 'axe-core';
1915

20-
import { useA11yContext } from './A11yContext';
2116
import { EVENTS } from '../constants';
2217
import type { A11yParameters } from '../params';
18+
import { useA11yContext } from './A11yContext';
19+
import { Report } from './Report';
20+
import { Tabs } from './Tabs';
2321

2422
export enum RuleType {
2523
VIOLATION,

code/addons/a11y/src/components/A11yContext.test.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
// @vitest-environment happy-dom
2+
import { act, cleanup, render } from '@testing-library/react';
3+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
24

3-
import { describe, beforeEach, afterEach, it, expect, vi } from 'vitest';
45
import * as React from 'react';
5-
import type { AxeResults } from 'axe-core';
6-
import { render, act, cleanup } from '@testing-library/react';
7-
import * as api from 'storybook/internal/manager-api';
6+
87
import { STORY_CHANGED } from 'storybook/internal/core-events';
8+
import * as api from 'storybook/internal/manager-api';
9+
910
import { HIGHLIGHT } from '@storybook/addon-highlight';
1011

11-
import { A11yContextProvider, useA11yContext } from './A11yContext';
12+
import type { AxeResults } from 'axe-core';
13+
1214
import { EVENTS } from '../constants';
15+
import { A11yContextProvider, useA11yContext } from './A11yContext';
1316

1417
vi.mock('storybook/internal/manager-api');
1518
const mockedApi = vi.mocked(api);

code/addons/a11y/src/components/A11yContext.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import * as React from 'react';
2-
import { themes, convert } from 'storybook/internal/theming';
3-
import type { Result } from 'axe-core';
4-
import { useChannel, useAddonState, useStorybookApi } from 'storybook/internal/manager-api';
2+
53
import { STORY_CHANGED, STORY_RENDERED } from 'storybook/internal/core-events';
4+
import { useAddonState, useChannel, useStorybookApi } from 'storybook/internal/manager-api';
5+
import { convert, themes } from 'storybook/internal/theming';
6+
67
import { HIGHLIGHT } from '@storybook/addon-highlight';
8+
9+
import type { Result } from 'axe-core';
10+
711
import { ADDON_ID, EVENTS } from '../constants';
812

913
export interface Results {

code/addons/a11y/src/components/Report/Elements.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import React from 'react';
44
import { styled } from 'storybook/internal/theming';
55

66
import type { NodeResult } from 'axe-core';
7-
import { Rules } from './Rules';
87

98
import type { RuleType } from '../A11YPanel';
109
import HighlightToggle from './HighlightToggle';
10+
import { Rules } from './Rules';
1111

1212
const Item = styled.li({
1313
fontWeight: 600,

code/addons/a11y/src/components/Report/HighlightToggle.test.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// @vitest-environment happy-dom
2+
import { cleanup, fireEvent, render } from '@testing-library/react';
3+
import { afterEach, describe, expect, it, vi } from 'vitest';
24

3-
import { describe, it, expect, afterEach, vi } from 'vitest';
45
import React from 'react';
5-
import { render, fireEvent, cleanup } from '@testing-library/react';
6+
67
import type { NodeResult } from 'axe-core';
7-
import HighlightToggle from './HighlightToggle';
8+
89
import { A11yContext } from '../A11yContext';
10+
import HighlightToggle from './HighlightToggle';
911

1012
const nodeResult = (target: string): NodeResult => ({
1113
html: '',

code/addons/a11y/src/components/Report/HighlightToggle.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import React from 'react';
2+
23
import { styled } from 'storybook/internal/theming';
34

45
import type { NodeResult } from 'axe-core';
6+
57
import { useA11yContext } from '../A11yContext';
68

79
interface ToggleProps {

code/addons/a11y/src/components/Report/Info.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { FC } from 'react';
22
import React from 'react';
33

44
import { styled } from 'storybook/internal/theming';
5+
56
import type { Result } from 'axe-core';
67

78
const Wrapper = styled.div({

code/addons/a11y/src/components/Report/Item.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ import React, { Fragment, useState } from 'react';
22

33
import { styled } from 'storybook/internal/theming';
44

5-
import type { Result } from 'axe-core';
6-
import { Info } from './Info';
5+
import { ChevronSmallDownIcon } from '@storybook/icons';
76

8-
import { Elements } from './Elements';
9-
import { Tags } from './Tags';
7+
import type { Result } from 'axe-core';
108

119
import type { RuleType } from '../A11YPanel';
10+
import { Elements } from './Elements';
1211
import HighlightToggle from './HighlightToggle';
13-
import { ChevronSmallDownIcon } from '@storybook/icons';
12+
import { Info } from './Info';
13+
import { Tags } from './Tags';
1414

1515
const Wrapper = styled.div(({ theme }) => ({
1616
display: 'flex',

code/addons/a11y/src/components/Report/Rules.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { FC } from 'react';
22
import React from 'react';
3-
import { styled } from 'storybook/internal/theming';
3+
44
import { Badge } from 'storybook/internal/components';
5+
import { styled } from 'storybook/internal/theming';
6+
57
import type { CheckResult } from 'axe-core';
68
import { useResizeDetector } from 'react-resize-detector';
79

code/addons/a11y/src/components/Report/Tags.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { FC } from 'react';
22
import React from 'react';
33

44
import { styled } from 'storybook/internal/theming';
5+
56
import type { TagValue } from 'axe-core';
67

78
const Wrapper = styled.div({

code/addons/a11y/src/components/Report/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { FC } from 'react';
22
import React, { Fragment } from 'react';
3+
34
import { EmptyTabContent } from 'storybook/internal/components';
4-
import type { Result } from 'axe-core';
55

6-
import { Item } from './Item';
6+
import type { Result } from 'axe-core';
77

88
import type { RuleType } from '../A11YPanel';
9+
import { Item } from './Item';
910

1011
export interface ReportProps {
1112
items: Result[];

code/addons/a11y/src/components/Tabs.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import * as React from 'react';
22

33
import { styled } from 'storybook/internal/theming';
4+
45
import type { NodeResult, Result } from 'axe-core';
56
import { useResizeDetector } from 'react-resize-detector';
6-
import HighlightToggle from './Report/HighlightToggle';
77

88
import type { RuleType } from './A11YPanel';
99
import { useA11yContext } from './A11yContext';
10+
import HighlightToggle from './Report/HighlightToggle';
1011

1112
// TODO: reuse the Tabs component from @storybook/theming instead of re-building identical functionality
1213

code/addons/a11y/src/components/VisionSimulator.test.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// @vitest-environment happy-dom
2-
32
/// <reference types="@testing-library/jest-dom" />;
4-
import { describe, it, expect } from 'vitest';
5-
import React from 'react';
6-
import { render, fireEvent, screen, waitFor } from '@testing-library/react';
3+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
74
import userEvent from '@testing-library/user-event';
8-
import { ThemeProvider, themes, convert } from 'storybook/internal/theming';
5+
import { describe, expect, it } from 'vitest';
6+
7+
import React from 'react';
8+
9+
import { ThemeProvider, convert, themes } from 'storybook/internal/theming';
10+
911
import { VisionSimulator, baseList } from './VisionSimulator';
1012

1113
const getOptionByNameAndPercentage = (option: string, percentage?: number) =>

code/addons/a11y/src/components/VisionSimulator.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import type { ReactNode } from 'react';
22
import React, { useState } from 'react';
3+
4+
import { IconButton, TooltipLinkList, WithTooltip } from 'storybook/internal/components';
35
import { Global, styled } from 'storybook/internal/theming';
4-
import { IconButton, WithTooltip, TooltipLinkList } from 'storybook/internal/components';
56

67
import { AccessibilityIcon } from '@storybook/icons';
8+
79
import { Filters } from './ColorFilters';
810

911
const iframeId = 'storybook-preview-iframe';

code/addons/a11y/src/manager.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// @vitest-environment happy-dom
2+
import { describe, expect, it, vi } from 'vitest';
23

3-
import { describe, it, expect, vi } from 'vitest';
44
import * as api from 'storybook/internal/manager-api';
55
import type { Addon_BaseType } from 'storybook/internal/types';
6+
67
import { PANEL_ID } from './constants';
78
import './manager';
89

code/addons/a11y/src/manager.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import React from 'react';
2-
import { addons, types, useAddonState } from 'storybook/internal/manager-api';
2+
33
import { Badge, Spaced } from 'storybook/internal/components';
4-
import { ADDON_ID, PANEL_ID, PARAM_KEY } from './constants';
5-
import { VisionSimulator } from './components/VisionSimulator';
4+
import { addons, types, useAddonState } from 'storybook/internal/manager-api';
5+
66
import { A11YPanel } from './components/A11YPanel';
77
import type { Results } from './components/A11yContext';
88
import { A11yContextProvider } from './components/A11yContext';
9+
import { VisionSimulator } from './components/VisionSimulator';
10+
import { ADDON_ID, PANEL_ID, PARAM_KEY } from './constants';
911

1012
const Title = () => {
1113
const [addonState] = useAddonState<Results>(ADDON_ID);

code/addons/a11y/src/params.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ElementContext, Spec, RunOptions } from 'axe-core';
1+
import type { ElementContext, RunOptions, Spec } from 'axe-core';
22

33
export interface Setup {
44
element?: ElementContext;

code/addons/a11y/vitest.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig, mergeConfig } from 'vitest/config';
2+
23
import { vitestCommonConfig } from '../../vitest.workspace';
34

45
export default mergeConfig(

code/addons/actions/src/addArgs.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { ArgsEnhancer } from 'storybook/internal/types';
2+
23
import { addActionsFromArgTypes, inferActionsFromArgTypesRegex } from './addArgsHelpers';
34

45
export const argsEnhancers: ArgsEnhancer[] = [

0 commit comments

Comments
 (0)