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 2.1.1 to 2.2.0

60

lib/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadRawConfig = exports.loadConfig = exports.loadPackagesFromRawConfig = void 0;
var rc_config_loader_1 = require("rc-config-loader");

@@ -12,3 +13,3 @@ var profiler_1 = require("@secretlint/profiler");

*/
exports.loadPackagesFromRawConfig = function (options) {
var loadPackagesFromRawConfig = function (options) {
// Early validation, validate rawConfig by JSON Schema

@@ -19,11 +20,11 @@ var resultValidateRawConfig = config_validator_1.validateRawConfig(options.rawConfig);

ok: false,
errors: [resultValidateRawConfig.error]
errors: [resultValidateRawConfig.error],
};
}
profiler_1.secretLintProfiler.mark({
type: "@config-loader>resolve-modules::start"
type: "@config-loader>resolve-modules::start",
});
// Search secretlint's module
var moduleResolver = new SecretLintModuleResolver_1.SecretLintModuleResolver({
baseDirectory: options.node_moduleDir
baseDirectory: options.node_moduleDir,
});

@@ -36,3 +37,3 @@ var errors = [];

type: "@config-loader>resolve-module::start",
id: configDescriptorRule.id
id: configDescriptorRule.id,
});

@@ -58,7 +59,7 @@ var replacedDefinition = options.testReplaceDefinitions &&

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

@@ -71,3 +72,3 @@ }

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

@@ -77,3 +78,3 @@ if (errors.length > 0) {

ok: false,
errors: errors
errors: errors,
};

@@ -83,3 +84,3 @@ }

sharedOptions: options.rawConfig.sharedOptions,
rules: rules
rules: rules,
};

@@ -92,3 +93,3 @@ // Finally, validate loadedConfig with validator

ok: false,
errors: [resultValidateConfig.error]
errors: [resultValidateConfig.error],
};

@@ -98,5 +99,6 @@ }

ok: true,
config: loadedConfig
config: loadedConfig,
};
};
exports.loadPackagesFromRawConfig = loadPackagesFromRawConfig;
/**

@@ -106,9 +108,9 @@ * Load config file and return config object that is loaded rule instance.

*/
exports.loadConfig = function (options) {
var loadConfig = function (options) {
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-config-file::start"
type: "@config-loader>load-config-file::start",
});
var rawResult = exports.loadRawConfig(options);
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-config-file::end"
type: "@config-loader>load-config-file::end",
});

@@ -118,7 +120,7 @@ if (!rawResult.ok) {

ok: false,
errors: rawResult.errors
errors: rawResult.errors,
};
}
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-packages::start"
type: "@config-loader>load-packages::start",
});

@@ -128,6 +130,6 @@ var result = exports.loadPackagesFromRawConfig({

node_moduleDir: options.node_moduleDir,
testReplaceDefinitions: options.testReplaceDefinitions
testReplaceDefinitions: options.testReplaceDefinitions,
});
profiler_1.secretLintProfiler.mark({
type: "@config-loader>load-packages::end"
type: "@config-loader>load-packages::end",
});

@@ -138,3 +140,3 @@ if (!result.ok) {

configFilePath: rawResult.configFilePath,
errors: result.errors
errors: result.errors,
};

@@ -145,5 +147,6 @@ }

config: result.config,
configFilePath: rawResult.configFilePath
configFilePath: rawResult.configFilePath,
};
};
exports.loadConfig = loadConfig;
/**

@@ -154,3 +157,3 @@ * Load config file and return config object that is not loaded rule instance

*/
exports.loadRawConfig = function (options) {
var loadRawConfig = function (options) {
try {

@@ -161,4 +164,4 @@ var results = rc_config_loader_1.rcFile("secretlint", {

packageJSON: {
fieldName: "secretlint"
}
fieldName: "secretlint",
},
});

@@ -170,4 +173,4 @@ // Not Found

errors: [
new Error("secretlint config is not found\n \nSecrelint require .secretlintrc config file.\nThe config file define the use of rules.")
]
new Error("secretlint config is not found\n \nSecrelint require .secretlintrc config file.\nThe config file define the use of rules."),
],
};

@@ -178,3 +181,3 @@ }

rawConfig: results.config,
configFilePath: results.filePath
configFilePath: results.filePath,
};

@@ -185,6 +188,7 @@ }

ok: false,
errors: [error]
errors: [error],
};
}
};
exports.loadRawConfig = loadRawConfig;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFullPackageName = exports.removePrefixFromPackageName = void 0;
/**
* Remove `prefix` from `text`.
*/
exports.removePrefixFromPackageName = function (prefixList, packageName) {
var removePrefixFromPackageName = function (prefixList, packageName) {
for (var i = 0; i < prefixList.length; i++) {

@@ -26,2 +27,3 @@ var prefix = prefixList[i];

};
exports.removePrefixFromPackageName = removePrefixFromPackageName;
/**

@@ -33,3 +35,3 @@ * Create full package name and return

*/
exports.createFullPackageName = function (prefix, name) {
var createFullPackageName = function (prefix, name) {
if (name.charAt(0) === "@") {

@@ -48,2 +50,3 @@ var scopedPackageNameRegex = new RegExp("^" + prefix + "(-|$)");

};
exports.createFullPackageName = createFullPackageName;
//# sourceMappingURL=package-name-util.js.map
// LICENSE : MIT
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecretLintModuleResolver = void 0;
var path = __importStar(require("path"));

@@ -12,0 +25,0 @@ var package_name_util_1 = require("./package-name-util");

{
"name": "@secretlint/config-loader",
"version": "2.1.1",
"version": "2.2.0",
"description": "Config loader for secretlint.",

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

"dependencies": {
"@secretlint/config-validator": "^2.1.1",
"@secretlint/profiler": "^2.1.1",
"@secretlint/types": "^2.1.1",
"@secretlint/config-validator": "^2.2.0",
"@secretlint/profiler": "^2.2.0",
"@secretlint/types": "^2.2.0",
"@textlint/module-interop": "^1.0.2",

@@ -56,12 +56,12 @@ "debug": "^4.1.1",

"devDependencies": {
"@secretlint/secretlint-rule-example": "^2.1.1",
"@types/mocha": "^7.0.1",
"@types/node": "^13.9.3",
"cross-env": "^7.0.0",
"mocha": "^7.1.1",
"prettier": "^2.0.2",
"@secretlint/secretlint-rule-example": "^2.2.0",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.41",
"cross-env": "^7.0.3",
"mocha": "^8.3.2",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"ts-node": "^8.8.1",
"ts-node-test-register": "^8.0.1",
"typescript": "^3.8.2"
"ts-node": "^9.1.1",
"ts-node-test-register": "^9.0.1",
"typescript": "^4.2.4"
},

@@ -71,3 +71,3 @@ "publishConfig": {

},
"gitHead": "ee794cdf7b9aa5f2ec756e361d269b24b6e40070"
"gitHead": "64bf33d6ee6e31a8416bf2bde6ee27a700955fb1"
}

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

SecretLintCoreDescriptorUnionRule,
SecretLintUnionRuleCreator
SecretLintUnionRuleCreator,
} from "@secretlint/types";

@@ -101,19 +101,19 @@ import { secretLintProfiler } from "@secretlint/profiler";

ok: false,
errors: [resultValidateRawConfig.error]
errors: [resultValidateRawConfig.error],
};
}
secretLintProfiler.mark({
type: "@config-loader>resolve-modules::start"
type: "@config-loader>resolve-modules::start",
});
// Search secretlint's module
const moduleResolver = new SecretLintModuleResolver({
baseDirectory: options.node_moduleDir
baseDirectory: options.node_moduleDir,
});
const errors: Error[] = [];
const rules: SecretLintCoreDescriptorUnionRule[] = [];
options.rawConfig.rules.forEach(configDescriptorRule => {
options.rawConfig.rules.forEach((configDescriptorRule) => {
try {
secretLintProfiler.mark({
type: "@config-loader>resolve-module::start",
id: configDescriptorRule.id
id: configDescriptorRule.id,
});

@@ -131,3 +131,5 @@ const replacedDefinition =

"rules" in configDescriptorRule && Array.isArray(configDescriptorRule.rules)
? (configDescriptorRule.rules.filter(rule => rule !== undefined) as SecretLintCoreDescriptorRule[])
? (configDescriptorRule.rules.filter(
(rule) => rule !== undefined
) as SecretLintCoreDescriptorRule[])
: undefined;

@@ -142,7 +144,7 @@ rules.push({

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

@@ -154,3 +156,3 @@ } catch (error) {

secretLintProfiler.mark({
type: "@config-loader>resolve-modules::end"
type: "@config-loader>resolve-modules::end",
});

@@ -160,3 +162,3 @@ if (errors.length > 0) {

ok: false,
errors
errors,
};

@@ -166,3 +168,3 @@ }

sharedOptions: options.rawConfig.sharedOptions,
rules
rules,
};

@@ -175,3 +177,3 @@ // Finally, validate loadedConfig with validator

ok: false,
errors: [resultValidateConfig.error]
errors: [resultValidateConfig.error],
};

@@ -181,3 +183,3 @@ }

ok: true,
config: loadedConfig
config: loadedConfig,
};

@@ -191,7 +193,7 @@ };

secretLintProfiler.mark({
type: "@config-loader>load-config-file::start"
type: "@config-loader>load-config-file::start",
});
const rawResult = loadRawConfig(options);
secretLintProfiler.mark({
type: "@config-loader>load-config-file::end"
type: "@config-loader>load-config-file::end",
});

@@ -201,7 +203,7 @@ if (!rawResult.ok) {

ok: false,
errors: rawResult.errors
errors: rawResult.errors,
};
}
secretLintProfiler.mark({
type: "@config-loader>load-packages::start"
type: "@config-loader>load-packages::start",
});

@@ -211,6 +213,6 @@ const result = loadPackagesFromRawConfig({

node_moduleDir: options.node_moduleDir,
testReplaceDefinitions: options.testReplaceDefinitions
testReplaceDefinitions: options.testReplaceDefinitions,
});
secretLintProfiler.mark({
type: "@config-loader>load-packages::end"
type: "@config-loader>load-packages::end",
});

@@ -221,3 +223,3 @@ if (!result.ok) {

configFilePath: rawResult.configFilePath,
errors: result.errors
errors: result.errors,
};

@@ -228,3 +230,3 @@ }

config: result.config,
configFilePath: rawResult.configFilePath
configFilePath: rawResult.configFilePath,
};

@@ -243,4 +245,4 @@ };

packageJSON: {
fieldName: "secretlint"
}
fieldName: "secretlint",
},
});

@@ -255,4 +257,4 @@ // Not Found

Secrelint require .secretlintrc config file.
The config file define the use of rules.`)
]
The config file define the use of rules.`),
],
};

@@ -263,3 +265,3 @@ }

rawConfig: results.config,
configFilePath: results.filePath
configFilePath: results.filePath,
};

@@ -269,5 +271,5 @@ } catch (error) {

ok: false,
errors: [error]
errors: [error],
};
}
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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