Skip to content

Commit 061c122

Browse files
authored
chore: update eslint and prettier dependencies (cloudevents#424)
There were some minor changes that resulted in a few code style changes, but not much. Signed-off-by: Lance Ball <lball@redhat.com>
1 parent b510056 commit 061c122

File tree

9 files changed

+1044
-419
lines changed

9 files changed

+1044
-419
lines changed

.eslintrc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
"sourceType": "module"
66
},
77
"extends": [
8-
"plugin:@typescript-eslint/recommended",
9-
"prettier/@typescript-eslint",
10-
"plugin:prettier/recommended"
8+
"plugin:prettier/recommended",
9+
"plugin:@typescript-eslint/recommended"
1110
],
1211
"env": {
1312
"es6": true,
@@ -25,16 +24,15 @@
2524
"arrow-body-style": ["error", "as-needed"],
2625
"prefer-template": "error",
2726
"max-len": ["warn", { "code": 120 }],
28-
"no-unused-vars": ["warn", {
29-
"argsIgnorePattern": "^_$|^e$|^reject$|^resolve$"
30-
}],
3127
"no-console": ["error", {
3228
"allow": ["warn", "error"]
3329
}],
3430
"valid-jsdoc": "warn",
3531
"semi": ["error", "always"],
3632
"quotes": ["error", "double", { "allowTemplateLiterals": true }],
3733
"@typescript-eslint/no-explicit-any": "off",
38-
"header/header": [2, "block", ["", " Copyright 2021 The CloudEvents Authors"," SPDX-License-Identifier: Apache-2.0", ""], 2]
34+
"header/header": [2, "block", ["", " Copyright 2021 The CloudEvents Authors"," SPDX-License-Identifier: Apache-2.0", ""], 2],
35+
"no-unused-vars": "off",
36+
"@typescript-eslint/no-unused-vars": ["error"]
3937
}
4038
}

package-lock.json

Lines changed: 1015 additions & 386 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,22 @@
118118
"@types/node": "^14.14.10",
119119
"@types/superagent": "^4.1.10",
120120
"@types/uuid": "^8.0.0",
121-
"@typescript-eslint/eslint-plugin": "^3.4.0",
122-
"@typescript-eslint/parser": "^3.4.0",
121+
"@typescript-eslint/eslint-plugin": "^4.29.0",
122+
"@typescript-eslint/parser": "^4.29.0",
123123
"axios": "^0.21.1",
124124
"chai": "~4.2.0",
125125
"cucumber": "^6.0.5",
126126
"cucumber-pretty": "^6.0.0",
127127
"cucumber-tsflow": "^3.2.0",
128128
"downtotemp": "^0.1.2",
129-
"eslint": "^7.3.0",
130-
"eslint-config-prettier": "^6.11.0",
131-
"eslint-config-standard": "^14.1.1",
129+
"eslint": "^7.32.0",
130+
"eslint-config-prettier": "^8.3.0",
131+
"eslint-config-standard": "^16.0.3",
132132
"eslint-plugin-header": "^3.1.1",
133-
"eslint-plugin-import": "^2.20.2",
133+
"eslint-plugin-import": "^2.23.4",
134134
"eslint-plugin-node": "^11.1.0",
135-
"eslint-plugin-prettier": "^3.1.4",
135+
"eslint-plugin-prettier": "^3.4.0",
136+
"eslint-plugin-promise": "^5.1.0",
136137
"got": "^11.7.0",
137138
"http-parser-js": "^0.5.2",
138139
"mocha": "~8.2.0",
@@ -145,8 +146,8 @@
145146
"remark-preset-lint-recommended": "^5.0.0",
146147
"superagent": "^6.1.0",
147148
"ts-node": "^8.10.2",
148-
"typedoc": "^0.20.24",
149-
"typescript": "^3.8.3",
149+
"typedoc": "^0.21.5",
150+
"typescript": "^4.3.5",
150151
"webpack": "^5.1.1",
151152
"webpack-cli": "^4.0.0"
152153
},

src/event/cloudevent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ export class CloudEvent implements CloudEventV1, CloudEventV03 {
7070
delete properties.time;
7171

7272
this.type = properties.type;
73-
delete properties.type;
73+
delete (properties as any).type;
7474

7575
this.source = properties.source;
76-
delete properties.source;
76+
delete (properties as any).source;
7777

7878
this.specversion = (properties.specversion as Version) || Version.V1;
7979
delete properties.specversion;

src/event/validation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ValidationError extends TypeError {
3131

3232
export const isString = (v: unknown): boolean => typeof v === "string";
3333
export const isObject = (v: unknown): boolean => typeof v === "object";
34-
export const isDefined = (v: unknown): boolean => v && typeof v !== "undefined";
34+
export const isDefined = (v: unknown): boolean => v !== null && typeof v !== "undefined";
3535

3636
export const isBoolean = (v: unknown): boolean => typeof v === "boolean";
3737
export const isInteger = (v: unknown): boolean => Number.isInteger(v as number);

src/transport/emitter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface TransportFunction {
3636
(message: Message, options?: Options): Promise<unknown>;
3737
}
3838

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

test/integration/emitter_factory_test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function superagentEmitter(message: Message, options?: Options): Promise<unknown
6060

6161
function gotEmitter(message: Message, options?: Options): Promise<unknown> {
6262
return Promise.resolve(
63-
got.post(sink, { headers: message.headers, body: message.body as string, ...((options as unknown) as Options) }),
63+
got.post(sink, { headers: message.headers, body: message.body as string, ...(options as Options) }),
6464
);
6565
}
6666

@@ -90,9 +90,6 @@ describe("emitterFor() defaults", () => {
9090
expect(body.id).to.equal("1234");
9191
return Promise.resolve();
9292
}
93-
// Ignore the next line to ensure that HTTP transport is still the default.
94-
// Otherwise, tslint would complain that the param did not have `binding: <val>`
95-
/* @ts-ignore */
9693
const emitter = emitterFor(transport, { mode: Mode.STRUCTURED });
9794
emitter(
9895
new CloudEvent({

test/integration/spec_03_tests.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe("CloudEvents Spec v0.3", () => {
9090
describe("'id'", () => {
9191
it("should throw an error when trying to remove", () => {
9292
expect(() => {
93-
delete cloudevent.id;
93+
delete (cloudevent as any).id;
9494
}).to.throw(TypeError);
9595
});
9696

@@ -103,23 +103,23 @@ describe("CloudEvents Spec v0.3", () => {
103103
describe("'source'", () => {
104104
it("should throw an error when trying to remove", () => {
105105
expect(() => {
106-
delete cloudevent.source;
106+
delete (cloudevent as any).source;
107107
}).to.throw(TypeError);
108108
});
109109
});
110110

111111
describe("'specversion'", () => {
112112
it("should throw an error when trying to remove", () => {
113113
expect(() => {
114-
delete cloudevent.specversion;
114+
delete (cloudevent as any).specversion;
115115
}).to.throw(TypeError);
116116
});
117117
});
118118

119119
describe("'type'", () => {
120120
it("should throw an error when trying to remove", () => {
121121
expect(() => {
122-
delete cloudevent.type;
122+
delete (cloudevent as any).type;
123123
}).to.throw(TypeError);
124124
});
125125

test/integration/spec_1_tests.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe("CloudEvents Spec v1.0", () => {
105105
describe("'id'", () => {
106106
it("should throw an error when trying to remove", () => {
107107
expect(() => {
108-
delete cloudevent.id;
108+
delete (cloudevent as any).id;
109109
}).to.throw(TypeError);
110110
});
111111

@@ -118,23 +118,23 @@ describe("CloudEvents Spec v1.0", () => {
118118
describe("'source'", () => {
119119
it("should throw an error when trying to remove", () => {
120120
expect(() => {
121-
delete cloudevent.source;
121+
delete (cloudevent as any).source;
122122
}).to.throw(TypeError);
123123
});
124124
});
125125

126126
describe("'specversion'", () => {
127127
it("should throw an error when trying to remove", () => {
128128
expect(() => {
129-
delete cloudevent.specversion;
129+
delete (cloudevent as any).specversion;
130130
}).to.throw(TypeError);
131131
});
132132
});
133133

134134
describe("'type'", () => {
135135
it("should throw an error when trying to remove", () => {
136136
expect(() => {
137-
delete cloudevent.type;
137+
delete (cloudevent as any).type;
138138
}).to.throw(TypeError);
139139
});
140140
});

0 commit comments

Comments
 (0)