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

chore: promote rules #532

Merged
merged 7 commits into from
Oct 16, 2023
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
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,28 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom
### JavaScript APIs
### Linter

#### Promoted rules

- [complexity/noExcessiveCognitiveComplexity](https://biomejs.dev/linter/rules/no-excessive-cognitive-complexity)
- [complexity/noVoid](https://biomejs.dev/linter/rules/no-void)
- [correctness/useExhaustiveDependencies](https://biomejs.dev/linter/rules/use-exhaustive-dependencies)
- [correctness/useHookAtTopLevel](https://biomejs.dev/linter/rules/use-hook-at-top-level)
- [performance/noAccumulatingSpread](https://biomejs.dev/linter/rules/no-accumulating-spread)
- [style/useCollapsedElseIf](https://biomejs.dev/linter/rules/use-collapsed-else-if)
- [suspicious/noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type)
- [suspicious/noFallthroughSwitchClause](https://biomejs.dev/linter/rules/no-fallthrough-switch-clause)
- [suspicious/noGlobalIsFinite](https://biomejs.dev/linter/rules/no-global-is-finite)
- [suspicious/noGlobalIsNan](https://biomejs.dev/linter/rules/no-global-is-nan)
- [suspicious/useIsArray](https://biomejs.dev/linter/rules/use-is-array)

The following rules are now recommended:

- [noAccumulatingSpread](https://biomejs.dev/linter/rules/)
- [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type)
- [noFallthroughSwitchClause](https://biomejs.dev/linter/rules/no-fallthrough-switch-clause)
- [noForEach](https://biomejs.dev/linter/rules/no-for-each)


#### Bug fixes

- Fix [#243](https://github.com/biomejs/biome/issues/243) a false positive case where the incorrect scope was defined for the `infer` type. in rule [noUndeclaredVariables](https://biomejs.dev/linter/rules/no-undeclared-variables/). Contributed by @denbezrukov
Expand Down Expand Up @@ -174,6 +196,8 @@ Read our [guidelines for writing a good changelog entry](https://github.com/biom

- [useValidAriaProps](https://biomejs.dev/linter/rules/use-valid-aria-props) now provides an unsafe code fix that removes invalid properties. Contributed by @vasucp1207

- `noExcessiveComplexity` was renamed to `noExcessiveCognitiveComplexity`

#### Bug fixes

- Fix [#294](https://github.com/biomejs/biome/issues/294). [noConfusingVoidType](https://biomejs.dev/linter/rules/no-confusing-void-type/) no longer reports false positives for return types. Contributed by @b4s36t4
Expand Down Expand Up @@ -862,9 +886,9 @@ New rules are promoted, please check [#4750](https://github.com/rome/tools/discu

The following rules are now recommended:

- [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/)
**- [noUselessFragments](https://biomejs.dev/linter/rules/no-useless-fragments/)
- [noRedundantUseStrict](https://biomejs.dev/linter/rules/no-redundant-use-strict/)
- [useExponentiationOperator](https://biomejs.dev/linter/rules/use-exponentiation-operator/)
- [useExponentiationOperator](https://biomejs.dev/linter/rules/use-exponentiation-operator/)**

#### Other changes

Expand Down
43 changes: 0 additions & 43 deletions crates/biome_cli/tests/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2491,49 +2491,6 @@ array.map((sentence) => sentence.split(" ")).flat();
));
}

#[test]
fn should_not_enable_nursery_rules() {
let mut fs = MemoryFileSystem::default();
let mut console = BufferConsole::default();

let configuration = r#" {
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"nursery": {
"noAccumulatingSpread": "error"
}
}
}
}"#;

let configuration_path = Path::new("biome.json");
fs.insert(configuration_path.into(), configuration.as_bytes());

let file_path = Path::new("fix.ts");
fs.insert(file_path.into(), r#"let confusingVoidType: void;"#);

let result = run_cli(
DynRef::Borrowed(&mut fs),
&mut console,
Args::from([("check"), file_path.as_os_str().to_str().unwrap()].as_slice()),
);

assert!(result.is_err(), "run_cli returned {result:?}");

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"should_not_enable_nursery_rules",
fs,
console,
result,
));
}

#[test]
fn apply_bogus_argument() {
let mut fs = MemoryFileSystem::default();
Expand Down
43 changes: 0 additions & 43 deletions crates/biome_cli/tests/commands/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2101,49 +2101,6 @@ array.map((sentence) => sentence.split(" ")).flat();
));
}

#[test]
fn should_not_enable_nursery_rules() {
let mut fs = MemoryFileSystem::default();
let mut console = BufferConsole::default();

let configuration = r#" {
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"nursery": {
"noAccumulatingSpread": "error"
}
}
}
}"#;

let configuration_path = Path::new("biome.json");
fs.insert(configuration_path.into(), configuration.as_bytes());

let file_path = Path::new("fix.ts");
fs.insert(file_path.into(), r#"let confusingVoidType: void;"#);

let result = run_cli(
DynRef::Borrowed(&mut fs),
&mut console,
Args::from([("lint"), file_path.as_os_str().to_str().unwrap()].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"should_not_enable_nursery_rules",
fs,
console,
result,
));
}

#[test]
fn apply_bogus_argument() {
let mut fs = MemoryFileSystem::default();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ biome.json:6:13 deserialize ━━━━━━━━━━━━━━━━━
- noUnusedVariables
- noVoidElementsWithChildren
- noVoidTypeReturn
- useExhaustiveDependencies
- useHookAtTopLevel
- useIsNan
- useValidForDirection
- useYield
Expand Down
22 changes: 11 additions & 11 deletions crates/biome_diagnostics_categories/src/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ define_categories! {
"lint/a11y/useValidAriaValues": "https://biomejs.dev/linter/rules/use-valid-aria-values",
"lint/a11y/useValidLang": "https://biomejs.dev/linter/rules/use-valid-lang",
"lint/complexity/noBannedTypes": "https://biomejs.dev/linter/rules/no-banned-types",
"lint/complexity/noExcessiveCognitiveComplexity": "https://biomejs.dev/linter/rules/no-excessive-cognitive-complexity",
"lint/complexity/noExtraBooleanCast": "https://biomejs.dev/linter/rules/no-extra-boolean-cast",
"lint/complexity/noForEach": "https://biomejs.dev/linter/rules/no-for-each",
"lint/complexity/noMultipleSpacesInRegularExpressionLiterals": "https://biomejs.dev/linter/rules/no-multiple-spaces-in-regular-expression-literals",
Expand All @@ -53,6 +54,7 @@ define_categories! {
"lint/complexity/noUselessSwitchCase": "https://biomejs.dev/linter/rules/no-useless-switch-case",
"lint/complexity/noUselessThisAlias": "https://biomejs.dev/linter/rules/no-useless-this-alias",
"lint/complexity/noUselessTypeConstraint": "https://biomejs.dev/linter/rules/no-useless-type-constraint",
"lint/complexity/noVoid": "https://biomejs.dev/linter/rules/no-void",
"lint/complexity/noWith": "https://biomejs.dev/linter/rules/no-with",
"lint/complexity/useFlatMap": "https://biomejs.dev/linter/rules/use-flat-map",
"lint/complexity/useLiteralKeys": "https://biomejs.dev/linter/rules/use-literal-keys",
Expand Down Expand Up @@ -85,38 +87,30 @@ define_categories! {
"lint/correctness/noUnusedVariables": "https://biomejs.dev/linter/rules/no-unused-variables",
"lint/correctness/noVoidElementsWithChildren": "https://biomejs.dev/linter/rules/no-void-elements-with-children",
"lint/correctness/noVoidTypeReturn": "https://biomejs.dev/linter/rules/no-void-type-return",
"lint/correctness/useExhaustiveDependencies": "https://biomejs.dev/linter/rules/use-exhaustive-dependencies",
"lint/correctness/useHookAtTopLevel": "https://biomejs.dev/linter/rules/use-hook-at-top-level",
"lint/correctness/useIsNan": "https://biomejs.dev/linter/rules/use-is-nan",
"lint/correctness/useValidForDirection": "https://biomejs.dev/linter/rules/use-valid-for-direction",
"lint/correctness/useYield": "https://biomejs.dev/linter/rules/use-yield",
"lint/nursery/noAccumulatingSpread": "https://biomejs.dev/linter/rules/no-accumulating-spread",
"lint/nursery/noApproximativeNumericConstant": "https://biomejs.dev/lint/rules/no-approximative-numeric-constant",
"lint/nursery/noConfusingVoidType": "https://biomejs.dev/linter/rules/no-confusing-void-type",
"lint/nursery/noDuplicateJsonKeys": "https://biomejs.dev/linter/rules/no-duplicate-json-keys",
"lint/nursery/noEmptyBlockStatements": "https://biomejs.dev/lint/rules/no-empty-block-statements",
"lint/nursery/noEmptyCharacterClassInRegex": "https://biomejs.dev/lint/rules/no-empty-character-class-in-regex",
"lint/nursery/noExcessiveComplexity": "https://biomejs.dev/linter/rules/no-excessive-complexity",
"lint/nursery/noFallthroughSwitchClause": "https://biomejs.dev/linter/rules/no-fallthrough-switch-clause",
"lint/nursery/noGlobalIsFinite": "https://biomejs.dev/linter/rules/no-global-is-finite",
"lint/nursery/noGlobalIsNan": "https://biomejs.dev/linter/rules/no-global-is-nan",
"lint/nursery/noInteractiveElementToNoninteractiveRole": "https://biomejs.dev/lint/rules/no-interactive-element-to-noninteractive-role",
"lint/nursery/noInvalidNewBuiltin": "https://biomejs.dev/lint/rules/no-invalid-new-builtin",
"lint/nursery/noMisleadingInstantiator": "https://biomejs.dev/linter/rules/no-misleading-instantiator",
"lint/nursery/noMisrefactoredShorthandAssign": "https://biomejs.dev/lint/rules/no-misrefactored-shorthand-assign",
"lint/nursery/noUnusedImports": "https://biomejs.dev/lint/rules/no-unused-imports",
"lint/nursery/noUselessElse": "https://biomejs.dev/lint/rules/no-useless-else",
"lint/nursery/noUselessLoneBlockStatements": "https://biomejs.dev/lint/rules/no-useless-lone-block-statements",
"lint/nursery/noVoid": "https://biomejs.dev/linter/rules/no-void",
"lint/nursery/useAriaActivedescendantWithTabindex": "https://biomejs.dev/lint/rules/use-aria-activedescendant-with-tabindex",
"lint/nursery/useArrowFunction": "https://biomejs.dev/linter/rules/use-arrow-function",
"lint/nursery/useAsConstAssertion": "https://biomejs.dev/lint/rules/use-as-const-assertion",
"lint/nursery/useBiomeSuppressionComment": "https://biomejs.dev/lint/rules/use-biome-suppression-comment",
"lint/nursery/useCollapsedElseIf": "https://biomejs.dev/lint/rules/use-collapsed-else-if",
"lint/nursery/useExhaustiveDependencies": "https://biomejs.dev/linter/rules/use-exhaustive-dependencies",
"lint/nursery/useGroupedTypeImport": "https://biomejs.dev/linter/rules/use-grouped-type-import",
"lint/nursery/useHookAtTopLevel": "https://biomejs.dev/linter/rules/use-hook-at-top-level",
"lint/nursery/useImportRestrictions": "https://biomejs.dev/linter/rules/use-import-restrictions",
"lint/nursery/useIsArray": "https://biomejs.dev/linter/rules/use-is-array",
"lint/nursery/useShorthandAssign": "https://biomejs.dev/lint/rules/use-shorthand-assign",
"lint/performance/noAccumulatingSpread": "https://biomejs.dev/linter/rules/no-accumulating-spread",
"lint/performance/noDelete": "https://biomejs.dev/linter/rules/no-delete",
"lint/security/noDangerouslySetInnerHtml": "https://biomejs.dev/linter/rules/no-dangerously-set-inner-html",
"lint/security/noDangerouslySetInnerHtmlWithChildren": "https://biomejs.dev/linter/rules/no-dangerously-set-inner-html-with-children",
Expand All @@ -134,6 +128,7 @@ define_categories! {
"lint/style/noUnusedTemplateLiteral": "https://biomejs.dev/linter/rules/no-unused-template-literal",
"lint/style/noVar": "https://biomejs.dev/linter/rules/no-var",
"lint/style/useBlockStatements": "https://biomejs.dev/linter/rules/use-block-statements",
"lint/style/useCollapsedElseIf": "https://biomejs.dev/lint/rules/use-collapsed-else-if",
"lint/style/useConst": "https://biomejs.dev/linter/rules/use-const",
"lint/style/useDefaultParameterLast": "https://biomejs.dev/linter/rules/use-default-parameter-last",
"lint/style/useEnumInitializers": "https://biomejs.dev/linter/rules/use-enum-initializers",
Expand All @@ -156,6 +151,7 @@ define_categories! {
"lint/suspicious/noCommentText": "https://biomejs.dev/linter/rules/no-comment-text",
"lint/suspicious/noCompareNegZero": "https://biomejs.dev/linter/rules/no-compare-neg-zero",
"lint/suspicious/noConfusingLabels": "https://biomejs.dev/linter/rules/no-confusing-labels",
"lint/suspicious/noConfusingVoidType": "https://biomejs.dev/linter/rules/no-confusing-void-type",
"lint/suspicious/noConsoleLog": "https://biomejs.dev/linter/rules/no-console-log",
"lint/suspicious/noConstEnum": "https://biomejs.dev/linter/rules/no-const-enum",
"lint/suspicious/noControlCharactersInRegex": "https://biomejs.dev/linter/rules/no-control-characters-in-regex",
Expand All @@ -169,7 +165,10 @@ define_categories! {
"lint/suspicious/noEmptyInterface": "https://biomejs.dev/linter/rules/no-empty-interface",
"lint/suspicious/noExplicitAny": "https://biomejs.dev/linter/rules/no-explicit-any",
"lint/suspicious/noExtraNonNullAssertion": "https://biomejs.dev/linter/rules/no-extra-non-null-assertion",
"lint/suspicious/noFallthroughSwitchClause": "https://biomejs.dev/linter/rules/no-fallthrough-switch-clause",
"lint/suspicious/noFunctionAssign": "https://biomejs.dev/linter/rules/no-function-assign",
"lint/suspicious/noGlobalIsFinite": "https://biomejs.dev/linter/rules/no-global-is-finite",
"lint/suspicious/noGlobalIsNan": "https://biomejs.dev/linter/rules/no-global-is-nan",
"lint/suspicious/noImportAssign": "https://biomejs.dev/linter/rules/no-import-assign",
"lint/suspicious/noLabelVar": "https://biomejs.dev/linter/rules/no-label-var",
"lint/suspicious/noPrototypeBuiltins": "https://biomejs.dev/linter/rules/no-prototype-builtins",
Expand All @@ -182,6 +181,7 @@ define_categories! {
"lint/suspicious/noUnsafeNegation": "https://biomejs.dev/linter/rules/no-unsafe-negation",
"lint/suspicious/useDefaultSwitchClauseLast": "https://biomejs.dev/linter/rules/use-default-switch-clause-last",
"lint/suspicious/useGetterReturn": "https://biomejs.dev/linter/rules/use-getter-return",
"lint/suspicious/useIsArray": "https://biomejs.dev/linter/rules/use-is-array",
"lint/suspicious/useNamespaceKeyword": "https://biomejs.dev/linter/rules/use-namespace-keyword",
"lint/suspicious/useValidTypeof": "https://biomejs.dev/linter/rules/use-valid-typeof",
;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use biome_analyze::context::RuleContext;
use biome_analyze::{declare_rule, ActionCategory, Ast, Rule, RuleDiagnostic};
use biome_analyze::{declare_rule, ActionCategory, Ast, FixKind, Rule, RuleDiagnostic};
use biome_console::markup;
use biome_diagnostics::Applicability;
use biome_js_syntax::jsx_ext::AnyJsxElement;
Expand Down Expand Up @@ -68,6 +68,7 @@ declare_rule! {
version: "1.0.0",
name: "useAnchorContent",
recommended: true,
fix_kind: FixKind::Unsafe,
}
}

Expand Down
Loading
Loading