Skip to content

build: enforce that deprecated APIs have a deletion target #9931

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib/core/ripple/ripple-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ export type RippleConfig = {
persistent?: boolean;
animation?: RippleAnimationConfig;
terminateOnPointerUp?: boolean;
/** @deprecated Use the animation property instead. */
/**
* @deprecated Use the `animation` property instead.
* @deletion-target 7.0.0
Copy link
Member Author

Choose a reason for hiding this comment

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

@devversion not completely sure on the version for this one.

Copy link
Member

Choose a reason for hiding this comment

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

7.0 is right

*/
speedFactor?: number;
};

Expand Down
25 changes: 13 additions & 12 deletions tools/tslint-rules/deletionTargetRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ export class Rule extends Lint.Rules.AbstractRule {
return this.applyWithFunction(sourceFile, (ctx: Lint.WalkContext<any>) => {
utils.forEachComment(ctx.sourceFile, (file, {pos, end}) => {
const commentText = file.substring(pos, end);

if (commentText.indexOf('@deletion-target') === -1) {
return;
}

const version = commentText.match(/\d+\.\d+\.\d+/);

if (!version) {
ctx.addFailure(pos, end, '@deletion-target must have a version.');
} else if (this._hasExpired(packageVersion, version[0])) {
ctx.addFailure(pos, end, `Deletion target at ${version[0]} is due to be deleted. ` +
`Current version is ${packageVersion}.`);
const hasDeletionTarget = commentText.indexOf('@deletion-target') > -1;

if (!hasDeletionTarget && commentText.indexOf('@deprecated') > -1) {
ctx.addFailure(pos, end, '@deprecated marker has to have a @deletion-target.');
} if (hasDeletionTarget) {
const version = commentText.match(/\d+\.\d+\.\d+/);

if (!version) {
ctx.addFailure(pos, end, '@deletion-target must have a version.');
} else if (this._hasExpired(packageVersion, version[0])) {
ctx.addFailure(pos, end, `Deletion target at ${version[0]} is due to be deleted. ` +
`Current version is ${packageVersion}.`);
}
}
});
});
Expand Down