Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stoplight/spectral

Package Overview
Dependencies
Maintainers
11
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/spectral - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

config/configLoader.d.ts

1

cli/commands/lint.d.ts

@@ -13,2 +13,3 @@ import { Command, flags as flagHelpers } from '@oclif/command';

verbose: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
config: flagHelpers.IOptionFlag<string | undefined>;
ruleset: flagHelpers.IOptionFlag<string[]>;

@@ -15,0 +16,0 @@ };

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

const fs_1 = require("fs");
const lodash_1 = require("lodash");
const path_1 = require("path");
const util_1 = require("util");
const configLoader_1 = require("../../config/configLoader");
const formatters_1 = require("../../formatters");

@@ -16,2 +18,3 @@ const reader_1 = require("../../fs/reader");

const spectral_1 = require("../../spectral");
const config_1 = require("../../types/config");
const writeFileAsync = util_1.promisify(fs_1.writeFile);

@@ -22,3 +25,15 @@ class Lint extends command_1.Command {

const { args, flags } = this.parse(Lint);
const { ruleset } = flags;
const { config: configFileFlag } = flags;
let config = mergeConfig(configLoader_1.createEmptyConfig(), flags);
const configFile = configFileFlag || configLoader_1.getDefaultConfigFile(process.cwd()) || null;
if (configFile) {
try {
const loadedConfig = yield configLoader_1.load(configFile, config_1.ConfigCommand.LINT);
config = mergeConfig(loadedConfig, flags);
}
catch (ex) {
this.error(`Cannot load provided config file. ${ex.message}.`);
}
}
const { ruleset } = config;
let rules;

@@ -35,3 +50,3 @@ if (ruleset) {

try {
yield lint(args.source, flags, this, rules);
yield lint(args.source, config, this, rules);
}

@@ -58,3 +73,2 @@ catch (ex) {

char: 'e',
default: 'utf8',
description: 'text encoding to use',

@@ -64,3 +78,2 @@ }),

char: 'f',
default: 'stylish',
description: 'formatter to use for outputting results',

@@ -81,2 +94,6 @@ options: ['json', 'stylish'],

}),
config: command_1.flags.string({
char: 'c',
description: 'path to a config file',
}),
ruleset: command_1.flags.string({

@@ -161,2 +178,12 @@ char: 'r',

exports.writeOutput = writeOutput;
function mergeConfig(config, flags) {
return Object.assign({}, config.lint, lodash_1.omitBy({
encoding: flags.encoding,
format: flags.format,
output: flags.output,
maxResults: flags.maxResults,
verbose: flags.verbose,
ruleset: flags.ruleset,
}, lodash_1.isNil));
}
//# sourceMappingURL=lint.js.map

2

oclif.manifest.json

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

{"version":"2.1.0","commands":{"lint":{"id":"lint","description":"lint a JSON/YAML document from a file or URL","pluginName":"@stoplight/spectral","pluginType":"core","aliases":[],"examples":["$ spectral lint .openapi.yaml\nlinting ./openapi.yaml\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"encoding":{"name":"encoding","type":"option","char":"e","description":"text encoding to use","default":"utf8"},"format":{"name":"format","type":"option","char":"f","description":"formatter to use for outputting results","options":["json","stylish"],"default":"stylish"},"output":{"name":"output","type":"option","char":"o","description":"output to a file instead of stdout"},"maxResults":{"name":"maxResults","type":"option","char":"m","description":"[default: all] maximum results to show"},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"increase verbosity","allowNo":false},"ruleset":{"name":"ruleset","type":"option","char":"r","description":"path to a ruleset file (supports remote files)"}},"args":[{"name":"source"}]}}}
{"version":"2.1.1","commands":{"lint":{"id":"lint","description":"lint a JSON/YAML document from a file or URL","pluginName":"@stoplight/spectral","pluginType":"core","aliases":[],"examples":["$ spectral lint .openapi.yaml\nlinting ./openapi.yaml\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"encoding":{"name":"encoding","type":"option","char":"e","description":"text encoding to use"},"format":{"name":"format","type":"option","char":"f","description":"formatter to use for outputting results","options":["json","stylish"]},"output":{"name":"output","type":"option","char":"o","description":"output to a file instead of stdout"},"maxResults":{"name":"maxResults","type":"option","char":"m","description":"[default: all] maximum results to show"},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"increase verbosity","allowNo":false},"config":{"name":"config","type":"option","char":"c","description":"path to a config file"},"ruleset":{"name":"ruleset","type":"option","char":"r","description":"path to a ruleset file (supports remote files)"}},"args":[{"name":"source"}]}}}
{
"name": "@stoplight/spectral",
"version": "2.1.0",
"version": "2.1.1",
"description": "A flexible object linter with out of the box support for OpenAPI v2 and v3.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc