Use ESlint instead of TSlint (#7719)
Migrated TSlint configs to ESlint ones using [tslint-to-eslint-config](https://github.com/typescript-eslint/tslint-to-eslint-config) tool, and refined the configs to better match the current coding style. Changes: - [member-delimiter-style](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/member-delimiter-style.md#options) that as suggested default for type definition to be with `semicolon` - Indentation fixes that is enforced by [eslint-indent](https://eslint.org/docs/rules/indent#options) - Added dependencies for ESlint with Typescript - Removed TSlint
This commit is contained in:
parent
9c501b5bed
commit
a92a005d68
|
@ -18,3 +18,6 @@
|
|||
|
||||
- [auto/nodejs] - Fix a case where inline programs could exit with outstanding async work.
|
||||
[#7704](https://github.com/pulumi/pulumi/pull/7704)
|
||||
|
||||
- [sdk/nodejs] - Use ESlint instead of TSlint
|
||||
[#7719](https://github.com/pulumi/pulumi/pull/7719)
|
191
sdk/nodejs/.eslintrc.js
Normal file
191
sdk/nodejs/.eslintrc.js
Normal file
|
@ -0,0 +1,191 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "tsconfig.json",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"eslint-plugin-import",
|
||||
"@typescript-eslint",
|
||||
"header"
|
||||
],
|
||||
"ignorePatterns": [
|
||||
"**/bin/**/*.ts",
|
||||
"tests/automation/data/tcfg/*.ts",
|
||||
"tests/sxs_ts_3.6/*.ts",
|
||||
"tests/sxs_ts_latest/*.ts",
|
||||
],
|
||||
"rules": {
|
||||
"header/header": [
|
||||
2,
|
||||
"line",
|
||||
[
|
||||
{
|
||||
"pattern": "Copyright \\d{4}-\\d{4}, Pulumi Corporation."
|
||||
}
|
||||
]
|
||||
],
|
||||
"@typescript-eslint/dot-notation": "off",
|
||||
"@typescript-eslint/explicit-member-accessibility": [
|
||||
"off",
|
||||
{
|
||||
"accessibility": "explicit"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/indent": [
|
||||
"error",
|
||||
4,
|
||||
{
|
||||
"FunctionDeclaration": {
|
||||
"parameters": "first"
|
||||
},
|
||||
"FunctionExpression": {
|
||||
"parameters": "first"
|
||||
}
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/member-delimiter-style": [
|
||||
"error",
|
||||
{
|
||||
"multiline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": true
|
||||
},
|
||||
"singleline": {
|
||||
"delimiter": "semi",
|
||||
"requireLast": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/member-ordering": [
|
||||
"error",
|
||||
{
|
||||
"default": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"error",
|
||||
{
|
||||
"selector": "default",
|
||||
"format": null
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-empty-function": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
"@typescript-eslint/no-parameter-properties": "off",
|
||||
"@typescript-eslint/no-require-imports": "off",
|
||||
"@typescript-eslint/no-shadow": [
|
||||
"error",
|
||||
{
|
||||
"hoist": "all"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-unused-expressions": "error",
|
||||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||
"@typescript-eslint/quotes": [
|
||||
"error",
|
||||
"double",
|
||||
{
|
||||
"avoidEscape": true,
|
||||
"allowTemplateLiterals": true
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/semi": [
|
||||
"error"
|
||||
],
|
||||
"@typescript-eslint/type-annotation-spacing": "error",
|
||||
"brace-style": "off",
|
||||
"comma-dangle": [
|
||||
"error",
|
||||
"always-multiline"
|
||||
],
|
||||
"curly": "error",
|
||||
"default-case": "error",
|
||||
"dot-notation": "off",
|
||||
"eol-last": "error",
|
||||
"eqeqeq": [
|
||||
"error",
|
||||
"smart"
|
||||
],
|
||||
"guard-for-in": "error",
|
||||
"id-blacklist": [
|
||||
"error",
|
||||
"any",
|
||||
"Number",
|
||||
"number",
|
||||
"String",
|
||||
"string",
|
||||
"Boolean",
|
||||
"boolean",
|
||||
"Undefined",
|
||||
"undefined"
|
||||
],
|
||||
"id-match": "error",
|
||||
"import/order": "off",
|
||||
"indent": "off",
|
||||
"no-bitwise": "off",
|
||||
"no-caller": "error",
|
||||
"no-cond-assign": "off",
|
||||
"no-console": [
|
||||
"error",
|
||||
{
|
||||
"allow": [
|
||||
"log",
|
||||
"warn",
|
||||
"dir",
|
||||
"timeLog",
|
||||
"assert",
|
||||
"clear",
|
||||
"count",
|
||||
"countReset",
|
||||
"group",
|
||||
"groupEnd",
|
||||
"table",
|
||||
"dirxml",
|
||||
"error",
|
||||
"groupCollapsed",
|
||||
"Console",
|
||||
"profile",
|
||||
"profileEnd",
|
||||
"timeStamp",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-debugger": "error",
|
||||
"no-empty": "error",
|
||||
"no-empty-function": "off",
|
||||
"no-eval": "error",
|
||||
"no-fallthrough": "error",
|
||||
"no-multiple-empty-lines": "off",
|
||||
"no-new-wrappers": "error",
|
||||
"no-redeclare": "off",
|
||||
"no-shadow": "off",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-unused-expressions": "error",
|
||||
"no-unused-labels": "error",
|
||||
"no-use-before-define": "off",
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
"quotes": "off",
|
||||
"radix": "error",
|
||||
"semi": "off",
|
||||
"spaced-comment": "off",
|
||||
"@typescript-eslint/no-redeclare": [
|
||||
"error"
|
||||
]
|
||||
}
|
||||
};
|
|
@ -18,7 +18,7 @@ include ../../build/common.mk
|
|||
export PATH:=$(shell yarn bin 2>/dev/null):$(PATH)
|
||||
|
||||
lint::
|
||||
./node_modules/.bin/tslint -c tslint.json -p tsconfig.json
|
||||
./node_modules/.bin/eslint -c .eslintrc.js --ext .ts .
|
||||
|
||||
build_package::
|
||||
./node_modules/.bin/tsc
|
||||
|
|
|
@ -23,7 +23,7 @@ export abstract class Archive {
|
|||
* A private field to help with RTTI that works in SxS scenarios.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiArchive: boolean = true;
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@ export abstract class Asset {
|
|||
* A private field to help with RTTI that works in SxS scenarios.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiAsset: boolean = true;
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,8 +68,8 @@ export function createCommandError(result: CommandResult): CommandError {
|
|||
const stderr = result.stderr;
|
||||
return (
|
||||
notFoundRegex.test(stderr) ? new StackNotFoundError(result) :
|
||||
alreadyExistsRegex.test(stderr) ? new StackAlreadyExistsError(result) :
|
||||
stderr.indexOf(conflictText) >= 0 ? new ConcurrentUpdateError(result) :
|
||||
new CommandError(result)
|
||||
alreadyExistsRegex.test(stderr) ? new StackAlreadyExistsError(result) :
|
||||
stderr.indexOf(conflictText) >= 0 ? new ConcurrentUpdateError(result) :
|
||||
new CommandError(result)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
// Copyright 2016-2020, Pulumi Corporation.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -74,7 +74,7 @@ export class LanguageServer<T> implements grpc.UntypedServiceImplementation {
|
|||
const engineAddr = args && args.length > 0 ? args[0] : "";
|
||||
|
||||
runtime.resetOptions(req.getProject(), req.getStack(), req.getParallel(), engineAddr,
|
||||
req.getMonitorAddress(), req.getDryrun());
|
||||
req.getMonitorAddress(), req.getDryrun());
|
||||
|
||||
const config: {[key: string]: string} = {};
|
||||
for (const [k, v] of req.getConfigMap()?.entries() || []) {
|
||||
|
|
|
@ -97,22 +97,22 @@ export class Stack {
|
|||
this.workspace = workspace;
|
||||
|
||||
switch (mode) {
|
||||
case "create":
|
||||
this.ready = workspace.createStack(name);
|
||||
return this;
|
||||
case "select":
|
||||
this.ready = workspace.selectStack(name);
|
||||
return this;
|
||||
case "createOrSelect":
|
||||
this.ready = workspace.createStack(name).catch((err) => {
|
||||
if (err instanceof StackAlreadyExistsError) {
|
||||
return workspace.selectStack(name);
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
return this;
|
||||
default:
|
||||
throw new Error(`unexpected Stack creation mode: ${mode}`);
|
||||
case "create":
|
||||
this.ready = workspace.createStack(name);
|
||||
return this;
|
||||
case "select":
|
||||
this.ready = workspace.selectStack(name);
|
||||
return this;
|
||||
case "createOrSelect":
|
||||
this.ready = workspace.createStack(name).catch((err) => {
|
||||
if (err instanceof StackAlreadyExistsError) {
|
||||
return workspace.selectStack(name);
|
||||
}
|
||||
throw err;
|
||||
});
|
||||
return this;
|
||||
default:
|
||||
throw new Error(`unexpected Stack creation mode: ${mode}`);
|
||||
}
|
||||
}
|
||||
private async readLines(logPath: string, callback: (event: EngineEvent) => void): Promise<ReadlineResult> {
|
||||
|
@ -659,20 +659,20 @@ export type UpdateResult = "not-started" | "in-progress" | "succeeded" | "failed
|
|||
* The granular CRUD operation performed on a particular resource during an update.
|
||||
*/
|
||||
export type OpType = "same"
|
||||
| "create"
|
||||
| "update"
|
||||
| "delete"
|
||||
| "replace"
|
||||
| "create-replacement"
|
||||
| "delete-replaced"
|
||||
| "read"
|
||||
| "read-replacement"
|
||||
| "refresh"
|
||||
| "discard"
|
||||
| "discard-replaced"
|
||||
| "remove-pending-replace"
|
||||
| "import"
|
||||
| "import-replacement";
|
||||
| "create"
|
||||
| "update"
|
||||
| "delete"
|
||||
| "replace"
|
||||
| "create-replacement"
|
||||
| "delete-replaced"
|
||||
| "read"
|
||||
| "read-replacement"
|
||||
| "refresh"
|
||||
| "discard"
|
||||
| "discard-replaced"
|
||||
| "remove-pending-replace"
|
||||
| "import"
|
||||
| "import-replacement";
|
||||
|
||||
/**
|
||||
* A map of operation types and their corresponding counts.
|
||||
|
|
|
@ -324,7 +324,7 @@ function resultIncludingProvider(result: any, props: any): any {
|
|||
// rejected the resource, or an initialization error, where the API server has accepted the
|
||||
// resource, but it failed to initialize (e.g., the app code is continually crashing and the
|
||||
// resource has failed to become alive).
|
||||
function grpcResponseFromError(e: {id: string, properties: any, message: string, reasons?: string[]}) {
|
||||
function grpcResponseFromError(e: {id: string; properties: any; message: string; reasons?: string[]}) {
|
||||
// Create response object.
|
||||
const resp = new statusproto.Status();
|
||||
resp.setCode(grpc.status.UNKNOWN);
|
||||
|
|
|
@ -113,7 +113,9 @@ function printErrorUsageAndExit(message: string): never {
|
|||
function main(args: string[]): void {
|
||||
// See usage above for the intended usage of this program, including flags and required args.
|
||||
const argv: minimist.ParsedArgs = minimist(args, {
|
||||
// eslint-disable-next-line id-blacklist
|
||||
boolean: [ "dry-run", "query-mode" ],
|
||||
// eslint-disable-next-line id-blacklist
|
||||
string: [ "project", "stack", "parallel", "pwd", "monitor", "engine", "tracing" ],
|
||||
unknown: (arg: string) => {
|
||||
return true;
|
||||
|
|
|
@ -203,7 +203,7 @@ export function run(argv: minimist.ParsedArgs,
|
|||
}
|
||||
else {
|
||||
log.error(
|
||||
`Running program '${program}' failed with an unhandled exception:
|
||||
`Running program '${program}' failed with an unhandled exception:
|
||||
${defaultMessage}`);
|
||||
}
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ class ConfigTypeError extends RunError {
|
|||
class ConfigEnumError extends RunError {
|
||||
constructor(key: string, v: any, values: any[]) {
|
||||
super(`Configuration '${key}' value '${v}' is not a legal enum value (${JSON.stringify(values)})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -459,7 +459,7 @@ class ConfigRangeError extends RunError {
|
|||
range += " chars";
|
||||
}
|
||||
super(`Configuration '${key}' value '${v}' is outside of the legal range (${range}, inclusive)`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -468,7 +468,7 @@ class ConfigRangeError extends RunError {
|
|||
class ConfigPatternError extends RunError {
|
||||
constructor(key: string, v: string, regexp: RegExp) {
|
||||
super(`Configuration '${key}' value '${v}' does not match the regular expression ${regexp.toString()}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ export class RunError extends Error {
|
|||
* A private field to help with RTTI that works in SxS scenarios.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiRunError: boolean = true;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ export class ResourceError extends Error {
|
|||
* A private field to help with RTTI that works in SxS scenarios.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention, no-underscore-dangle, id-blacklist, id-match
|
||||
public readonly __pulumResourceError: boolean = true;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ import { Input, Output } from "../output";
|
|||
*
|
||||
*/
|
||||
export function toObject<T, V>(
|
||||
iter: Input<Input<T>[]>, selector: (t: T) => Input<[Input<string>, Input<V>]>): Output<{[key: string]: V}> {
|
||||
iter: Input<Input<T>[]>, selector: (t: T) => Input<[Input<string>, Input<V>]>): Output<{[key: string]: V}> {
|
||||
return Output.create(iter).apply(elems => {
|
||||
const array: Input<[Input<string>, Input<V>]>[] = [];
|
||||
for (const e of elems) {
|
||||
|
@ -59,7 +59,7 @@ export function toObject<T, V>(
|
|||
*
|
||||
*/
|
||||
export function groupBy<T, V>(
|
||||
iter: Input<Input<T>[]>, selector: (t: T) => Input<[Input<string>, Input<V>]>): Output<{[key: string]: V[]}> {
|
||||
iter: Input<Input<T>[]>, selector: (t: T) => Input<[Input<string>, Input<V>]>): Output<{[key: string]: V[]}> {
|
||||
return Output.create(iter).apply(elems => {
|
||||
const array: Input<[Input<string>, Input<V>]>[] = [];
|
||||
for (const e of elems) {
|
||||
|
|
|
@ -93,10 +93,10 @@ export function error(msg: string, resource?: resourceTypes.Resource, streamId?:
|
|||
}
|
||||
|
||||
function log(
|
||||
engine: any, sev: any, msg: string,
|
||||
resource: resourceTypes.Resource | undefined,
|
||||
streamId: number | undefined,
|
||||
ephemeral: boolean | undefined): Promise<void> {
|
||||
engine: any, sev: any, msg: string,
|
||||
resource: resourceTypes.Resource | undefined,
|
||||
streamId: number | undefined,
|
||||
ephemeral: boolean | undefined): Promise<void> {
|
||||
|
||||
// Ensure we log everything in serial order.
|
||||
const keepAlive: () => void = rpcKeepAlive();
|
||||
|
|
|
@ -16,7 +16,7 @@ import { Resource } from "./resource";
|
|||
import * as runtime from "./runtime";
|
||||
import * as utils from "./utils";
|
||||
|
||||
/*tslint:disable:no-shadowed-variable*/
|
||||
/* eslint-disable no-shadow, @typescript-eslint/no-shadow */
|
||||
|
||||
/**
|
||||
* Output helps encode the relationship between Resources in a Pulumi application. Specifically an
|
||||
|
@ -32,7 +32,7 @@ class OutputImpl<T> implements OutputInstance<T> {
|
|||
* This is internal instead of being truly private, to support mixins and our serialization model.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiOutput: boolean = true;
|
||||
|
||||
/**
|
||||
|
@ -161,11 +161,11 @@ class OutputImpl<T> implements OutputInstance<T> {
|
|||
|
||||
/** @internal */
|
||||
public constructor(
|
||||
resources: Set<Resource> | Resource[] | Resource,
|
||||
promise: Promise<T>,
|
||||
isKnown: Promise<boolean>,
|
||||
isSecret: Promise<boolean>,
|
||||
allResources: Promise<Set<Resource> | Resource[] | Resource> | undefined) {
|
||||
resources: Set<Resource> | Resource[] | Resource,
|
||||
promise: Promise<T>,
|
||||
isKnown: Promise<boolean>,
|
||||
isSecret: Promise<boolean>,
|
||||
allResources: Promise<Set<Resource> | Resource[] | Resource> | undefined) {
|
||||
|
||||
// Always create a copy so that no one accidentally modifies our Resource list.
|
||||
const resourcesCopy = copyResources(resources);
|
||||
|
@ -180,7 +180,7 @@ class OutputImpl<T> implements OutputInstance<T> {
|
|||
isKnown = Promise.all([isKnown, promise]).then(([known, val]) => known && !containsUnknowns(val));
|
||||
|
||||
const lifted = Promise.all([allResourcesCopy, promise, isKnown, isSecret])
|
||||
.then(([liftedResources, value, liftedIsKnown, liftedIsSecret]) => liftInnerOutput(liftedResources, value, liftedIsKnown, liftedIsSecret));
|
||||
.then(([liftedResources, value, liftedIsKnown, liftedIsSecret]) => liftInnerOutput(liftedResources, value, liftedIsKnown, liftedIsSecret));
|
||||
|
||||
this.resources = () => resourcesCopy;
|
||||
this.allResources = () => lifted.then(l => l.allResources);
|
||||
|
@ -299,7 +299,7 @@ To manipulate the value of this Output, use '.apply' instead.`);
|
|||
// we're inside the modern `output` code, so it's safe to call `.allResources!` here.
|
||||
|
||||
const applied = Promise.all([this.allResources!(), this.promise(/*withUnknowns*/ true), this.isKnown, this.isSecret])
|
||||
.then(([allResources, value, isKnown, isSecret]) => applyHelperAsync<T, U>(allResources, value, isKnown, isSecret, func, !!runWithUnknowns));
|
||||
.then(([allResources, value, isKnown, isSecret]) => applyHelperAsync<T, U>(allResources, value, isKnown, isSecret, func, !!runWithUnknowns));
|
||||
|
||||
const result = new OutputImpl<U>(
|
||||
this.resources(),
|
||||
|
@ -320,8 +320,8 @@ export function getAllResources<T>(op: OutputInstance<T>): Promise<Set<Resource>
|
|||
|
||||
function copyResources(resources: Set<Resource> | Resource[] | Resource) {
|
||||
const copy = Array.isArray(resources) ? new Set(resources) :
|
||||
resources instanceof Set ? new Set(resources) :
|
||||
new Set([resources]);
|
||||
resources instanceof Set ? new Set(resources) :
|
||||
new Set([resources]);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
@ -353,10 +353,10 @@ async function liftInnerOutput(allResources: Set<Resource>, value: any, isKnown:
|
|||
};
|
||||
}
|
||||
|
||||
// tslint:disable:max-line-length
|
||||
/* eslint-disable max-len */
|
||||
async function applyHelperAsync<T, U>(
|
||||
allResources: Set<Resource>, value: T, isKnown: boolean, isSecret: boolean,
|
||||
func: (t: T) => Input<U>, runWithUnknowns: boolean) {
|
||||
allResources: Set<Resource>, value: T, isKnown: boolean, isSecret: boolean,
|
||||
func: (t: T) => Input<U>, runWithUnknowns: boolean) {
|
||||
if (runtime.isDryRun()) {
|
||||
// During previews only perform the apply if the engine was able to give us an actual value
|
||||
// for this Output.
|
||||
|
@ -541,7 +541,7 @@ export function secret<T>(val: Input<T | undefined>): Output<Unwrap<T | undefine
|
|||
* [unsecret] behaves the same as [output] except the returned output takes the existing output and unwraps the secret
|
||||
*/
|
||||
export function unsecret<T>(val: Output<T>): Output<T> {
|
||||
return new Output(
|
||||
return new Output(
|
||||
val.resources(), val.promise(/*withUnknowns*/ true),
|
||||
val.isKnown, Promise.resolve(false), val.allResources!());
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ function createSimpleOutput(val: any) {
|
|||
* In this example, taking a dependency on d3 means a resource will depend on all the resources of
|
||||
* d1 and d2.
|
||||
*/
|
||||
// tslint:disable:max-line-length
|
||||
/* eslint-disable max-len */
|
||||
export function all<T>(val: Record<string, Input<T>>): Output<Record<string, Unwrap<T>>>;
|
||||
export function all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined, Input<T4> | undefined, Input<T5> | undefined, Input<T6> | undefined, Input<T7> | undefined, Input<T8> | undefined]): Output<[Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>, Unwrap<T5>, Unwrap<T6>, Unwrap<T7>, Unwrap<T8>]>;
|
||||
export function all<T1, T2, T3, T4, T5, T6, T7>(values: [Input<T1> | undefined, Input<T2> | undefined, Input<T3> | undefined, Input<T4> | undefined, Input<T5> | undefined, Input<T6> | undefined, Input<T7> | undefined]): Output<[Unwrap<T1>, Unwrap<T2>, Unwrap<T3>, Unwrap<T4>, Unwrap<T5>, Unwrap<T6>, Unwrap<T7>]>;
|
||||
|
@ -601,13 +601,14 @@ export function all<T>(val: Input<T>[] | Record<string, Input<T>>): Output<any>
|
|||
function getAwaitableValue(v: any): any {
|
||||
if (Output.isInstance(v)) {
|
||||
return v.promise(/* withUnknowns */ true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
async function getPromisedObject<T>(
|
||||
keysAndOutputs: { key: string; value: any }[]): Promise<Record<string, Unwrap<T>>> {
|
||||
keysAndOutputs: { key: string; value: any }[]): Promise<Record<string, Unwrap<T>>> {
|
||||
const result: Record<string, Unwrap<T>> = {};
|
||||
for (const kvp of keysAndOutputs) {
|
||||
result[kvp.key] = await getAwaitableValue(kvp.value);
|
||||
|
@ -666,7 +667,7 @@ class Unknown {
|
|||
* This is internal instead of being truly private, to support mixins and our serialization model.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiUnknown: boolean = true;
|
||||
|
||||
/**
|
||||
|
@ -760,8 +761,8 @@ export type Unwrap<T> =
|
|||
// 2. Otherwise, if we have an output, do the same as a promise and just unwrap the inner type.
|
||||
// 3. Otherwise, we have a basic type. Just unwrap that.
|
||||
T extends Promise<infer U1> ? UnwrapSimple<U1> :
|
||||
T extends OutputInstance<infer U2> ? UnwrapSimple<U2> :
|
||||
UnwrapSimple<T>;
|
||||
T extends OutputInstance<infer U2> ? UnwrapSimple<U2> :
|
||||
UnwrapSimple<T>;
|
||||
|
||||
type primitive = Function | string | number | boolean | undefined | null;
|
||||
|
||||
|
@ -778,10 +779,10 @@ export type UnwrapSimple<T> =
|
|||
// types have been unwrapped.
|
||||
// 4. return 'never' at the end so that if we've missed something we'll discover it.
|
||||
T extends primitive ? T :
|
||||
T extends Resource ? T :
|
||||
T extends Array<infer U> ? UnwrappedArray<U> :
|
||||
T extends object ? UnwrappedObject<T> :
|
||||
never;
|
||||
T extends Resource ? T :
|
||||
T extends Array<infer U> ? UnwrappedArray<U> :
|
||||
T extends object ? UnwrappedObject<T> :
|
||||
never;
|
||||
|
||||
export interface UnwrappedArray<T> extends Array<Unwrap<T>> {}
|
||||
|
||||
|
@ -853,11 +854,11 @@ export interface OutputConstructor {
|
|||
isInstance<T>(obj: any): obj is Output<T>;
|
||||
|
||||
/** @internal */ new<T>(
|
||||
resources: Set<Resource> | Resource[] | Resource,
|
||||
promise: Promise<T>,
|
||||
isKnown: Promise<boolean>,
|
||||
isSecret: Promise<boolean>,
|
||||
allResources: Promise<Set<Resource> | Resource[] | Resource>): Output<T>;
|
||||
resources: Set<Resource> | Resource[] | Resource,
|
||||
promise: Promise<T>,
|
||||
isKnown: Promise<boolean>,
|
||||
isSecret: Promise<boolean>,
|
||||
allResources: Promise<Set<Resource> | Resource[] | Resource>): Output<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -903,7 +904,7 @@ export interface OutputConstructor {
|
|||
* ```
|
||||
*/
|
||||
export type Output<T> = OutputInstance<T> & Lifted<T>;
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,@typescript-eslint/no-redeclare,no-underscore-dangle,id-blacklist,id-match
|
||||
export const Output: OutputConstructor = <any>OutputImpl;
|
||||
|
||||
/**
|
||||
|
@ -942,13 +943,13 @@ export const Output: OutputConstructor = <any>OutputImpl;
|
|||
export type Lifted<T> =
|
||||
// Specially handle 'string' since TS doesn't map the 'String.Length' property to it.
|
||||
T extends string ? LiftedObject<String, NonFunctionPropertyNames<String>> :
|
||||
T extends Array<infer U> ? LiftedArray<U> :
|
||||
T extends object ? LiftedObject<T, NonFunctionPropertyNames<T>> :
|
||||
// fallback to lifting no properties. Note that `Lifted` is used in
|
||||
// Output<T> = OutputInstance<T> & Lifted<T>
|
||||
// so returning an empty object just means that we're adding nothing to Output<T>.
|
||||
// This is needed for cases like `Output<any>`.
|
||||
{};
|
||||
T extends Array<infer U> ? LiftedArray<U> :
|
||||
T extends object ? LiftedObject<T, NonFunctionPropertyNames<T>> :
|
||||
// fallback to lifting no properties. Note that `Lifted` is used in
|
||||
// Output<T> = OutputInstance<T> & Lifted<T>
|
||||
// so returning an empty object just means that we're adding nothing to Output<T>.
|
||||
// This is needed for cases like `Output<any>`.
|
||||
{};
|
||||
|
||||
// The set of property names in T that are *not* functions.
|
||||
type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? never : K }[keyof T];
|
||||
|
@ -957,7 +958,7 @@ type NonFunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? nev
|
|||
// If it's require before, keep it required afterwards.
|
||||
export type LiftedObject<T, K extends keyof T> = {
|
||||
[P in K]: T[P] extends OutputInstance<infer T1> ? Output<T1> :
|
||||
T[P] extends Promise<infer T2> ? Output<T2> : Output<T[P]>
|
||||
T[P] extends Promise<infer T2> ? Output<T2> : Output<T[P]>
|
||||
};
|
||||
|
||||
export type LiftedArray<T> = {
|
||||
|
|
|
@ -34,9 +34,13 @@
|
|||
"@types/read-package-tree": "^5.2.0",
|
||||
"@types/semver": "^5.5.0",
|
||||
"@types/split2": "^2.1.6",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.0",
|
||||
"@typescript-eslint/parser": "^4.29.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-header": "^3.1.1",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"istanbul": "^0.4.5",
|
||||
"mocha": "^3.5.0",
|
||||
"tslint": "^5.11.0"
|
||||
"mocha": "^3.5.0"
|
||||
},
|
||||
"pulumi": {
|
||||
"comment": "Do not remove. Marks this as as a deployment-time-only package"
|
||||
|
|
|
@ -209,7 +209,7 @@ export interface Provider {
|
|||
* @param options the options for the resource.
|
||||
*/
|
||||
construct?: (name: string, type: string, inputs: Inputs, options: resource.ComponentResourceOptions)
|
||||
=> Promise<ConstructResult>;
|
||||
=> Promise<ConstructResult>;
|
||||
|
||||
/**
|
||||
* Call calls the indicated method.
|
||||
|
|
|
@ -264,7 +264,7 @@ class Server implements grpc.UntypedServiceImplementation {
|
|||
// in its own context, possibly using Node's `createContext` API to avoid modifying global state:
|
||||
// https://nodejs.org/api/vm.html#vm_vm_createcontext_contextobject_options
|
||||
const res = this.constructCallQueue.then(() => this.constructImpl(call, callback));
|
||||
// tslint:disable:no-empty
|
||||
/* eslint-disable no-empty,no-empty-function,@typescript-eslint/no-empty-function */
|
||||
this.constructCallQueue = res.catch(() => {});
|
||||
return res;
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ class Server implements grpc.UntypedServiceImplementation {
|
|||
// in its own context, possibly using Node's `createContext` API to avoid modifying global state:
|
||||
// https://nodejs.org/api/vm.html#vm_vm_createcontext_contextobject_options
|
||||
const res = this.constructCallQueue.then(() => this.callImpl(call, callback));
|
||||
// tslint:disable:no-empty
|
||||
/* eslint-disable no-empty, no-empty-function, @typescript-eslint/no-empty-function */
|
||||
this.constructCallQueue = res.catch(() => {});
|
||||
return res;
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ function configureRuntime(req: any, engineAddr: string) {
|
|||
// NOTE: these are globals! We should ensure that all settings are identical between calls, and eventually
|
||||
// refactor so we can avoid the global state.
|
||||
runtime.resetOptions(req.getProject(), req.getStack(), req.getParallel(), engineAddr,
|
||||
req.getMonitorendpoint(), req.getDryrun());
|
||||
req.getMonitorendpoint(), req.getDryrun());
|
||||
|
||||
const pulumiConfig: {[key: string]: string} = {};
|
||||
const rpcConfig = req.getConfigMap();
|
||||
|
@ -513,7 +513,7 @@ async function deserializeInputs(inputsStruct: any, inputDependencies: any): Pro
|
|||
// rejected the resource, or an initialization error, where the API server has accepted the
|
||||
// resource, but it failed to initialize (e.g., the app code is continually crashing and the
|
||||
// resource has failed to become alive).
|
||||
function grpcResponseFromError(e: {id: string, properties: any, message: string, reasons?: string[]}) {
|
||||
function grpcResponseFromError(e: {id: string; properties: any; message: string; reasons?: string[]}) {
|
||||
// Create response object.
|
||||
const resp = new statusproto.Status();
|
||||
resp.setCode(grpc.status.UNKNOWN);
|
||||
|
|
|
@ -25,20 +25,20 @@ export type ResolvedResource<T extends Resource> = Omit<Resolved<T>, "urn" | "ge
|
|||
export type Resolved<T> = T extends Promise<infer U1>
|
||||
? ResolvedSimple<U1>
|
||||
: T extends OutputInstance<infer U2>
|
||||
? ResolvedSimple<U2>
|
||||
: ResolvedSimple<T>;
|
||||
? ResolvedSimple<U2>
|
||||
: ResolvedSimple<T>;
|
||||
|
||||
type primitive = string | number | boolean | undefined | null;
|
||||
|
||||
type ResolvedSimple<T> = T extends primitive
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
? ResolvedArray<U>
|
||||
: T extends Function
|
||||
? never
|
||||
: T extends object
|
||||
? ResolvedObject<T>
|
||||
: never;
|
||||
? ResolvedArray<U>
|
||||
: T extends Function
|
||||
? never
|
||||
: T extends object
|
||||
? ResolvedObject<T>
|
||||
: never;
|
||||
|
||||
interface ResolvedArray<T> extends Array<Resolved<T>> {}
|
||||
|
||||
|
@ -48,4 +48,4 @@ type RequiredKeys<T> = { [P in keyof T]: undefined extends T[P] ? never : P }[ke
|
|||
type OptionalKeys<T> = { [P in keyof T]: undefined extends T[P] ? P : never }[keyof T];
|
||||
|
||||
type ModifyOptionalProperties<T> = { [P in RequiredKeys<T>]: T[P] } &
|
||||
{ [P in OptionalKeys<T>]?: T[P] };
|
||||
{ [P in OptionalKeys<T>]?: T[P] };
|
||||
|
|
|
@ -76,14 +76,14 @@ export abstract class Resource {
|
|||
* A private field to help with RTTI that works in SxS scenarios.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiResource: boolean = true;
|
||||
|
||||
/**
|
||||
* The optional parent of this resource.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __parentResource: Resource | undefined;
|
||||
|
||||
/**
|
||||
|
@ -125,7 +125,7 @@ export abstract class Resource {
|
|||
*
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public __childResources: Set<Resource> | undefined;
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ export abstract class Resource {
|
|||
* When set to true, protect ensures this resource cannot be deleted.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
private readonly __protect: boolean;
|
||||
|
||||
/**
|
||||
|
@ -149,7 +149,7 @@ export abstract class Resource {
|
|||
* cases where they are passed "old" resources.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
__transformations?: ResourceTransformation[];
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ export abstract class Resource {
|
|||
* cases where they are passed "old" resources.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
readonly __aliases?: Input<URN>[];
|
||||
|
||||
/**
|
||||
|
@ -171,14 +171,14 @@ export abstract class Resource {
|
|||
* cases where they are passed "old" resources.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
private readonly __name?: string;
|
||||
|
||||
/**
|
||||
* The set of providers to use for child resources. Keyed by package name (e.g. "aws").
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
private readonly __providers: Record<string, ProviderResource>;
|
||||
|
||||
/**
|
||||
|
@ -187,14 +187,14 @@ export abstract class Resource {
|
|||
*/
|
||||
// Note: This is deliberately not named `__provider` as that conflicts with the property
|
||||
// used by the `dynamic.Resource` class.
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
readonly __prov?: ProviderResource;
|
||||
|
||||
/**
|
||||
* The specified provider version.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
readonly __version?: string;
|
||||
|
||||
public static isInstance(obj: any): obj is Resource {
|
||||
|
@ -454,10 +454,10 @@ export interface Alias {
|
|||
|
||||
// collapseAliasToUrn turns an Alias into a URN given a set of default data
|
||||
function collapseAliasToUrn(
|
||||
alias: Input<Alias | string>,
|
||||
defaultName: string,
|
||||
defaultType: string,
|
||||
defaultParent: Resource | undefined): Output<URN> {
|
||||
alias: Input<Alias | string>,
|
||||
defaultName: string,
|
||||
defaultType: string,
|
||||
defaultParent: Resource | undefined): Output<URN> {
|
||||
|
||||
return output(alias).apply(a => {
|
||||
if (typeof a === "string") {
|
||||
|
@ -684,7 +684,7 @@ export abstract class CustomResource extends Resource {
|
|||
* A private field to help with RTTI that works in SxS scenarios.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiCustomResource: boolean;
|
||||
|
||||
/**
|
||||
|
@ -692,7 +692,7 @@ export abstract class CustomResource extends Resource {
|
|||
* classes that inherit from `CustomResource`.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiType: string;
|
||||
|
||||
/**
|
||||
|
@ -745,7 +745,7 @@ export abstract class ProviderResource extends CustomResource {
|
|||
private readonly pkg: string;
|
||||
|
||||
/** @internal */
|
||||
// tslint:disable-next-line: variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public __registrationId?: string;
|
||||
|
||||
public static async register(provider: ProviderResource | undefined): Promise<string | undefined> {
|
||||
|
@ -792,19 +792,19 @@ export class ComponentResource<TData = any> extends Resource {
|
|||
* A private field to help with RTTI that works in SxS scenarios.
|
||||
* @internal
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __pulumiComponentResource = true;
|
||||
|
||||
/** @internal */
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __data: Promise<TData>;
|
||||
|
||||
/** @internal */
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
private __registered = false;
|
||||
|
||||
/** @internal */
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
public readonly __remote: boolean;
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,7 +72,7 @@ export class PushableAsyncIterable<T> implements AsyncIterable<T | undefined> {
|
|||
[Symbol.asyncIterator]() {
|
||||
const t = this;
|
||||
return {
|
||||
async next(): Promise<{ done: boolean; value: T | undefined; }> {
|
||||
async next(): Promise<{ done: boolean; value: T | undefined }> {
|
||||
const value = await t.shift();
|
||||
if (value === closeValue) {
|
||||
return { value: undefined, done: true };
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable:max-line-length
|
||||
/* eslint-disable max-len */
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as normalize from "normalize-package-data";
|
||||
|
@ -162,9 +162,9 @@ function isSubsumedByHigherPath(normalizedPath: string, normalizedPathSet: Set<s
|
|||
// allFolders computes the set of package folders that are transitively required by the root
|
||||
// 'dependencies' node in the client's project.json file.
|
||||
function allFoldersForPackages(
|
||||
includedPackages: Set<string>,
|
||||
excludedPackages: Set<string>,
|
||||
logResource: Resource | undefined): Promise<Set<string>> {
|
||||
includedPackages: Set<string>,
|
||||
excludedPackages: Set<string>,
|
||||
logResource: Resource | undefined): Promise<Set<string>> {
|
||||
return new Promise((resolve, reject) => {
|
||||
readPackageTree(".", <any>undefined, (err: any, root: readPackageTree.Node) => {
|
||||
try {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable:max-line-length
|
||||
/* eslint-disable max-len */
|
||||
|
||||
import * as upath from "upath";
|
||||
import { ResourceError } from "../../errors";
|
||||
|
@ -101,7 +101,7 @@ export interface Entry {
|
|||
json?: any;
|
||||
|
||||
// An RegExp. Will be serialized as 'new RegExp(re.source, re.flags)'
|
||||
regexp?: { source: string, flags: string };
|
||||
regexp?: { source: string; flags: string };
|
||||
|
||||
// a closure we are dependent on.
|
||||
function?: FunctionInfo;
|
||||
|
@ -181,7 +181,7 @@ interface ContextFrame {
|
|||
functionLocation?: FunctionLocation;
|
||||
capturedFunctionName?: string;
|
||||
capturedVariableName?: string;
|
||||
capturedModule?: { name: string, value: any };
|
||||
capturedModule?: { name: string; value: any };
|
||||
}
|
||||
|
||||
interface ClosurePropertyDescriptor {
|
||||
|
@ -195,7 +195,7 @@ interface ClosurePropertyDescriptor {
|
|||
value?: any;
|
||||
writable?: boolean;
|
||||
get?: () => any;
|
||||
set?: (v: any)=> void;
|
||||
set?: (v: any) => void;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -213,7 +213,7 @@ class SerializedOutput<T> {
|
|||
|
||||
public apply<U>(func: (t: T) => Input<U>): Output<U> {
|
||||
throw new Error(
|
||||
"'apply' is not allowed from inside a cloud-callback. Use 'get' to retrieve the value of this Output directly.");
|
||||
"'apply' is not allowed from inside a cloud-callback. Use 'get' to retrieve the value of this Output directly.");
|
||||
}
|
||||
|
||||
public get(): T {
|
||||
|
@ -339,7 +339,7 @@ export async function createClosureInfoAsync(
|
|||
// see http://www.ecma-international.org/ecma-262/6.0/#sec-generatorfunction-objects and
|
||||
// http://www.ecma-international.org/ecma-262/6.0/figure-2.png
|
||||
async function addGeneratorEntriesAsync() {
|
||||
// tslint:disable-next-line:no-empty
|
||||
// eslint-disable-next-line no-empty,no-empty-function,@typescript-eslint/no-empty-function
|
||||
const emptyGenerator = function* (): any { };
|
||||
|
||||
await addEntriesAsync(
|
||||
|
@ -362,8 +362,8 @@ export async function createClosureInfoAsync(
|
|||
* final FunctionInfo.
|
||||
*/
|
||||
async function analyzeFunctionInfoAsync(
|
||||
func: Function, context: Context,
|
||||
serialize: (o: any) => boolean, logInfo?: boolean): Promise<FunctionInfo> {
|
||||
func: Function, context: Context,
|
||||
serialize: (o: any) => boolean, logInfo?: boolean): Promise<FunctionInfo> {
|
||||
|
||||
// logInfo = logInfo || func.name === "addHandler";
|
||||
|
||||
|
@ -687,7 +687,7 @@ function throwSerializationError(
|
|||
message += getTrimmedFunctionCode(func);
|
||||
|
||||
const moduleIndex = context.frames.findIndex(
|
||||
f => f.capturedModule !== undefined);
|
||||
f => f.capturedModule !== undefined);
|
||||
|
||||
if (moduleIndex >= 0) {
|
||||
const module = context.frames[moduleIndex].capturedModule!;
|
||||
|
@ -782,10 +782,10 @@ async function isDefaultFunctionPrototypeAsync(func: Function, prototypeProp: an
|
|||
}
|
||||
|
||||
async function createPropertyInfoAsync(
|
||||
descriptor: ClosurePropertyDescriptor,
|
||||
context: Context,
|
||||
serialize: (o: any) => boolean,
|
||||
logInfo: boolean | undefined): Promise<PropertyInfo> {
|
||||
descriptor: ClosurePropertyDescriptor,
|
||||
context: Context,
|
||||
serialize: (o: any) => boolean,
|
||||
logInfo: boolean | undefined): Promise<PropertyInfo> {
|
||||
|
||||
const propertyInfo = <PropertyInfo>{ hasValue: descriptor.value !== undefined };
|
||||
propertyInfo.configurable = descriptor.configurable;
|
||||
|
@ -793,11 +793,11 @@ async function createPropertyInfoAsync(
|
|||
propertyInfo.writable = descriptor.writable;
|
||||
if (descriptor.get) {
|
||||
propertyInfo.get = await getOrCreateEntryAsync(
|
||||
descriptor.get, undefined, context, serialize, logInfo);
|
||||
descriptor.get, undefined, context, serialize, logInfo);
|
||||
}
|
||||
if (descriptor.set) {
|
||||
propertyInfo.set = await getOrCreateEntryAsync(
|
||||
descriptor.set, undefined, context, serialize, logInfo);
|
||||
descriptor.set, undefined, context, serialize, logInfo);
|
||||
}
|
||||
|
||||
return propertyInfo;
|
||||
|
@ -818,10 +818,10 @@ function getOrCreateNameEntryAsync(
|
|||
* specific properties. If propNames is not provided, or is empty, serialize out all properties.
|
||||
*/
|
||||
async function getOrCreateEntryAsync(
|
||||
obj: any, capturedObjectProperties: CapturedPropertyChain[] | undefined,
|
||||
context: Context,
|
||||
serialize: (o: any) => boolean,
|
||||
logInfo: boolean | undefined): Promise<Entry> {
|
||||
obj: any, capturedObjectProperties: CapturedPropertyChain[] | undefined,
|
||||
context: Context,
|
||||
serialize: (o: any) => boolean,
|
||||
logInfo: boolean | undefined): Promise<Entry> {
|
||||
|
||||
// Check if this is a special number that we cannot json serialize. Instead, we'll just inject
|
||||
// the code necessary to represent the number on the other side. Note: we have to do this
|
||||
|
@ -1046,7 +1046,7 @@ async function getOrCreateEntryAsync(
|
|||
// Serializes out only the subset of properties of this object that we have seen used
|
||||
// and have recorded in localCapturedPropertyChains
|
||||
async function serializeSomeObjectPropertiesAsync(
|
||||
object: ObjectInfo, localCapturedPropertyChains: CapturedPropertyChain[]): Promise<boolean> {
|
||||
object: ObjectInfo, localCapturedPropertyChains: CapturedPropertyChain[]): Promise<boolean> {
|
||||
|
||||
// validate our invariants.
|
||||
for (const chain of localCapturedPropertyChains) {
|
||||
|
@ -1422,8 +1422,8 @@ async function getOwnPropertyDescriptors(obj: any): Promise<ClosurePropertyDescr
|
|||
|
||||
async function getOwnPropertyAsync(obj: any, descriptor: ClosurePropertyDescriptor): Promise<any> {
|
||||
return (descriptor.get || descriptor.set) ?
|
||||
undefined :
|
||||
obj[getNameOrSymbol(descriptor)];
|
||||
undefined :
|
||||
obj[getNameOrSymbol(descriptor)];
|
||||
}
|
||||
|
||||
async function getPropertyAsync(obj: any, name: string): Promise<any> {
|
||||
|
|
|
@ -239,7 +239,7 @@ function tryParseAsArrowFunction(toParse: string): boolean {
|
|||
}
|
||||
|
||||
function makeFunctionDeclaration(
|
||||
v: string, isAsync: boolean, isFunctionDeclaration: boolean): [string, ParsedFunctionCode] {
|
||||
v: string, isAsync: boolean, isFunctionDeclaration: boolean): [string, ParsedFunctionCode] {
|
||||
|
||||
let prefix = isAsync ? "async " : "";
|
||||
prefix += "function ";
|
||||
|
@ -338,18 +338,18 @@ function computeUsesNonLexicalThis(file: ts.SourceFile): boolean {
|
|||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.SuperKeyword:
|
||||
case ts.SyntaxKind.ThisKeyword:
|
||||
usesNonLexicalThis = true;
|
||||
break;
|
||||
case ts.SyntaxKind.SuperKeyword:
|
||||
case ts.SyntaxKind.ThisKeyword:
|
||||
usesNonLexicalThis = true;
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
return visitCallExpression(<ts.CallExpression>node);
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
return visitCallExpression(<ts.CallExpression>node);
|
||||
|
||||
case ts.SyntaxKind.MethodDeclaration:
|
||||
case ts.SyntaxKind.FunctionDeclaration:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
return visitBaseFunction(<ts.FunctionLikeDeclarationBase>node);
|
||||
case ts.SyntaxKind.MethodDeclaration:
|
||||
case ts.SyntaxKind.FunctionDeclaration:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
return visitBaseFunction(<ts.FunctionLikeDeclarationBase>node);
|
||||
|
||||
// Note: it is intentional that we ignore ArrowFunction. If we use 'this' inside of it,
|
||||
// then that should be considered a use of the non-lexical-this from an outer function.
|
||||
|
@ -357,8 +357,8 @@ function computeUsesNonLexicalThis(file: ts.SourceFile): boolean {
|
|||
// function f() { var v = () => console.log(this) }
|
||||
//
|
||||
// case ts.SyntaxKind.ArrowFunction:
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ts.forEachChild(node, walk);
|
||||
|
@ -494,35 +494,35 @@ function computeCapturedVariableNames(file: ts.SourceFile): CapturedVariables {
|
|||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return visitIdentifier(<ts.Identifier>node);
|
||||
case ts.SyntaxKind.ThisKeyword:
|
||||
return visitThisExpression(<ts.ThisExpression>node);
|
||||
case ts.SyntaxKind.Block:
|
||||
return visitBlockStatement(<ts.Block>node);
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
return visitCallExpression(<ts.CallExpression>node);
|
||||
case ts.SyntaxKind.CatchClause:
|
||||
return visitCatchClause(<ts.CatchClause>node);
|
||||
case ts.SyntaxKind.MethodDeclaration:
|
||||
return visitMethodDeclaration(<ts.MethodDeclaration>node);
|
||||
case ts.SyntaxKind.MetaProperty:
|
||||
// don't walk down an es6 metaproperty (i.e. "new.target"). It doesn't
|
||||
// capture anything.
|
||||
return;
|
||||
case ts.SyntaxKind.PropertyAssignment:
|
||||
return visitPropertyAssignment(<ts.PropertyAssignment>node);
|
||||
case ts.SyntaxKind.PropertyAccessExpression:
|
||||
return visitPropertyAccessExpression(<ts.PropertyAccessExpression>node);
|
||||
case ts.SyntaxKind.FunctionDeclaration:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
return visitFunctionDeclarationOrExpression(<ts.FunctionDeclaration>node);
|
||||
case ts.SyntaxKind.ArrowFunction:
|
||||
return visitBaseFunction(<ts.ArrowFunction>node, /*isArrowFunction:*/true, /*name:*/ undefined);
|
||||
case ts.SyntaxKind.VariableDeclaration:
|
||||
return visitVariableDeclaration(<ts.VariableDeclaration>node);
|
||||
default:
|
||||
break;
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return visitIdentifier(<ts.Identifier>node);
|
||||
case ts.SyntaxKind.ThisKeyword:
|
||||
return visitThisExpression(<ts.ThisExpression>node);
|
||||
case ts.SyntaxKind.Block:
|
||||
return visitBlockStatement(<ts.Block>node);
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
return visitCallExpression(<ts.CallExpression>node);
|
||||
case ts.SyntaxKind.CatchClause:
|
||||
return visitCatchClause(<ts.CatchClause>node);
|
||||
case ts.SyntaxKind.MethodDeclaration:
|
||||
return visitMethodDeclaration(<ts.MethodDeclaration>node);
|
||||
case ts.SyntaxKind.MetaProperty:
|
||||
// don't walk down an es6 metaproperty (i.e. "new.target"). It doesn't
|
||||
// capture anything.
|
||||
return;
|
||||
case ts.SyntaxKind.PropertyAssignment:
|
||||
return visitPropertyAssignment(<ts.PropertyAssignment>node);
|
||||
case ts.SyntaxKind.PropertyAccessExpression:
|
||||
return visitPropertyAccessExpression(<ts.PropertyAccessExpression>node);
|
||||
case ts.SyntaxKind.FunctionDeclaration:
|
||||
case ts.SyntaxKind.FunctionExpression:
|
||||
return visitFunctionDeclarationOrExpression(<ts.FunctionDeclaration>node);
|
||||
case ts.SyntaxKind.ArrowFunction:
|
||||
return visitBaseFunction(<ts.ArrowFunction>node, /*isArrowFunction:*/true, /*name:*/ undefined);
|
||||
case ts.SyntaxKind.VariableDeclaration:
|
||||
return visitVariableDeclaration(<ts.VariableDeclaration>node);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ts.forEachChild(node, walk);
|
||||
|
@ -625,7 +625,7 @@ function computeCapturedVariableNames(file: ts.SourceFile): CapturedVariables {
|
|||
}
|
||||
|
||||
function visitFunctionDeclarationOrExpression(
|
||||
node: ts.FunctionDeclaration | ts.FunctionExpression): void {
|
||||
node: ts.FunctionDeclaration | ts.FunctionExpression): void {
|
||||
// A function declaration is special in one way: its identifier is added to the current function's
|
||||
// var-style variables, so that its name is in scope no matter the order of surrounding references to it.
|
||||
|
||||
|
@ -637,9 +637,9 @@ function computeCapturedVariableNames(file: ts.SourceFile): CapturedVariables {
|
|||
}
|
||||
|
||||
function visitBaseFunction(
|
||||
node: ts.FunctionLikeDeclarationBase,
|
||||
isArrowFunction: boolean,
|
||||
functionName: ts.Identifier | undefined): void {
|
||||
node: ts.FunctionLikeDeclarationBase,
|
||||
isArrowFunction: boolean,
|
||||
functionName: ts.Identifier | undefined): void {
|
||||
// First, push new free vars list, scope, and function vars
|
||||
const savedRequired = required;
|
||||
const savedOptional = optional;
|
||||
|
@ -794,27 +794,27 @@ function computeCapturedVariableNames(file: ts.SourceFile): CapturedVariables {
|
|||
}
|
||||
|
||||
switch (n.kind) {
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return visitVariableDeclarationIdentifier(<ts.Identifier>n, isVar);
|
||||
case ts.SyntaxKind.ObjectBindingPattern:
|
||||
case ts.SyntaxKind.ArrayBindingPattern:
|
||||
const bindingPattern = <ts.BindingPattern>n;
|
||||
for (const element of bindingPattern.elements) {
|
||||
if (ts.isBindingElement(element)) {
|
||||
visitBindingElement(element, isVar);
|
||||
}
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return visitVariableDeclarationIdentifier(<ts.Identifier>n, isVar);
|
||||
case ts.SyntaxKind.ObjectBindingPattern:
|
||||
case ts.SyntaxKind.ArrayBindingPattern:
|
||||
const bindingPattern = <ts.BindingPattern>n;
|
||||
for (const element of bindingPattern.elements) {
|
||||
if (ts.isBindingElement(element)) {
|
||||
visitBindingElement(element, isVar);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function visitVariableDeclaration(node: ts.VariableDeclaration): void {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
// eslint-disable-next-line max-len
|
||||
const isLet = node.parent !== undefined && ts.isVariableDeclarationList(node.parent) && (node.parent.flags & ts.NodeFlags.Let) !== 0;
|
||||
// tslint:disable-next-line:max-line-length
|
||||
// eslint-disable-next-line max-len
|
||||
const isConst = node.parent !== undefined && ts.isVariableDeclarationList(node.parent) && (node.parent.flags & ts.NodeFlags.Const) !== 0;
|
||||
const isVar = !isLet && !isConst;
|
||||
|
||||
|
|
|
@ -92,8 +92,8 @@ export interface SerializedFunction {
|
|||
* @param args Arguments to use to control the serialization of the JavaScript function.
|
||||
*/
|
||||
export async function serializeFunction(
|
||||
func: Function,
|
||||
args: SerializeFunctionArgs = {}): Promise<SerializedFunction> {
|
||||
func: Function,
|
||||
args: SerializeFunctionArgs = {}): Promise<SerializedFunction> {
|
||||
|
||||
const exportName = args.exportName || "handler";
|
||||
const serialize = args.serialize || (_ => true);
|
||||
|
@ -110,8 +110,8 @@ export async function serializeFunction(
|
|||
* @deprecated Please use 'serializeFunction' instead.
|
||||
*/
|
||||
export async function serializeFunctionAsync(
|
||||
func: Function,
|
||||
serialize?: (o: any) => boolean): Promise<string> {
|
||||
func: Function,
|
||||
serialize?: (o: any) => boolean): Promise<string> {
|
||||
log.warn("'function serializeFunctionAsync' is deprecated. Please use 'serializeFunction' instead.");
|
||||
|
||||
serialize = serialize || (_ => true);
|
||||
|
@ -129,9 +129,9 @@ export async function serializeFunctionAsync(
|
|||
* @param c The FunctionInfo to be serialized into a module string.
|
||||
*/
|
||||
function serializeJavaScriptText(
|
||||
outerClosure: closure.ClosureInfo,
|
||||
exportName: string,
|
||||
isFactoryFunction: boolean): SerializedFunction {
|
||||
outerClosure: closure.ClosureInfo,
|
||||
exportName: string,
|
||||
isFactoryFunction: boolean): SerializedFunction {
|
||||
|
||||
// Now produce a textual representation of the closure and its serialized captured environment.
|
||||
|
||||
|
@ -257,7 +257,7 @@ function serializeJavaScriptText(
|
|||
}
|
||||
|
||||
function simpleEnvEntryToString(
|
||||
envEntry: closure.Entry, varName: string): string {
|
||||
envEntry: closure.Entry, varName: string): string {
|
||||
|
||||
if (envEntry.hasOwnProperty("json")) {
|
||||
return JSON.stringify(envEntry.json);
|
||||
|
@ -285,7 +285,7 @@ function serializeJavaScriptText(
|
|||
}
|
||||
|
||||
function complexEnvEntryToString(
|
||||
envEntry: closure.Entry, varName: string): string {
|
||||
envEntry: closure.Entry, varName: string): string {
|
||||
// Call all environment variables __e<num> to make them unique. But suffix
|
||||
// them with the original name of the property to help provide context when
|
||||
// looking at the source.
|
||||
|
@ -401,7 +401,7 @@ function serializeJavaScriptText(
|
|||
}
|
||||
|
||||
function emitComplexObjectProperties(
|
||||
envVar: string, varName: string, objEntry: closure.ObjectInfo): void {
|
||||
envVar: string, varName: string, objEntry: closure.ObjectInfo): void {
|
||||
|
||||
for (const [keyEntry, { info, entry: valEntry }] of objEntry.env) {
|
||||
const subName = typeof keyEntry.json === "string" ? keyEntry.json : "sym";
|
||||
|
@ -451,7 +451,7 @@ function serializeJavaScriptText(
|
|||
}
|
||||
|
||||
function emitArray(
|
||||
envVar: string, arr: closure.Entry[], varName: string): void {
|
||||
envVar: string, arr: closure.Entry[], varName: string): void {
|
||||
if (arr.some(deepContainsObjOrArrayOrRegExp) || isSparse(arr) || hasNonNumericIndices(arr)) {
|
||||
// we have a complex child. Because of the possibility of recursion in the object
|
||||
// graph, we have to spit out this variable initialized (but empty) first. Then we can
|
||||
|
|
|
@ -102,7 +102,7 @@ function getScript(func: Function): V8Script | undefined {
|
|||
const getSourcePosition: (func: Function) => V8SourcePosition =
|
||||
new Function("func", "return %FunctionGetScriptSourcePosition(func);") as any;
|
||||
|
||||
function scriptPositionInfo(script: V8Script, pos: V8SourcePosition): {line: number, column: number} {
|
||||
function scriptPositionInfo(script: V8Script, pos: V8SourcePosition): {line: number; column: number} {
|
||||
if (isNodeAtLeastV10) {
|
||||
const scriptPositionInfoFunc =
|
||||
new Function("script", "pos", "return %ScriptPositionInfo(script, pos, false);") as any;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable:max-line-length
|
||||
/* eslint-disable max-len */
|
||||
|
||||
import * as inspector from "inspector";
|
||||
import * as util from "util";
|
||||
|
@ -193,8 +193,8 @@ async function getRuntimeIdForFunctionAsync(func: Function): Promise<inspector.R
|
|||
}
|
||||
|
||||
async function runtimeGetPropertiesAsync(
|
||||
objectId: inspector.Runtime.RemoteObjectId,
|
||||
ownProperties: boolean | undefined) {
|
||||
objectId: inspector.Runtime.RemoteObjectId,
|
||||
ownProperties: boolean | undefined) {
|
||||
const session = <GetPropertiesSession>await v8Hooks.getSessionAsync();
|
||||
const post = util.promisify(session.post);
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ function createInvokeRequest(tok: string, serialized: any, provider: string | un
|
|||
|
||||
function getProvider(tok: string, opts: InvokeOptions) {
|
||||
return opts.provider ? opts.provider :
|
||||
opts.parent ? opts.parent.getProvider(tok) : undefined;
|
||||
opts.parent ? opts.parent.getProvider(tok) : undefined;
|
||||
}
|
||||
|
||||
function deserializeResponse(tok: string, resp: any): any {
|
||||
|
@ -329,7 +329,7 @@ export function call<T>(tok: string, props: Inputs, res?: Resource): Output<T> {
|
|||
}
|
||||
|
||||
function createOutput<T>(label: string):
|
||||
[Output<T>, (v: T, isKnown: boolean, isSecret: boolean, deps?: Resource[], err?: Error | undefined) => void] {
|
||||
[Output<T>, (v: T, isKnown: boolean, isSecret: boolean, deps?: Resource[], err?: Error | undefined) => void] {
|
||||
let resolveValue: (v: T) => void;
|
||||
let rejectValue: (err: Error) => void;
|
||||
let resolveIsKnown: (v: boolean) => void;
|
||||
|
|
|
@ -93,11 +93,11 @@ export interface Mocks {
|
|||
|
||||
* @param args: MockResourceArgs
|
||||
*/
|
||||
newResource(args: MockResourceArgs): { id: string | undefined, state: Record<string, any> };
|
||||
newResource(args: MockResourceArgs): { id: string | undefined; state: Record<string, any> };
|
||||
}
|
||||
|
||||
export class MockMonitor {
|
||||
readonly resources = new Map<string, { urn: string, id: string | undefined, state: any }>();
|
||||
readonly resources = new Map<string, { urn: string; id: string | undefined; state: any }>();
|
||||
|
||||
constructor(readonly mocks: Mocks) {
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ async function prepareResource(label: string, res: Resource, custom: boolean, re
|
|||
rejectIsKnown = reject;
|
||||
}),
|
||||
`resolveURNIsKnown(${label})`),
|
||||
/*isSecret:*/ Promise.resolve(false),
|
||||
/*isSecret:*/ Promise.resolve(false),
|
||||
Promise.resolve(res));
|
||||
|
||||
resolveURN = (v, err) => {
|
||||
|
@ -478,7 +478,7 @@ async function prepareResource(label: string, res: Resource, custom: boolean, re
|
|||
resolveValue = resolve;
|
||||
rejectValue = reject;
|
||||
}),
|
||||
`resolveID(${label})`),
|
||||
`resolveID(${label})`),
|
||||
debuggablePromise(new Promise<boolean>((resolve, reject) => {
|
||||
resolveIsKnown = resolve;
|
||||
rejectIsKnown = reject;
|
||||
|
@ -630,7 +630,7 @@ async function getAllTransitivelyReferencedResourceURNs(resources: Set<Resource>
|
|||
// Then we filter to only include Custom and Remote resources.
|
||||
const transitivelyReachableCustomResources =
|
||||
[...transitivelyReachableResources]
|
||||
.filter(r => CustomResource.isInstance(r) || (r as ComponentResource).__remote);
|
||||
.filter(r => CustomResource.isInstance(r) || (r as ComponentResource).__remote);
|
||||
const promises = transitivelyReachableCustomResources.map(r => r.urn.promise());
|
||||
const urns = await Promise.all(promises);
|
||||
return new Set<string>(urns);
|
||||
|
@ -814,8 +814,8 @@ export function listResourceOutputs<U extends Resource>(
|
|||
}).then<any[]>(({ outputs }) => utils.values(outputs)),
|
||||
)
|
||||
.map<ResolvedResource<U>>(({ type: typ, outputs }) => {
|
||||
return { ...outputs, __pulumiType: typ };
|
||||
})
|
||||
return { ...outputs, __pulumiType: typ };
|
||||
})
|
||||
.filter(typeFilter);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,10 +112,10 @@ export function transferProperties(onto: Resource, label: string, props: Inputs)
|
|||
* be remoted over to registerResource.
|
||||
*/
|
||||
async function serializeFilteredProperties(
|
||||
label: string,
|
||||
props: Inputs,
|
||||
acceptKey: (k: string) => boolean,
|
||||
): Promise<[Record<string, any>, Map<string, Set<Resource>>]> {
|
||||
label: string,
|
||||
props: Inputs,
|
||||
acceptKey: (k: string) => boolean,
|
||||
): Promise<[Record<string, any>, Map<string, Set<Resource>>]> {
|
||||
|
||||
const propertyToDependentResources = new Map<string, Set<Resource>>();
|
||||
|
||||
|
@ -232,9 +232,9 @@ export function resolveProperties(
|
|||
// present during previews (i.e. isDryRun() will be true).
|
||||
resolve(value, /*isKnown*/ true, isSecret, deps[k]);
|
||||
}
|
||||
catch (err) {
|
||||
catch (resolveError) {
|
||||
throw new Error(
|
||||
`Unable to set property '${k}' on resource '${name}' [${t}]; error: ${errorString(err)}`);
|
||||
`Unable to set property '${k}' on resource '${name}' [${t}]; error: ${errorString(resolveError)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,83 +499,83 @@ export function deserializeProperty(prop: any): any {
|
|||
const sig: any = prop[specialSigKey];
|
||||
if (sig) {
|
||||
switch (sig) {
|
||||
case specialAssetSig:
|
||||
if (prop["path"]) {
|
||||
return new asset.FileAsset(<string>prop["path"]);
|
||||
}
|
||||
else if (prop["text"]) {
|
||||
return new asset.StringAsset(<string>prop["text"]);
|
||||
}
|
||||
else if (prop["uri"]) {
|
||||
return new asset.RemoteAsset(<string>prop["uri"]);
|
||||
}
|
||||
else {
|
||||
throw new Error("Invalid asset encountered when unmarshaling resource property");
|
||||
}
|
||||
case specialArchiveSig:
|
||||
if (prop["assets"]) {
|
||||
const assets: asset.AssetMap = {};
|
||||
for (const name of Object.keys(prop["assets"])) {
|
||||
const a = deserializeProperty(prop["assets"][name]);
|
||||
if (!(asset.Asset.isInstance(a)) && !(asset.Archive.isInstance(a))) {
|
||||
throw new Error(
|
||||
"Expected an AssetArchive's assets to be unmarshaled Asset or Archive objects");
|
||||
}
|
||||
assets[name] = a;
|
||||
case specialAssetSig:
|
||||
if (prop["path"]) {
|
||||
return new asset.FileAsset(<string>prop["path"]);
|
||||
}
|
||||
else if (prop["text"]) {
|
||||
return new asset.StringAsset(<string>prop["text"]);
|
||||
}
|
||||
else if (prop["uri"]) {
|
||||
return new asset.RemoteAsset(<string>prop["uri"]);
|
||||
}
|
||||
else {
|
||||
throw new Error("Invalid asset encountered when unmarshaling resource property");
|
||||
}
|
||||
case specialArchiveSig:
|
||||
if (prop["assets"]) {
|
||||
const assets: asset.AssetMap = {};
|
||||
for (const name of Object.keys(prop["assets"])) {
|
||||
const a = deserializeProperty(prop["assets"][name]);
|
||||
if (!(asset.Asset.isInstance(a)) && !(asset.Archive.isInstance(a))) {
|
||||
throw new Error(
|
||||
"Expected an AssetArchive's assets to be unmarshaled Asset or Archive objects");
|
||||
}
|
||||
return new asset.AssetArchive(assets);
|
||||
assets[name] = a;
|
||||
}
|
||||
else if (prop["path"]) {
|
||||
return new asset.FileArchive(<string>prop["path"]);
|
||||
}
|
||||
else if (prop["uri"]) {
|
||||
return new asset.RemoteArchive(<string>prop["uri"]);
|
||||
}
|
||||
else {
|
||||
throw new Error("Invalid archive encountered when unmarshaling resource property");
|
||||
}
|
||||
case specialSecretSig:
|
||||
return {
|
||||
[specialSigKey]: specialSecretSig,
|
||||
value: deserializeProperty(prop["value"]),
|
||||
};
|
||||
case specialResourceSig:
|
||||
// Deserialize the resource into a live Resource reference
|
||||
const urn = prop["urn"];
|
||||
const version = prop["packageVersion"];
|
||||
return new asset.AssetArchive(assets);
|
||||
}
|
||||
else if (prop["path"]) {
|
||||
return new asset.FileArchive(<string>prop["path"]);
|
||||
}
|
||||
else if (prop["uri"]) {
|
||||
return new asset.RemoteArchive(<string>prop["uri"]);
|
||||
}
|
||||
else {
|
||||
throw new Error("Invalid archive encountered when unmarshaling resource property");
|
||||
}
|
||||
case specialSecretSig:
|
||||
return {
|
||||
[specialSigKey]: specialSecretSig,
|
||||
value: deserializeProperty(prop["value"]),
|
||||
};
|
||||
case specialResourceSig:
|
||||
// Deserialize the resource into a live Resource reference
|
||||
const urn = prop["urn"];
|
||||
const version = prop["packageVersion"];
|
||||
|
||||
const urnParts = urn.split("::");
|
||||
const qualifiedType = urnParts[2];
|
||||
const urnName = urnParts[3];
|
||||
const urnParts = urn.split("::");
|
||||
const qualifiedType = urnParts[2];
|
||||
const urnName = urnParts[3];
|
||||
|
||||
const type = qualifiedType.split("$").pop()!;
|
||||
const typeParts = type.split(":");
|
||||
const pkgName = typeParts[0];
|
||||
const modName = typeParts.length > 1 ? typeParts[1] : "";
|
||||
const typName = typeParts.length > 2 ? typeParts[2] : "";
|
||||
const isProvider = pkgName === "pulumi" && modName === "providers";
|
||||
const type = qualifiedType.split("$").pop()!;
|
||||
const typeParts = type.split(":");
|
||||
const pkgName = typeParts[0];
|
||||
const modName = typeParts.length > 1 ? typeParts[1] : "";
|
||||
const typName = typeParts.length > 2 ? typeParts[2] : "";
|
||||
const isProvider = pkgName === "pulumi" && modName === "providers";
|
||||
|
||||
if (isProvider) {
|
||||
const resourcePackage = getResourcePackage(typName, version);
|
||||
if (resourcePackage) {
|
||||
return resourcePackage.constructProvider(urnName, type, urn);
|
||||
}
|
||||
} else {
|
||||
const resourceModule = getResourceModule(pkgName, modName, version);
|
||||
if (resourceModule) {
|
||||
return resourceModule.construct(urnName, type, urn);
|
||||
}
|
||||
if (isProvider) {
|
||||
const resourcePackage = getResourcePackage(typName, version);
|
||||
if (resourcePackage) {
|
||||
return resourcePackage.constructProvider(urnName, type, urn);
|
||||
}
|
||||
|
||||
// If we've made it here, deserialize the reference as either a URN or an ID (if present).
|
||||
if (prop["id"]) {
|
||||
const id = prop["id"];
|
||||
return deserializeProperty(id === "" ? unknownValue : id);
|
||||
} else {
|
||||
const resourceModule = getResourceModule(pkgName, modName, version);
|
||||
if (resourceModule) {
|
||||
return resourceModule.construct(urnName, type, urn);
|
||||
}
|
||||
return urn;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new Error(`Unrecognized signature '${sig}' when unmarshaling resource property`);
|
||||
// If we've made it here, deserialize the reference as either a URN or an ID (if present).
|
||||
if (prop["id"]) {
|
||||
const id = prop["id"];
|
||||
return deserializeProperty(id === "" ? unknownValue : id);
|
||||
}
|
||||
return urn;
|
||||
|
||||
default:
|
||||
throw new Error(`Unrecognized signature '${sig}' when unmarshaling resource property`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ const grpcChannelOptions = { "grpc.max_receive_message_length": maxRPCMessageSiz
|
|||
/**
|
||||
* excessiveDebugOutput enables, well, pretty excessive debug output pertaining to resources and properties.
|
||||
*/
|
||||
export let excessiveDebugOutput: boolean = false;
|
||||
export const excessiveDebugOutput: boolean = false;
|
||||
|
||||
/**
|
||||
* Options is a bag of settings that controls the behavior of previews and deployments
|
||||
|
|
|
@ -628,7 +628,7 @@ describe("LocalWorkspace", () => {
|
|||
|
||||
// pulumi up
|
||||
await assert.rejects(stack.up(), (err: Error) => {
|
||||
return err.stack!.indexOf("Detected multiple versions of '@pulumi/pulumi'") >= 0;
|
||||
return err.stack!.indexOf("Detected multiple versions of '@pulumi/pulumi'") >= 0;
|
||||
});
|
||||
|
||||
// pulumi destroy
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable
|
||||
/* eslint-disable */
|
||||
|
||||
import * as assert from "assert";
|
||||
import { ComponentResourceOptions, ProviderResource, merge, mergeOptions } from "../resource";
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable
|
||||
/* eslint-disable */
|
||||
|
||||
import * as assert from "assert";
|
||||
import { Output, all, concat, interpolate, output, unknown, secret, unsecret, isSecret } from "../output";
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable
|
||||
/* eslint-disable */
|
||||
|
||||
import * as assert from "assert";
|
||||
import { Output, concat, interpolate, output } from "../output";
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable
|
||||
/* eslint-disable */
|
||||
|
||||
// Make sure we are listening for v8 events as they're necessary to get things like file locations
|
||||
// for serialization errors. We need to do this first, before we even get around to running tests.
|
||||
|
|
|
@ -51,7 +51,7 @@ export class Config {
|
|||
return undefined;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* fullKey turns a simple configuration key into a fully resolved one, by prepending the bag's name.
|
||||
|
|
|
@ -11,7 +11,7 @@ const cases = [];
|
|||
|
||||
cases.push({
|
||||
title: "Captures bigint",
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
func: function () { console.log(zeroBigInt + smallBigInt + negativeBigInt + largeBigInt + negativeBigInt + negativeLargeBigInt); },
|
||||
expectText: `exports.handler = __f0;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
const cases = [];
|
||||
cases.push({
|
||||
title: "Async anonymous function closure (js)",
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
func: async function (a) { await a; },
|
||||
expectText: `exports.handler = __f0;
|
||||
|
||||
|
@ -22,7 +22,7 @@ return async function (a) { await a; };
|
|||
|
||||
cases.push({
|
||||
title: "Async anonymous function closure - extra space (js)",
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
func: async function (a) { await a; },
|
||||
expectText: `exports.handler = __f0;
|
||||
|
||||
|
@ -40,7 +40,7 @@ return async function (a) { await a; };
|
|||
|
||||
cases.push({
|
||||
title: "Async named function closure (js)",
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
func: async function foo(a) { await a; },
|
||||
expectText: `exports.handler = __foo;
|
||||
|
||||
|
@ -58,7 +58,7 @@ return async function /*foo*/(a) { await a; };
|
|||
|
||||
cases.push({
|
||||
title: "Async arrow function closure (js)",
|
||||
// tslint:disable-next-line
|
||||
// eslint-disable-next-line
|
||||
func: async (a) => { await a; },
|
||||
expectText: `exports.handler = __f0;
|
||||
|
||||
|
|
|
@ -47,18 +47,18 @@ interface RunCase {
|
|||
};
|
||||
skipRootResourceEndpoints?: boolean;
|
||||
showRootResourceRegistration?: boolean;
|
||||
invoke?: (ctx: any, tok: string, args: any, version: string, provider: string) => { failures: any, ret: any };
|
||||
invoke?: (ctx: any, tok: string, args: any, version: string, provider: string) => { failures: any; ret: any };
|
||||
readResource?: (ctx: any, t: string, name: string, id: string, par: string, state: any, version: string) => {
|
||||
urn: URN | undefined, props: any | undefined,
|
||||
urn: URN | undefined; props: any | undefined;
|
||||
};
|
||||
registerResource?: (ctx: any, dryrun: boolean, t: string, name: string, res: any, dependencies?: string[],
|
||||
custom?: boolean, protect?: boolean, parent?: string, provider?: string,
|
||||
propertyDeps?: any, ignoreChanges?: string[], version?: string, importID?: string,
|
||||
replaceOnChanges?: string[]) => {
|
||||
urn: URN | undefined, id: ID | undefined, props: any | undefined,
|
||||
custom?: boolean, protect?: boolean, parent?: string, provider?: string,
|
||||
propertyDeps?: any, ignoreChanges?: string[], version?: string, importID?: string,
|
||||
replaceOnChanges?: string[]) => {
|
||||
urn: URN | undefined; id: ID | undefined; props: any | undefined;
|
||||
};
|
||||
registerResourceOutputs?: (ctx: any, dryrun: boolean, urn: URN,
|
||||
t: string, name: string, res: any, outputs: any | undefined) => void;
|
||||
t: string, name: string, res: any, outputs: any | undefined) => void;
|
||||
log?: (ctx: any, severity: any, message: string, urn: URN, streamId: number) => void;
|
||||
getRootResource?: (ctx: any) => { urn: string };
|
||||
setRootResource?: (ctx: any, urn: string) => void;
|
||||
|
@ -211,42 +211,42 @@ describe("rpc", () => {
|
|||
let id: ID | undefined;
|
||||
let props: any | undefined;
|
||||
switch (t) {
|
||||
case "test:index:ResourceA": {
|
||||
assert.strictEqual(name, "resourceA");
|
||||
assert.deepStrictEqual(res, { inprop: 777 });
|
||||
if (!dryrun) {
|
||||
id = name;
|
||||
props = { outprop: "output yeah" };
|
||||
}
|
||||
break;
|
||||
case "test:index:ResourceA": {
|
||||
assert.strictEqual(name, "resourceA");
|
||||
assert.deepStrictEqual(res, { inprop: 777 });
|
||||
if (!dryrun) {
|
||||
id = name;
|
||||
props = { outprop: "output yeah" };
|
||||
}
|
||||
case "test:index:ResourceB": {
|
||||
assert.strictEqual(name, "resourceB");
|
||||
assert.deepStrictEqual(dependencies, ["test:index:ResourceA::resourceA"]);
|
||||
break;
|
||||
}
|
||||
case "test:index:ResourceB": {
|
||||
assert.strictEqual(name, "resourceB");
|
||||
assert.deepStrictEqual(dependencies, ["test:index:ResourceA::resourceA"]);
|
||||
|
||||
if (dryrun) {
|
||||
// If this is a dry-run, we will have no known values.
|
||||
assert.deepStrictEqual(res, {
|
||||
otherIn: runtime.unknownValue,
|
||||
otherOut: runtime.unknownValue,
|
||||
});
|
||||
}
|
||||
else {
|
||||
// Otherwise, we will:
|
||||
assert.deepStrictEqual(res, {
|
||||
otherIn: 777,
|
||||
otherOut: "output yeah",
|
||||
});
|
||||
}
|
||||
|
||||
if (!dryrun) {
|
||||
id = name;
|
||||
}
|
||||
break;
|
||||
if (dryrun) {
|
||||
// If this is a dry-run, we will have no known values.
|
||||
assert.deepStrictEqual(res, {
|
||||
otherIn: runtime.unknownValue,
|
||||
otherOut: runtime.unknownValue,
|
||||
});
|
||||
}
|
||||
default:
|
||||
assert.fail(`Unrecognized resource type ${t}`);
|
||||
throw new Error();
|
||||
else {
|
||||
// Otherwise, we will:
|
||||
assert.deepStrictEqual(res, {
|
||||
otherIn: 777,
|
||||
otherOut: "output yeah",
|
||||
});
|
||||
}
|
||||
|
||||
if (!dryrun) {
|
||||
id = name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert.fail(`Unrecognized resource type ${t}`);
|
||||
throw new Error();
|
||||
}
|
||||
return {
|
||||
urn: makeUrn(t, name),
|
||||
|
@ -491,27 +491,27 @@ describe("rpc", () => {
|
|||
},
|
||||
log: (ctx: any, severity: number, message: string, urn: URN, streamId: number) => {
|
||||
switch (message) {
|
||||
case "info message":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.INFO);
|
||||
return;
|
||||
case "warning message":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.WARNING);
|
||||
return;
|
||||
case "error message":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.ERROR);
|
||||
return;
|
||||
case "attached to resource":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.INFO);
|
||||
assert.strictEqual(urn, ctx.testUrn);
|
||||
return;
|
||||
case "with streamid":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.INFO);
|
||||
assert.strictEqual(urn, ctx.testUrn);
|
||||
assert.strictEqual(streamId, 42);
|
||||
return;
|
||||
default:
|
||||
assert.fail("unexpected message: " + message);
|
||||
break;
|
||||
case "info message":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.INFO);
|
||||
return;
|
||||
case "warning message":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.WARNING);
|
||||
return;
|
||||
case "error message":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.ERROR);
|
||||
return;
|
||||
case "attached to resource":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.INFO);
|
||||
assert.strictEqual(urn, ctx.testUrn);
|
||||
return;
|
||||
case "with streamid":
|
||||
assert.strictEqual(severity, engineproto.LogSeverity.INFO);
|
||||
assert.strictEqual(urn, ctx.testUrn);
|
||||
assert.strictEqual(streamId, 42);
|
||||
return;
|
||||
default:
|
||||
assert.fail("unexpected message: " + message);
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -583,40 +583,40 @@ describe("rpc", () => {
|
|||
assert.strictEqual(t, "test:index:MyResource");
|
||||
|
||||
switch (name) {
|
||||
case "resA":
|
||||
assert.deepStrictEqual(deps, []);
|
||||
assert.deepStrictEqual(propertyDeps, {});
|
||||
break;
|
||||
case "resB":
|
||||
assert.deepStrictEqual(deps, ["resA"]);
|
||||
assert.deepStrictEqual(propertyDeps, {});
|
||||
break;
|
||||
case "resC":
|
||||
assert.deepStrictEqual(deps, ["resA", "resB"]);
|
||||
assert.deepStrictEqual(propertyDeps, {
|
||||
"propA": ["resA"],
|
||||
"propB": ["resB"],
|
||||
"propC": [],
|
||||
});
|
||||
break;
|
||||
case "resD":
|
||||
assert.deepStrictEqual(deps, ["resA", "resB", "resC"]);
|
||||
assert.deepStrictEqual(propertyDeps, {
|
||||
"propA": ["resA", "resB"],
|
||||
"propB": ["resC"],
|
||||
"propC": [],
|
||||
});
|
||||
break;
|
||||
case "resE":
|
||||
assert.deepStrictEqual(deps, ["resA", "resB", "resC", "resD"]);
|
||||
assert.deepStrictEqual(propertyDeps, {
|
||||
"propA": ["resC"],
|
||||
"propB": ["resA", "resB"],
|
||||
"propC": [],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case "resA":
|
||||
assert.deepStrictEqual(deps, []);
|
||||
assert.deepStrictEqual(propertyDeps, {});
|
||||
break;
|
||||
case "resB":
|
||||
assert.deepStrictEqual(deps, ["resA"]);
|
||||
assert.deepStrictEqual(propertyDeps, {});
|
||||
break;
|
||||
case "resC":
|
||||
assert.deepStrictEqual(deps, ["resA", "resB"]);
|
||||
assert.deepStrictEqual(propertyDeps, {
|
||||
"propA": ["resA"],
|
||||
"propB": ["resB"],
|
||||
"propC": [],
|
||||
});
|
||||
break;
|
||||
case "resD":
|
||||
assert.deepStrictEqual(deps, ["resA", "resB", "resC"]);
|
||||
assert.deepStrictEqual(propertyDeps, {
|
||||
"propA": ["resA", "resB"],
|
||||
"propB": ["resC"],
|
||||
"propC": [],
|
||||
});
|
||||
break;
|
||||
case "resE":
|
||||
assert.deepStrictEqual(deps, ["resA", "resB", "resC", "resD"]);
|
||||
assert.deepStrictEqual(propertyDeps, {
|
||||
"propA": ["resC"],
|
||||
"propB": ["resA", "resB"],
|
||||
"propC": [],
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return { urn: name, id: undefined, props: { "outprop": "qux" } };
|
||||
|
@ -628,9 +628,9 @@ describe("rpc", () => {
|
|||
expectResourceCount: 2,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyResource::cust1"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyResource::cust1"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -641,10 +641,10 @@ describe("rpc", () => {
|
|||
expectResourceCount: 3,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyResource::cust1"]); break;
|
||||
case "cust3": assert.deepStrictEqual(deps, ["test:index:MyResource::cust1"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyResource::cust1"]); break;
|
||||
case "cust3": assert.deepStrictEqual(deps, ["test:index:MyResource::cust1"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -661,10 +661,10 @@ describe("rpc", () => {
|
|||
expectResourceCount: 3,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -675,11 +675,11 @@ describe("rpc", () => {
|
|||
expectResourceCount: 4,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1", "test:index:MyCustomResource::cust2"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1", "test:index:MyCustomResource::cust2"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -690,13 +690,13 @@ describe("rpc", () => {
|
|||
expectResourceCount: 6,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust3": assert.deepStrictEqual(deps, []); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1", "test:index:MyCustomResource::cust2", "test:index:MyCustomResource::cust3"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust3": assert.deepStrictEqual(deps, []); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1", "test:index:MyCustomResource::cust2", "test:index:MyCustomResource::cust3"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -707,17 +707,17 @@ describe("rpc", () => {
|
|||
expectResourceCount: 10,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust3": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust4": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2"]); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1", "test:index:MyCustomResource::cust2", "test:index:MyCustomResource::cust3"]); break;
|
||||
case "res2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2", "test:index:MyCustomResource::cust3"]); break;
|
||||
case "res3": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2"]); break;
|
||||
case "res4": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust4"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "comp2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust3": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust4": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2"]); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1", "test:index:MyCustomResource::cust2", "test:index:MyCustomResource::cust3"]); break;
|
||||
case "res2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2", "test:index:MyCustomResource::cust3"]); break;
|
||||
case "res3": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2"]); break;
|
||||
case "res4": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust4"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -728,13 +728,13 @@ describe("rpc", () => {
|
|||
expectResourceCount: 6,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res3": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "comp1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res3": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust2"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -745,10 +745,10 @@ describe("rpc", () => {
|
|||
expectResourceCount: 3,
|
||||
registerResource: (ctx, dryrun, t, name, res, deps) => {
|
||||
switch (name) {
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
case "cust1": assert.deepStrictEqual(deps, []); break;
|
||||
case "cust2": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
case "res1": assert.deepStrictEqual(deps, ["test:index:MyCustomResource::cust1"]); break;
|
||||
default: throw new Error("Didn't check: " + name);
|
||||
}
|
||||
return { urn: makeUrn(t, name), id: undefined, props: undefined };
|
||||
},
|
||||
|
@ -813,19 +813,19 @@ describe("rpc", () => {
|
|||
custom?: boolean, protect?: boolean, parent?: string, provider?: string,
|
||||
propertyDeps?: any, ignoreChanges?: string[], version?: string, importID?: string,
|
||||
replaceOnChanges?: string[],
|
||||
) => {
|
||||
) => {
|
||||
switch (name) {
|
||||
case "testResource":
|
||||
assert.strictEqual("0.19.1", version);
|
||||
break;
|
||||
case "testResource2":
|
||||
assert.strictEqual("0.19.2", version);
|
||||
break;
|
||||
case "testResource3":
|
||||
assert.strictEqual("", version);
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unknown resource: ${name}`);
|
||||
case "testResource":
|
||||
assert.strictEqual("0.19.1", version);
|
||||
break;
|
||||
case "testResource2":
|
||||
assert.strictEqual("0.19.2", version);
|
||||
break;
|
||||
case "testResource3":
|
||||
assert.strictEqual("", version);
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unknown resource: ${name}`);
|
||||
}
|
||||
return {
|
||||
urn: makeUrn(t, name),
|
||||
|
@ -835,17 +835,17 @@ describe("rpc", () => {
|
|||
},
|
||||
invoke: (ctx: any, tok: string, args: any, version: string) => {
|
||||
switch (tok) {
|
||||
case "invoke:index:doit":
|
||||
assert.strictEqual(version, "0.19.1");
|
||||
break;
|
||||
case "invoke:index:doit_v2":
|
||||
assert.strictEqual(version, "0.19.2");
|
||||
break;
|
||||
case "invoke:index:doit_noversion":
|
||||
assert.strictEqual(version, "");
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unknown invoke: ${tok}`);
|
||||
case "invoke:index:doit":
|
||||
assert.strictEqual(version, "0.19.1");
|
||||
break;
|
||||
case "invoke:index:doit_v2":
|
||||
assert.strictEqual(version, "0.19.2");
|
||||
break;
|
||||
case "invoke:index:doit_noversion":
|
||||
assert.strictEqual(version, "");
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unknown invoke: ${tok}`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -855,14 +855,14 @@ describe("rpc", () => {
|
|||
},
|
||||
readResource: (ctx: any, t: string, name: string, id: string, par: string, state: any, version: string) => {
|
||||
switch (name) {
|
||||
case "foo":
|
||||
assert.strictEqual(version, "0.20.0");
|
||||
break;
|
||||
case "foo_noversion":
|
||||
assert.strictEqual(version, "");
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unknown read: ${name}`);
|
||||
case "foo":
|
||||
assert.strictEqual(version, "0.20.0");
|
||||
break;
|
||||
case "foo_noversion":
|
||||
assert.strictEqual(version, "");
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unknown read: ${name}`);
|
||||
}
|
||||
return {
|
||||
urn: makeUrn(t, name),
|
||||
|
@ -1400,27 +1400,27 @@ function parentDefaultsRegisterResource(
|
|||
const rpath = name.split("/");
|
||||
for (let i = 1; i < rpath.length; i++) {
|
||||
switch (rpath[i]) {
|
||||
case "c0":
|
||||
case "r0":
|
||||
// Pass through parent values
|
||||
break;
|
||||
case "c1":
|
||||
case "r1":
|
||||
// Force protect to false
|
||||
expectProtect = false;
|
||||
break;
|
||||
case "c2":
|
||||
case "r2":
|
||||
// Force protect to true
|
||||
expectProtect = true;
|
||||
break;
|
||||
case "c3":
|
||||
case "r3":
|
||||
// Force provider
|
||||
expectProviderName = `${rpath.slice(0, i).join("/")}-p`;
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unexpected path element in name: ${rpath[i]}`);
|
||||
case "c0":
|
||||
case "r0":
|
||||
// Pass through parent values
|
||||
break;
|
||||
case "c1":
|
||||
case "r1":
|
||||
// Force protect to false
|
||||
expectProtect = false;
|
||||
break;
|
||||
case "c2":
|
||||
case "r2":
|
||||
// Force protect to true
|
||||
expectProtect = true;
|
||||
break;
|
||||
case "c3":
|
||||
case "r3":
|
||||
// Force provider
|
||||
expectProviderName = `${rpath.slice(0, i).join("/")}-p`;
|
||||
break;
|
||||
default:
|
||||
assert.fail(`unexpected path element in name: ${rpath[i]}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1526,7 +1526,7 @@ async function createMockEngineAsync(
|
|||
return { server: server, addr: `0.0.0.0:${port}` };
|
||||
}
|
||||
|
||||
function serveLanguageHostProcess(engineAddr: string): { proc: childProcess.ChildProcess, addr: Promise<string> } {
|
||||
function serveLanguageHostProcess(engineAddr: string): { proc: childProcess.ChildProcess; addr: Promise<string> } {
|
||||
// A quick note about this:
|
||||
//
|
||||
// Normally, `pulumi-language-nodejs` launches `./node-modules/@pulumi/pulumi/cmd/run` which is responsible
|
||||
|
|
|
@ -41,12 +41,12 @@ class TestErrorResource extends CustomResource {
|
|||
class TestResourceModule implements runtime.ResourceModule {
|
||||
construct(name: string, type: string, urn: string): Resource {
|
||||
switch (type) {
|
||||
case "test:index:component":
|
||||
return new TestComponentResource(name, {urn});
|
||||
case "test:index:custom":
|
||||
return new TestCustomResource(name, type, {urn});
|
||||
default:
|
||||
throw new Error(`unknown resource type ${type}`);
|
||||
case "test:index:component":
|
||||
return new TestComponentResource(name, {urn});
|
||||
case "test:index:custom":
|
||||
return new TestCustomResource(name, type, {urn});
|
||||
default:
|
||||
throw new Error(`unknown resource type ${type}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,54 +56,58 @@ class TestMocks implements runtime.Mocks {
|
|||
throw new Error(`unknown function ${args.token}`);
|
||||
}
|
||||
|
||||
newResource(args: runtime.MockResourceArgs): { id: string | undefined, state: Record<string, any> } {
|
||||
newResource(args: runtime.MockResourceArgs): { id: string | undefined; state: Record<string, any> } {
|
||||
switch (args.type) {
|
||||
case "test:index:component":
|
||||
return {id: undefined, state: {}};
|
||||
case "test:index:custom":
|
||||
case "test2:index:custom":
|
||||
return {
|
||||
id: runtime.isDryRun() ? undefined : "test-id",
|
||||
state: {},
|
||||
};
|
||||
case "error":
|
||||
throw new Error("this is an intentional error");
|
||||
default:
|
||||
throw new Error(`unknown resource type ${args.type}`);
|
||||
case "test:index:component":
|
||||
return {id: undefined, state: {}};
|
||||
case "test:index:custom":
|
||||
case "test2:index:custom":
|
||||
return {
|
||||
id: runtime.isDryRun() ? undefined : "test-id",
|
||||
state: {},
|
||||
};
|
||||
case "error":
|
||||
throw new Error("this is an intentional error");
|
||||
default:
|
||||
throw new Error(`unknown resource type ${args.type}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
const TestStrEnum = {
|
||||
Foo: "foo",
|
||||
Bar: "bar",
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
type TestStrEnum = (typeof TestStrEnum)[keyof typeof TestStrEnum];
|
||||
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
const TestIntEnum = {
|
||||
One: 1,
|
||||
Zero: 0,
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
type TestIntEnum = (typeof TestIntEnum)[keyof typeof TestIntEnum];
|
||||
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
const TestNumEnum = {
|
||||
One: 1.0,
|
||||
ZeroPointOne: 0.1,
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
type TestNumEnum = (typeof TestNumEnum)[keyof typeof TestNumEnum];
|
||||
|
||||
// tslint:disable-next-line:variable-name
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
||||
const TestBoolEnum = {
|
||||
One: true,
|
||||
Zero: false,
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
type TestBoolEnum = (typeof TestBoolEnum)[keyof typeof TestBoolEnum];
|
||||
|
||||
interface TestInputs {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable
|
||||
/* eslint-disable */
|
||||
|
||||
import * as assert from "assert";
|
||||
import { EOL } from "os";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// tslint:disable:file-header
|
||||
/* eslint-disable header/header */
|
||||
|
||||
// See README.md for information on what to do if this test fails.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// tslint:disable:file-header
|
||||
/* eslint-disable header/header */
|
||||
|
||||
// See README.md for information on what to do if this test fails.
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// tslint:disable
|
||||
/* eslint-disable */
|
||||
|
||||
import * as assert from "assert";
|
||||
import { all, output, Output, unknown } from "../index";
|
||||
|
|
|
@ -20,31 +20,31 @@ import { MockCallArgs, MockResourceArgs } from "../runtime";
|
|||
pulumi.runtime.setMocks({
|
||||
call: (args: MockCallArgs) => {
|
||||
switch (args.token) {
|
||||
case "test:index:MyFunction":
|
||||
return { out_value: 59 };
|
||||
default:
|
||||
return {};
|
||||
case "test:index:MyFunction":
|
||||
return { out_value: 59 };
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
},
|
||||
newResource: (args: MockResourceArgs): {id: string, state: any} => {
|
||||
newResource: (args: MockResourceArgs): {id: string; state: any} => {
|
||||
switch (args.type) {
|
||||
case "aws:ec2/instance:Instance":
|
||||
assert.strictEqual(args.custom, true);
|
||||
const state = {
|
||||
arn: "arn:aws:ec2:us-west-2:123456789012:instance/i-1234567890abcdef0",
|
||||
instanceState: "running",
|
||||
primaryNetworkInterfaceId: "eni-12345678",
|
||||
privateDns: "ip-10-0-1-17.ec2.internal",
|
||||
publicDns: "ec2-203-0-113-12.compute-1.amazonaws.com",
|
||||
publicIP: "203.0.113.12",
|
||||
};
|
||||
return { id: "i-1234567890abcdef0", state: { ...args.inputs, ...state } };
|
||||
case "pkg:index:MyCustom":
|
||||
assert.strictEqual(args.custom, true);
|
||||
return { id: args.name + "_id", state: args.inputs };
|
||||
default:
|
||||
assert.strictEqual(args.custom, false);
|
||||
return { id: "", state: {} };
|
||||
case "aws:ec2/instance:Instance":
|
||||
assert.strictEqual(args.custom, true);
|
||||
const state = {
|
||||
arn: "arn:aws:ec2:us-west-2:123456789012:instance/i-1234567890abcdef0",
|
||||
instanceState: "running",
|
||||
primaryNetworkInterfaceId: "eni-12345678",
|
||||
privateDns: "ip-10-0-1-17.ec2.internal",
|
||||
publicDns: "ec2-203-0-113-12.compute-1.amazonaws.com",
|
||||
publicIP: "203.0.113.12",
|
||||
};
|
||||
return { id: "i-1234567890abcdef0", state: { ...args.inputs, ...state } };
|
||||
case "pkg:index:MyCustom":
|
||||
assert.strictEqual(args.custom, true);
|
||||
return { id: args.name + "_id", state: args.inputs };
|
||||
default:
|
||||
assert.strictEqual(args.custom, false);
|
||||
return { id: "", state: {} };
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -68,10 +68,10 @@ class Instance extends pulumi.CustomResource {
|
|||
pulumi.runtime.registerResourceModule("aws", "ec2/instance", {
|
||||
construct: (name: string, type: string, urn: string): pulumi.Resource => {
|
||||
switch (type) {
|
||||
case "aws:ec2/instance:Instance":
|
||||
return new Instance(name, { urn });
|
||||
default:
|
||||
throw new Error(`unknown resource type ${type}`);
|
||||
case "aws:ec2/instance:Instance":
|
||||
return new Instance(name, { urn });
|
||||
default:
|
||||
throw new Error(`unknown resource type ${type}`);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^2.2.42",
|
||||
"@types/node": "^10.12.7",
|
||||
"tslint": "^5.11.0"
|
||||
"@types/node": "^10.12.7"
|
||||
}
|
||||
}
|
||||
|
|
125
tslint.json
125
tslint.json
|
@ -1,125 +0,0 @@
|
|||
{
|
||||
"rules": {
|
||||
"align": [
|
||||
true,
|
||||
"parameters",
|
||||
"statements"
|
||||
],
|
||||
"ban": false,
|
||||
"class-name": true,
|
||||
"comment-format": [
|
||||
true,
|
||||
"check-space"
|
||||
],
|
||||
"curly": true,
|
||||
"eofline": true,
|
||||
"forin": true,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces"
|
||||
],
|
||||
"interface-name": false,
|
||||
"jsdoc-format": false,
|
||||
"label-position": true,
|
||||
"max-line-length": [
|
||||
true,
|
||||
120
|
||||
],
|
||||
"member-access": false,
|
||||
"member-ordering": [
|
||||
true,
|
||||
"static-before-instance",
|
||||
"variables-before-functions"
|
||||
],
|
||||
"no-any": false,
|
||||
"no-arg": true,
|
||||
"no-bitwise": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": true,
|
||||
"no-eval": true,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": true,
|
||||
"no-parameter-properties": false,
|
||||
"no-require-imports": true,
|
||||
"no-shadowed-variable": true,
|
||||
"no-string-literal": false,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-trailing-whitespace": true,
|
||||
"no-unused-expression": true,
|
||||
"no-use-before-declare": true,
|
||||
"no-var-keyword": true,
|
||||
"no-var-requires": true,
|
||||
"object-literal-sort-keys": false,
|
||||
"one-line": [
|
||||
true,
|
||||
"check-open-brace",
|
||||
"check-whitespace"
|
||||
],
|
||||
"ordered-imports": true,
|
||||
"prefer-const": true,
|
||||
"quotemark": [
|
||||
true,
|
||||
"double",
|
||||
"avoid-escape"
|
||||
],
|
||||
"radix": true,
|
||||
"semicolon": true,
|
||||
"switch-default": true,
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"multiline": "always",
|
||||
"singleline": "never"
|
||||
}
|
||||
],
|
||||
"triple-equals": [
|
||||
true,
|
||||
"allow-null-check"
|
||||
],
|
||||
"typedef": [
|
||||
false,
|
||||
"call-signature",
|
||||
"parameter",
|
||||
"property-declaration",
|
||||
"variable-declaration",
|
||||
"member-variable-declaration"
|
||||
],
|
||||
"typedef-whitespace": [
|
||||
true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
}
|
||||
],
|
||||
"variable-name": [
|
||||
true,
|
||||
"check-format",
|
||||
"allow-leading-underscore",
|
||||
"ban-keywords"
|
||||
],
|
||||
"whitespace": [
|
||||
true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-module",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
]
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue