cli/v1.4.1-nightly.d869a33
版本发布时间: 2024-01-03 21:40:18
biomejs/biome最新发布版本:js-api/v0.7.1(2024-10-02 00:17:16)
Biome now scores 97% compatibility with Prettier and features more than 180 linter rules.
Analyzer
CLI
New features
-
Biome now shows a diagnostic when it encounters a protected file. Contributed by @ematipico
-
The command
biome migrate
now updates the$schema
if there's an outdated version. -
The commands
format
,lint
,check
andci
now accepts two new arguments:--changed
and--since
. Use these options when the VCS integration is enabled to process only the files that were changed. Contributed by @simonxabrisbiome format --write --changed
-
Introduced a new command called
biome explain
, which has the capability to display documentation for lint rules. Contributed by @kalleep
Bug fixes
-
Fix #1247, Biome now prints a warning diagnostic if it encounters files that can't handle. Contributed by @ematipico
You can ignore unknown file types using the
files.ignoreUnknown
configuration inbiome.json
:{ "files": { "ignoreUnknown": true } }
Or the
--files-ignore-unknown
CLI option:biome format --files-ignore-unknown=true --write .
-
Fix #709 and #805 by correctly parsing
.gitignore
files. Contributed by @ematipico -
Fix #1117 by correctly respecting the matching. Contributed by @ematipico
-
Fix #691 and #1190, by correctly apply the configuration when computing
overrides
configuration. Contributed by @ematipico
Configuration
New features
-
Users can specify git ignore patterns inside
ignore
andinclude
properties, for example it's possible to allow list globs of files using the!
character:{ "files": { "ignore": [ "node_modules/**", "!**/dist/**" // this is now accepted and allow list files inside the `dist` folder ] } }
Editors
New features
-
The LSP registers formatting without the need of using dynamic capabilities from the client.
This brings formatting services to the editors that don't support or have limited support for dynamic capabilities.
Formatter
Bug fixes
-
Fix #1169. Account for escaped strings when computing layout for assignments. Contributed by @kalleep
-
Fix #1220. Avoid duplicating comments in type unions for mapped, empty object, and empty tuple types. #1240 Contributed by @faultyserver
-
Fix #1356. Ensure
if_group_fits_on_line
content is always written inRemoveSoftLinesBuffer
s. #1357 Contributed by @faultyserver -
Fix #1171. Correctly format empty statement with comment inside arrow body when used as single argument in call expression. Contributed by @kalleep
JavaScript APIs
Linter
New features
-
Add useExportType that enforces the use of type-only exports for names that are only types. Contributed by @Conaclos
interface A {} interface B {} class C {} - export type { A, C } + export { type A, C } - export { type B } + export type { B }
-
Add useFilenamingConvention, that enforces naming conventions for JavaScript and TypeScript filenames. Contributed by @Conaclos
By default, the rule requires that a filename be in
camelCase
,kebab-case
,snake_case
, or matches the name of anexport
in the file. The rule provides options to restrict the allowed cases. -
Add useNodejsImportProtocol that enforces the use of the
node:
protocol when importing Node.js modules. Contributed by @2-NOW and @Conaclos- import fs from "fs"; + import fs from "node:fs";
-
Add noNodejsModules, that disallows the use of Node.js modules. Contributed by @anonrig, @ematipico, and @Conaclos
-
Add noInvalidUseBeforeDeclaration that reports variables and function parameters used before their declaration. Contributed by @Conaclos
function f() { console.log(c); // Use of `c` before its declaration. const c = 0; }
Enhancements
-
Address #959 and #1157. noEmptyInterface no longer reports empty interfaces that extend a type. Contributed by @Conaclos
This allows supporting interface augmentation in external modules as demonstrated in the following example:
interface Extension { metadata: unknown; } declare module "@external/module" { // Empty interface that extends a type. export interface ExistingInterface extends Extension {} }
-
Preserve more comments in the fix of useExponentiationOperator. Contributed by @Conaclos
The rule now preserves comments that follow the (optional) trailing comma.
For example, the rule now suggests the following code fix:
- Math.pow( - a, // a - 2, // 2 - ); + + a ** // a + 2 // 2 +
-
The code action (fix) of noMultipleSpacesInRegularExpressionLiterals is now marked as safe. Contributed by @Conaclos
Bug fixes
-
Fix #1061. noRedeclare no longer reports overloads of
export default function
. Contributed by @ConaclosThe following code is no longer reported:
export default function(a: boolean): boolean; export default function(a: number): number; export default function(a: number | boolean): number | boolean { return a; }
-
Fix #651, useExhaustiveDependencies no longer reports out of scope dependencies. Contributed by @kalleep
The following code is no longer reported:
let outer = false; const Component = ({}) => { useEffect(() => { outer = true; }, []); }
-
Fix #1191. noUselessElse now preserve comments of the
else
clause. Contributed by @ConaclosFor example, the rule suggested the following fix:
function f(x) { if (x <0) { return 0; } - // Comment - else { return x; - } }
Now the rule suggests a fix that preserves the comment of the
else
clause:function f(x) { if (x <0) { return 0; } // Comment - else { return x; - } }
-
Fix #728. useSingleVarDeclarator no longer outputs invalid code. Contributed by @Conaclos
-
Fix #1167. useValidAriaProps no longer reports
aria-atomic
as invalid. Contributed by @unvalley
Parser
BREAKING CHANGES
-
The representation of imports has been simplified. Contributed by @Conaclos
The new representation is closer to the ECMAScript standard. It provides a single way of representing a namespace import such as
import * as ns from ""
. It rules out some invalid states that was previously representable. For example, it is no longer possible to represent a combined import with atype
qualifier such asimport type D, { N } from ""
.See #1163 for more details.
Bug fixes
-
Fix #1077 where parenthesized identifiers in conditional expression were being parsed as arrow expressions. Contributed by @kalleep
These cases are now properly parsed:
JavasSript:
a ? (b) : a => {};
TypeScript:
a ? (b) : a => {};
JSX:
bar ? (foo) : (<a>{() => {}}</a>);
What's Changed
Other changes
- docs: add caveat to
lint/complexity/noForEach
by @danielsarsi in https://github.com/biomejs/biome/pull/1305 - fix(css_formatter): don't preserve empty lines for selector lists by @faultyserver in https://github.com/biomejs/biome/pull/1309
- docs(lint/noForEach): add caveat in the source file by @Conaclos in https://github.com/biomejs/biome/pull/1318
- chore: use logo v2 in translated README by @unvalley in https://github.com/biomejs/biome/pull/1317
- feat(css_formatter): Always quote attribute matcher values by @faultyserver in https://github.com/biomejs/biome/pull/1321
- fix(json_formatter): handle comments in empty arrays/objects by @faultyserver in https://github.com/biomejs/biome/pull/1323
- docs(website): use biome latest in ci example doc by @unvalley in https://github.com/biomejs/biome/pull/1325
- feat(css_parser): CSS Parser: parse page at rule #1310 by @denbezrukov in https://github.com/biomejs/biome/pull/1319
- feat(css_parser): CSS Parser: parse layer #1320 by @denbezrukov in https://github.com/biomejs/biome/pull/1329
- feat(css_formatter): support @page and margin at-rules by @faultyserver in https://github.com/biomejs/biome/pull/1331
- feat(css_parser): support calc linear url var function by @suxin2017 in https://github.com/biomejs/biome/pull/1292
- CSS Parser: parse scope at rule #1334 by @denbezrukov in https://github.com/biomejs/biome/pull/1343
- fix(linter/rules): change wrong
lint/rules
tolinter/rules
in the url by @Marukome0743 in https://github.com/biomejs/biome/pull/1344 - feat(css_parser): CSS Parser: parse supports #1330 by @denbezrukov in https://github.com/biomejs/biome/pull/1332
- feat(css_formatter): format scope and layer at-rules by @faultyserver in https://github.com/biomejs/biome/pull/1346
- feat(css_formatter): formatting support for supports at-rules by @faultyserver in https://github.com/biomejs/biome/pull/1348
- feat(css_formatter): format functions and binary expressions by @faultyserver in https://github.com/biomejs/biome/pull/1347
- feat(rule): noThenProperty by @togami2864 in https://github.com/biomejs/biome/pull/1295
- refactor(cli): diagnostics printing by @ematipico in https://github.com/biomejs/biome/pull/1345
- feat(js_parser, js_formatter): allow empty type parameters in type alias and interface declaration by @togami2864 in https://github.com/biomejs/biome/pull/1350
- feat(css_parser,css_formatter): distinguish regular, custom, and dashed identifiers by @faultyserver in https://github.com/biomejs/biome/pull/1353
- feat(project): show message when a file is protected by @ematipico in https://github.com/biomejs/biome/pull/1358
- feat(css_formatter): automatically downcase all keywords and regular identifiers by @faultyserver in https://github.com/biomejs/biome/pull/1354
- feat(css_formatter): support meaningful boundaries for range formatting by @faultyserver in https://github.com/biomejs/biome/pull/1363
- chore: upgrade to rust 1.75.0 by @ematipico in https://github.com/biomejs/biome/pull/1364
- ci: benchmark analyzer with codspeed by @ematipico in https://github.com/biomejs/biome/pull/1366
- ci: benchmark js parser with codspeed by @ematipico in https://github.com/biomejs/biome/pull/1367
- ci: bench js formatter with codspeed by @ematipico in https://github.com/biomejs/biome/pull/1368
- ci: add JSON and CSS benchmarks by @ematipico in https://github.com/biomejs/biome/pull/1369
- feat(css_parser): parse CSS-wide keywords and disallow their usage as needed by @faultyserver in https://github.com/biomejs/biome/pull/1361
- Parse recovery trait by @denbezrukov in https://github.com/biomejs/biome/pull/1371
- docs(analyzer): update the link of snaphot testing by @chansuke in https://github.com/biomejs/biome/pull/1376
- chore(lint/useShorthandFunctionType): ignore if node has inner comments by @seitarof in https://github.com/biomejs/biome/pull/1365
- refactor: benchmark code generic by @ematipico in https://github.com/biomejs/biome/pull/1379
- fix: add
svg
as non-interactive html element by @chansuke in https://github.com/biomejs/biome/pull/1381 - feat(css_parser): better handling for Dimensions by @faultyserver in https://github.com/biomejs/biome/pull/1375
- ci: use codspeed criterion by @ematipico in https://github.com/biomejs/biome/pull/1387
- fix(website): fix the sponsor image by @ematipico in https://github.com/biomejs/biome/pull/1389
- ci: format and use
--all-targets
to detect used deps by @ematipico in https://github.com/biomejs/biome/pull/1388 - fix(project): correctly compute language settings for overrides by @ematipico in https://github.com/biomejs/biome/pull/1392
- feat(css_formatter): Add
quoteStyle
for css formatting by @faultyserver in https://github.com/biomejs/biome/pull/1384 - docs(pt-br): formatter section by @danspinola in https://github.com/biomejs/biome/pull/1315
- ci: unify benchmarks under one CI job by @ematipico in https://github.com/biomejs/biome/pull/1401
- doc(editors): how to use biome in
lsp-mode
for Emacs by @cxa in https://github.com/biomejs/biome/pull/1395 - feat(css-parser): generic component value by @denbezrukov in https://github.com/biomejs/biome/pull/1396
- docs: add source and source kind to rulemetadata and update lintdoc by @Levieber in https://github.com/biomejs/biome/pull/1290
- chore: remove vscode artifacts by @nhedger in https://github.com/biomejs/biome/pull/1402
- chore: add test case for issue by @ematipico in https://github.com/biomejs/biome/pull/1404
- chore(css_formatter): create
NodeConcept::Property
to group property nodes by @faultyserver in https://github.com/biomejs/biome/pull/1400 - docs: fixed indentation on code example by @robclancy in https://github.com/biomejs/biome/pull/1412
New Contributors
- @danielsarsi made their first contribution in https://github.com/biomejs/biome/pull/1305
- @Marukome0743 made their first contribution in https://github.com/biomejs/biome/pull/1344
- @danspinola made their first contribution in https://github.com/biomejs/biome/pull/1315
- @cxa made their first contribution in https://github.com/biomejs/biome/pull/1395
- @eryue0220 made their first contribution in https://github.com/biomejs/biome/pull/1137
- @robclancy made their first contribution in https://github.com/biomejs/biome/pull/1412
Full Changelog: https://github.com/biomejs/biome/compare/cli/v1.4.1-nightly.22dd4e1...cli/v1.4.1-nightly.d869a33
1、 biome-darwin-arm64 16.13MB
2、 biome-darwin-x64 17.45MB
3、 biome-linux-arm64 17.43MB
4、 biome-linux-arm64-musl 15.57MB
5、 biome-linux-x64 19.46MB
6、 biome-linux-x64-musl 18.71MB
7、 biome-win32-arm64.exe 19.01MB
8、 biome-win32-x64.exe 22.05MB