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,
"mocha": true
},
"plugins": [
"header"
],
"rules": {
"no-var": "error",
"standard/no-callback-literal": "off",
@ -31,6 +34,7 @@
"valid-jsdoc": "warn",
"semi": ["error", "always"],
"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
let common = [
"--require-module ts-node/register", // Load TypeScript module

6
package-lock.json generated
View File

@ -3185,6 +3185,12 @@
"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": {
"version": "2.22.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz",

View File

@ -42,7 +42,62 @@
},
{
"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",
@ -74,6 +129,7 @@
"eslint": "^7.3.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"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({
CHARSET_DEFAULT: "utf-8",
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 { 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.
* @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 = {
$ref: "#/definitions/event",
definitions: {

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import Ajv from "ajv";
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";
/**

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import { CloudEvent, Version } from "./event/cloudevent";
import { ValidationError } from "./event/validation";
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 { CloudEvent } 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 { 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 { CloudEvent } from "..";
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 { 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 { HTTP, Message, Mode } from "../message";
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 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
*/
export const enum Protocol {
HTTPBinary,
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 */
import { assert } from "chai";
import { Given, When, Then, World } from "cucumber";
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 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 { CONSTANTS } from "../../src";

View File

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

View File

@ -1,3 +1,8 @@
/*
Copyright 2021 The CloudEvents Authors
SPDX-License-Identifier: Apache-2.0
*/
import "mocha";
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 fs from "fs";

View File

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

View File

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