New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@secretlint/config-loader

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@secretlint/config-loader - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

68

CHANGELOG.md
# Change Log
## 0.7.1
### Patch Changes
- aaef596: Path Update
- Updated dependencies [aaef596]
- Updated dependencies [5a22277]
- @secretlint/config-validator@0.7.1
- @secretlint/profiler@0.7.1
- @secretlint/secretlint-rule-example@0.7.1
- @secretlint/types@0.7.1
All notable changes to this project will be documented in this file.

@@ -10,17 +22,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.6.0](https://github.com/secretlint/secretlint/compare/v0.5.0...v0.6.0) (2020-02-29)
### Features
* support terminalLink ([#65](https://github.com/secretlint/secretlint/issues/65)) ([a28ef9e](https://github.com/secretlint/secretlint/commit/a28ef9eb9b3803984ec37bbbd9cdf35e7d4b67a6))
- support terminalLink ([#65](https://github.com/secretlint/secretlint/issues/65)) ([a28ef9e](https://github.com/secretlint/secretlint/commit/a28ef9eb9b3803984ec37bbbd9cdf35e7d4b67a6))
# [0.5.0](https://github.com/secretlint/secretlint/compare/v0.4.2...v0.5.0) (2020-02-28)

@@ -30,6 +33,2 @@

## [0.4.1](https://github.com/secretlint/secretlint/compare/v0.4.0...v0.4.1) (2020-02-28)

@@ -39,18 +38,9 @@

# [0.4.0](https://github.com/secretlint/secretlint/compare/v0.3.0...v0.4.0) (2020-02-28)
### Features
* **core:** support "disabled" options ([17c1391](https://github.com/secretlint/secretlint/commit/17c1391cbd19edfe72f894fcf2e3a9d50fc4a7d2))
* **core:** support "disabledMessages" options ([17de33e](https://github.com/secretlint/secretlint/commit/17de33eaef2408c63cbaeecb4038c8878a292ca0))
- **core:** support "disabled" options ([17c1391](https://github.com/secretlint/secretlint/commit/17c1391cbd19edfe72f894fcf2e3a9d50fc4a7d2))
- **core:** support "disabledMessages" options ([17de33e](https://github.com/secretlint/secretlint/commit/17de33eaef2408c63cbaeecb4038c8878a292ca0))
# [0.3.0](https://github.com/secretlint/secretlint/compare/v0.2.0...v0.3.0) (2020-02-27)

@@ -60,6 +50,2 @@

# [0.2.0](https://github.com/secretlint/secretlint/compare/v0.1.2...v0.2.0) (2020-02-23)

@@ -69,23 +55,17 @@

# 0.1.0 (2020-02-16)
### Bug Fixes
* **cli:** fix exit status ([04d9b41](https://github.com/secretlint/secretlint/commit/04d9b412fe60eb638d0cb131d95ed4dcfcc4c11a))
* **config-loader:** rule will be undefined ([9a109a6](https://github.com/secretlint/secretlint/commit/9a109a630c2062890a553c7b4d672b00b4db0724))
* **config-loader:** rule will be undefined ([c0c2bcd](https://github.com/secretlint/secretlint/commit/c0c2bcdbb93536af219ce54bfa8019aff2f748c6))
- **cli:** fix exit status ([04d9b41](https://github.com/secretlint/secretlint/commit/04d9b412fe60eb638d0cb131d95ed4dcfcc4c11a))
- **config-loader:** rule will be undefined ([9a109a6](https://github.com/secretlint/secretlint/commit/9a109a630c2062890a553c7b4d672b00b4db0724))
- **config-loader:** rule will be undefined ([c0c2bcd](https://github.com/secretlint/secretlint/commit/c0c2bcdbb93536af219ce54bfa8019aff2f748c6))
### Features
* **config-loader:** add config-loader ([c56e8a3](https://github.com/secretlint/secretlint/commit/c56e8a3b8f2b1dc5fc6b3306dbd3ef496b31feb5))
* **config-loader:** add validation on loading ([686b879](https://github.com/secretlint/secretlint/commit/686b879928e60e3f886f0af50f3d51d495c364b0))
* **core:** support severity options ([876e936](https://github.com/secretlint/secretlint/commit/876e9360c324232aeade50fd7767fe8bd08907a5))
* **node:** support configFilePath ([682bb60](https://github.com/secretlint/secretlint/commit/682bb6021473e3a08a1e73704fd68bcff256c74d))
* **secretlint:** implement `secretlint` package as CLI ([6765e2d](https://github.com/secretlint/secretlint/commit/6765e2d6a182e5e876f4c4ba5348101bf8f36806))
* **tester:** support .secretlintrc options via file ([c137c00](https://github.com/secretlint/secretlint/commit/c137c00829d6ee903d0e81894e0d343fff94f089))
- **config-loader:** add config-loader ([c56e8a3](https://github.com/secretlint/secretlint/commit/c56e8a3b8f2b1dc5fc6b3306dbd3ef496b31feb5))
- **config-loader:** add validation on loading ([686b879](https://github.com/secretlint/secretlint/commit/686b879928e60e3f886f0af50f3d51d495c364b0))
- **core:** support severity options ([876e936](https://github.com/secretlint/secretlint/commit/876e9360c324232aeade50fd7767fe8bd08907a5))
- **node:** support configFilePath ([682bb60](https://github.com/secretlint/secretlint/commit/682bb6021473e3a08a1e73704fd68bcff256c74d))
- **secretlint:** implement `secretlint` package as CLI ([6765e2d](https://github.com/secretlint/secretlint/commit/6765e2d6a182e5e876f4c4ba5348101bf8f36806))
- **tester:** support .secretlintrc options via file ([c137c00](https://github.com/secretlint/secretlint/commit/c137c00829d6ee903d0e81894e0d343fff94f089))

@@ -22,9 +22,14 @@ import { SecretLintConfigDescriptor, SecretLintCoreDescriptor, SecretLintUnionRuleCreator } from "@secretlint/types";

ok: true;
config: SecretLintCoreDescriptor;
configFilePath: string;
config: SecretLintCoreDescriptor;
} | {
ok: false;
configFilePath?: string;
rawConfig?: SecretLintConfigDescriptor;
errors: Error[];
};
export declare type SecretLintConfigLoaderRawResult = {
ok: true;
configFilePath: string;
rawConfig: SecretLintConfigDescriptor;
errors: Error[];
} | {

@@ -34,6 +39,25 @@ ok: false;

};
export declare type SecretLintConfigLoaderRawResult = {
export declare type SecretLintLoadPackagesFromRawConfigOptions = {
/**
* Loaded config object
*/
rawConfig: SecretLintConfigDescriptor;
/**
* node_modules directory path
* Default: undefined
*/
node_moduleDir?: string;
/**
* This definitions replace id to rule module
* It is useful for replacing specific ruleId with specific rule module.
* Main use-case is tester.
*/
testReplaceDefinitions?: {
id: string;
rule: SecretLintUnionRuleCreator;
}[];
};
export declare type SecretLintLoadPackagesFromRawConfigResult = {
ok: true;
configFilePath: string;
config: SecretLintConfigDescriptor;
config: SecretLintCoreDescriptor;
} | {

@@ -44,2 +68,7 @@ ok: false;

/**
* Load packages in RawConfig and return loaded config object
* @param options
*/
export declare const loadPackagesFromRawConfig: (options: SecretLintLoadPackagesFromRawConfigOptions) => SecretLintLoadPackagesFromRawConfigResult;
/**
* Load config file and return config object that is loaded rule instance.

@@ -46,0 +75,0 @@ * @param options

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var rc_config_loader_1 = require("rc-config-loader");
var profiler_1 = require("@secretlint/profiler");
var SecretLintModuleResolver_1 = require("./SecretLintModuleResolver");

@@ -8,15 +9,8 @@ var module_interop_1 = require("@textlint/module-interop");

/**
* Load config file and return config object that is loaded rule instance.
* Load packages in RawConfig and return loaded config object
* @param options
*/
exports.loadConfig = function (options) {
var rawResult = exports.loadRawConfig(options);
if (!rawResult.ok) {
return {
ok: false,
errors: rawResult.errors
};
}
exports.loadPackagesFromRawConfig = function (options) {
// Early validation, validate rawConfig by JSON Schema
var resultValidateRawConfig = config_validator_1.validateRawConfig(rawResult.config);
var resultValidateRawConfig = config_validator_1.validateRawConfig(options.rawConfig);
if (!resultValidateRawConfig.ok) {

@@ -28,2 +22,5 @@ return {

}
profiler_1.secretLintProfiler.mark({
type: "@config-loader>resolve-modules::start"
});
// Search secretlint's module

@@ -35,4 +32,8 @@ var moduleResolver = new SecretLintModuleResolver_1.SecretLintModuleResolver({

var rules = [];
rawResult.config.rules.forEach(function (configDescriptorRule) {
options.rawConfig.rules.forEach(function (configDescriptorRule) {
try {
profiler_1.secretLintProfiler.mark({
type: "@config-loader>resolve-module::start",
id: configDescriptorRule.id
});
var replacedDefinition = options.testReplaceDefinitions &&

@@ -59,2 +60,6 @@ options.testReplaceDefinitions.find(function (_a) {

});
profiler_1.secretLintProfiler.mark({
type: "@config-loader>resolve-module::end",
id: configDescriptorRule.id
});
}

@@ -65,7 +70,8 @@ catch (error) {

});
profiler_1.secretLintProfiler.mark({
type: "@config-loader>resolve-modules::end"
});
if (errors.length > 0) {
return {
ok: false,
rawConfig: rawResult.config,
configFilePath: rawResult.configFilePath,
errors: errors

@@ -88,3 +94,2 @@ };

ok: true,
configFilePath: rawResult.configFilePath,
config: loadedConfig

@@ -94,2 +99,44 @@ };

/**
* Load config file and return config object that is loaded rule instance.
* @param options
*/
exports.loadConfig = function (options) {
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-config-file::start"
});
var rawResult = exports.loadRawConfig(options);
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-config-file::end"
});
if (!rawResult.ok) {
return {
ok: false,
errors: rawResult.errors
};
}
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-packages::start"
});
var result = exports.loadPackagesFromRawConfig({
rawConfig: rawResult.rawConfig,
node_moduleDir: options.node_moduleDir,
testReplaceDefinitions: options.testReplaceDefinitions
});
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-packages::end"
});
if (!result.ok) {
return {
ok: false,
configFilePath: rawResult.configFilePath,
errors: result.errors
};
}
return {
ok: true,
config: result.config,
configFilePath: rawResult.configFilePath
};
};
/**
* Load config file and return config object that is not loaded rule instance

@@ -117,3 +164,3 @@ * It is just JSON present for config file. Raw data

ok: true,
config: results.config,
rawConfig: results.config,
configFilePath: results.filePath

@@ -120,0 +167,0 @@ };

{
"name": "@secretlint/config-loader",
"version": "0.7.0",
"description": "Config loader for secretlint.",
"keywords": [
"secretlint",
"node",
"config",
"loader"
],
"homepage": "https://github.com/secretlint/secretlint/tree/master/packages/@secretlint/config-loader/",
"bugs": {
"url": "https://github.com/secretlint/secretlint/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/secretlint/secretlint.git"
},
"license": "MIT",
"author": "azu",
"files": [
"bin/",
"lib/",
"src/"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib",
"test": "test"
},
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"clean": "rimraf lib/",
"prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
"prepublish": "npm run --if-present build",
"test": "mocha \"test/**/*.ts\"",
"watch": "tsc -p . --watch"
},
"prettier": {
"printWidth": 120,
"singleQuote": false,
"tabWidth": 4
},
"dependencies": {
"@secretlint/config-validator": "^0.7.0",
"@secretlint/types": "^0.7.0",
"@textlint/module-interop": "^1.0.2",
"debug": "^4.1.1",
"rc-config-loader": "^3.0.0",
"try-resolve": "^1.0.1"
},
"devDependencies": {
"@secretlint/secretlint-rule-example": "^0.7.0",
"@types/mocha": "^7.0.1",
"@types/node": "^13.7.4",
"cross-env": "^7.0.0",
"mocha": "^7.0.1",
"prettier": "^1.19.1",
"rimraf": "^3.0.2",
"ts-node": "^8.6.2",
"ts-node-test-register": "^8.0.1",
"typescript": "^3.8.2"
},
"publishConfig": {
"access": "public"
},
"gitHead": "b29781cbb16259b05547b66b5a728f56c9ad9698"
"name": "@secretlint/config-loader",
"version": "0.7.1",
"description": "Config loader for secretlint.",
"keywords": [
"secretlint",
"node",
"config",
"loader"
],
"homepage": "https://github.com/secretlint/secretlint/tree/master/packages/@secretlint/config-loader/",
"bugs": {
"url": "https://github.com/secretlint/secretlint/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/secretlint/secretlint.git"
},
"license": "MIT",
"author": "azu",
"files": [
"bin/",
"lib/",
"src/"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib",
"test": "test"
},
"scripts": {
"build": "cross-env NODE_ENV=production tsc -p .",
"clean": "rimraf lib/",
"prettier": "prettier --write \"**/*.{js,jsx,ts,tsx,css}\"",
"prepublish": "npm run --if-present build",
"test": "mocha \"test/**/*.ts\"",
"watch": "tsc -p . --watch"
},
"prettier": {
"printWidth": 120,
"singleQuote": false,
"tabWidth": 4
},
"dependencies": {
"@secretlint/config-validator": "^0.7.1",
"@secretlint/profiler": "^0.7.1",
"@secretlint/types": "^0.7.1",
"@textlint/module-interop": "^1.0.2",
"debug": "^4.1.1",
"rc-config-loader": "^3.0.0",
"try-resolve": "^1.0.1"
},
"devDependencies": {
"@secretlint/secretlint-rule-example": "^0.7.1",
"@types/mocha": "^7.0.1",
"@types/node": "^13.7.4",
"cross-env": "^7.0.0",
"mocha": "^7.0.1",
"prettier": "^1.19.1",
"rimraf": "^3.0.2",
"ts-node": "^8.6.2",
"ts-node-test-register": "^8.0.1",
"typescript": "^3.8.2"
},
"publishConfig": {
"access": "public"
},
"gitHead": "ceffac0e71ed7bd2d20a518fbb74ecc6a9935161"
}

@@ -9,2 +9,3 @@ import { rcFile } from "rc-config-loader";

} from "@secretlint/types";
import { secretLintProfiler } from "@secretlint/profiler";
import { SecretLintModuleResolver } from "./SecretLintModuleResolver";

@@ -35,42 +36,62 @@ import { moduleInterop } from "@textlint/module-interop";

| {
ok: true;
configFilePath: string;
config: SecretLintCoreDescriptor; // Core Option object
}
ok: true;
config: SecretLintCoreDescriptor; // Core Option object
configFilePath: string;
}
| {
// load module error
ok: false;
configFilePath: string;
rawConfig: SecretLintConfigDescriptor;
errors: Error[];
}
| {
// load config error
ok: false;
errors: Error[];
};
// load config error
ok: false;
configFilePath?: string;
rawConfig?: SecretLintConfigDescriptor; // Config Raw object
errors: Error[];
} ;
export type SecretLintConfigLoaderRawResult =
| {
ok: true;
configFilePath: string;
config: SecretLintConfigDescriptor; // Config Raw object
}
ok: true;
configFilePath: string;
rawConfig: SecretLintConfigDescriptor; // Config Raw object
}
| {
ok: false;
errors: Error[];
};
ok: false;
errors: Error[];
};
export type SecretLintLoadPackagesFromRawConfigOptions = {
/**
* Loaded config object
*/
rawConfig: SecretLintConfigDescriptor;
/**
* node_modules directory path
* Default: undefined
*/
node_moduleDir?: string;
/**
* This definitions replace id to rule module
* It is useful for replacing specific ruleId with specific rule module.
* Main use-case is tester.
*/
testReplaceDefinitions?: {
id: string;
rule: SecretLintUnionRuleCreator;
}[];
}
export type SecretLintLoadPackagesFromRawConfigResult =
| {
ok: true;
config: SecretLintCoreDescriptor; // Core Option object
}
| {
// load config error
ok: false;
errors: Error[];
} ;
/**
* Load config file and return config object that is loaded rule instance.
* Load packages in RawConfig and return loaded config object
* @param options
*/
export const loadConfig = (options: SecretLintConfigLoaderOptions): SecretLintConfigLoaderResult => {
const rawResult = loadRawConfig(options);
if (!rawResult.ok) {
return {
ok: false,
errors: rawResult.errors
};
}
export const loadPackagesFromRawConfig = (options: SecretLintLoadPackagesFromRawConfigOptions): SecretLintLoadPackagesFromRawConfigResult => {
// Early validation, validate rawConfig by JSON Schema
const resultValidateRawConfig = validateRawConfig(rawResult.config);
const resultValidateRawConfig = validateRawConfig(options.rawConfig);
if (!resultValidateRawConfig.ok) {

@@ -82,2 +103,5 @@ return {

}
secretLintProfiler.mark({
type: "@config-loader>resolve-modules::start"
});
// Search secretlint's module

@@ -89,4 +113,8 @@ const moduleResolver = new SecretLintModuleResolver({

const rules: SecretLintCoreDescriptorUnionRule[] = [];
rawResult.config.rules.forEach(configDescriptorRule => {
options.rawConfig.rules.forEach(configDescriptorRule => {
try {
secretLintProfiler.mark({
type: "@config-loader>resolve-module::start",
id: configDescriptorRule.id
});
const replacedDefinition =

@@ -115,2 +143,6 @@ options.testReplaceDefinitions &&

});
secretLintProfiler.mark({
type: "@config-loader>resolve-module::end",
id: configDescriptorRule.id
});
} catch (error) {

@@ -120,7 +152,8 @@ errors.push(error);

});
secretLintProfiler.mark({
type: "@config-loader>resolve-modules::end"
});
if (errors.length > 0) {
return {
ok: false,
rawConfig: rawResult.config,
configFilePath: rawResult.configFilePath,
errors

@@ -143,3 +176,2 @@ };

ok: true,
configFilePath: rawResult.configFilePath,
config: loadedConfig

@@ -149,2 +181,44 @@ };

/**
* Load config file and return config object that is loaded rule instance.
* @param options
*/
export const loadConfig = (options: SecretLintConfigLoaderOptions): SecretLintConfigLoaderResult => {
secretLintProfiler.mark({
type: "@config-loader>load-config-file::start"
});
const rawResult = loadRawConfig(options);
secretLintProfiler.mark({
type: "@config-loader>load-config-file::end"
});
if (!rawResult.ok) {
return {
ok: false,
errors: rawResult.errors
};
}
secretLintProfiler.mark({
type: "@config-loader>load-packages::start"
});
const result = loadPackagesFromRawConfig({
rawConfig: rawResult.rawConfig,
node_moduleDir: options.node_moduleDir,
testReplaceDefinitions: options.testReplaceDefinitions
});
secretLintProfiler.mark({
type: "@config-loader>load-packages::end"
});
if (!result.ok) {
return {
ok: false,
configFilePath: rawResult.configFilePath,
errors: result.errors
};
}
return {
ok: true,
config: result.config,
configFilePath: rawResult.configFilePath
};
};
/**
* Load config file and return config object that is not loaded rule instance

@@ -172,3 +246,3 @@ * It is just JSON present for config file. Raw data

ok: true,
config: results.config,
rawConfig: results.config,
configFilePath: results.filePath

@@ -175,0 +249,0 @@ };

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