Socket
Socket
Sign inDemoInstall

@airtasker/spot

Package Overview
Dependencies
176
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.1.1

build/lib/src/linting/find-lint-violations.d.ts

3

build/cli/src/commands/lint.d.ts
import { Command } from "@oclif/command";
export interface LintConfig {
rules: Record<string, string>;
}
/**

@@ -3,0 +6,0 @@ * oclif command to lint a spot contract

20

build/cli/src/commands/lint.js

@@ -6,3 +6,10 @@ "use strict";

const parser_1 = require("../../../lib/src/parser");
const find_lint_violations_1 = require("../../../lib/src/linting/find-lint-violations");
const ARG_API = "spot_contract";
// TODO: Make it possible to specify by reading a config file
const lintConfig = {
rules: {
"no-omittable-fields-within-response-bodies": "warn"
}
};
/**

@@ -16,9 +23,10 @@ * oclif command to lint a spot contract

const contract = parser_1.parse(contractPath);
// TODO: Make it possible to specify with a config file which lint rules to enable.
const lintingErrors = linter_1.lint(contract);
const deferExit = lintingErrors.length > 0;
lintingErrors.forEach(error => {
this.error(error.message, { exit: false });
const groupedLintErrors = linter_1.lint(contract);
const { errorCount } = find_lint_violations_1.findLintViolations(groupedLintErrors, lintConfig, {
error: (msg) => {
this.error(msg, { exit: false });
},
warn: this.warn
});
if (deferExit) {
if (errorCount > 0) {
process.exit(1);

@@ -25,0 +33,0 @@ }

import { Contract } from "../definitions";
import { LintingRuleViolation } from "./rule";
export declare function lint(contract: Contract): LintingRuleViolation[];
import { GroupedLintRuleViolations } from "./rule";
export declare function lint(contract: Contract): GroupedLintRuleViolations[];

@@ -5,4 +5,7 @@ "use strict";

function lint(contract) {
return Object.keys(rules_1.availableRules).reduce((acc, ruleName) => acc.concat(rules_1.availableRules[ruleName](contract)), []);
return Object.keys(rules_1.availableRules).reduce((acc, ruleName) => acc.concat({
name: ruleName,
violations: rules_1.availableRules[ruleName](contract)
}), []);
}
exports.lint = lint;

@@ -10,1 +10,5 @@ import { Contract } from "../definitions";

}
export interface GroupedLintRuleViolations {
name: string;
violations: LintingRuleViolation[];
}

@@ -19,3 +19,3 @@ "use strict";

"no-nullable-fields-within-request-bodies": no_nullable_fields_within_request_bodies_1.noNullableFieldsWithinRequestBodies,
"no-omiitable-fields-within-response-bodies": no_omittable_fields_within_response_bodies_1.noOmittableFieldsWithinResponseBodies
"no-omittable-fields-within-response-bodies": no_omittable_fields_within_response_bodies_1.noOmittableFieldsWithinResponseBodies
};

@@ -1,1 +0,1 @@

{"version":"1.0.2","commands":{"checksum":{"id":"checksum","description":"Generate a checksum for a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot checksum api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"docs":{"id":"docs","description":"Preview Spot contract as OpenAPI3 documentation. The documentation server will start on http://localhost:8080.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot docs api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"Documentation server port","default":8080}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"generate":{"id":"generate","description":"Runs a generator on an API. Used to produce client libraries, server boilerplates and well-known API contract formats such as OpenAPI.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot generate --contract api.ts --language yaml --generator openapi3 --out output/"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"contract":{"name":"contract","type":"option","char":"c","description":"Path to a TypeScript Contract definition","required":true},"language":{"name":"language","type":"option","char":"l","description":"Language to generate"},"generator":{"name":"generator","type":"option","char":"g","description":"Generator to run"},"out":{"name":"out","type":"option","char":"o","description":"Directory in which to output generated files"}},"args":[]},"init":{"id":"init","description":"Generates the boilerplate for an API.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot init\nGenerated the following files:\n- api.ts\n- tsconfig.json\n- package.json\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"lint":{"id":"lint","description":"Lint a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot lint api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"mock":{"id":"mock","description":"Run a mock server based on a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot mock api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"proxyBaseUrl":{"name":"proxyBaseUrl","type":"option","description":"If set, the server will act as a proxy and fetch data from the given remote server instead of mocking it"},"port":{"name":"port","type":"option","char":"p","description":"Port on which to run the mock server","required":true,"default":3010},"pathPrefix":{"name":"pathPrefix","type":"option","description":"Prefix to prepend to each endpoint path"}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validate":{"id":"validate","description":"Validate a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validate api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validation-server":{"id":"validation-server","description":"Start the spot contract validation server","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validation-server api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"The port where application will be available","default":5907}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]}}}
{"version":"1.1.1","commands":{"checksum":{"id":"checksum","description":"Generate a checksum for a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot checksum api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"docs":{"id":"docs","description":"Preview Spot contract as OpenAPI3 documentation. The documentation server will start on http://localhost:8080.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot docs api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"Documentation server port","default":8080}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"generate":{"id":"generate","description":"Runs a generator on an API. Used to produce client libraries, server boilerplates and well-known API contract formats such as OpenAPI.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot generate --contract api.ts --language yaml --generator openapi3 --out output/"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"contract":{"name":"contract","type":"option","char":"c","description":"Path to a TypeScript Contract definition","required":true},"language":{"name":"language","type":"option","char":"l","description":"Language to generate"},"generator":{"name":"generator","type":"option","char":"g","description":"Generator to run"},"out":{"name":"out","type":"option","char":"o","description":"Directory in which to output generated files"}},"args":[]},"init":{"id":"init","description":"Generates the boilerplate for an API.","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot init\nGenerated the following files:\n- api.ts\n- tsconfig.json\n- package.json\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"lint":{"id":"lint","description":"Lint a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot lint api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"mock":{"id":"mock","description":"Run a mock server based on a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot mock api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"proxyBaseUrl":{"name":"proxyBaseUrl","type":"option","description":"If set, the server will act as a proxy and fetch data from the given remote server instead of mocking it"},"port":{"name":"port","type":"option","char":"p","description":"Port on which to run the mock server","required":true,"default":3010},"pathPrefix":{"name":"pathPrefix","type":"option","description":"Prefix to prepend to each endpoint path"}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validate":{"id":"validate","description":"Validate a Spot contract","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validate api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]},"validation-server":{"id":"validation-server","description":"Start the spot contract validation server","pluginName":"@airtasker/spot","pluginType":"core","aliases":[],"examples":["$ spot validation-server api.ts"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"The port where application will be available","default":5907}},"args":[{"name":"spot_contract","description":"path to Spot contract","required":true,"hidden":false}]}}}
{
"name": "@airtasker/spot",
"version": "1.0.2",
"version": "1.1.1",
"author": "Francois Wouts, Leslie Fung",

@@ -22,3 +22,3 @@ "bin": {

"randomstring": "^1.1.5",
"ts-morph": "^7.0.0",
"ts-morph": "^7.0.1",
"typescript": "^3.8.3",

@@ -31,3 +31,3 @@ "validator": "^13.0.0"

"@types/cors": "^2.8.6",
"@types/express": "^4.17.3",
"@types/express": "^4.17.4",
"@types/fs-extra": "^8.1.0",

@@ -40,13 +40,13 @@ "@types/inquirer": "^6.5.0",

"@types/randomstring": "^1.1.6",
"@types/react": "^16.9.25",
"@types/react-dom": "^16.9.5",
"@types/react": "^16.9.31",
"@types/react-dom": "^16.9.6",
"@types/supertest": "^2.0.8",
"@types/validator": "^12.0.1",
"@typescript-eslint/eslint-plugin": "^2.25.0",
"@typescript-eslint/parser": "^2.25.0",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"core-js": "^3.6.4",
"css-loader": "^3.4.2",
"eslint": "^6.8.0",
"html-webpack-plugin": "^4.0.1",
"jest": "^25.2.0",
"html-webpack-plugin": "^4.0.3",
"jest": "^25.2.4",
"jest-junit": "^10.0.0",

@@ -59,6 +59,6 @@ "mini-css-extract-plugin": "^0.9.0",

"react-dom": "^16.13.1",
"redoc": "^2.0.0-rc.24",
"redoc": "^2.0.0-rc.25",
"styled-components": "^4.4.1",
"supertest": "^4.0.2",
"ts-jest": "^25.2.1",
"ts-jest": "^25.3.0",
"ts-loader": "^6.2.2",

@@ -65,0 +65,0 @@ "webpack": "^4.42.1",

@@ -147,3 +147,3 @@ # Spot

_See code: [build/cli/src/commands/checksum.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/checksum.js)_
_See code: [build/cli/src/commands/checksum.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/checksum.js)_

@@ -169,3 +169,3 @@ ## `spot docs SPOT_CONTRACT`

_See code: [build/cli/src/commands/docs.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/docs.js)_
_See code: [build/cli/src/commands/docs.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/docs.js)_

@@ -191,3 +191,3 @@ ## `spot generate`

_See code: [build/cli/src/commands/generate.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/generate.js)_
_See code: [build/cli/src/commands/generate.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/generate.js)_

@@ -230,3 +230,3 @@ ## `spot help [COMMAND]`

_See code: [build/cli/src/commands/init.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/init.js)_
_See code: [build/cli/src/commands/init.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/init.js)_

@@ -251,3 +251,3 @@ ## `spot lint SPOT_CONTRACT`

_See code: [build/cli/src/commands/lint.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/lint.js)_
_See code: [build/cli/src/commands/lint.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/lint.js)_

@@ -277,3 +277,3 @@ ## `spot mock SPOT_CONTRACT`

_See code: [build/cli/src/commands/mock.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/mock.js)_
_See code: [build/cli/src/commands/mock.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/mock.js)_

@@ -298,3 +298,3 @@ ## `spot validate SPOT_CONTRACT`

_See code: [build/cli/src/commands/validate.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/validate.js)_
_See code: [build/cli/src/commands/validate.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/validate.js)_

@@ -320,3 +320,3 @@ ## `spot validation-server SPOT_CONTRACT`

_See code: [build/cli/src/commands/validation-server.js](https://github.com/airtasker/spot/blob/v1.0.2/build/cli/src/commands/validation-server.js)_
_See code: [build/cli/src/commands/validation-server.js](https://github.com/airtasker/spot/blob/v1.1.1/build/cli/src/commands/validation-server.js)_
<!-- commandsstop -->

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc