Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

biome #1668

Merged
merged 39 commits into from Dec 22, 2023
Merged

biome #1668

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
068968b
Add biome.json configuration
tony Dec 22, 2023
9c8a076
js(deps): Add @biomejs/biome
tony Dec 22, 2023
5fc3467
yarn workspaces foreach --all add --dev --exact @biomejs/biome
tony Dec 22, 2023
2e8ded9
yarn workspaces foreach --all remove oxlint
tony Dec 22, 2023
5dc9503
package.json(lint): Use yarn biome lint .
tony Dec 22, 2023
5a2f0d4
yarn: remove prettier and @ianvs/prettier-plugin-sort-imports
tony Dec 22, 2023
b365906
package.json: Switch prettier to biome format
tony Dec 22, 2023
7fb7958
package.json(biome): Rename to biome-all
tony Dec 22, 2023
cae1081
.gitignore: Ignore biome-logs/
tony Dec 22, 2023
a6c28f7
root(package.json[format,lint]): use biome {format,lint} .
tony Dec 22, 2023
42d4deb
.vim: Add coc.nvim configuration for biome
tony Dec 22, 2023
bdd75d3
.prettierrc.json: Remove plugins and plugin configs
tony Dec 22, 2023
58838e0
.prettierrc: Remove (deprecated by biome.json)
tony Dec 22, 2023
bc609a9
yarn lint --apply-unsafe
tony Dec 22, 2023
7b3fc01
yarn format
tony Dec 22, 2023
1ff0532
chore(chart-react-carbon): Fix useEffect dependencies
tony Dec 22, 2023
9bb507d
lib/search/mobx.ts: Fix lint issue
tony Dec 22, 2023
2139f8b
ChartLinks: Use button for a11y
tony Dec 22, 2023
a64507e
billboard: Fix useEffect hooks
tony Dec 22, 2023
3bb13a3
victory: Fix useEffect hooks
tony Dec 22, 2023
45f1c4b
plotly: Use exhaustive dependencies in useEffect
tony Dec 22, 2023
1b8ae49
data/custom.d.ts: Use string instead of any
tony Dec 22, 2023
5f9f0f9
react/custom.d.ts: any to string
tony Dec 22, 2023
c4c6d37
nivo: Use exhaustive deps in useEffect
tony Dec 22, 2023
c308088
FilterDateRange: Use type="button"
tony Dec 22, 2023
889f921
ColorScheme: Remove duplicate layout hooks, use exhaustive deps
tony Dec 22, 2023
bb2f094
ColorScheme: onKeyDown for setting color scheme
tony Dec 22, 2023
7eadd71
Settings: Use type with button
tony Dec 22, 2023
350abe3
Card: Fix key in array map
tony Dec 22, 2023
acf7b87
Settings: Use type="button"
tony Dec 22, 2023
faae7a3
Card: Use more descriptive keys in array map
tony Dec 22, 2023
e5242bf
ColorScheme: Use onKeyDown in onClick use case
tony Dec 22, 2023
8ef96dc
FilterDateRange: Improve key in array maps
tony Dec 22, 2023
27c2c8d
Results: Use more descriptive key in array
tony Dec 22, 2023
929dbf4
App.tsx: Ignore dangerouslySetInnerHTML for root custom properties (v…
tony Dec 22, 2023
f2e68b5
github: Fix linting nits
tony Dec 22, 2023
9d9488f
Charts: Remove catch-all re-render hooks
tony Dec 22, 2023
c64fc02
ci(tests): prettier and eslint to biome format and biome lint
tony Dec 22, 2023
bb0bf18
package.json: line endings
tony Dec 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/tests.yaml
Expand Up @@ -22,11 +22,7 @@ jobs:
- name: pull gh repos
run: |
env GITHUB_API_TOKEN=${{ secrets.CI_GITHUB_API_TOKEN }} yarn workspace @tony/cv-scripts run github
- name: prettier --check . - all
run: yarn prettier --check .
- name: eslint - lib
run: yarn workspace @tony/cv-lib run -T lint
- name: eslint - react
run: yarn workspace @tony/cv-react run -T lint
- name: eslint - all
run: yarn lint
- name: yarn biome format .
run: yarn biome format .
- name: yarn biome lint .
run: yarn biome lint .
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -31,3 +31,6 @@ packages/data/scraped/

# WSL
*:Zone.Identifier

# biome
biome-logs/
18 changes: 0 additions & 18 deletions .prettierrc

This file was deleted.

8 changes: 8 additions & 0 deletions .vim/coc-settings.json
@@ -0,0 +1,8 @@
{
"[markdown][javascript][typescript][typescriptreact]": {
"coc.preferences.formatOnSave": true
},
"prettier.enable": false,
"eslint.enable": false,
"biome.enable": true
}
26 changes: 26 additions & 0 deletions biome.json
@@ -0,0 +1,26 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.1/schema.json",
"files": {
"ignore": [
"node_modules",
"dist",
".cache",
"*.graphql",
"packages/data/scraped"
],
"ignoreUnknown": true
},
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
}
}
11 changes: 5 additions & 6 deletions package.json
Expand Up @@ -6,11 +6,11 @@
"build": "yarn workspaces foreach --all run build",
"clean": "yarn workspaces foreach --all run clean",
"distclean": "yarn workspaces foreach --all run distclean",
"format": "yarn workspaces foreach --all run format",
"lint": "yarn workspaces foreach --all run lint",
"format": "biome format .",
"lint": "biome lint .",
"ncu": "yarn ncu-local -u; yarn workspaces foreach --all run ncu",
"ncu-local": "ncu",
"prettier": "yarn workspaces foreach --all run prettier",
"biome-all": "yarn workspaces foreach --all run biome",
"update": "yarn workspaces foreach --all run update",
"github": "yarn workspace @tony/cv-scripts run github",
"deduplicate": "npx --yes yarn-deduplicate yarn.lock"
Expand All @@ -22,9 +22,8 @@
"packages/*"
],
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"cross-env": "^7.0.3",
"oxlint": "^0.0.21"
"@biomejs/biome": "1.4.1",
"cross-env": "^7.0.3"
},
"packageManager": "yarn@4.0.2"
}
9 changes: 4 additions & 5 deletions packages/chart-react-billboard/package.json
Expand Up @@ -9,20 +9,19 @@
"start": "echo 'noop'",
"build": "echo 'noop'",
"test": "echo 'noop'",
"lint": "yarn oxlint",
"prettier": "prettier",
"format": "yarn run prettier . --write",
"lint": "yarn biome lint .",
"biome": "biome",
"format": "yarn biome format . --write",
"update": "yarn run ncu",
"ncu": "ncu",
"clean": "rm -rf dist/"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@types/node": "^20.10.5",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"cross-env": "^7.0.3",
"oxlint": "^0.0.21",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
},
"dependencies": {
Expand Down
14 changes: 5 additions & 9 deletions packages/chart-react-billboard/src/charts.tsx
Expand Up @@ -28,7 +28,7 @@ export const Chart: React.FC<bb.ChartOptions> = observer(
setChart(newChart);
return () => newChart.unload();
}
}, [props, data]);
}, [props, data, setChart, chart, ref.current, data]);

React.useEffect(() => {
if (!chart || !data) {
Expand Down Expand Up @@ -60,17 +60,15 @@ export const LanguagePieChart: React.FC<Partial<DonutChartProps>> = observer(
}
},
),
[cvState],
[cvState, setChartData],
);

React.useEffect(() => {
if (!chartData) {
setChartData(stateToDonut(cvState) as DonutChartProps);
}
return void 0;
}, [cvState]);

React.useEffect(() => void 0, [chartData]);
}, [cvState, setChartData, chartData]);

if (!chartData) {
return null;
Expand All @@ -97,17 +95,15 @@ export const ActivityLineChart: React.FC<Partial<bb.ChartOptions>> = observer(
}
},
),
[cvState],
[cvState, setChartData],
);

React.useEffect(() => {
if (!chartData) {
setChartData(stateToLine(cvState) as LineChartProps);
}
return void 0;
}, [cvState]);

React.useEffect(() => void 0, [chartData]);
}, [setChartData, chartData, cvState]);

if (!chartData) {
return null;
Expand Down
17 changes: 7 additions & 10 deletions packages/chart-react-billboard/src/query.ts
Expand Up @@ -38,17 +38,14 @@ export const stateToDonut = (state: Instance<typeof CVState>) => {
labels: {
// billboard.js doesn't accept callbacks here
// issue: https://github.com/naver/billboard.js/issues/1845
colors: state.languages.reduce(
(languageColorMap, language) => {
if (language) {
if (!(language.id in languageColorMap) && language.ui?.color) {
languageColorMap[language.id] = language.ui.color as string;
}
colors: state.languages.reduce((languageColorMap, language) => {
if (language) {
if (!(language.id in languageColorMap) && language.ui?.color) {
languageColorMap[language.id] = language.ui.color as string;
}
return languageColorMap;
},
{} as { [key: string]: string },
),
}
return languageColorMap;
}, {} as { [key: string]: string }),
},
},
legend: {
Expand Down
9 changes: 4 additions & 5 deletions packages/chart-react-carbon/package.json
Expand Up @@ -9,20 +9,19 @@
"start": "echo 'noop'",
"build": "echo 'noop'",
"test": "echo 'noop'",
"lint": "yarn oxlint",
"prettier": "prettier",
"format": "yarn run prettier . --write",
"lint": "yarn biome lint .",
"biome": "biome",
"format": "yarn biome format . --write",
"update": "yarn run ncu",
"ncu": "ncu",
"clean": "rm -rf dist/"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@types/node": "^20.10.5",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"cross-env": "^7.0.3",
"oxlint": "^0.0.21",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
},
"dependencies": {
Expand Down
24 changes: 6 additions & 18 deletions packages/chart-react-carbon/src/charts.tsx
Expand Up @@ -35,25 +35,21 @@ export const LanguagePieChart: React.FC<Partial<DonutChartProps>> = observer(
}
},
),
[cvState],
[cvState, setChartData],
);

React.useEffect(() => {
if (!chartData) {
setChartData(stateToDonut(cvState) as DonutChartProps);
}
return void 0;
}, [cvState]);

React.useEffect(() => void 0, [chartData]);
}, [cvState, chartData, setChartData]);

if (!chartData) {
return null;
}

return (
<DonutChart ref={languageChartRef} {...chartData} {...props}></DonutChart>
);
return <DonutChart ref={languageChartRef} {...chartData} {...props} />;
},
);

Expand All @@ -75,28 +71,20 @@ export const ActivityLineChart: React.FC<Partial<LineChartProps>> = observer(
}
},
),
[cvState],
[cvState, setChartData],
);

React.useEffect(() => {
if (!chartData) {
setChartData(stateToLine(cvState) as LineChartProps);
}
return void 0;
}, [cvState]);

React.useEffect(() => void 0, [chartData]);
}, [cvState, chartData, setChartData]);

if (!chartData) {
return null;
}

return (
<StackedAreaChart
ref={lineChartRef}
{...chartData}
{...props}
></StackedAreaChart>
);
return <StackedAreaChart ref={lineChartRef} {...chartData} {...props} />;
},
);
9 changes: 4 additions & 5 deletions packages/chart-react-nivo/package.json
Expand Up @@ -9,20 +9,19 @@
"start": "echo 'noop'",
"build": "echo 'noop'",
"test": "echo 'noop'",
"lint": "yarn oxlint",
"prettier": "prettier",
"format": "yarn run prettier . --write",
"lint": "yarn biome lint .",
"biome": "biome",
"format": "yarn biome format . --write",
"update": "yarn run ncu",
"ncu": "ncu",
"clean": "rm -rf dist/"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@types/node": "^20.10.5",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"cross-env": "^7.0.3",
"oxlint": "^0.0.21",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
},
"dependencies": {
Expand Down
12 changes: 4 additions & 8 deletions packages/chart-react-nivo/src/charts.tsx
Expand Up @@ -34,17 +34,15 @@ export const LanguagePieChart: React.FC<Partial<DonutChartProps>> = observer(
}
},
),
[cvState],
[cvState, setChartData],
);

React.useEffect(() => {
if (!chartData) {
setChartData(stateToDonut(cvState) as DonutChartProps);
}
return void 0;
}, [cvState]);

React.useEffect(() => void 0, [chartData]);
}, [cvState, setChartData, chartData]);

if (!chartData) {
return null;
Expand Down Expand Up @@ -85,17 +83,15 @@ export const ActivityLineChart: React.FC<
}
},
),
[cvState],
[cvState, setChartData],
);

React.useEffect(() => {
if (!chartData) {
setChartData(stateToLine(cvState) as LineChartProps);
}
return void 0;
}, [cvState]);

React.useEffect(() => void 0, [chartData]);
}, [cvState, chartData, setChartData]);

if (!chartData) {
return null;
Expand Down
4 changes: 2 additions & 2 deletions packages/chart-react-nivo/src/query.ts
Expand Up @@ -50,7 +50,7 @@ export const stateToDonut = (
},
),
colors: (item) => {
const color = state.languages.find((language) => language.id == item.id)
const color = state.languages.find((language) => language.id === item.id)
?.ui?.backgroundColor;

if (color && isString(color)) {
Expand All @@ -69,7 +69,7 @@ export const stateToDonut = (
label: string;
value: number;
}) => {
const color = state.languages.find((language) => language.id == item.id)
const color = state.languages.find((language) => language.id === item.id)
?.ui?.color;

if (color && isString(color)) {
Expand Down
9 changes: 4 additions & 5 deletions packages/chart-react-plotly/package.json
Expand Up @@ -9,21 +9,20 @@
"start": "echo 'noop'",
"build": "echo 'noop'",
"test": "echo 'noop'",
"lint": "yarn oxlint",
"prettier": "prettier",
"format": "yarn run prettier . --write",
"lint": "yarn biome lint .",
"biome": "biome",
"format": "yarn biome format . --write",
"update": "yarn run ncu",
"ncu": "ncu",
"clean": "rm -rf dist/"
},
"devDependencies": {
"@biomejs/biome": "1.4.1",
"@types/node": "^20.10.5",
"@types/plotly.js": "^2.12.31",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"cross-env": "^7.0.3",
"oxlint": "^0.0.21",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
},
"dependencies": {
Expand Down