Bug: [no-shadow] inconsistent reports on function parameter names inside ambient declarations clashing with real variable declarations #10539
Labels
accepting prs
Go ahead, send a pull request that resolves this issue
bug
Something isn't working
locked due to age
Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Before You File a Bug Report Please Confirm You Have Done The Following...
Playground Link
https://typescript-eslint.io/play/#ts=5.6.3&fileType=.tsx&code=CYUwxgNghgTiAEkoGdnwMoHsC2IDC0qAjPAN4CwAUPIpgHbIAuMArmI5jABRj1OvtOABVhRsALnhQ6ATwCUAbio1kOEAFkQjABaZgXXDr0iYYydPlLq8Vbk1HgAdQCWOgKIAPAA4RnYVwBKWiwwdAAqMl4gBlq6wCZiAPrmsnKS-M50AOZWNAD0efAAUixMUvAAZiAA7vDYnAiMIEzIAHTtyjZq9nEAgmBgIF6MmVl4UBAQAEZQYADWPBPTs3OSMQ4JElKp8AC8AHzblp22IEIwmFEwjDJrsBfVAGIsdOzO9Jsp8nuHAG6YzmAVgAvlQKi83vRaAxmGwODBNlw5GR4KDKODXiMoYY4ojkaRUWCIVi6HVYsZRNhEkiUWiMZDSfdME9ie86HjaVQqAV4O1WhgxAhtFAvFE6KN4NVXNp4DoEGIps4QHRGJVWVDQEhTCTxFzKJroHA1Zi2V1cM8TfQuPSSZ8jml4P9AVYbabXR9KTSCcCrNzCnz4FMWKq6JhVVKdLLtPLsIrlarfrBnFAphAEAbRCT4FxEzA8mnGHleDD4CAPGIfM00nqM0bc2aQAA1JMptNrMBLGbzO0WZEHR0AoFEy2kjuTLtzDnehTwHm9CCqeCh0swC4wNDOCqO2D5rRFviq5xoUogYDwTJMEBQM-RuA18CGhAFhvNmDJ1MgAAyWnbnZWm2-Rgvj7P5BxddVRz-btKUAr1UV9fUH1gBBizKU5X3fNM8APX9x3-SlsJhYCfgHZ1hwZRAoMnAiDzgn09R5AA5TAVzXDctzlGxhWAZlTyXQVzzQAADXMhN1SgqFrFDCDQLBcAIFBkAAJjITpUNhQRuHUgR4U2JTgNyBsej0dZcUpfT7RBKh620uFhHMqx6xxClTGwJSEKk40KNOC0GWtCC9IdJ0h0oet3XZByGP9dp4E4eAhILMT7y1aTFIwNQFNQABmVTrFszSeAPHT7NcrKDJObpyX0Zz4kpMrLKoNFn3y3S6qsZ8as2LKPKQo1wobXySX8kcuqCsDrNgLzbTaqLeRiuKhPUpKJMQlLEBk9L5JkgAWXKaBazhCphYqEUpbbyusU5jOqqrNnOhrKDRdToX4OzTtc3bdmzEDaSsZ7OrOvZvpI6dksfKbTR8iDhoZO6xrI0LJvCu6rCAA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1uQAsBDACYcA7uiiJo0DtEjgwAXxDygA&tsconfig=N4KABGBEDGD2C2AHAlgGwKYCcDyiAuysAdgM6QBcYoEEkJemy0eAcgK6qoDCAFutAGsylBm3TgwAXxCSgA&tokens=false
Repro Code
The minimal reproduction is as follows:
If, however,
function methodParam
is instead avar
,let
orconst
declaration, the ESLint error is not triggered.Quite a few more examples of this strange behavior are in the playground link.
ESLint Config
tsconfig
Expected Result
The error should always be reported or not reported no matter with what type of declaration the name of the parameter inside an ambient declaration clashes.
I personally can't tell whether it's technically shadowing or not. Perhaps having an option to treat clashes between real and ambient declarations' names as shadowing issues could be the solution.
Actual Result
The current behavior seems inconsistent to me.
Additional Info
No response
The text was updated successfully, but these errors were encountered: