Wener Notes

biome

约 1 分钟阅读
bash
brew install biome          # by macOS Brew
pnpm add -Dw @biomejs/biome # add to Project

# check=lint+format
npx biome check ./src # 如果安装了 @biomejs/biome

npx biome start                         # daemon
time npx biome check ./src --use-server # 一般项目 user 快 0.2s

# 如果没安装 @biomejs/biome
npx @biomejs/biome check ./src
npx @biomejs/biome check ./src --apply

biome format --write ./src package.json

# 单个规则 v1.7.4+
# https://biomejs.dev/linter/rules/
biome lint --only=style/useNamingConvention --apply ./src
npx -y @biomejs/biome lint --only=style/useImportType ./src --write
npx -y @biomejs/biome lint --only=lint/correctness/noUnusedImports ./src --write
# warn `export * from './mod` in index.ts
npx -y @biomejs/biome lint --only=lint/performance/noReExportAll ./src/**/index.ts
Packages@biomejs/biomenpm Package@biomejs/biomeNPM

biome.json

json
{
  "javascript": {
    "parser": {
      "unsafeParameterDecoratorsEnabled": true
    }
  },
  "formatter": {
    "enabled": false
  },
  "organizeImports": {
    "enabled": false
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true,
      "suspicious": {
        "noExplicitAny": "off",
        "noShadowRestrictedNames": "off",
        "noAssignInExpressions": "off"
      },
      "style": {
        "useConst": "off",
        "noNonNullAssertion": "warn",
        "noUnusedTemplateLiteral": "off",
        "noParameterAssign": "off"
      },
      "complexity": {
        "noBannedTypes": "off",
        "noStaticOnlyClass": "off"
      }
    }
  }
}

prettier

关联信息

反向链接、本文链接的其他页面和外部资料。

References

GitHub2 条
其他外链5 条
最近更新commit 7cf313aEdit

On this page