Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lint/noBarrelFile): rule source #2464

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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