Skip to content

Commit

Permalink
fix(project): correctly map globals (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico authored Oct 20, 2023
1 parent 9639141 commit 888b158
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom
#### Bug fixes

- Fix [#548](https://github.com/biomejs/biome/issues/548) which made [noSelfAssign](https://biomejs.dev/linter/rules/no-self-assign) panic.
- Fix [#555](https://github.com/biomejs/biome/issues/555), by correctly map `globals` into the workspace.

### Parser

### VSCode

## 1.3.0
## 1.3.0 (2022-10-19)

### Analyzer

Expand Down
7 changes: 7 additions & 0 deletions crates/biome_cli/tests/commands/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,13 @@ fn ignore_configured_globals() {
let rome_json = r#"{
"javascript": {
"globals": ["foo", "bar"]
},
"linter": {
"rules": {
"correctness": {
"noUndeclaredVariables": "error"
}
}
}
}"#;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ expression: content
{
"javascript": {
"globals": ["foo", "bar"]
},
"linter": {
"rules": {
"correctness": {
"noUndeclaredVariables": "error"
}
}
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_service/src/file_handlers/javascript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ fn organize_imports(parse: AnyParse) -> Result<OrganizeImportsResult, WorkspaceE
fn compute_analyzer_options(settings: &SettingsHandle, file_path: PathBuf) -> AnalyzerOptions {
let configuration = AnalyzerConfiguration {
rules: to_analyzer_rules(settings.as_ref(), file_path.as_path()),
globals: if let Some(globals) = &settings.as_ref().languages.javascript.globals.as_ref() {
globals: if let Some(globals) = settings.as_ref().languages.javascript.globals.as_ref() {
globals
.iter()
.map(|global| global.to_string())
Expand Down
2 changes: 2 additions & 0 deletions crates/biome_service/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ impl From<JavascriptConfiguration> for LanguageSettings<JsLanguage> {
let organize_imports = javascript.organize_imports;
if let Some(_organize_imports) = organize_imports {}

language_setting.globals = javascript.globals.map(|global| global.into_index_set());

language_setting
}
}
Expand Down
3 changes: 2 additions & 1 deletion website/src/content/docs/internals/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom
#### Bug fixes

- Fix [#548](https://github.com/biomejs/biome/issues/548) which made [noSelfAssign](https://biomejs.dev/linter/rules/no-self-assign) panic.
- Fix [#555](https://github.com/biomejs/biome/issues/555), by correctly map `globals` into the workspace.

### Parser

### VSCode

## 1.3.0
## 1.3.0 (2022-10-19)

### Analyzer

Expand Down

0 comments on commit 888b158

Please sign in to comment.