Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

🐛 When using private fieldName in constructor, rome says js/noUnusedVariables #3183

Closed
1 task done
meesvandongen opened this issue Sep 8, 2022 · 1 comment · Fixed by #3316
Closed
1 task done
Assignees
Labels
A-Linter Area: linter S-Bug: confirmed Status: report has been confirmed as a valid bug
Milestone

Comments

@meesvandongen
Copy link

Environment information

vscode plugin

What happened?

In this code:

export class Logger {
  constructor(private debugMode: boolean) {}

  private emitLog(msg: string) {
    if (this.debugMode) {
      console.log(msg);
    }
  }
}

Rome says This parameter is unused .rome(js/noUnusedVariables), pointing to debugMode in constructor(private debugMode: boolean) {}

Expected result

It should not be reported as unused.

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@meesvandongen meesvandongen added the S-To triage Status: user report of a possible bug that needs to be triaged label Sep 8, 2022
@ematipico ematipico added S-Bug: confirmed Status: report has been confirmed as a valid bug A-Linter Area: linter and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Sep 8, 2022
lgarron added a commit to cubing/cubing.js that referenced this issue Sep 10, 2022
Keep forever:

- `js/noDelete`
- `js/noNegationElse`
- `js/noShoutyConstants`

May require checking that Rome is detecting things correctly:

- `js/noUnusedVariables` (see rome/tools#3183)
- `js/noUnnecessaryContinue`

To refactor:

- `js/useSingleCaseStatement`
- `js/noUnusedTemplateLiteral`
- `js/useTemplate`
- `js/useSimplifiedLogicExpression`
- `js/useSingleVarDeclarator`
- `js/useBlockStatements`
- `js/noDoubleEquals`
- `js/noArguments`
- `js/noAsyncPromiseExecutor`
- `ts/useShorthandArrayType`
lgarron added a commit to cubing/cubing.js that referenced this issue Sep 10, 2022
Keep forever:

- `js/noDelete`
- `js/noNegationElse`
- `js/noShoutyConstants`

May require checking that Rome is detecting things correctly:

- `js/noUnusedVariables` (see rome/tools#3183)
- `js/noUnnecessaryContinue`

To refactor (some of these are frivolous, but they generally don't hurt):

- `js/useSingleCaseStatement`
- `js/noUnusedTemplateLiteral`
- `js/useTemplate`
- `js/useSimplifiedLogicExpression`
- `js/useSingleVarDeclarator`
- `js/useBlockStatements`
- `js/noDoubleEquals`
- `js/noArguments`
- `js/noAsyncPromiseExecutor`
- `ts/useShorthandArrayType`
lgarron added a commit to cubing/cubing.js that referenced this issue Sep 10, 2022
Keep forever:

- `js/noDelete`
- `js/noNegationElse`
- `js/noShoutyConstants`

May require checking that Rome is detecting things correctly:

- `js/noUnusedVariables` (see rome/tools#3183)
- `js/noUnnecessaryContinue`

To refactor (some of these are frivolous, but they generally don't hurt):

- `js/useSingleCaseStatement`
- `js/noUnusedTemplateLiteral`
- `js/useTemplate`
- `js/useSimplifiedLogicExpression`
- `js/useSingleVarDeclarator`
- `js/useBlockStatements`
- `js/noDoubleEquals`
- `js/noArguments`
- `js/noAsyncPromiseExecutor`
- `ts/useShorthandArrayType`
@github-actions
Copy link

This issue is stale because it has been open 14 days with no activity.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
Status: Done
4 participants