Skip to content
This repository has been 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

Open
michaelw85 opened this issue May 24, 2019 · 0 comments

Comments

@michaelw85
Copy link

michaelw85 commented May 24, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants