chore: update eslint and prettier dependencies

There were some minor changes that resulted in a few code style changes,
but not much.

Signed-off-by: Lance Ball <lball@redhat.com>
This commit is contained in:
Lance Ball 2021-08-04 13:00:21 -04:00
parent b5100566c6
commit 0207db04f8
No known key found for this signature in database
GPG Key ID: 0D7C787CAE37ED3F
9 changed files with 1045 additions and 420 deletions

View File

@ -5,9 +5,8 @@
"sourceType": "module" "sourceType": "module"
}, },
"extends": [ "extends": [
"plugin:@typescript-eslint/recommended", "plugin:prettier/recommended",
"prettier/@typescript-eslint", "plugin:@typescript-eslint/recommended"
"plugin:prettier/recommended"
], ],
"env": { "env": {
"es6": true, "es6": true,
@ -25,9 +24,6 @@
"arrow-body-style": ["error", "as-needed"], "arrow-body-style": ["error", "as-needed"],
"prefer-template": "error", "prefer-template": "error",
"max-len": ["warn", { "code": 120 }], "max-len": ["warn", { "code": 120 }],
"no-unused-vars": ["warn", {
"argsIgnorePattern": "^_$|^e$|^reject$|^resolve$"
}],
"no-console": ["error", { "no-console": ["error", {
"allow": ["warn", "error"] "allow": ["warn", "error"]
}], }],
@ -35,6 +31,8 @@
"semi": ["error", "always"], "semi": ["error", "always"],
"quotes": ["error", "double", { "allowTemplateLiterals": true }], "quotes": ["error", "double", { "allowTemplateLiterals": true }],
"@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-explicit-any": "off",
"header/header": [2, "block", ["", " Copyright 2021 The CloudEvents Authors"," SPDX-License-Identifier: Apache-2.0", ""], 2] "header/header": [2, "block", ["", " Copyright 2021 The CloudEvents Authors"," SPDX-License-Identifier: Apache-2.0", ""], 2],
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"]
} }
} }

1397
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -118,21 +118,22 @@
"@types/node": "^14.14.10", "@types/node": "^14.14.10",
"@types/superagent": "^4.1.10", "@types/superagent": "^4.1.10",
"@types/uuid": "^8.0.0", "@types/uuid": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^3.4.0", "@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^3.4.0", "@typescript-eslint/parser": "^4.29.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"chai": "~4.2.0", "chai": "~4.2.0",
"cucumber": "^6.0.5", "cucumber": "^6.0.5",
"cucumber-pretty": "^6.0.0", "cucumber-pretty": "^6.0.0",
"cucumber-tsflow": "^3.2.0", "cucumber-tsflow": "^3.2.0",
"downtotemp": "^0.1.2", "downtotemp": "^0.1.2",
"eslint": "^7.3.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^14.1.1", "eslint-config-standard": "^16.0.3",
"eslint-plugin-header": "^3.1.1", "eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0",
"got": "^11.7.0", "got": "^11.7.0",
"http-parser-js": "^0.5.2", "http-parser-js": "^0.5.2",
"mocha": "~8.2.0", "mocha": "~8.2.0",
@ -145,8 +146,8 @@
"remark-preset-lint-recommended": "^5.0.0", "remark-preset-lint-recommended": "^5.0.0",
"superagent": "^6.1.0", "superagent": "^6.1.0",
"ts-node": "^8.10.2", "ts-node": "^8.10.2",
"typedoc": "^0.20.24", "typedoc": "^0.21.5",
"typescript": "^3.8.3", "typescript": "^4.3.5",
"webpack": "^5.1.1", "webpack": "^5.1.1",
"webpack-cli": "^4.0.0" "webpack-cli": "^4.0.0"
}, },

View File

@ -70,10 +70,10 @@ export class CloudEvent implements CloudEventV1, CloudEventV03 {
delete properties.time; delete properties.time;
this.type = properties.type; this.type = properties.type;
delete properties.type; delete (properties as any).type;
this.source = properties.source; this.source = properties.source;
delete properties.source; delete (properties as any).source;
this.specversion = (properties.specversion as Version) || Version.V1; this.specversion = (properties.specversion as Version) || Version.V1;
delete properties.specversion; delete properties.specversion;

View File

@ -31,7 +31,7 @@ export class ValidationError extends TypeError {
export const isString = (v: unknown): boolean => typeof v === "string"; export const isString = (v: unknown): boolean => typeof v === "string";
export const isObject = (v: unknown): boolean => typeof v === "object"; export const isObject = (v: unknown): boolean => typeof v === "object";
export const isDefined = (v: unknown): boolean => v && typeof v !== "undefined"; export const isDefined = (v: unknown): boolean => v !== null && typeof v !== "undefined";
export const isBoolean = (v: unknown): boolean => typeof v === "boolean"; export const isBoolean = (v: unknown): boolean => typeof v === "boolean";
export const isInteger = (v: unknown): boolean => Number.isInteger(v as number); export const isInteger = (v: unknown): boolean => Number.isInteger(v as number);

View File

@ -36,7 +36,7 @@ export interface TransportFunction {
(message: Message, options?: Options): Promise<unknown>; (message: Message, options?: Options): Promise<unknown>;
} }
const emitterDefaults = { binding: HTTP, mode: Mode.BINARY }; const emitterDefaults: Options = { binding: HTTP, mode: Mode.BINARY };
/** /**
* Creates and returns an {@linkcode EmitterFunction} using the supplied * Creates and returns an {@linkcode EmitterFunction} using the supplied
* {@linkcode TransportFunction}. The returned {@linkcode EmitterFunction} * {@linkcode TransportFunction}. The returned {@linkcode EmitterFunction}
@ -55,7 +55,7 @@ export function emitterFor(fn: TransportFunction, options = emitterDefaults): Em
if (!fn) { if (!fn) {
throw new TypeError("A TransportFunction is required"); throw new TypeError("A TransportFunction is required");
} }
const { binding, mode } = { ...emitterDefaults, ...options }; const { binding, mode }: any = { ...emitterDefaults, ...options };
return function emit(event: CloudEvent, opts?: Options): Promise<unknown> { return function emit(event: CloudEvent, opts?: Options): Promise<unknown> {
opts = opts || {}; opts = opts || {};

View File

@ -60,7 +60,7 @@ function superagentEmitter(message: Message, options?: Options): Promise<unknown
function gotEmitter(message: Message, options?: Options): Promise<unknown> { function gotEmitter(message: Message, options?: Options): Promise<unknown> {
return Promise.resolve( return Promise.resolve(
got.post(sink, { headers: message.headers, body: message.body as string, ...((options as unknown) as Options) }), got.post(sink, { headers: message.headers, body: message.body as string, ...(options as Options) }),
); );
} }
@ -90,9 +90,6 @@ describe("emitterFor() defaults", () => {
expect(body.id).to.equal("1234"); expect(body.id).to.equal("1234");
return Promise.resolve(); return Promise.resolve();
} }
// Ignore the next line to ensure that HTTP transport is still the default.
// Otherwise, tslint would complain that the param did not have `binding: <val>`
/* @ts-ignore */
const emitter = emitterFor(transport, { mode: Mode.STRUCTURED }); const emitter = emitterFor(transport, { mode: Mode.STRUCTURED });
emitter( emitter(
new CloudEvent({ new CloudEvent({

View File

@ -90,7 +90,7 @@ describe("CloudEvents Spec v0.3", () => {
describe("'id'", () => { describe("'id'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.id; delete (cloudevent as any).id;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });
@ -103,7 +103,7 @@ describe("CloudEvents Spec v0.3", () => {
describe("'source'", () => { describe("'source'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.source; delete (cloudevent as any).source;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });
}); });
@ -111,7 +111,7 @@ describe("CloudEvents Spec v0.3", () => {
describe("'specversion'", () => { describe("'specversion'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.specversion; delete (cloudevent as any).specversion;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });
}); });
@ -119,7 +119,7 @@ describe("CloudEvents Spec v0.3", () => {
describe("'type'", () => { describe("'type'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.type; delete (cloudevent as any).type;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });

View File

@ -105,7 +105,7 @@ describe("CloudEvents Spec v1.0", () => {
describe("'id'", () => { describe("'id'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.id; delete (cloudevent as any).id;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });
@ -118,7 +118,7 @@ describe("CloudEvents Spec v1.0", () => {
describe("'source'", () => { describe("'source'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.source; delete (cloudevent as any).source;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });
}); });
@ -126,7 +126,7 @@ describe("CloudEvents Spec v1.0", () => {
describe("'specversion'", () => { describe("'specversion'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.specversion; delete (cloudevent as any).specversion;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });
}); });
@ -134,7 +134,7 @@ describe("CloudEvents Spec v1.0", () => {
describe("'type'", () => { describe("'type'", () => {
it("should throw an error when trying to remove", () => { it("should throw an error when trying to remove", () => {
expect(() => { expect(() => {
delete cloudevent.type; delete (cloudevent as any).type;
}).to.throw(TypeError); }).to.throw(TypeError);
}); });
}); });