Skip to content

Commit 69d7ddf

Browse files
ci: migrate from eslint/prettier to biome (#18)
* ci: migrate from eslint/prettier to biome * ci: change prettier job name to biome
1 parent 879910a commit 69d7ddf

File tree

16 files changed

+1136
-2002
lines changed

16 files changed

+1136
-2002
lines changed

.changeset/thick-pens-applaud.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@amandaguthrie/panda-preset-framework-simplecss': patch
3+
'@amandaguthrie/panda-preset-font-modernfs': patch
4+
'@amandaguthrie/panda-preset-shared-utils': patch
5+
'@amandaguthrie/panda-plugin-type-extend': patch
6+
'@amandaguthrie/panda-preset-color-radix': patch
7+
'@amandaguthrie/panda-plugin-add-export': patch
8+
---
9+
10+
Migrate from ESLint/Prettier to Biome.
11+
Change .forEach to for ... of loops and switch from != undefined to != null or !== undefined.

.eslintrc

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/quality.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ on:
77
pull_request:
88
branches:
99
- main
10+
types:
11+
- opened
12+
- reopened
13+
- edited
14+
- synchronize
1015

1116
concurrency:
1217
group: ${{ github.workflow }}-${{ github.ref }}
1318
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1419

1520
jobs:
1621
prettier:
17-
name: Prettier
22+
name: Biome
1823
runs-on: ubuntu-latest
1924
steps:
2025
- name: Checkout
@@ -23,8 +28,8 @@ jobs:
2328
- name: Install
2429
uses: ./.github/composite-actions/install
2530

26-
- name: Run Prettier
27-
run: pnpm prettier
31+
- name: Run Biome
32+
run: pnpm format
2833

2934
tests:
3035
name: Unit Tests
@@ -39,21 +44,6 @@ jobs:
3944
- name: Run test
4045
run: pnpm test
4146

42-
eslint:
43-
name: ESLint
44-
runs-on: ubuntu-latest
45-
steps:
46-
- name: Checkout
47-
uses: actions/checkout@v4
48-
49-
- name: Install
50-
uses: ./.github/composite-actions/install
51-
52-
- name: Run ESLint
53-
run: pnpm lint
54-
env:
55-
NODE_OPTIONS: "--max-old-space-size=4096"
56-
5747
types:
5848
name: TypeScript
5949
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ on:
55
paths:
66
- '.changeset/**'
77
- 'packages/**'
8+
- '.npmrc'
9+
- 'biome.json'
10+
- 'bunfig.toml'
11+
- 'package.json'
12+
- 'tsconfig.build.json'
13+
- 'tsconfig.json'
14+
- 'tsup.config.ts'
815
branches:
916
- main
1017

biome.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"files": {
4+
"ignore": ["build", "dist", "node_modules", "**/*.md", "pnpm-lock.yaml", "styled-system"]
5+
},
6+
"organizeImports": {
7+
"enabled": true
8+
},
9+
"formatter": {
10+
"lineWidth": 120
11+
},
12+
"javascript": {
13+
"formatter": {
14+
"enabled": true,
15+
"quoteStyle": "single",
16+
"jsxQuoteStyle": "double",
17+
"trailingCommas": "all",
18+
"semicolons": "always",
19+
"bracketSpacing": true
20+
}
21+
},
22+
"json": {
23+
"formatter": {
24+
"enabled": true,
25+
"indentWidth": 2
26+
},
27+
"parser": {
28+
"allowComments": true
29+
}
30+
},
31+
"linter": {
32+
"enabled": true,
33+
"rules": {
34+
"recommended": true,
35+
36+
"correctness": {
37+
"noUnusedVariables": {
38+
"level": "error"
39+
}
40+
},
41+
"suspicious": {
42+
"noExplicitAny": "off"
43+
},
44+
"style": {
45+
"noNonNullAssertion": "off"
46+
}
47+
}
48+
}
49+
}

package.json

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,31 @@
1818
"build-fast": "pnpm -r --parallel --filter=./packages/** build-fast",
1919
"build": "pnpm -r --filter=./packages/** build",
2020
"reset": "pnpm -r --parallel exec rimraf node_modules dist && rimraf node_modules dist",
21-
"lint": "eslint packages --ext .ts",
22-
"prettier": "prettier --check packages",
23-
"prettier-fix": "prettier --write packages",
21+
"format": "biome lint packages",
22+
"format-fix": "biome check --write packages",
2423
"test": "pnpm -r --parallel --filter=./packages/** test --if-present",
2524
"typecheck": "tsc --noEmit",
2625
"release": "changeset publish",
2726
"release:dev:version": "changeset version --snapshot dev",
2827
"release:dev:publish": "changeset publish --no-git-tag --tag dev"
2928
},
3029
"devDependencies": {
30+
"@biomejs/biome": "^1.8.3",
3131
"@changesets/changelog-github": "^0.5.0",
32-
"@changesets/cli": "^2.27.1",
33-
"@types/eslint": "^8.56.10",
34-
"@types/node": "^20.12.7",
35-
"@typescript-eslint/eslint-plugin": "^7.7.1",
36-
"@typescript-eslint/parser": "^7.7.1",
37-
"eslint": "^8.57.0",
38-
"eslint-config-prettier": "^9.1.0",
39-
"glob": "^10.3.12",
40-
"prettier": "^3.2.5",
41-
"rimraf": "^5.0.5",
42-
"tsup": "^8.0.2",
43-
"tsx": "^4.7.2",
44-
"typescript": "^5.4.5"
32+
"@changesets/cli": "^2.27.7",
33+
"@types/node": "^22.0.0",
34+
"glob": "^11.0.0",
35+
"rimraf": "^5.0.9",
36+
"tsup": "^8.2.3",
37+
"tsx": "^4.16.2",
38+
"typescript": "^5.5.4"
4539
},
46-
"packageManager": "pnpm@9.0.5",
40+
"packageManager": "pnpm@9.6.0",
4741
"pnpm": {
4842
"overrides": {
4943
"@pandacss/dev": "^0.37.2",
50-
"@pandacss/types": "^0.37.2"
44+
"@pandacss/types": "^0.37.2",
45+
"typescript": "^5.5.4"
5146
}
5247
}
5348
}

packages/panda-plugin-add-export/src/exportTokens.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function exportTokens(artifacts: Artifact[], options: AddExportsPluginOpt
77
const artId = 'design-tokens';
88
const artifactIndex = findArtifactIndex(artifacts, artId);
99
const jsFileName = `index.${options.outExtension}`;
10-
const tsFileName = `index.d.ts`;
10+
const tsFileName = 'index.d.ts';
1111
const jsFile = findFile(artifacts, artId, jsFileName);
1212
const jsFileIndex = findFileIndex(artifacts, artId, jsFileName);
1313
const tsFile = findFile(artifacts, artId, tsFileName);

packages/panda-plugin-type-extend/src/extendTypeLayerStyleProperty.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export function extendLayerStylePropertyType(cssVars: CssProperty[]): PandaPlugi
1212
const codeArray = file?.code?.split('\n\n');
1313
const layerStylePropertyIndex = codeArray?.findIndex((line) => line.includes('type LayerStyleProperty '));
1414
if (layerStylePropertyIndex && layerStylePropertyIndex !== -1 && codeArray) {
15-
cssVars.forEach((property) => {
15+
for (const property of cssVars) {
1616
codeArray[layerStylePropertyIndex] += `\n | '${property}'`;
17-
});
17+
}
1818
}
1919
file.code = codeArray?.join('\n\n');
2020
}

packages/panda-plugin-type-extend/src/extendTypeTextStyleProperty.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ export function extendTextStylePropertyType(cssVars: CssProperty[]): PandaPlugin
1212
const codeArray = file?.code?.split('\n\n');
1313
const textStylePropertyIndex = codeArray?.findIndex((line) => line.includes('type TextStyleProperty '));
1414
if (textStylePropertyIndex && textStylePropertyIndex !== -1 && codeArray) {
15-
cssVars.forEach((property) => {
15+
for (const property of cssVars) {
1616
codeArray[textStylePropertyIndex] += `\n | '${property}'`;
17-
});
17+
}
1818
}
1919
file.code = codeArray?.join('\n\n');
2020
}

packages/panda-preset-color-radix/src/preset.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const defaultOptions: ColorRadixPresetDefaults = {
2020
};
2121

2222
export function pandaPresetColorRadix(options?: ColorRadixPresetOptions) {
23-
const mergedOptions = options != undefined ? Object.assign({}, defaultOptions, options) : defaultOptions;
23+
const mergedOptions = options != null ? Object.assign({}, defaultOptions, options) : defaultOptions;
2424
const { colors, colorModeConditions, coreColorPrefix, semanticColorMap, semanticColorPrefix } = mergedOptions;
2525

2626
// If an array of colors is passed, filter the array to valid Radix color names. If the array has no valid color names, return all Radix colors.
@@ -32,13 +32,12 @@ export function pandaPresetColorRadix(options?: ColorRadixPresetOptions) {
3232
let semanticTokens: RecursiveToken<string, any> | undefined = undefined;
3333
if (Object.keys(semanticColorMap).length > 0) {
3434
// If this semantic color wasn't included in the colors array, add it.
35-
Object.values(semanticColorMap).forEach(
36-
(mapDetail) =>
37-
radixAllColorsArray.includes(mapDetail.color) &&
38-
Array.isArray(validColors) &&
39-
!validColors.includes(mapDetail.color) &&
40-
validColors.push(mapDetail.color),
41-
);
35+
for (const mapDetail of Object.values(semanticColorMap)) {
36+
radixAllColorsArray.includes(mapDetail.color) &&
37+
Array.isArray(validColors) &&
38+
!validColors.includes(mapDetail.color) &&
39+
validColors.push(mapDetail.color);
40+
}
4241
semanticTokens = generateRadixSemanticTokens({
4342
coreColorPrefix,
4443
semanticColorPrefix,
@@ -61,7 +60,7 @@ export function pandaPresetColorRadix(options?: ColorRadixPresetOptions) {
6160
},
6261
};
6362

64-
if (semanticTokens != undefined) {
63+
if (semanticTokens !== undefined) {
6564
// @ts-ignore This is undefined but we can set it.
6665
preset.theme.extend.semanticTokens = { colors: semanticTokens };
6766
}
@@ -135,7 +134,9 @@ function generateRadixSemanticTokens({
135134
if (conditions === undefined || conditions.length <= 0) {
136135
return source;
137136
}
138-
conditions.forEach((condition) => (newValue[condition] = conditionValue));
137+
for (const condition of conditions) {
138+
newValue[condition] = conditionValue;
139+
}
139140
return newValue;
140141
}
141142

0 commit comments

Comments
 (0)