Skip to content

Commit e6ee96d

Browse files
Fix lint errors by removing unused imports and apply formatting
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
1 parent 0ebcdd1 commit e6ee96d

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

src/compiler/checker.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,8 +1123,6 @@ import {
11231123
VariableLikeDeclaration,
11241124
VariableStatement,
11251125
VarianceFlags,
1126-
Version,
1127-
versionMajorMinor,
11281126
visitEachChild as visitEachChildWorker,
11291127
visitNode,
11301128
visitNodes,
@@ -48001,28 +47999,28 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4800147999
const pos = getNonModifierTokenPosOfNode(node);
4800248000
const span = getSpanOfTokenAtPosition(sourceFile, pos);
4800348001

48004-
// Check if ignoreDeprecations should suppress this error
48005-
const shouldSuppress = compilerOptions.ignoreDeprecations === "6.0";
48006-
48007-
if (!shouldSuppress) {
48008-
// Generate error for module keyword usage in namespace declarations
48009-
const errorDiagnostic = createFileDiagnostic(
48010-
sourceFile,
48011-
span.start,
48012-
span.length,
48013-
Diagnostics.The_module_keyword_is_not_allowed_for_namespace_declarations_Use_the_namespace_keyword_instead,
48014-
);
48015-
diagnostics.add(errorDiagnostic);
48016-
}
48017-
else {
48018-
// When suppressed by ignoreDeprecations, keep as suggestion
48019-
const suggestionDiagnostic = createFileDiagnostic(
48020-
sourceFile,
48021-
span.start,
48022-
span.length,
48023-
Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead,
48024-
);
48025-
suggestionDiagnostics.add(suggestionDiagnostic);
48002+
// Check if ignoreDeprecations should suppress this error
48003+
const shouldSuppress = compilerOptions.ignoreDeprecations === "6.0";
48004+
48005+
if (!shouldSuppress) {
48006+
// Generate error for module keyword usage in namespace declarations
48007+
const errorDiagnostic = createFileDiagnostic(
48008+
sourceFile,
48009+
span.start,
48010+
span.length,
48011+
Diagnostics.The_module_keyword_is_not_allowed_for_namespace_declarations_Use_the_namespace_keyword_instead,
48012+
);
48013+
diagnostics.add(errorDiagnostic);
48014+
}
48015+
else {
48016+
// When suppressed by ignoreDeprecations, keep as suggestion
48017+
const suggestionDiagnostic = createFileDiagnostic(
48018+
sourceFile,
48019+
span.start,
48020+
span.length,
48021+
Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead,
48022+
);
48023+
suggestionDiagnostics.add(suggestionDiagnostic);
4802648024
}
4802748025
}
4802848026
}

src/compiler/diagnosticMessages.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,11 +1820,11 @@
18201820
"category": "Error",
18211821
"code": 1539
18221822
},
1823-
"A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.": {
1824-
"category": "Suggestion",
1825-
"code": 1540,
1826-
"reportsDeprecated": true
1827-
},
1823+
"A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.": {
1824+
"category": "Suggestion",
1825+
"code": 1540,
1826+
"reportsDeprecated": true
1827+
},
18281828
"Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute.": {
18291829
"category": "Error",
18301830
"code": 1541
@@ -1845,15 +1845,15 @@
18451845
"category": "Error",
18461846
"code": 1545
18471847
},
1848-
"'await using' declarations are not allowed in ambient contexts.": {
1849-
"category": "Error",
1850-
"code": 1546
1851-
},
1852-
"The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead.": {
1853-
"category": "Error",
1854-
"code": 1547
1855-
},
1856-
1848+
"'await using' declarations are not allowed in ambient contexts.": {
1849+
"category": "Error",
1850+
"code": 1546
1851+
},
1852+
"The 'module' keyword is not allowed for namespace declarations. Use the 'namespace' keyword instead.": {
1853+
"category": "Error",
1854+
"code": 1547
1855+
},
1856+
18571857
"The types of '{0}' are incompatible between these types.": {
18581858
"category": "Error",
18591859
"code": 2200

0 commit comments

Comments
 (0)