You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ESLint transition: update code so "@typescript-eslint/no-unused-vars" passes #192
During the transition from TSLint (now deprecated) to ESLint for typescript linting we introduced some new rules that don't yet pass and added a temporary override in the .eslintrc.json file to temporarily disable them.
This issue covers removing that temporary override and any changes to the typescript code required to get the rule passing. Use npm run lint to run the linter and once you've done changing the typescript don't forget to also run npm run build to reflect the changes in the built javascript (which also needs to be checked in).
...\codeql-action\src\api-client.ts
36:74 warning '_' is defined but never used @typescript-eslint/no-unused-vars
37:68 warning '_' is defined but never used @typescript-eslint/no-unused-vars
...\codeql-action\src\config-utils.test.ts
734:9 warning '_queries' is defined but never used @typescript-eslint/no-unused-vars
735:9 warning '_extraSearchPath' is defined but never used @typescript-eslint/no-unused-vars
I'm wondering if we want to remove them - which is possible, they're all trailing function arguments that can be removed safely without consequence - or if we want to configure the rule to allow unused variables if they either A) start with an underscore, or B) consist only of underscores. (This may desirable e.g. if you want to be explicit about the public function interface.) This can be archived by adding the following to the .eslintrc.json file:
I'm sorry I dropped the ball on replying to this so long.
I don't have a strong enough sense of what we're trying to achieve with these extra parameters to have a definitive answer for you, but perhaps @robertbrignull might?
It seems like these parameters are superfluous and so could be removed fairly easily, but maybe there's value in keeping them in the codebase for documentation or something else?
Regarding _queries and_extraSearchPath, I'm not sure what they are doing there either. Those are the args of the resolveQueries method but we aren't using them in that particular implementation. I think deleting those ares is fine. There are other definitions of resolveQueries in that file that don't have any args.
I think the cases in api-client.ts have been removed since that comment was made, so that's good.
So yeah enabling @typescript-eslint/no-unused-vars should be nice and easy now.
Activity
ericcornelissen commentedon Nov 19, 2020
Currently (aafb457) the output of
npm run lintwith the @typescript-eslint/no-unused-vars rule enabled is:I'm wondering if we want to remove them - which is possible, they're all trailing function arguments that can be removed safely without consequence - or if we want to configure the rule to allow unused variables if they either A) start with an underscore, or B) consist only of underscores. (This may desirable e.g. if you want to be explicit about the public function interface.) This can be archived by adding the following to the
.eslintrc.jsonfile:cbraynor commentedon Dec 23, 2020
I'm sorry I dropped the ball on replying to this so long.
I don't have a strong enough sense of what we're trying to achieve with these extra parameters to have a definitive answer for you, but perhaps @robertbrignull might?
It seems like these parameters are superfluous and so could be removed fairly easily, but maybe there's value in keeping them in the codebase for documentation or something else?
robertbrignull commentedon Jan 4, 2021
Regarding
_queriesand_extraSearchPath, I'm not sure what they are doing there either. Those are the args of theresolveQueriesmethod but we aren't using them in that particular implementation. I think deleting those ares is fine. There are other definitions ofresolveQueriesin that file that don't have any args.I think the cases in
api-client.tshave been removed since that comment was made, so that's good.So yeah enabling
@typescript-eslint/no-unused-varsshould be nice and easy now.Fix no shadow issues in api-client.ts