Skip to content

Commit

Permalink
fix(lint/noBarrelFile): rule source (#2464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos authored Apr 15, 2024
1 parent 2dce6af commit d4b2d3e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ pub(crate) fn migrate_eslint_any_rule(
let rule = group.use_await.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
"barrel-files/avoid-barrel-files" => {
if !options.include_inspired {
results.has_inspired_rules = true;
return false;
}
let group = rules.performance.get_or_insert_with(Default::default);
let rule = group.no_barrel_file.get_or_insert(Default::default());
rule.set_level(rule_severity.into());
}
"barrel-files/avoid-namespace-import" => {
let group = rules.style.get_or_insert_with(Default::default);
let rule = group.no_namespace_import.get_or_insert(Default::default());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ declare_rule! {
version: "1.6.0",
name: "noBarrelFile",
recommended: false,
sources: &[RuleSource::EslintBarrelFiles("avoid-namespace-import")],
sources: &[RuleSource::EslintBarrelFiles("avoid-barrel-files")],
source_kind: RuleSourceKind::Inspired,
}
}
Expand Down
3 changes: 2 additions & 1 deletion website/src/content/docs/linter/rules-sources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ Some **Biome** rules might **not** have options, compared to the original rule.
### eslint-plugin-barrel-files
| eslint-plugin-barrel-files rule name | Biome rule name |
| ---- | ---- |
| [avoid-namespace-import](https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-namespace-import.md) |[noBarrelFile](/linter/rules/no-barrel-file) (inspired) |
| [avoid-barrel-files](https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-barrel-files.md) |[noBarrelFile](/linter/rules/no-barrel-file) (inspired) |
| [avoid-namespace-import](https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-namespace-import.md) |[noNamespaceImport](/linter/rules/no-namespace-import) |
| [avoid-re-export-all](https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-re-export-all.md) |[noReExportAll](/linter/rules/no-re-export-all) |
### eslint-plugin-import
| eslint-plugin-import rule name | Biome rule name |
Expand Down
2 changes: 1 addition & 1 deletion website/src/content/docs/linter/rules/no-barrel-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: noBarrelFile (since v1.6.0)

**Diagnostic Category: `lint/performance/noBarrelFile`**

Inspired from: <a href="https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-namespace-import.md" target="_blank"><code>avoid-namespace-import</code></a>
Inspired from: <a href="https://github.com/thepassle/eslint-plugin-barrel-files/blob/main/docs/rules/avoid-barrel-files.md" target="_blank"><code>avoid-barrel-files</code></a>

Disallow the use of barrel file.

Expand Down

0 comments on commit d4b2d3e

Please sign in to comment.