Skip to content

Conversation

@ericcornelissen
Copy link
Contributor

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.

Closes #202

This updates the configuration so that @typescript-eslint/no-shadow is enabled (instead of just no-shadow, following the @typescript-eslint/no-shadow documentation; otherwise some false positives will be outputted). I tried to split my commits per updated file so that I can motivate my changes. Below is an overview of this as well. Suggestions are certainly welcome, and the maintainers can feel free to change things as they see fit 🙂

Changes

In api-client.ts:

  • Duplicate use of "_" placeholder argument name.

In codeql.ts:

  • Two simple variable renames from "path" to "paths" since the types are arrays of strings (not just one string).
  • One function definition inside a function moved outside that function to avoid shadowing the "options" argument.

In config-utils.test.ts:

  • Rename "queries" variable in test cases to "testQueries" to avoid shadowing it in a subsequent helper function call (4 times).
  • Rename "path" twice in a hlper function to "validPath" and "invalidPath" to avoid shadowing "path". The new names are more explicit.

In config-utils.ts:

  • Rename throwaway variable "suite" to "found" when assigned from "find".
  • Rename local variable "path" to "newPath" as it is a modification of the "originalPath" provided to validateAndSanitisePath.
  • Rename instances of "path" to more explicit varients "ignorePath" and "includePath". Maybe "ignoredPath" and "includedPath" are better names?

In fingerprints.test.ts:

  • Rename shadowing "uri" argument to the more explicit "artifactURI".

In fingerprints.ts:

  • Rename various instances of "hash", shadowing the function with that name.

In upload-lib.ts:

  • Rename one instance of "path" to avoid shadowing.

Remove the "no-shadow": "off" override and replace it by enabling
"@typescript-eslint/no-shadow" in the "rules" section, following the
typescript-eslint docs:
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md#how-to-use
Duplicate use of "_" placeholder argument name. This change may conflict
with #192.
Two simple variable renames from "path" to "paths" since the types are
arrays of strings (not just one string).

One function definition inside a function moved outside that function
to avoid shadowing the "options" argument.
Rename "queries" variable in test cases to "testQueries" to avoid
shadowing it in a subsequent helper function call (4 times).

Rename "path" twice in a hlper function to "validPath" and "invalidPath"
to avoid shadowing "path". The new names are more explicit.
Rename throwaway variable "suite" to "found" when assigned from "find".

Rename local variable "path" to "newPath" as it is a modification of
the "originalPath" provided to `validateAndSanitisePath`.

Rename instances of "path" to more explicit varients "ignorePath" and
"includePath". Maybe "ignoredPath" and "includedPath" are better names?
Rename shadowing "uri" argument to the more explicit "artifactURI".
Rename various instances of "hash", shadowing the function with that
name.
Rename one instance of "path"  to avoid shadowing.
Copy link
Contributor

@chrisgavin chrisgavin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks good to me.

@chrisgavin chrisgavin merged commit c5d599e into github:main Nov 20, 2020
@ericcornelissen ericcornelissen deleted the eslint-rule/no-shadow branch November 20, 2020 13:29
@github-actions github-actions bot mentioned this pull request Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESLint transition: update code so "no-shadow" passes

2 participants