web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
9.5k stars 550 forks source link

[Tracking]: enable biome lint and format rules #7182

Open SoonIter opened 3 months ago

SoonIter commented 3 months ago

What subject does this issue tracking?

Recommended rules https://biomejs.dev/linter/rules/#recommended-rules

### Tasks
- [ ] https://github.com/web-infra-dev/rspack/pull/7061
- [ ] https://github.com/web-infra-dev/rspack/pull/7099
- [ ] https://github.com/web-infra-dev/rspack/pull/7103
- [ ] https://github.com/web-infra-dev/rspack/pull/7157
- [ ] https://github.com/web-infra-dev/rspack/pull/7160
- [ ] https://github.com/web-infra-dev/rspack/pull/7176
- [ ] https://github.com/web-infra-dev/rspack/pull/7181
- [ ] https://github.com/web-infra-dev/rspack/pull/7224
- [x] lint/complexity/useLiteralKeys
- [x] lint/style/useEnumInitializers
- [x] lint/a11y/noSvgWithoutTitle
- [x] lint/style/noUselessElse
- [x] lint/suspicious/noDoubleEquals
- [x] lint/complexity/noForEach
- [x] lint/style/useSelfClosingElements
- [x] lint/a11y/useButtonType
- [ ] remove "noMultipleSpacesInRegularExpressionLiterals": "off",
- [ ] remove "noStaticOnlyClass": "off",
- [ ] remove "noThisInStatic": "off",
- [ ] remove "noUselessConstructor": "off",
- [ ] remove "noUselessTernary": "off",
- [ ] remove "noBannedTypes": "off",
- [ ] remove "useOptionalChain": "off",
- [ ] remove "noUselessEmptyExport": "off",
- [ ] remove "noExtraBooleanCast": "off" -
- [ ] remove "noEmptyPattern": "off",
- [ ] remove "noConstructorReturn": "off",
- [ ] remove "noSwitchDeclarations": "off",
- [ ] remove "noInvalidUseBeforeDeclaration": "off",
- [ ] remove "noInnerDeclarations": "off",
- [ ] remove "noVoidTypeReturn": "off" -
- [ ] remove "noCommaOperator": "off",
- [ ] remove "useExponentiationOperator": "off",
- [ ] remove "useShorthandFunctionType": "off",
- [ ] remove "noArguments": "off",
- [ ] remove "noInferrableTypes": "off",
- [ ] remove "noVar": "off",
- [ ] remove "noParameterAssign": "off",
- [ ] remove "useTemplate": "off",
- [ ] remove "useSingleVarDeclarator": "off" -
- [ ] remove "noAccumulatingSpread": "off" -
- [ ] remove "noEmptyInterface": "off",
- [ ] remove "noGlobalAssign": "off",
- [ ] remove "noGlobalIsNan": "off",
- [ ] remove "noFallthroughSwitchClause": "off",
- [ ] remove "noConstEnum": "off",
- [ ] remove "noConfusingVoidType": "off",
- [ ] remove "noPrototypeBuiltins": "off",
- [ ] remove "noImplicitAnyLet": "off",
- [ ] remove "noAssignInExpressions": "off",
- [ ] remove "noArrayIndexKey": "off",
- [ ] remove "noRedundantUseStrict": "off",
- [ ] remove "noControlCharactersInRegex": "off", -
- [ ] TODO: format
chenjiahan commented 3 months ago

We have enabled the organizeImports feature of Biome, but the git hooks only only run prettier before commit (see lint-staged.config.mjs).

After pushing code, the Biome may throw an error for organizeImports, which is a bit annoying. We should run Biome in the pre-commit hook to solve this.

image

https://github.com/web-infra-dev/rspack/actions/runs/9993447832/job/27620851849

SoonIter commented 2 months ago

The rule that caused large changes has been opened, and the remaining rules can be opened in batches 😁