Skip to content

Commit

Permalink
Merge pull request #63 from chhsiao1981/biome
Browse files Browse the repository at this point in the history
add biome for formatting / linting
  • Loading branch information
chhsiao1981 authored Feb 12, 2025
2 parents becb4f2 + 3f01713 commit 9008a2b
Show file tree
Hide file tree
Showing 32 changed files with 5,342 additions and 18,404 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -19,11 +19,11 @@ jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
node-version: [22.x]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand All @@ -39,7 +39,7 @@ jobs:

# coverage
- name: coverage
run: npx jest --coverage --silent --colors
run: npm run coverage

# codecov
- name: Upload coverage report
Expand Down
17 changes: 0 additions & 17 deletions babel.config.js

This file was deleted.

71 changes: 71 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"files": {
"include": [
"src/**",
"tests/**",
"package.json",
"biome.json",
"*.config.ts",
"vitest.*.ts",
"tsconfig*.json",
"testing/*.mjs"
],
"ignore": ["package-lock.json", "*.d.ts"]
},
"organizeImports": {
"enabled": true
},
"formatter": {
"indentWidth": 2,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"noNonNullAssertion": "off"
},
"complexity": {
"useLiteralKeys": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
},
"suspicious": {
"noArrayIndexKey": "off",
"noPrototypeBuiltins": "off"
}
}
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "main"
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single",
"jsxQuoteStyle": "single",
"indentStyle": "space",
"lineWidth": 120
},
"globals": ["window"]
},
"json": {
"parser": {
"allowComments": true
},
"formatter": {
"indentStyle": "space"
}
},
"css": {
"formatter": {
"indentStyle": "space"
}
}
}
70 changes: 70 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import eslint from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import tseslint from 'typescript-eslint'
import reactRefresh from 'eslint-plugin-react-refresh'

export default tseslint.config(
{ ignores: ['dist', '.venv', 'eslint.config.ts', 'coverage', 'vitest.config.ts', '**/*.d.ts'] },
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
globals: globals.browser,
parserOptions: {
project: ['./tsconfig.app.json', './tsconfig.node.json', './tsconfig.test.json'],
// @ts-expect-error languageOptions.tsconfigRootDir
tsconfigRootDir: import.meta.dirname,
},
},
},
{
files: ['src/*.{ts,tsx}'],
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'index-signature'],
'@typescript-eslint/dot-notation': 'off',
'no-prototype-builtins': 'off',
'react-hooks/exhaustive-deps': 'off',
quotes: ['error', 'single'],
'no-unused-vars': 'off', //use tse/no-unused-vars instead.
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_$' }],
'@typescript-eslint/no-explicit-any': 'off', // taken care of by biome. don't know how to specify next-line ignoring on both biome / eslint though.
'@typescript-eslint/no-unsafe-argument': 'off', // taken care of by biome. don't know how to specify next-line ignoring on both biome / eslint though.
},
},
{
files: ['tests/*.{ts,tsx}'],
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'index-signature'],
'@typescript-eslint/dot-notation': 'off',
'no-prototype-builtins': 'off',
'react-hooks/exhaustive-deps': 'off',
quotes: ['error', 'single'],
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
},
},
)
23 changes: 0 additions & 23 deletions jest.config.js

This file was deleted.

Loading

0 comments on commit 9008a2b

Please sign in to comment.