Skip to content
This repository was archived by the owner on Apr 27, 2021. It is now read-only.
This repository was archived by the owner on Apr 27, 2021. It is now read-only.

bool-param-default should ignore type declaration when function has meet requirements #857

Description

@michaelw85

I want to report a bug.

SonarTS version: 1.9.0

Node.js version: v10.15.1

TypeScript version: 3.4.5

SonarQube version: N/A

SonarLint version and used IDE: No, vscode

TSLint version: 5.16.0

Rule key:
bool-param-default
Provide a default value for 'devMode' so that the logic of the function is more evident when this parameter is missing. Consider defining another function if providing default value is not possible.

Reproducer

// Rules fires due to devMode?: boolean
const configure: (config: FrameworkConfiguration, devMode?: boolean) => FrameworkConfiguration = (
    config: FrameworkConfiguration,
    devMode: boolean = false
): FrameworkConfiguration => // function logic

Expected behavior
Rule should not throw error for type declaration if function sets a default value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions