Skip to content

Commit

Permalink
Merge branch 'main' into use-at-index
Browse files Browse the repository at this point in the history
  • Loading branch information
GunseiKPaseri committed Oct 9, 2024
2 parents 4a98336 + d2273a6 commit 387634a
Show file tree
Hide file tree
Showing 210 changed files with 5,535 additions and 2,358 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01_formatter_bug.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 📝 Formatter bug report
description: Report a bug or regression of the formatter
title: "📝 <TITLE>"
labels: [ "S-To triage" ]
labels: [ "S-Needs triage" ]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/02_lint_bug.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 💅 Linter bug report
description: Report a bug or regression of the linter
title: "💅 <TITLE>"
labels: [ "S-To triage" ]
labels: [ "S-Needs triage" ]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/03_bug.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: 🐛 Bug Report
description: Report a possible bug or regression
title: "🐛 <TITLE>"
labels: [ "S-To triage" ]
labels: [ "S-Needs triage" ]
body:
- type: markdown
attributes:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'crates/**_parser/**/*.rs'
- 'crates/**_formatter/**/*.rs'
- 'crates/**_analyze/**/*.rs'
- 'crates/biome_grit_patterns/**/*.rs'
push:
branches:
- main
Expand All @@ -19,6 +20,7 @@ on:
- 'crates/**_parser/**/*.rs'
- 'crates/**_formatter/**/*.rs'
- 'crates/**_analyze/**/*.rs'
- 'crates/biome_grit_patterns/**/*.rs'

env:
RUST_LOG: info
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/close-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Close issues

on:
schedule:
- cron: "0 0 * * *"


permissions:
issues: write

jobs:
close-issues:
if: github.repository == 'biomejs/biome'
runs-on: ubuntu-latest
steps:
- name: Close issue without reproduction
uses: actions-cool/issues-helper@v3
with:
actions: "close-issues"
token: ${{ secrets.GITHUB_TOKEN }}
labels: "S-Needs repro"
inactive-day: 3
38 changes: 38 additions & 0 deletions .github/workflows/needs-repro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Needs reproduction

on:
issues:
types: [ labeled ]

permissions:
issues: write

jobs:
reply-labeled:
if: github.repository == 'biomejs/biome'
runs-on: ubuntu-latest
steps:
- name: Remove triaging label
if: contains(github.event.issue.labels.*.name, 'S-Bug-confirmed') && contains(github.event.issue.labels.*.name, 'S-Needs triage')
uses: actions-cool/issues-helper@v3
with:
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: "S-Needs triage"

- name: Needs reproduction
if: github.event.label.name == 'S-Needs repro'
uses: actions-cool/issues-helper@v3
with:
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}, please provide a minimal reproduction. You can use one of the following options:
- Provide a link to [our playground](https://biomejs.dev/playground), if it's applicable.
- Provide a link to GitHub repository. To easily create a reproduction, you can use our interactive CLI via `npm create @biomejs/biome-reproduction`
Issues marked with `S-Needs repro` will be **closed** if they have **no activity within 3 days**.
labels: "S-Needs triage"
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
with:
node-version: 20
- name: Cache pnpm modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Free Disk Space
uses: ./.github/actions/free-disk-space
- name: Cache pnpm modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: echo "nightly=true" >> $GITHUB_ENV

- name: Check version changes
uses: EndBug/version-check@d4be4219408b50d1bbbfd350a47cbcb126878692 # v2.1.4
uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5
if: env.nightly != 'true'
id: version
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_js_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: echo "nightly=true" >> $GITHUB_ENV

- name: Check version changes
uses: EndBug/version-check@d4be4219408b50d1bbbfd350a47cbcb126878692 # v2.1.4
uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5
if: env.nightly != 'true'
id: version
with:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Cache pnpm modules
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_knope.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Check version changes
uses: EndBug/version-check@d4be4219408b50d1bbbfd350a47cbcb126878692 # v2.1.4
uses: EndBug/version-check@36ff30f37c7deabe56a30caa043d127be658c425 # v2.1.5
id: version
with:
diff-search: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/repository_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Warm up wasm-pack cache
id: cache-restore
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache/restore@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
with:
path: |
./target
Expand All @@ -52,7 +52,7 @@ jobs:
continue-on-error: true

- name: Save new wasm-pack cache
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache/save@2cdf405574d6ef1f33a1d12acccd3ae82f47b3f2 # v4.1.0
with:
path: |
./target
Expand Down
94 changes: 94 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,16 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

### Analyzer

#### Bug fixes

- Improved the message for unused suppression comments. Contributed by @dyc3

### CLI

#### Enhancements

- The `--summary` reporter now reports parsing diagnostics too. Contributed by @ematipico

### Configuration

#### Bug fixes
Expand All @@ -29,8 +37,94 @@ our [guidelines for writing a good changelog entry](https://github.com/biomejs/b

### Linter

#### Bug Fixes

- Biome no longer crashes when it encounters a string that contain a multibyte character ([#4181](https://github.com/biomejs/biome/issues/4181)).

This fixes a regression introduced in Biome 1.9.3
The regression affected the following linter rules:

- nursery/useSortedClasses
- nursery/useTrimStartEnd
- style/useTemplate
- suspicious/noMisleadingCharacterClass

Contributed by @Conaclos

- Fix [#4190](https://github.com/biomejs/biome/issues/4190), where the rule `noMissingVarFunction` wrongly reported a variable as missing when used inside a `var()` function that was a newline. Contributed by @ematipico

- Fix [#4041](https://github.com/biomejs/biome/issues/4041). Now the rule `useSortedClasses` won't be triggered if `className` is composed only by inlined variables. Contributed by @ematipico

- [useImportType](https://biomejs.dev/linter/rules/use-import-type/) and [useExportType](https://biomejs.dev/linter/rules/use-export-type/) now report useless inline type qualifiers ([#4178](https://github.com/biomejs/biome/issues/4178)).

The following fix is now proposed:

```diff
- import type { type A, B } from "";
+ import type { A, B } from "";

- export type { type C, D };
+ export type { C, D };
```

Contributed by @Conaclos

- [useExportType](https://biomejs.dev/linter/rules/use-export-type/) now reports ungrouped `export from`.

The following fix is now proposed:

```diff
- export { type A, type B } from "";
+ export type { A, B } from "";
```

Contributed by @Conaclos

- [noVoidTypeReturn](https://biomejs.dev/linter/rules/no-void-type-return/) now accepts `void` expressions in return position ([#4173](https://github.com/biomejs/biome/issues/4173)).

The following code is now accepted:

```ts
function f(): void {
return void 0;
}
```

Contributed by @Conaclos

- Fixes [#4059](https://github.com/biomejs/biome/issues/4059), the rule [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/) now correctly handles fragments containing HTML escapes (e.g. `&nbsp;`) inside expression escapes `{ ... }`.
The following code is no longer reported:

```jsx
function Component() {
return (
<div key={index}>{line || <>&nbsp;</>}</div>
)
}
```

Contributed by @fireairforce

### Parser

#### Bug Fixes

- The CSS parser now accepts more emoji in identifiers ([#3627](https://github.com/biomejs/biome/issues/3627#issuecomment-2392388022)).

Browsers accept more emoji than the standard allows.
Biome now accepts these additional emoji.

The following code is now correctly parsed:

```css
p {
--✨-color: red;
color: var(--✨-color);
}
```

Contributed by @Conaclos

## v1.9.3 (2024-10-01)

### CLI
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"node": ">20.0.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "8.7.0",
"@typescript-eslint/eslint-plugin": "8.8.0",
"dprint": "0.47.2",
"eslint": "9.11.1",
"eslint": "9.12.0",
"prettier": "3.3.3"
}
}
15 changes: 10 additions & 5 deletions crates/biome_analyze/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ use biome_deserialize_macros::Deserializable;
pub struct MyRuleOptions {
behavior: Behavior,
threshold: u8,
behavior_exceptions: Vec<String>
behavior_exceptions: Box<[Box<str>]>
}

#[derive(Clone, Debug, Default, Deserializable)]
Expand All @@ -182,6 +182,9 @@ pub enum Behavior {
}
```

Note that we use a boxed slice `Box<[Box<str>]>` instead of `Vec<String>`.
This allows saving memory: [boxed slices and boxed str use 2 words instead of three words](https://nnethercote.github.io/perf-book/type-sizes.html#boxed-slices).

To allow deserializing instances of the types `MyRuleOptions` and `Behavior`,
they have to implement the `Deserializable` trait from the `biome_deserialize` crate.
This is what the `Deserializable` keyword in the `#[derive]` statements above did.
Expand Down Expand Up @@ -432,16 +435,18 @@ impl Rule for ForLoopCountReferences {
#### Multiple signals

Some rules require you to find all possible cases upfront in `run` function.
To achieve that you can change Signals type from `Option<()>` to `Vec<()>`.
This will call the diagnostic/action function for every item of the vec.
To achieve that you can change Signals type from `Option<Self::State>` to an iterable data structure such as `Vec<Self::State>` or `Box<[Self::State]>`.
This will call the diagnostic/action function for every item of the data structure.
We prefer to use `Box<[_]>` over `Vec<_>` because it takes less memory.
You can easily convert a `Vec<_>` into a `Box<[_]>` using the `Vec::into_boxed_slice()` method.

Taking previous example and modifying it a bit we can apply diagnostic for each item easily.

```rust
impl Rule for ForLoopCountReferences {
type Query = Semantic<JsForStatement>;
type State = TextRange;
type Signals = Vec<Self::State>; // Replaced Option with Vec
type Signals = Box<[Self::State]>;
type Options = ();

fn run(ctx: &RuleContext<Self>) -> Self::Signals {
Expand All @@ -462,7 +467,7 @@ impl Rule for ForLoopCountReferences {
Some(range)
}).collect::<Vec<_>>();

write_ranges
write_ranges.into_boxed_slice()
}

fn diagnostic(_: &RuleContext<Self>, range: &Self::State) -> Option<RuleDiagnostic> {
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_analyze/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ where
SuppressionDiagnostic::new(
category!("suppressions/unused"),
suppression.comment_span,
"Suppression comment is not being used",
"Suppression comment has no effect. Remove the suppression or make sure you are suppressing the correct rule.",
)
});

Expand Down Expand Up @@ -424,7 +424,7 @@ where
suppression
.suppressed_instances
.iter()
.any(|(filter, v)| *filter == entry.rule && v == value)
.any(|(filter, v)| *filter == entry.rule && v == value.as_ref())
})
});

Expand Down
2 changes: 1 addition & 1 deletion crates/biome_analyze/src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub struct SignalEntry<'phase, L: Language> {
/// Unique identifier for the rule that emitted this signal
pub rule: RuleKey,
/// Optional rule instances being suppressed
pub instances: Vec<String>,
pub instances: Box<[Box<str>]>,
/// Text range in the document this signal covers
pub text_range: TextRange,
}
Expand Down
Loading

0 comments on commit 387634a

Please sign in to comment.