-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Repro
{
"rules": {
"@typescript-eslint/deprecation": ["warn"]
}
}
// CASE 1: for functions
/** @deprecated use f2 instead */
function f1(): void {return;}
function f2(): void {return;}
f1(); // WARN: "f1 is deprecated: use f2 instead
// CASE 2: for interfaces
interface Test {
/** @deprecated use b instead */
public a?: string;
public b?: string;
}
const x: Test = {
a: "foo"; // WARN: "Test.a is deprecated: use b instead
}
Expected Result
In both cases there should be a warning, that the function or property are depricated.
Actual Result
The @depricated
comments are ignored.
Additional Info
There is a TSLint Rule: deprication
and a long discussion at the TypeScript Bugtracker
I did not check the implementation for TSLint, but there are many things to consider. They should be configurable.
- For interfaces a depricated property must be optional (otherwise one could not not use the property)
- There should be a warning if a
private
orprotected
property is marked as depricated. (at least private properties should be updated as soon as a property is depricated) - A
@depricated
tag must be followed by an explanation and/or alternative.
sindresorhus, coalman, nickharris, ShrishaKumar, maftab1 and 8 more
Metadata
Metadata
Assignees
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin