Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(eslint-plugin): report deprecations used in default export#10330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -100,6 +100,23 @@ ruleTester.run('no-deprecated', rule, { | ||
a('b'); | ||
`, | ||
` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This test is a fine test of overloaded function signature logic! I'm happy for us to keep it around, but I think for the sake of this issue we should also have a test purely for the default export usage that's as simple as functionnotDeprecated(){return{};}exportdefaultnotDeprecated(); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Added additional valid test 🙂 | ||
function a(value: 'b' | undefined): void; | ||
/** @deprecated */ | ||
function a(value: 'c' | undefined): void; | ||
function a(value: string | undefined): void { | ||
// ... | ||
} | ||
export default a('b'); | ||
`, | ||
` | ||
function notDeprecated(): object { | ||
return {}; | ||
} | ||
export default notDeprecated(); | ||
`, | ||
` | ||
import { deprecatedFunctionWithOverloads } from './deprecated'; | ||
@@ -2463,5 +2480,25 @@ ruleTester.run('no-deprecated', rule, { | ||
}, | ||
], | ||
}, | ||
{ | ||
code: ` | ||
/** @deprecated */ | ||
function a(): object { | ||
return {}; | ||
} | ||
export default a(); | ||
`, | ||
errors: [ | ||
{ | ||
column: 24, | ||
data: { name: 'a' }, | ||
endColumn: 25, | ||
endLine: 7, | ||
line: 7, | ||
messageId: 'deprecated', | ||
}, | ||
], | ||
}, | ||
], | ||
}); |
Uh oh!
There was an error while loading.Please reload this page.