Skip to content

Commit

Permalink
suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Oct 16, 2023
1 parent 0937a79 commit eef7b1e
Show file tree
Hide file tree
Showing 56 changed files with 128 additions and 103 deletions.
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
4 changes: 2 additions & 2 deletions crates/biome_diagnostics_categories/src/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +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/noExcessiveComplexity": "https://biomejs.dev/linter/rules/no-excessive-complexity",
"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 Down Expand Up @@ -96,7 +96,6 @@ define_categories! {
"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/noGlobalIsFinite": "https://biomejs.dev/linter/rules/no-global-is-finite",
"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",
Expand Down Expand Up @@ -168,6 +167,7 @@ define_categories! {
"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",
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_js_analyze/src/analyzers/complexity.rs

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

Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@ declare_rule! {
///
/// The allowed values range from 1 through 254. The default is 15.
///
pub(crate) NoExcessiveComplexity {
pub(crate) NoExcessiveCognitiveComplexity {
version: "1.0.0",
name: "noExcessiveComplexity",
name: "noExcessiveCognitiveComplexity",
recommended: false,
}
}

impl Rule for NoExcessiveComplexity {
impl Rule for NoExcessiveCognitiveComplexity {
type Query = CognitiveComplexity;
type State = ();
type Signals = Option<Self::State>;
Expand Down Expand Up @@ -372,7 +372,7 @@ pub struct ComplexityScore {
calculated_score: u8,
}

/// Options for the rule `noNestedModuleImports`.
/// Options for the rule `noExcessiveCognitiveComplexity`.
#[derive(Deserialize, Serialize, Debug, Clone, Bpaf, Eq, PartialEq)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
Expand Down
4 changes: 2 additions & 2 deletions crates/biome_js_analyze/src/options.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module contains the rules that have options
use crate::analyzers::complexity::no_excessive_complexity::{
use crate::analyzers::complexity::no_excessive_cognitive_complexity::{
complexity_options, ComplexityOptions,
};
use crate::semantic_analyzers::correctness::use_exhaustive_dependencies::{
Expand Down Expand Up @@ -52,7 +52,7 @@ impl FromStr for PossibleOptions {
impl PossibleOptions {
pub fn extract_option(&self, rule_key: &RuleKey) -> RuleOptions {
match rule_key.rule_name() {
"noExcessiveComplexity" => {
"noExcessiveCognitiveComplexity" => {
let options = match self {
PossibleOptions::Complexity(options) => options.clone(),
_ => ComplexityOptions::default(),
Expand Down
2 changes: 0 additions & 2 deletions crates/biome_js_analyze/src/semantic_analyzers/nursery.rs

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

2 changes: 2 additions & 0 deletions crates/biome_js_analyze/src/semantic_analyzers/suspicious.rs

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

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function booleanOperators() {

# Diagnostics
```
booleanOperators.js:1:10 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
booleanOperators.js:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function booleanOperators2() {

# Diagnostics
```
booleanOperators2.js:1:10 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
booleanOperators2.js:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function handleArrowDown(event: React.KeyboardEvent) {
# Diagnostics
```
complexEventHandler.ts:1:10 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
complexEventHandler.ts:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━

! Excessive complexity detected.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function excessiveNesting() {

# Diagnostics
```
excessiveNesting.js:10:46 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
excessiveNesting.js:10:46 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function functionalChain(array) {

# Diagnostics
```
functionalChain.js:4:24 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
functionalChain.js:4:24 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function lambdas(array) {

# Diagnostics
```
lambdas.js:4:26 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
lambdas.js:4:26 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand All @@ -55,7 +55,7 @@ lambdas.js:4:26 lint/complexity/noExcessiveComplexity ━━━━━━━━
```

```
lambdas.js:10:22 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
lambdas.js:10:22 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand All @@ -72,7 +72,7 @@ lambdas.js:10:22 lint/complexity/noExcessiveComplexity ━━━━━━━━
```

```
lambdas.js:16:23 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
lambdas.js:16:23 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand All @@ -89,7 +89,7 @@ lambdas.js:16:23 lint/complexity/noExcessiveComplexity ━━━━━━━━
```

```
lambdas.js:22:32 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
lambdas.js:22:32 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function nestedControlFlowStructures(num) {

# Diagnostics
```
nestedControlFlowStructures.js:1:10 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━
nestedControlFlowStructures.js:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function simpleBranches() {

# Diagnostics
```
simpleBranches.js:1:10 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
simpleBranches.js:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function simpleBranches2() {

# Diagnostics
```
simpleBranches2.js:1:10 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
simpleBranches2.js:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function sumOfPrimes(max) {

# Diagnostics
```
sumOfPrimes.js:1:10 lint/complexity/noExcessiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
sumOfPrimes.js:1:10 lint/complexity/noExcessiveCognitiveComplexity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! Excessive complexity detected.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"linter": {
"rules": {
"complexity": {
"noExcessiveComplexity": {
"noExcessiveCognitiveComplexity": {
"level": "error",
"options": {
"maxAllowedComplexity": 6
Expand Down
Loading

0 comments on commit eef7b1e

Please sign in to comment.