@@ -14,18 +14,19 @@ export class Rule extends Lint.Rules.AbstractRule {
14
14
return this . applyWithFunction ( sourceFile , ( ctx : Lint . WalkContext < any > ) => {
15
15
utils . forEachComment ( ctx . sourceFile , ( file , { pos, end} ) => {
16
16
const commentText = file . substring ( pos , end ) ;
17
-
18
- if ( commentText . indexOf ( '@deletion-target' ) === - 1 ) {
19
- return ;
20
- }
21
-
22
- const version = commentText . match ( / \d + \. \d + \. \d + / ) ;
23
-
24
- if ( ! version ) {
25
- ctx . addFailure ( pos , end , '@deletion-target must have a version.' ) ;
26
- } else if ( this . _hasExpired ( packageVersion , version [ 0 ] ) ) {
27
- ctx . addFailure ( pos , end , `Deletion target at ${ version [ 0 ] } is due to be deleted. ` +
28
- `Current version is ${ packageVersion } .` ) ;
17
+ const hasDeletionTarget = commentText . indexOf ( '@deletion-target' ) > - 1 ;
18
+
19
+ if ( ! hasDeletionTarget && commentText . indexOf ( '@deprecated' ) > - 1 ) {
20
+ ctx . addFailure ( pos , end , '@deprecated marker has to have a @deletion-target.' ) ;
21
+ } if ( hasDeletionTarget ) {
22
+ const version = commentText . match ( / \d + \. \d + \. \d + / ) ;
23
+
24
+ if ( ! version ) {
25
+ ctx . addFailure ( pos , end , '@deletion-target must have a version.' ) ;
26
+ } else if ( this . _hasExpired ( packageVersion , version [ 0 ] ) ) {
27
+ ctx . addFailure ( pos , end , `Deletion target at ${ version [ 0 ] } is due to be deleted. ` +
28
+ `Current version is ${ packageVersion } .` ) ;
29
+ }
29
30
}
30
31
} ) ;
31
32
} ) ;
0 commit comments