chore: add copyrights header and lint rules (#418)

Signed-off-by: Remi Cattiau <remi@cattiau.com>
This commit is contained in:
Remi Cattiau 2021-05-14 06:28:49 -07:00 committed by GitHub
parent db4be6b1da
commit 80d987c1f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 200 additions and 2 deletions

View File

@ -14,6 +14,9 @@
"node": true, "node": true,
"mocha": true "mocha": true
}, },
"plugins": [
"header"
],
"rules": { "rules": {
"no-var": "error", "no-var": "error",
"standard/no-callback-literal": "off", "standard/no-callback-literal": "off",
@ -31,6 +34,7 @@
"valid-jsdoc": "warn", "valid-jsdoc": "warn",
"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]
} }
} }

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
// cucumber.js // cucumber.js
let common = [ let common = [
"--require-module ts-node/register", // Load TypeScript module "--require-module ts-node/register", // Load TypeScript module

6
package-lock.json generated
View File

@ -3185,6 +3185,12 @@
"regexpp": "^3.0.0" "regexpp": "^3.0.0"
} }
}, },
"eslint-plugin-header": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz",
"integrity": "sha512-9vlKxuJ4qf793CmeeSrZUvVClw6amtpghq3CuWcB5cUNnWHQhgcqy5eF8oVKFk1G3Y/CbchGfEaw3wiIJaNmVg==",
"dev": true
},
"eslint-plugin-import": { "eslint-plugin-import": {
"version": "2.22.1", "version": "2.22.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz",

View File

@ -42,7 +42,62 @@
}, },
{ {
"name": "Lance Ball", "name": "Lance Ball",
"email": "lball@redhat.com" "email": "lball@redhat.com",
"url": "https://github.com/lance"
},
{
"name": "Lucas Holmquist",
"email": "lholmqui@redhat.com",
"url": "https://github.com/lholmquist"
},
{
"name": "Grant Timmerman",
"url": "https://github.com/grant"
},
{
"name": "Daniel Bevenius",
"email": "daniel.bevenius@gmail.com",
"url": "https://github.com/danbev"
},
{
"name": "Helio Frota",
"url": "https://github.com/helio-frota"
},
{
"name": "Doug Davis",
"email": "dug@us.ibm.com",
"url": "https://github.com/duglin"
},
{
"name": "Remi Cattiau",
"email": "rcattiau@gmail.com",
"url": "https://github.com/loopingz"
},
{
"name": "Michele Angioni",
"url": "https://github.com/micheleangioni"
},
{
"name": "Ali Ok",
"email": "aliok@redhat.com",
"url": "https://github.com/aliok"
},
{
"name": "Philip Hayes",
"url": "https://github.com/deewhyweb"
},
{
"name": "Jingwen Peng",
"url": "https://github.com/pengsrc"
},
{
"name": "Sidharth Vinod",
"email": "sidharthv96@gmail.com",
"url": "https://github.com/sidharthv96"
},
{
"name": "Matej Vasek",
"url": "https://github.com/matejvasek"
} }
], ],
"license": "Apache-2.0", "license": "Apache-2.0",
@ -74,6 +129,7 @@
"eslint": "^7.3.0", "eslint": "^7.3.0",
"eslint-config-prettier": "^6.11.0", "eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1", "eslint-config-standard": "^14.1.1",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.1.4",

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
const CONSTANTS = Object.freeze({ const CONSTANTS = Object.freeze({
CHARSET_DEFAULT: "utf-8", CHARSET_DEFAULT: "utf-8",
EXTENSIONS_PREFIX: "ce-", EXTENSIONS_PREFIX: "ce-",

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import { Emitter } from ".."; import { Emitter } from "..";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
/** /**
* The object interface for CloudEvents 1.0. * The object interface for CloudEvents 1.0.
* @see https://github.com/cloudevents/spec/blob/v1.0/spec.md * @see https://github.com/cloudevents/spec/blob/v1.0/spec.md

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
export const schemaV1 = { export const schemaV1 = {
$ref: "#/definitions/event", $ref: "#/definitions/event",
definitions: { definitions: {

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import Ajv from "ajv"; import Ajv from "ajv";
import { ValidationError, isBase64 } from "./validation"; import { ValidationError, isBase64 } from "./validation";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { ErrorObject } from "ajv"; import { ErrorObject } from "ajv";
/** /**

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { CloudEvent, Version } from "./event/cloudevent"; import { CloudEvent, Version } from "./event/cloudevent";
import { ValidationError } from "./event/validation"; import { ValidationError } from "./event/validation";
import { CloudEventV03, CloudEventV03Attributes, CloudEventV1, CloudEventV1Attributes } from "./event/interfaces"; import { CloudEventV03, CloudEventV03Attributes, CloudEventV1, CloudEventV1Attributes } from "./event/interfaces";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { PassThroughParser, DateParser, MappedParser } from "../../parsers"; import { PassThroughParser, DateParser, MappedParser } from "../../parsers";
import { CloudEvent } from "../.."; import { CloudEvent } from "../..";
import { Headers } from "../"; import { Headers } from "../";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { CloudEvent, CloudEventV03, CloudEventV1, CONSTANTS, Mode, Version } from "../.."; import { CloudEvent, CloudEventV03, CloudEventV1, CONSTANTS, Mode, Version } from "../..";
import { Message, Headers } from ".."; import { Message, Headers } from "..";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { IncomingHttpHeaders } from "http"; import { IncomingHttpHeaders } from "http";
import { CloudEvent } from ".."; import { CloudEvent } from "..";
import { binary, deserialize, structured, isEvent } from "./http"; import { binary, deserialize, structured, isEvent } from "./http";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import CONSTANTS from "./constants"; import CONSTANTS from "./constants";
import { isString, isDefinedOrThrow, isStringOrObjectOrThrow, ValidationError } from "./event/validation"; import { isString, isDefinedOrThrow, isStringOrObjectOrThrow, ValidationError } from "./event/validation";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { CloudEvent } from "../event/cloudevent"; import { CloudEvent } from "../event/cloudevent";
import { HTTP, Message, Mode } from "../message"; import { HTTP, Message, Mode } from "../message";
import { EventEmitter } from "events"; import { EventEmitter } from "events";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { Message, Options } from "../.."; import { Message, Options } from "../..";
import axios from "axios"; import axios from "axios";

View File

@ -1,6 +1,12 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
/** /**
* An enum representing the transport protocols for an event * An enum representing the transport protocols for an event
*/ */
export const enum Protocol { export const enum Protocol {
HTTPBinary, HTTPBinary,
HTTPStructured, HTTPStructured,

View File

@ -1,4 +1,10 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
/* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable @typescript-eslint/ban-ts-comment */
import { assert } from "chai"; import { assert } from "chai";
import { Given, When, Then, World } from "cucumber"; import { Given, When, Then, World } from "cucumber";
import { Message, Headers, HTTP } from "../../src"; import { Message, Headers, HTTP } from "../../src";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import path from "path"; import path from "path";
import fs from "fs"; import fs from "fs";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { expect } from "chai"; import { expect } from "chai";
import { CONSTANTS } from "../../src"; import { CONSTANTS } from "../../src";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha"; import "mocha";
import { expect } from "chai"; import { expect } from "chai";
import nock from "nock"; import nock from "nock";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha"; import "mocha";
import { emitterFor, HTTP, Mode, Message, Emitter } from "../../src"; import { emitterFor, HTTP, Mode, Message, Emitter } from "../../src";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import path from "path"; import path from "path";
import fs from "fs"; import fs from "fs";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha"; import "mocha";
import { expect } from "chai"; import { expect } from "chai";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha"; import "mocha";
import { expect } from "chai"; import { expect } from "chai";
import { CloudEvent, Version } from "../../src"; import { CloudEvent, Version } from "../../src";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha"; import "mocha";
import { expect } from "chai"; import { expect } from "chai";
import { CloudEvent, Version, ValidationError, Mode } from "../../src"; import { CloudEvent, Version, ValidationError, Mode } from "../../src";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha"; import "mocha";
import { expect } from "chai"; import { expect } from "chai";
import { CloudEvent, Version, ValidationError } from "../../src"; import { CloudEvent, Version, ValidationError } from "../../src";

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha"; import "mocha";
import { expect } from "chai"; import { expect } from "chai";
import { isStringOrThrow, equalsOrThrow, isBase64, asData } from "../../src/event/validation"; import { isStringOrThrow, equalsOrThrow, isBase64, asData } from "../../src/event/validation";