Skip to content

Commit db6c969

Browse files
committed
Change ingore diagonstic comment to // @ts-ignore
1 parent e408cad commit db6c969

File tree

23 files changed

+46
-38
lines changed

23 files changed

+46
-38
lines changed

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference path="types.ts"/>
1+
/// <reference path="types.ts"/>
22
/// <reference path="performance.ts" />
33

44
namespace ts {

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3484,7 +3484,7 @@
34843484
"category": "Message",
34853485
"code": 90018
34863486
},
3487-
"Suppress this error message.": {
3487+
"Ignore this error message.": {
34883488
"category": "Message",
34893489
"code": 90019
34903490
},

src/compiler/program.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/// <reference path="sys.ts" />
1+
/// <reference path="sys.ts" />
22
/// <reference path="emitter.ts" />
33
/// <reference path="core.ts" />
44

55
namespace ts {
66
const emptyArray: any[] = [];
7-
const suppressDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-suppress)?)/;
7+
const ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/;
88

99
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName = "tsconfig.json"): string {
1010
while (true) {
@@ -926,21 +926,21 @@ namespace ts {
926926
}
927927

928928
/**
929-
* Skip errors if previous line start with '// @ts-suppress' comment, not counting non-empty non-comment lines
929+
* Skip errors if previous line start with '// @ts-ignore' comment, not counting non-empty non-comment lines
930930
*/
931931
function shouldReportDiagnostic(diagnostic: Diagnostic) {
932932
const { file, start } = diagnostic;
933933
const lineStarts = getLineStarts(file);
934934
let { line } = computeLineAndCharacterOfPosition(lineStarts, start);
935935
while (line > 0) {
936936
const previousLineText = file.text.slice(lineStarts[line - 1], lineStarts[line]);
937-
const result = suppressDiagnosticCommentRegEx.exec(previousLineText);
937+
const result = ignoreDiagnosticCommentRegEx.exec(previousLineText);
938938
if (!result) {
939939
// non-empty line
940940
return true;
941941
}
942942
if (result[3]) {
943-
// @ts-suppress
943+
// @ts-ignore
944944
return false;
945945
}
946946
line--;

src/harness/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//
1+
//
22
// Copyright (c) Microsoft Corporation. All rights reserved.
33
//
44
// Licensed under the Apache License, Version 2.0 (the "License");

src/services/codefixes/disableJsDiagnostics.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @internal */
1+
/* @internal */
22
namespace ts.codefix {
33
registerCodeFix({
44
errorCodes: getApplicableDiagnosticCodes(),
@@ -12,12 +12,12 @@ namespace ts.codefix {
1212
.map(d => allDiagnostcs[d].code);
1313
}
1414

15-
function getSuppressCommentLocationForLocation(sourceFile: SourceFile, position: number, newLineCharacter: string) {
16-
let { line } = getLineAndCharacterOfPosition(sourceFile, position);
15+
function getIgnoreCommentLocationForLocation(sourceFile: SourceFile, position: number, newLineCharacter: string) {
16+
const { line } = getLineAndCharacterOfPosition(sourceFile, position);
1717
const lineStartPosition = getStartPositionOfLine(line, sourceFile);
1818
const startPosition = getFirstNonSpaceCharacterPosition(sourceFile.text, lineStartPosition);
1919

20-
// First try to see if we can put the '// @ts-suppress' on the previous line.
20+
// First try to see if we can put the '// @ts-ignore' on the previous line.
2121
// We need to make sure that we are not in the middle of a string literal or a comment.
2222
// We also want to check if the previous line holds a comment for a node on the next line
2323
// if so, we do not want to separate the node from its comment if we can.
@@ -27,15 +27,15 @@ namespace ts.codefix {
2727
if (!tokenLeadingCommnets || !tokenLeadingCommnets.length || tokenLeadingCommnets[0].pos >= startPosition) {
2828
return {
2929
span: { start: startPosition, length: 0 },
30-
newText: `// @ts-suppress${newLineCharacter}`
30+
newText: `// @ts-ignore${newLineCharacter}`
3131
};
3232
}
3333
}
3434

3535
// If all fails, add an extra new line immediatlly before the error span.
3636
return {
3737
span: { start: position, length: 0 },
38-
newText: `${position === startPosition ? "" : newLineCharacter}// @ts-suppress${newLineCharacter}`
38+
newText: `${position === startPosition ? "" : newLineCharacter}// @ts-ignore${newLineCharacter}`
3939
};
4040
}
4141

@@ -47,10 +47,10 @@ namespace ts.codefix {
4747
}
4848

4949
return [{
50-
description: getLocaleSpecificMessage(Diagnostics.Suppress_this_error_message),
50+
description: getLocaleSpecificMessage(Diagnostics.Ignore_this_error_message),
5151
changes: [{
5252
fileName: sourceFile.fileName,
53-
textChanges: [getSuppressCommentLocationForLocation(sourceFile, span.start, newLineCharacter)]
53+
textChanges: [getIgnoreCommentLocationForLocation(sourceFile, span.start, newLineCharacter)]
5454
}]
5555
},
5656
{

src/services/codefixes/fixAddMissingMember.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* @internal */
1+
/* @internal */
22
namespace ts.codefix {
33
registerCodeFix({
44
errorCodes: [Diagnostics.Property_0_does_not_exist_on_type_1.code],

tests/baselines/reference/checkJsFiles_skipDiagnostics.symbols

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ var x = 0;
44
>x : Symbol(x, Decl(a.js, 1, 3))
55

66

7-
/// @ts-suppress
7+
/// @ts-ignore
88
x();
99
>x : Symbol(x, Decl(a.js, 1, 3))
1010

11-
/// @ts-suppress
11+
/// @ts-ignore
1212
x();
1313
>x : Symbol(x, Decl(a.js, 1, 3))
1414

15-
/// @ts-suppress
15+
/// @ts-ignore
1616
x(
1717
>x : Symbol(x, Decl(a.js, 1, 3))
1818

@@ -21,7 +21,7 @@ x(
2121

2222

2323

24-
// @ts-suppress
24+
// @ts-ignore
2525
// come comment
2626
// some other comment
2727

@@ -32,7 +32,7 @@ x();
3232

3333

3434

35-
// @ts-suppress: no call signature
35+
// @ts-ignore: no call signature
3636
x();
3737
>x : Symbol(x, Decl(a.js, 1, 3))
3838

tests/baselines/reference/checkJsFiles_skipDiagnostics.types

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ var x = 0;
55
>0 : 0
66

77

8-
/// @ts-suppress
8+
/// @ts-ignore
99
x();
1010
>x() : any
1111
>x : number
1212

13-
/// @ts-suppress
13+
/// @ts-ignore
1414
x();
1515
>x() : any
1616
>x : number
1717

18-
/// @ts-suppress
18+
/// @ts-ignore
1919
x(
2020
>x( 2, 3) : any
2121
>x : number
@@ -28,7 +28,7 @@ x(
2828

2929

3030

31-
// @ts-suppress
31+
// @ts-ignore
3232
// come comment
3333
// some other comment
3434

@@ -40,7 +40,7 @@ x();
4040

4141

4242

43-
// @ts-suppress: no call signature
43+
// @ts-ignore: no call signature
4444
x();
4545
>x() : any
4646
>x : number

tests/baselines/reference/tsConfig/Default initialized TSConfig/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */
66
// "lib": [], /* Specify library files to be included in the compilation: */
77
// "allowJs": true, /* Allow javascript files to be compiled. */
8+
// "checkJs": true, /* Report errors in .js files. */
89
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
910
// "declaration": true, /* Generates corresponding '.d.ts' file. */
1011
// "sourceMap": true, /* Generates corresponding '.map' file. */

tests/baselines/reference/tsConfig/Initialized TSConfig with boolean value compiler options/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd' or 'es2015'. */
66
// "lib": [], /* Specify library files to be included in the compilation: */
77
// "allowJs": true, /* Allow javascript files to be compiled. */
8+
// "checkJs": true, /* Report errors in .js files. */
89
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
910
// "declaration": true, /* Generates corresponding '.d.ts' file. */
1011
// "sourceMap": true, /* Generates corresponding '.map' file. */

0 commit comments

Comments
 (0)