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:
Horace Lee 2021-08-11 02:31:59 +08:00 committed by GitHub
parent 9c501b5bed
commit a92a005d68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 776 additions and 698 deletions

View file

@ -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
View 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"
]
}
};

View file

@ -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

View file

@ -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;
/**

View file

@ -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;
/**

View file

@ -1,4 +1,3 @@
// Copyright 2016-2020, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");

View file

@ -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);

View file

@ -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;

View file

@ -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;
/**

View file

@ -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;
/**
@ -353,7 +353,7 @@ 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) {
@ -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,7 +601,8 @@ 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;
}
}
@ -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;
/**
@ -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;
/**

View file

@ -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"

View file

@ -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;
}
@ -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);

View file

@ -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 {
@ -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;
/**

View file

@ -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 };

View file

@ -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";

View file

@ -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 {
@ -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(

View file

@ -812,9 +812,9 @@ function computeCapturedVariableNames(file: ts.SourceFile): CapturedVariables {
}
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;

View file

@ -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;

View file

@ -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";

View file

@ -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) {
}

View file

@ -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)}`);
}
}

View file

@ -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

View file

@ -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";

View file

@ -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";

View file

@ -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";

View file

@ -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.

View file

@ -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;

View file

@ -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;

View file

@ -47,15 +47,15 @@ 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,
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;
@ -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

View file

@ -56,7 +56,7 @@ 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: {}};
@ -74,36 +74,40 @@ class TestMocks implements runtime.Mocks {
}
}
// 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 {

View file

@ -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";

View file

@ -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.

View file

@ -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.

View file

@ -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";

View file

@ -26,7 +26,7 @@ pulumi.runtime.setMocks({
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);

View file

@ -6,7 +6,6 @@
},
"devDependencies": {
"@types/mocha": "^2.2.42",
"@types/node": "^10.12.7",
"tslint": "^5.11.0"
"@types/node": "^10.12.7"
}
}

View file

@ -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"
]
}
}