Use explicit extensions for imports within src (#58421)

This commit is contained in:
Jake Bailey 2024-05-06 17:07:54 -07:00 committed by GitHub
parent 9598d35074
commit 16beff101a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
582 changed files with 2583 additions and 2360 deletions

View File

@ -144,7 +144,8 @@
"local/no-in-operator": "error",
"local/debug-assert": "error",
"local/no-keywords": "error",
"local/jsdoc-format": "error"
"local/jsdoc-format": "error",
"local/js-extensions": "error"
},
"overrides": [
// By default, the ESLint CLI only looks at .js files. But, it will also look at

View File

@ -18,6 +18,9 @@
".git-blame-ignore-revs"
],
"javascript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "js",
// Match dprint in organize/auto-imports.
"typescript.unstable": {
"organizeImportsCollation": "unicode",

View File

@ -0,0 +1,70 @@
const { createRule } = require("./utils.cjs");
module.exports = createRule({
name: "js-extensions",
meta: {
docs: {
description: ``,
},
messages: {
missingJsExtension: `This relative module reference is missing a '.js' extension`,
},
schema: [],
type: "suggestion",
fixable: "code",
},
defaultOptions: [],
create(context) {
/** @type {(
* node:
* | import("@typescript-eslint/utils").TSESTree.ImportDeclaration
* | import("@typescript-eslint/utils").TSESTree.ExportAllDeclaration
* | import("@typescript-eslint/utils").TSESTree.ExportNamedDeclaration
* | import("@typescript-eslint/utils").TSESTree.TSImportEqualsDeclaration
* | import("@typescript-eslint/utils").TSESTree.TSModuleDeclaration
* ) => void}
*/
const check = node => {
let source;
if (node.type === "TSImportEqualsDeclaration") {
const moduleReference = node.moduleReference;
if (
moduleReference.type === "TSExternalModuleReference"
&& moduleReference.expression.type === "Literal"
&& typeof moduleReference.expression.value === "string"
) {
source = moduleReference.expression;
}
}
else if (node.type === "TSModuleDeclaration") {
if (node.kind === "module" && node.id.type === "Literal") {
source = node.id;
}
}
else {
source = node.source;
}
// This is not 100% accurate; this could point to a nested package, or to a directory
// containing an index.js file. But we don't have anything like that in our repo,
// so this check is good enough. Replicate this logic at your own risk.
if (source?.value.startsWith(".") && !/\.[cm]?js$/.test(source.value)) {
const quote = source.raw[0];
context.report({
messageId: "missingJsExtension",
node: source,
fix: fixer => fixer.replaceText(source, `${quote}${source.value}.js${quote}`),
});
}
};
return {
ImportDeclaration: check,
ExportAllDeclaration: check,
ExportNamedDeclaration: check,
TSImportEqualsDeclaration: check,
TSModuleDeclaration: check,
};
},
});

View File

@ -0,0 +1,149 @@
const { RuleTester } = require("./support/RuleTester.cjs");
const rule = require("../rules/js-extensions.cjs");
const ruleTester = new RuleTester({
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
},
parser: require.resolve("@typescript-eslint/parser"),
});
ruleTester.run("js-extensions", rule, {
valid: [
{
code: `
import "some-library";
import "./a.js";
import "./a.mjs";
import "./a.cjs";
import "../foo/a.js";
import "../foo/a.mjs";
import "../foo/a.cjs";
`,
},
{
code: `
import * as blah from "some-library";
import * as blah from "./a.js";
import * as blah from "./a.mjs";
import * as blah from "./a.cjs";
import * as blah from "../foo/a.js";
import * as blah from "../foo/a.mjs";
import * as blah from "../foo/a.cjs";
`,
},
{
code: `
export * from "some-library";
export * from "./a.js";
export * from "./a.mjs";
export * from "./a.cjs";
export * from "../foo/a.js";
export * from "../foo/a.mjs";
export * from "../foo/a.cjs";
`,
},
{
code: `
import blah = require("some-library");
import blah = require("./a.js");
import blah = require("./a.mjs");
import blah = require("./a.cjs");
import blah = require("../foo/a.js");
import blah = require("../foo/a.mjs");
import blah = require("../foo/a.cjs");
`,
},
],
invalid: [
{
code: `
import "./a";
import "../foo/a";
`,
errors: [
{
messageId: "missingJsExtension",
line: 2,
column: 8,
},
{
messageId: "missingJsExtension",
line: 3,
column: 8,
},
],
output: `
import "./a.js";
import "../foo/a.js";
`,
},
{
code: `
import * as blah from "./a";
import * as blah from "../foo/a";
`,
errors: [
{
messageId: "missingJsExtension",
line: 2,
column: 23,
},
{
messageId: "missingJsExtension",
line: 3,
column: 23,
},
],
output: `
import * as blah from "./a.js";
import * as blah from "../foo/a.js";
`,
},
{
code: `
export * from "./a";
export * from "../foo/a";
`,
errors: [
{
messageId: "missingJsExtension",
line: 2,
column: 15,
},
{
messageId: "missingJsExtension",
line: 3,
column: 15,
},
],
output: `
export * from "./a.js";
export * from "../foo/a.js";
`,
},
{
code: `
import blah = require("./a");
import blah = require("../foo/a");
`,
errors: [
{
messageId: "missingJsExtension",
line: 2,
column: 23,
},
{
messageId: "missingJsExtension",
line: 3,
column: 23,
},
],
output: `
import blah = require("./a.js");
import blah = require("../foo/a.js");
`,
},
],
});

View File

@ -86,7 +86,7 @@ function buildInfoFileOutput(messageTable, inputFilePathRel) {
"// <auto-generated />",
`// generated from '${inputFilePathRel}'`,
"",
'import { DiagnosticCategory, DiagnosticMessage } from "./types";',
'import { DiagnosticCategory, DiagnosticMessage } from "./types.js";',
"",
"function diag(code: number, category: DiagnosticCategory, key: string, message: string, reportsUnnecessary?: {}, elidedInCompatabilityPyramid?: boolean, reportsDeprecated?: {}): DiagnosticMessage {",
" return { code, category, key, message, reportsUnnecessary, elidedInCompatabilityPyramid, reportsDeprecated };",

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the ts.moduleSpecifiers namespace. */
export * from "../moduleSpecifiers";
export * from "../moduleSpecifiers.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the ts.performance namespace. */
export * from "../performance";
export * from "../performance.js";

View File

@ -1,79 +1,79 @@
/* Generated file to emulate the ts namespace. */
export * from "../corePublic";
export * from "../core";
export * from "../debug";
export * from "../semver";
export * from "../performanceCore";
export * from "../perfLogger";
export * from "../tracing";
export * from "../types";
export * from "../sys";
export * from "../path";
export * from "../diagnosticInformationMap.generated";
export * from "../scanner";
export * from "../utilitiesPublic";
export * from "../utilities";
export * from "../factory/baseNodeFactory";
export * from "../factory/parenthesizerRules";
export * from "../factory/nodeConverters";
export * from "../factory/nodeFactory";
export * from "../factory/emitNode";
export * from "../factory/emitHelpers";
export * from "../factory/nodeTests";
export * from "../factory/nodeChildren";
export * from "../factory/utilities";
export * from "../factory/utilitiesPublic";
export * from "../parser";
export * from "../commandLineParser";
export * from "../moduleNameResolver";
export * from "../binder";
export * from "../symbolWalker";
export * from "../checker";
export * from "../visitorPublic";
export * from "../sourcemap";
export * from "../transformers/utilities";
export * from "../transformers/destructuring";
export * from "../transformers/classThis";
export * from "../transformers/namedEvaluation";
export * from "../transformers/taggedTemplate";
export * from "../transformers/ts";
export * from "../transformers/classFields";
export * from "../transformers/typeSerializer";
export * from "../transformers/legacyDecorators";
export * from "../transformers/esDecorators";
export * from "../transformers/es2017";
export * from "../transformers/es2018";
export * from "../transformers/es2019";
export * from "../transformers/es2020";
export * from "../transformers/es2021";
export * from "../transformers/esnext";
export * from "../transformers/jsx";
export * from "../transformers/es2016";
export * from "../transformers/es2015";
export * from "../transformers/generators";
export * from "../transformers/module/module";
export * from "../transformers/module/system";
export * from "../transformers/module/esnextAnd2015";
export * from "../transformers/module/impliedNodeFormatDependent";
export * from "../transformers/declarations/diagnostics";
export * from "../transformers/declarations";
export * from "../transformer";
export * from "../emitter";
export * from "../watchUtilities";
export * from "../program";
export * from "../builderStatePublic";
export * from "../builderState";
export * from "../builder";
export * from "../builderPublic";
export * from "../resolutionCache";
export * from "../watch";
export * from "../watchPublic";
export * from "../tsbuild";
export * from "../tsbuildPublic";
export * from "../executeCommandLine";
export * from "../expressionToTypeNode";
import * as moduleSpecifiers from "./ts.moduleSpecifiers";
export * from "../corePublic.js";
export * from "../core.js";
export * from "../debug.js";
export * from "../semver.js";
export * from "../performanceCore.js";
export * from "../perfLogger.js";
export * from "../tracing.js";
export * from "../types.js";
export * from "../sys.js";
export * from "../path.js";
export * from "../diagnosticInformationMap.generated.js";
export * from "../scanner.js";
export * from "../utilitiesPublic.js";
export * from "../utilities.js";
export * from "../factory/baseNodeFactory.js";
export * from "../factory/parenthesizerRules.js";
export * from "../factory/nodeConverters.js";
export * from "../factory/nodeFactory.js";
export * from "../factory/emitNode.js";
export * from "../factory/emitHelpers.js";
export * from "../factory/nodeTests.js";
export * from "../factory/nodeChildren.js";
export * from "../factory/utilities.js";
export * from "../factory/utilitiesPublic.js";
export * from "../parser.js";
export * from "../commandLineParser.js";
export * from "../moduleNameResolver.js";
export * from "../binder.js";
export * from "../symbolWalker.js";
export * from "../checker.js";
export * from "../visitorPublic.js";
export * from "../sourcemap.js";
export * from "../transformers/utilities.js";
export * from "../transformers/destructuring.js";
export * from "../transformers/classThis.js";
export * from "../transformers/namedEvaluation.js";
export * from "../transformers/taggedTemplate.js";
export * from "../transformers/ts.js";
export * from "../transformers/classFields.js";
export * from "../transformers/typeSerializer.js";
export * from "../transformers/legacyDecorators.js";
export * from "../transformers/esDecorators.js";
export * from "../transformers/es2017.js";
export * from "../transformers/es2018.js";
export * from "../transformers/es2019.js";
export * from "../transformers/es2020.js";
export * from "../transformers/es2021.js";
export * from "../transformers/esnext.js";
export * from "../transformers/jsx.js";
export * from "../transformers/es2016.js";
export * from "../transformers/es2015.js";
export * from "../transformers/generators.js";
export * from "../transformers/module/module.js";
export * from "../transformers/module/system.js";
export * from "../transformers/module/esnextAnd2015.js";
export * from "../transformers/module/impliedNodeFormatDependent.js";
export * from "../transformers/declarations/diagnostics.js";
export * from "../transformers/declarations.js";
export * from "../transformer.js";
export * from "../emitter.js";
export * from "../watchUtilities.js";
export * from "../program.js";
export * from "../builderStatePublic.js";
export * from "../builderState.js";
export * from "../builder.js";
export * from "../builderPublic.js";
export * from "../resolutionCache.js";
export * from "../watch.js";
export * from "../watchPublic.js";
export * from "../tsbuild.js";
export * from "../tsbuildPublic.js";
export * from "../executeCommandLine.js";
export * from "../expressionToTypeNode.js";
import * as moduleSpecifiers from "./ts.moduleSpecifiers.js";
export { moduleSpecifiers };
import * as performance from "./ts.performance";
import * as performance from "./ts.performance.js";
export { performance };

View File

@ -320,8 +320,8 @@ import {
VariableDeclaration,
WhileStatement,
WithStatement,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
/** @internal */
export const enum ModuleInstanceState {

View File

@ -81,7 +81,7 @@ import {
tryAddToSet,
WriteFileCallback,
WriteFileCallbackData,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export interface ReusableDiagnostic extends ReusableDiagnosticRelatedInformation {

View File

@ -16,7 +16,7 @@ import {
SavedBuildProgramEmitState,
SourceFile,
WriteFileCallback,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
export type AffectedFileResult<T> = { result: T; affected: SourceFile | Program; } | undefined;

View File

@ -31,7 +31,7 @@ import {
Symbol,
toPath,
TypeChecker,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export function getFileEmitOutput(

View File

@ -1,7 +1,7 @@
import {
Diagnostic,
WriteFileCallbackData,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
export interface EmitOutput {
outputFiles: OutputFile[];

View File

@ -1105,9 +1105,9 @@ import {
WideningContext,
WithStatement,
YieldExpression,
} from "./_namespaces/ts";
import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers.js";
import * as performance from "./_namespaces/ts.performance.js";
const ambientModuleSymbolRegex = /^".+"$/;
const anon = "(anonymous)" as __String & string;

View File

@ -121,7 +121,7 @@ import {
WatchDirectoryKind,
WatchFileKind,
WatchOptions,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export const compileOnSaveCommandLineOption: CommandLineOption = {

View File

@ -9,7 +9,7 @@ import {
SortedArray,
SortedReadonlyArray,
TextSpan,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export const emptyArray: never[] = [] as never[];

View File

@ -1,4 +1,4 @@
import * as ts from "./_namespaces/ts";
import * as ts from "./_namespaces/ts.js";
import {
AnyFunction,
AssertionLevel,
@ -91,7 +91,7 @@ import {
unescapeLeadingUnderscores,
VarianceFlags,
zipWith,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export enum LogLevel {

View File

@ -1,4 +1,4 @@
import * as ts from "./_namespaces/ts";
import * as ts from "./_namespaces/ts.js";
import {
AccessorDeclaration,
ArrayBindingPattern,
@ -420,8 +420,8 @@ import {
writeCommentRange,
writeFile,
YieldExpression,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
const brackets = createBracketsMap();

View File

@ -86,8 +86,8 @@ import {
WatchCompilerHost,
WatchOfConfigFile,
WatchOptions,
} from "./_namespaces/ts";
import * as performance from "./performance";
} from "./_namespaces/ts.js";
import * as performance from "./performance.js";
interface Statistic {
name: string;

View File

@ -64,7 +64,7 @@ import {
TypeParameterDeclaration,
UnionTypeNode,
VariableDeclaration,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export function createSyntacticTypeNodeBuilder(options: CompilerOptions, resolver: SyntacticTypeNodeBuilderResolver) {

View File

@ -2,7 +2,7 @@ import {
Node,
objectAllocator,
SyntaxKind,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/**
* A `BaseNodeFactory` is an abstraction over an `ObjectAllocator` that handles caching `Node` constructors

View File

@ -35,7 +35,7 @@ import {
TextRange,
TransformationContext,
UnscopedEmitHelper,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export const enum PrivateIdentifierKind {

View File

@ -26,7 +26,7 @@ import {
TextRange,
TypeNode,
TypeParameterDeclaration,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/**
* Associates a node with the current transformation, initializing

View File

@ -2,7 +2,7 @@ import {
emptyArray,
isNodeKind,
Node,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
const nodeChildren = new WeakMap<Node, readonly Node[] | undefined>();

View File

@ -35,7 +35,7 @@ import {
setStartsOnNewLine,
setTextRange,
SyntaxKind,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function createNodeConverters(factory: NodeFactory): NodeConverters {

View File

@ -456,7 +456,7 @@ import {
WhileStatement,
WithStatement,
YieldExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
let nextAutoGenerateId = 0;

View File

@ -227,7 +227,7 @@ import {
WhileStatement,
WithStatement,
YieldExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
// Literals

View File

@ -48,7 +48,7 @@ import {
SyntaxKind,
TypeNode,
UnaryExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function createParenthesizerRules(factory: NodeFactory): ParenthesizerRules {

View File

@ -180,7 +180,7 @@ import {
TransformFlags,
TypeNode,
WrappedExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
// Compound nodes

View File

@ -5,7 +5,7 @@ import {
setTextRangePosEnd,
SyntaxKind,
TextRange,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
export function setTextRange<T extends TextRange>(range: T, location: TextRange | undefined): T {
return location ? setTextRangePosEnd(range, location.pos, location.end) : range;

View File

@ -108,7 +108,7 @@ import {
version,
versionMajorMinor,
VersionRange,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export function trace(host: ModuleResolutionHost, message: DiagnosticMessage, ...args: any[]): void {

View File

@ -124,7 +124,7 @@ import {
tryParsePatterns,
TypeChecker,
UserPreferences,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
// Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.

View File

@ -397,8 +397,8 @@ import {
WhileStatement,
WithStatement,
YieldExpression,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
const enum SignatureFlags {
None = 0,

View File

@ -16,7 +16,7 @@ import {
Path,
some,
startsWith,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/**
* Internally, we represent paths as strings with '/' as the directory separator.

View File

@ -7,7 +7,7 @@ import {
System,
timestamp,
tryGetNativePerformanceHooks,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** Performance measurements for the compiler. */

View File

@ -1,4 +1,4 @@
import { isNodeLikeSystem } from "./_namespaces/ts";
import { isNodeLikeSystem } from "./_namespaces/ts.js";
// The following definitions provide the minimum compatible support for the Web Performance User Timings API
// between browsers and NodeJS:

View File

@ -328,8 +328,8 @@ import {
WriteFileCallback,
WriteFileCallbackData,
writeFileEnsuringDirectories,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean, configName = "tsconfig.json"): string | undefined {
return forEachAncestorDirectory(searchPath, ancestor => {

View File

@ -76,7 +76,7 @@ import {
trace,
updateResolutionField,
WatchDirectoryFlags,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export interface HasInvalidatedFromResolutionCache {

View File

@ -33,7 +33,7 @@ import {
SyntaxKind,
TextRange,
TokenFlags,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
export type ErrorCallback = (message: DiagnosticMessage, length: number, arg0?: any) => void;

View File

@ -8,7 +8,7 @@ import {
isArray,
map,
some,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
// https://semver.org/#spec-item-2
// > A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative

View File

@ -24,8 +24,8 @@ import {
sortAndDeduplicate,
SortedReadonlyArray,
SourceMapGenerator,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
/** @internal */
export interface SourceMapGeneratorOptions {

View File

@ -24,7 +24,7 @@ import {
TypeQueryNode,
TypeReference,
UnionOrIntersectionType,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export function createGetSymbolWalker(

View File

@ -46,7 +46,7 @@ import {
WatchFileKind,
WatchOptions,
writeFileEnsuringDirectories,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
declare function clearTimeout(handle: any): void;

View File

@ -20,8 +20,8 @@ import {
TypeReference,
unescapeLeadingUnderscores,
UnionType,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
/* Tracing events for the compiler. */

View File

@ -72,8 +72,8 @@ import {
transformSystemModule,
transformTypeScript,
VariableDeclaration,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
function getModuleTransformer(moduleKind: ModuleKind): TransformerFactory<SourceFile | Bundle> {
switch (moduleKind) {

View File

@ -225,7 +225,7 @@ import {
Visitor,
visitParameterList,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
const enum ClassPropertySubstitutionFlags {
/**

View File

@ -21,7 +21,7 @@ import {
Statement,
SyntaxKind,
ThisExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/**
* Creates a class `static {}` block used to assign the static `this` to a `_classThis` (or similar) variable.

View File

@ -210,7 +210,7 @@ import {
visitNode,
visitNodes,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, file: SourceFile | undefined): DiagnosticWithLocation[] | undefined {

View File

@ -87,7 +87,7 @@ import {
TypeAliasDeclaration,
TypeParameterDeclaration,
VariableDeclaration,
} from "../../_namespaces/ts";
} from "../../_namespaces/ts.js";
/** @internal */
export type GetSymbolAccessibilityDiagnostic = (symbolAccessibilityResult: SymbolAccessibilityResult) => SymbolAccessibilityDiagnostic | undefined;

View File

@ -60,7 +60,7 @@ import {
VariableDeclaration,
visitNode,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
interface FlattenContext {
context: TransformationContext;

View File

@ -215,7 +215,7 @@ import {
VoidExpression,
WhileStatement,
YieldExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
const enum ES2015SubstitutionFlags {
/** Enables substitutions for captured `this` */

View File

@ -15,7 +15,7 @@ import {
visitEachChild,
visitNode,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function transformES2016(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -99,7 +99,7 @@ import {
visitNodes,
visitParameterList,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration;

View File

@ -110,7 +110,7 @@ import {
VisitResult,
VoidExpression,
YieldExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
const enum ESNextSubstitutionFlags {
/** Enables substitutions for async methods with `super` calls. */

View File

@ -11,7 +11,7 @@ import {
visitEachChild,
visitNode,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function transformES2019(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -36,7 +36,7 @@ import {
visitNode,
visitNodes,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function transformES2020(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -19,7 +19,7 @@ import {
visitEachChild,
visitNode,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function transformES2021(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -188,7 +188,7 @@ import {
Visitor,
VisitResult,
WrappedExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
// Class/Decorator evaluation order, as it pertains to this transformer:
//

View File

@ -61,7 +61,7 @@ import {
visitNode,
visitNodes,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
const enum UsingKind {
None,

View File

@ -95,7 +95,7 @@ import {
WhileStatement,
WithStatement,
YieldExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
// Transforms generator functions into a compatible ES5 representation with similar runtime
// semantics. This is accomplished by first transforming the body of each generator

View File

@ -84,7 +84,7 @@ import {
visitEachChild,
visitNode,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function transformJsx(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -82,7 +82,7 @@ import {
visitNode,
visitNodes,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function transformLegacyDecorators(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -49,7 +49,7 @@ import {
visitEachChild,
visitNodes,
VisitResult,
} from "../../_namespaces/ts";
} from "../../_namespaces/ts.js";
/** @internal */
export function transformECMAScriptModule(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -11,7 +11,7 @@ import {
TransformationContext,
transformECMAScriptModule,
transformModule,
} from "../../_namespaces/ts";
} from "../../_namespaces/ts.js";
/** @internal */
export function transformImpliedNodeFormatDependentModule(context: TransformationContext) {

View File

@ -161,7 +161,7 @@ import {
VisitResult,
WhileStatement,
WithStatement,
} from "../../_namespaces/ts";
} from "../../_namespaces/ts.js";
/** @internal */
export function transformModule(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -128,7 +128,7 @@ import {
VisitResult,
WhileStatement,
WithStatement,
} from "../../_namespaces/ts";
} from "../../_namespaces/ts.js";
/** @internal */
export function transformSystemModule(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {

View File

@ -48,7 +48,7 @@ import {
TransformationContext,
VariableDeclaration,
WrappedExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/**
* Gets a string literal to use as the assigned name of an anonymous class or function declaration.

View File

@ -23,7 +23,7 @@ import {
visitEachChild,
visitNode,
Visitor,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export enum ProcessLevel {

View File

@ -201,7 +201,7 @@ import {
visitNodes,
visitParameterList,
VisitResult,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/**
* Indicates whether to emit type metadata in the new format.

View File

@ -67,7 +67,7 @@ import {
TypeReferenceSerializationKind,
UnionOrIntersectionTypeNode,
VoidExpression,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export type SerializedEntityName =

View File

@ -90,7 +90,7 @@ import {
unorderedRemoveItem,
VariableDeclaration,
VariableStatement,
} from "../_namespaces/ts";
} from "../_namespaces/ts.js";
/** @internal */
export function getOriginalNodeId(node: Node) {

View File

@ -4,7 +4,7 @@ import {
fileExtensionIs,
Path,
ResolvedConfigFileName,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export enum UpToDateStatusType {

View File

@ -126,8 +126,8 @@ import {
WildcardDirectoryWatcher,
writeFile,
WriteFileCallback,
} from "./_namespaces/ts";
import * as performance from "./_namespaces/ts.performance";
} from "./_namespaces/ts.js";
import * as performance from "./_namespaces/ts.performance.js";
const minimumDate = new Date(-8640000000000000);
const maximumDate = new Date(8640000000000000);

View File

@ -16,7 +16,7 @@ import {
ProgramBuildInfo,
SymlinkCache,
ThisContainer,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
// branded string type used to store absolute, normalized and canonicalized paths
// arbitrary file name can be converted to Path via toPath function

View File

@ -585,7 +585,7 @@ import {
WriteFileCallback,
WriteFileCallbackData,
YieldExpression,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/** @internal */
export const resolvingEmptyArray: never[] = [];

View File

@ -295,7 +295,7 @@ import {
TypeReferenceType,
UnaryExpression,
VariableDeclaration,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
export function isExternalModuleNameRelative(moduleName: string): boolean {
// TypeScript 1.0 spec (April 2014): 11.2.1

View File

@ -102,7 +102,7 @@ import {
SyntaxKind,
TransformationContext,
Visitor,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/**
* Visits a Node using the supplied visitor, possibly returning a new Node in its place.

View File

@ -106,7 +106,7 @@ import {
WatchStatusReporter,
whitespaceOrMapCommentRegExp,
WriteFileCallback,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
const sysFormatDiagnosticsHost: FormatDiagnosticsHost | undefined = sys ? {
getCurrentDirectory: () => sys.getCurrentDirectory(),

View File

@ -94,7 +94,7 @@ import {
WatchType,
WatchTypeRegistry,
WildcardDirectoryWatcher,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
export interface ReadBuildProgramHost {
useCaseSensitiveFileNames(): boolean;

View File

@ -56,7 +56,7 @@ import {
WatchDirectoryFlags,
WatchFileKind,
WatchOptions,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
/**
* Partial interface of the System thats needed to support the caching of directory structure

View File

@ -1,4 +1,4 @@
/* Generated file to emulate the ts namespace. */
export * from "../../compiler/_namespaces/ts";
export * from "../deprecations";
export * from "../../compiler/_namespaces/ts.js";
export * from "../deprecations.js";

View File

@ -5,7 +5,7 @@ import {
noop,
Version,
version,
} from "./_namespaces/ts";
} from "./_namespaces/ts.js";
export let enableDeprecationWarnings = true;

View File

@ -2,8 +2,8 @@ import {
hasProperty,
UnionToIntersection,
Version,
} from "./_namespaces/ts";
import { deprecate } from "./deprecate";
} from "./_namespaces/ts.js";
import { deprecate } from "./deprecate.js";
/** @internal */
export interface DeprecationOptions {

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the FourSlash namespace. */
export * from "../fourslashImpl";
export * from "../fourslashImpl.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the FourSlashInterface namespace. */
export * from "../fourslashInterfaceImpl";
export * from "../fourslashInterfaceImpl.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the Harness.LanguageService namespace. */
export * from "../harnessLanguageService";
export * from "../harnessLanguageService.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the Harness.SourceMapRecorder namespace. */
export * from "../sourceMapRecorder";
export * from "../sourceMapRecorder.js";

View File

@ -1,9 +1,9 @@
/* Generated file to emulate the Harness namespace. */
export * from "../runnerbase";
export * from "../harnessIO";
export * from "../typeWriter";
import * as LanguageService from "./Harness.LanguageService";
export * from "../runnerbase.js";
export * from "../harnessIO.js";
export * from "../typeWriter.js";
import * as LanguageService from "./Harness.LanguageService.js";
export { LanguageService };
import * as SourceMapRecorder from "./Harness.SourceMapRecorder";
import * as SourceMapRecorder from "./Harness.SourceMapRecorder.js";
export { SourceMapRecorder };

View File

@ -1,5 +1,5 @@
/* Generated file to emulate the Utils namespace. */
export * from "../util";
export * from "../findUpDir";
export * from "../harnessUtils";
export * from "../util.js";
export * from "../findUpDir.js";
export * from "../harnessUtils.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the collections namespace. */
export * from "../collectionsImpl";
export * from "../collectionsImpl.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the compiler namespace. */
export * from "../compilerImpl";
export * from "../compilerImpl.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the documents namespace. */
export * from "../documentsUtil";
export * from "../documentsUtil.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the evaluator namespace. */
export * from "../evaluatorImpl";
export * from "../evaluatorImpl.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the fakes namespace. */
export * from "../fakesHosts";
export * from "../fakesHosts.js";

View File

@ -1,6 +1,6 @@
/* Generated file to emulate the ts.server namespace. */
export * from "../../jsTyping/_namespaces/ts.server";
export * from "../../server/_namespaces/ts.server";
export * from "../../typingsInstallerCore/_namespaces/ts.server";
export * from "../client";
export * from "../../jsTyping/_namespaces/ts.server.js";
export * from "../../server/_namespaces/ts.server.js";
export * from "../../typingsInstallerCore/_namespaces/ts.server.js";
export * from "../client.js";

View File

@ -1,11 +1,11 @@
/* Generated file to emulate the ts namespace. */
export * from "../../compiler/_namespaces/ts";
export * from "../../services/_namespaces/ts";
export * from "../../jsTyping/_namespaces/ts";
export * from "../../server/_namespaces/ts";
export * from "../../typingsInstallerCore/_namespaces/ts";
export * from "../../deprecatedCompat/_namespaces/ts";
export * from "../harnessGlobals";
import * as server from "./ts.server";
export * from "../../compiler/_namespaces/ts.js";
export * from "../../services/_namespaces/ts.js";
export * from "../../jsTyping/_namespaces/ts.js";
export * from "../../server/_namespaces/ts.js";
export * from "../../typingsInstallerCore/_namespaces/ts.js";
export * from "../../deprecatedCompat/_namespaces/ts.js";
export * from "../harnessGlobals.js";
import * as server from "./ts.server.js";
export { server };

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the vfs namespace. */
export * from "../vfsUtil";
export * from "../vfsUtil.js";

View File

@ -1,3 +1,3 @@
/* Generated file to emulate the vpath namespace. */
export * from "../vpathUtil";
export * from "../vpathUtil.js";

View File

@ -73,8 +73,8 @@ import {
TodoComment,
TodoCommentDescriptor,
UserPreferences,
} from "./_namespaces/ts";
import { protocol } from "./_namespaces/ts.server";
} from "./_namespaces/ts.js";
import { protocol } from "./_namespaces/ts.server.js";
export interface SessionClientHost extends LanguageServiceHost {
writeMessage(message: string): void;

View File

@ -1,4 +1,4 @@
import * as ts from "./_namespaces/ts";
import * as ts from "./_namespaces/ts.js";
export interface SortOptions<T> {
comparer: (a: T, b: T) => number;

Some files were not shown because too many files have changed in this diff Show More