standard / ts-standard

Typescript style guide, linter, and formatter using StandardJS
https://www.npmjs.com/package/ts-standard
MIT License
464 stars 36 forks source link

Three unused function parameters #109

Closed LinusU closed 3 years ago

LinusU commented 3 years ago

What version of this package are you using?

10.0.0

What operating system, Node.js, and npm version?

macOS 11.0.1, Node v12.18.2

What happened?

willResolveField (_: {}, __: {}, ___: {}, { path, fieldName, parentType, returnType }: GraphQLResolveInfo): ReturnType<NonNullable<GraphQLExtension['willResolveField']>> {
  // ...
}

Parameter name ___ trimmed as _ must match one of the following formats: camelCase, PascalCase, UPPER_CASE (@typescript-eslint/naming-convention)

What did you expect to happen?

I expected no errors since I'm using the _, __, and ___ names to ignore the arguments

Are you willing to submit a pull request to fix this bug?

Yes

theoludwig commented 3 years ago

Right, maybe it has something to do with the rules defined in eslint-config-standard-with-typescript. @LinusU

toddbluhm commented 3 years ago

Does this error still occur if you name the params and start them with _ so

willResolveField (_param1: {}, _param2: {}, _param3: {}, { path, fieldName, parentType, returnType }: GraphQLResolveInfo): ReturnType<NonNullable<GraphQLExtension['willResolveField']>> {
  // ...
}

I believe the rule wants to you give them proper arg names, just prefix them with _ to designate they are ignored. Feel free to open an issue in the rules project if you think it should be changed.