Skip to content

Commit 6acad81

Browse files
authored
Use Biome to speed up linting (#2583)
1 parent 7a21824 commit 6acad81

File tree

128 files changed

+792
-488
lines changed

Some content is hidden

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

128 files changed

+792
-488
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ package.json
1111
package-lock.json
1212
*rc.*
1313
/scripts/
14-
# disable linting for templates because it will have its own rules when used in a new app
14+
# disable linting for templates because they will have their own rules when used in a new app
1515
packages/cna-template/template
1616
packages/astro-template/src/env.d.ts
1717
packages/circuit-ui/vendor

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/setup-node@v4
2020
with:
2121
node-version: ${{ matrix.node }}
22-
cache: 'npm'
22+
cache: "npm"
2323

2424
- name: Install dependencies
2525
run: npm ci
@@ -34,7 +34,7 @@ jobs:
3434
run: npm run build
3535

3636
- name: Lint code
37-
run: npm run lint
37+
run: npm run lint:ci
3838

3939
- name: Lint styles
4040
run: npm run lint:css

.prettierignore

-1
This file was deleted.

.storybook/addons/versions/index.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// biome-ignore lint/correctness/noUnusedImports: React isn't injected globally in this file
12
import React, { useState } from 'react';
23
import {
34
IconButton,

.storybook/components/Icons.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
*/
1515

1616
import {
17+
useState,
1718
type Dispatch,
1819
type SetStateAction,
19-
useState,
20-
ChangeEvent,
20+
type ChangeEvent,
2121
} from 'react';
2222
import { Unstyled } from '@storybook/addon-docs';
2323
import * as iconComponents from '@sumup/icons';
@@ -43,7 +43,8 @@ function groupBy(
4343
) {
4444
return icons.reduce(
4545
(groups, icon) => {
46-
(groups[icon[key]] = groups[icon[key]] || []).push(icon);
46+
groups[icon[key]] = groups[icon[key]] || [];
47+
groups[icon[key]].push(icon);
4748
return groups;
4849
},
4950
{} as Record<string, IconsManifest['icons']>,

.storybook/components/Intro.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ import type { BodyLargeProps } from '../../packages/circuit-ui/index.js';
1919

2020
import classes from './Intro.module.css';
2121

22-
function Intro({
22+
export default function Intro({
2323
children,
2424
...props
2525
}: {
2626
children: BodyLargeProps['children'];
27-
}): JSX.Element {
27+
}) {
2828
return (
2929
<BodyLarge as="div" variant="subtle" className={classes.base} {...props}>
3030
{children}
3131
</BodyLarge>
3232
);
3333
}
34-
35-
export default Intro;

.storybook/components/Statuses.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
import type { ReactNode } from 'react';
1717
import { Unstyled } from '@storybook/addon-docs';
1818
import LinkTo from '@storybook/addon-links/react';
19-
import { Badge, BadgeProps, Body } from '../../packages/circuit-ui/index.js';
19+
import {
20+
Body,
21+
Badge,
22+
type BadgeProps,
23+
} from '../../packages/circuit-ui/index.js';
2024

2125
import classes from './Statuses.module.css';
2226

.storybook/components/Theme.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { ComponentType, useEffect, useState } from 'react';
16+
import { useEffect, useState, type ComponentType } from 'react';
1717
import { ThemeProvider, useTheme } from '@emotion/react';
1818
import { Unstyled } from '@storybook/addon-docs';
1919
import { light, schema } from '@sumup/design-tokens';
2020
import { SumUpLogomark } from '@sumup/icons';
2121
import {
2222
Anchor,
2323
Table,
24-
TableHeaderCell,
25-
TableRow,
2624
ToastProvider,
2725
useNotificationToast,
26+
type TableHeaderCell,
27+
type TableRow,
2828
} from '../../packages/circuit-ui/index.js';
2929

3030
type CustomPropertyName = `--cui-${string}`;

.storybook/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { StorybookConfig } from '@storybook/react-vite';
2-
import path from 'path';
2+
import path from 'node:path';
33
import remarkGfm from 'remark-gfm';
44
import { mergeConfig } from 'vite';
55

@@ -38,7 +38,7 @@ const config: StorybookConfig = {
3838
name: '@storybook/react-vite',
3939
options: {},
4040
},
41-
async viteFinal(config, { configType }) {
41+
async viteFinal(config) {
4242
return mergeConfig(config, {
4343
define: {
4444
'process.env.UNSAFE_DISABLE_ELEMENT_ERRORS': false,

.storybook/manager.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ addons.register('version-switcher', () => {
3636
addons.add(VERSIONS_PARAM_KEY, {
3737
type: types.TOOL,
3838
title: 'Versions',
39-
match: ({ viewMode }) => !!(viewMode && viewMode?.match(/^(story|docs)$/)),
39+
match: ({ viewMode }) =>
40+
viewMode ? /^(story|docs)$/.test(viewMode) : false,
4041
render: Versions,
4142
});
4243
});

MIGRATION.md

-2
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,6 @@ Previously, many apps would use `CreateStyled`:
710710
import styled, { CreateStyled } from '@emotion/styled';
711711
import { Theme } from '@sumup/design-tokens';
712712
713-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
714713
export default styled as CreateStyled<Theme>;
715714
```
716715
@@ -737,7 +736,6 @@ import { Theme as CircuitTheme } from '@sumup/design-tokens';
737736
import {} from '@emotion/react/types/css-prop'; // See https://github.com/emotion-js/emotion/pull/1941
738737
739738
declare module '@emotion/react' {
740-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
741739
export interface Theme extends CircuitTheme {}
742740
}
743741
```

biome.jsonc

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.2/schema.json",
3+
"extends": ["@sumup-oss/foundry/biome"],
4+
"files": {
5+
"ignore": [
6+
// Generated artifacts
7+
"**/build/**",
8+
"**/dist/**",
9+
"**/public/**",
10+
"**/.next/**",
11+
"**/.out/**",
12+
"**/__coverage__/**",
13+
"**/__reports__/**",
14+
"**/*.astro",
15+
"packages/circuit-ui/vendor/**"
16+
]
17+
},
18+
"formatter": {
19+
"ignore": [
20+
// Configuration files that use conflicting formatting
21+
".changeset/**",
22+
"**/package.json",
23+
"**/package-lock.json",
24+
"**/tsconfig.json",
25+
"**/tsconfig.*.json",
26+
"**/lerna.json",
27+
"**/.vscode/extensions.json"
28+
]
29+
},
30+
"organizeImports": {
31+
"enabled": false
32+
},
33+
"linter": {
34+
"rules": {
35+
"recommended": true,
36+
"style": {
37+
"noDefaultExport": "warn",
38+
"useFilenamingConvention": {
39+
"level": "error",
40+
"options": {
41+
"requireAscii": true,
42+
"filenameCases": ["camelCase", "kebab-case", "PascalCase"]
43+
}
44+
}
45+
},
46+
"suspicious": {
47+
"noArrayIndexKey": "warn",
48+
"noExplicitAny": "warn"
49+
}
50+
},
51+
"ignore": [
52+
// The templates have their own linting setup
53+
"packages/astro-template/**",
54+
"packages/cna-template/template/**",
55+
"packages/remix-template/**"
56+
]
57+
},
58+
"overrides": [
59+
{
60+
"include": ["*.css"],
61+
"css": {
62+
"formatter": {
63+
"enabled": true,
64+
"indentStyle": "space",
65+
"quoteStyle": "double"
66+
},
67+
"linter": {
68+
"enabled": true
69+
}
70+
}
71+
},
72+
{
73+
"include": ["*.module.css"],
74+
"css": {
75+
"parser": {
76+
"cssModules": true
77+
}
78+
}
79+
},
80+
{
81+
"include": ["packages/eslint-plugin-circuit-ui/**"],
82+
"linter": {
83+
"rules": {
84+
"style": {
85+
"noNonNullAssertion": "off"
86+
}
87+
}
88+
}
89+
},
90+
{
91+
"include": ["**/*spec.*", "**/setupTests.*", "**/test-utils.*"],
92+
"linter": {
93+
"rules": {
94+
"suspicious": {
95+
"noGlobalAssign": "off"
96+
}
97+
}
98+
}
99+
}
100+
]
101+
}

lint-staged.config.js

-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515

1616
module.exports = require('@sumup-oss/foundry/lint-staged')({
1717
'*.svg': ['svgo --config svgo.config.js --pretty'],
18-
'*.css': ['stylelint'],
1918
});

0 commit comments

Comments
 (0)