Skip to content

Commit 1a0c77a

Browse files
authored
Merge pull request #24 from SigNoz/chore/biome-setup
chore: migrate from ESLint and Prettier to Biome for linting and formatting
2 parents b92a473 + 3e8843d commit 1a0c77a

14 files changed

Lines changed: 939 additions & 2852 deletions

.changeset/config.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
3-
"changelog": "@changesets/cli/changelog",
4-
"commit": false,
5-
"fixed": [],
6-
"linked": [],
7-
"access": "restricted",
8-
"baseBranch": "main",
9-
"updateInternalDependencies": "patch",
10-
"ignore": []
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.3/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
1111
}

.eslintrc.js

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

.prettierrc

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

.storybook/main.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import type { StorybookConfig } from "@storybook/react-vite";
1+
import type { StorybookConfig } from '@storybook/react-vite';
22

33
const config: StorybookConfig = {
4-
stories: ["../stories/**/*.stories.@(js|jsx|ts|tsx)"],
5-
addons: ["@storybook/addon-a11y", "@storybook/addon-docs"],
6-
framework: {
7-
name: "@storybook/react-vite",
8-
options: {},
9-
},
10-
typescript: {
11-
check: false,
12-
reactDocgen: false,
13-
},
4+
stories: ['../stories/**/*.stories.@(js|jsx|ts|tsx)'],
5+
addons: ['@storybook/addon-a11y', '@storybook/addon-docs'],
6+
framework: {
7+
name: '@storybook/react-vite',
8+
options: {},
9+
},
10+
typescript: {
11+
check: false,
12+
reactDocgen: false,
13+
},
1414
};
1515

1616
export default config;

.storybook/preview.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import React from "react";
1+
import React from 'react';
22

33
/** @type { import('@storybook/react-vite').Preview } */
44
const preview = {
5-
parameters: {
6-
layout: "padded",
7-
controls: { hideNoControlsWarning: true },
8-
},
9-
decorators: [
10-
(Story) =>
11-
React.createElement(
12-
"div",
13-
{ style: { fontFamily: "'Inter', system-ui, sans-serif" } },
14-
React.createElement(Story)
15-
),
16-
],
5+
parameters: {
6+
layout: 'padded',
7+
controls: { hideNoControlsWarning: true },
8+
},
9+
decorators: [
10+
(Story) =>
11+
React.createElement(
12+
'div',
13+
{ style: { fontFamily: "'Inter', system-ui, sans-serif" } },
14+
React.createElement(Story),
15+
),
16+
],
1717
};
1818

1919
export default preview;

biome.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.4.3/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"includes": ["**", "!dist", "!src", "!assets", "!**/*.svg"]
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "space",
14+
"indentWidth": 1,
15+
"lineWidth": 100
16+
},
17+
"javascript": {
18+
"formatter": {
19+
"quoteStyle": "single",
20+
"trailingCommas": "all",
21+
"semicolons": "always"
22+
}
23+
},
24+
"linter": {
25+
"enabled": true,
26+
"rules": {
27+
"recommended": true,
28+
"correctness": {
29+
"useExhaustiveDependencies": "warn"
30+
},
31+
"style": {
32+
"useImportType": "off"
33+
},
34+
"a11y": {
35+
"useKeyWithClickEvents": "off"
36+
}
37+
}
38+
},
39+
"overrides": [
40+
{
41+
"includes": ["*.config.js", "*.config.cjs", "*.config.mjs"],
42+
"linter": {
43+
"rules": {
44+
"suspicious": {
45+
"noExplicitAny": "off"
46+
}
47+
}
48+
}
49+
}
50+
]
51+
}

commitlint.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['@commitlint/config-conventional'],
3-
};
2+
extends: ['@commitlint/config-conventional'],
3+
};

index-template.cjs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
const path = require("path");
1+
const path = require('node:path');
22

33
/**
44
* SVGR index template: generates src/index.ts with named exports.
55
* Component names starting with a number get an "Icon" prefix (e.g. 42.svg -> Icon42).
66
*/
77
function indexTemplate(filePaths) {
8-
const exportEntries = filePaths
9-
.filter((entry) => entry && (entry.path != null || entry.originalPath != null))
10-
.map((entry) => {
11-
const filePath = entry.path ?? entry.originalPath;
12-
const basename = path.basename(filePath, path.extname(filePath));
13-
const exportName = /^\d/.test(basename) ? `Icon${basename}` : basename;
14-
return `export { default as ${exportName} } from './${basename}'`;
15-
});
16-
return exportEntries.join("\n");
8+
const exportEntries = filePaths
9+
.filter((entry) => entry && (entry.path != null || entry.originalPath != null))
10+
.map((entry) => {
11+
const filePath = entry.path ?? entry.originalPath;
12+
const basename = path.basename(filePath, path.extname(filePath));
13+
const exportName = /^\d/.test(basename) ? `Icon${basename}` : basename;
14+
return `export { default as ${exportName} } from './${basename}'`;
15+
});
16+
return exportEntries.join('\n');
1717
}
1818

1919
module.exports = indexTemplate;

package.json

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,30 @@
1515
],
1616
"scripts": {
1717
"prebuild": "pnpm run precheck",
18-
"precheck": "pnpm run clean && pnpm run lint ",
18+
"precheck": "pnpm run clean && pnpm run lint",
1919
"clean": "rimraf src && rimraf dist",
2020
"build": "pnpm run svgr && rollup -c",
2121
"svgr": "rimraf src && svgr --typescript --replace-attr-values '#1D1D1D=currentColor' --template ./svgr-template.js --index-template ./index-template.cjs -d src -- assets",
22-
"lint": "eslint .",
22+
"lint": "biome check .",
23+
"lint:fix": "biome check --write .",
2324
"type-check": "tsc --noEmit",
2425
"commitlint": "commitlint --edit",
25-
"format": "prettier --write .",
26-
"format:check": "prettier --check .",
26+
"format": "biome format --write .",
27+
"format:check": "biome format .",
2728
"changeset": "changeset",
2829
"version": "changeset version",
2930
"release": "pnpm run build && changeset publish",
3031
"storybook": "pnpm run svgr && storybook dev -p 6006",
31-
"build-storybook": "pnpm run svgr && storybook build"
32+
"build-storybook": "pnpm run svgr && storybook build",
33+
"update:browserslist": "pnpm dlx update-browserslist-db@latest"
3234
},
3335
"license": "MIT",
3436
"devDependencies": {
3537
"@babel/plugin-transform-runtime": "^7.22.5",
3638
"@babel/preset-env": "^7.16.4",
3739
"@babel/preset-react": "^7.16.0",
3840
"@babel/traverse": "^7.25.6",
41+
"@biomejs/biome": "^2.4.3",
3942
"@changesets/cli": "^2.27.8",
4043
"@rollup/plugin-babel": "^5.3.0",
4144
"@rollup/plugin-typescript": "^12.1.2",
@@ -45,18 +48,9 @@
4548
"@storybook/react-vite": "^10.2.10",
4649
"@svgr/cli": "^6.1.2",
4750
"@types/react": "^18.2.0",
48-
"@typescript-eslint/eslint-plugin": "^5.59.11",
49-
"@typescript-eslint/parser": "^5.59.11",
5051
"chromatic": "^15.1.1",
51-
"eslint": "^8.42.0",
52-
"eslint-config-prettier": "^10.0.1",
53-
"eslint-import-resolver-node": "^0.3.9",
54-
"eslint-plugin-import": "^2.31.0",
55-
"eslint-plugin-react": "^7.37.4",
56-
"eslint-plugin-storybook": "10.2.10",
5752
"husky": "^8.0.3",
5853
"lint-staged": "^15.5.1",
59-
"prettier": "^2.8.8",
6054
"react": "^18.2.0",
6155
"react-dom": "^18.2.0",
6256
"rimraf": "^3.0.2",
@@ -74,9 +68,8 @@
7468
"@commitlint/config-conventional": "^17.6.7"
7569
},
7670
"lint-staged": {
77-
"*.{js,jsx,ts,tsx}": [
78-
"prettier --write",
79-
"eslint --fix"
71+
"*.{js,jsx,ts,tsx,json,jsonc}": [
72+
"biome check --write"
8073
]
8174
},
8275
"resolutions": {
@@ -88,11 +81,5 @@
8881
"react": "^18.2.0",
8982
"react-dom": "^18.2.0"
9083
}
91-
},
92-
"eslintIgnore": [
93-
"dist/**",
94-
"src/**",
95-
"assets/**",
96-
"*.svg"
97-
]
84+
}
9885
}

0 commit comments

Comments
 (0)