@secretlint/core
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -6,2 +6,3 @@ // MIT © 2017 azu | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PromiseEventEmitter = void 0; | ||
const events_1 = require("events"); | ||
@@ -21,3 +22,3 @@ class PromiseEventEmitter { | ||
const promises = []; | ||
this.events.listeners(event).forEach(listener => { | ||
this.events.listeners(event).forEach((listener) => { | ||
promises.push(listener(...args)); | ||
@@ -24,0 +25,0 @@ }); |
@@ -1,4 +0,4 @@ | ||
import { SecretLintRuleLocalizeMessages, SecretLintRuleMessageTranslateResult } from "@secretlint/types"; | ||
import { SecretLintRuleLocaleTag, SecretLintRuleLocalizeMessages, SecretLintRuleMessageTranslateResult } from "@secretlint/types"; | ||
export declare const createTranslator: <T extends SecretLintRuleLocalizeMessages>(messages: T, options: { | ||
defaultLocale: string; | ||
defaultLocale: SecretLintRuleLocaleTag; | ||
}) => <MessageId extends keyof T, Props = T[MessageId]>(messageId: MessageId, props?: Props | undefined) => SecretLintRuleMessageTranslateResult<Props>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createTranslator = void 0; | ||
/** | ||
@@ -34,3 +35,3 @@ * Default locale that is also fallback locale. | ||
}; | ||
exports.createTranslator = (messages, options) => { | ||
const createTranslator = (messages, options) => { | ||
return (messageId, props) => { | ||
@@ -72,2 +73,3 @@ const messageHandler = messages[messageId]; | ||
}; | ||
exports.createTranslator = createTranslator; | ||
//# sourceMappingURL=SecretLintRuleMessageTranslator.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.lintSource = void 0; | ||
const SecretLintSourceCodeImpl_1 = require("./SecretLintSourceCodeImpl"); | ||
@@ -10,7 +11,7 @@ const RuleContext_1 = require("./RuleContext"); | ||
const debug = require("debug")("@secretlint/core"); | ||
exports.lintSource = ({ source, options }) => { | ||
const lintSource = ({ source, options }) => { | ||
var _a; | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@core>lint::start", | ||
id: source.filePath | ||
id: source.filePath, | ||
}); | ||
@@ -26,6 +27,6 @@ debug(`source filePath: %O`, source.filePath); | ||
// setup | ||
contextEvents.onReport(message => { | ||
contextEvents.onReport((message) => { | ||
reportedMessages.push(message); | ||
}); | ||
contextEvents.onIgnore(message => { | ||
contextEvents.onIgnore((message) => { | ||
ignoredMessages.push(message); | ||
@@ -38,11 +39,11 @@ }); | ||
ext: source.ext || "", | ||
contentType: source.contentType | ||
contentType: source.contentType, | ||
}); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@core>setup-rules::start" | ||
type: "@core>setup-rules::start", | ||
}); | ||
rules.forEach(rule => { | ||
rules.forEach((rule) => { | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@core>setup-rule::start", | ||
id: rule.rule.meta.id | ||
id: rule.rule.meta.id, | ||
}); | ||
@@ -55,11 +56,11 @@ registerRule({ | ||
runningEvents, | ||
locale | ||
locale, | ||
}); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@core>setup-rule::end", | ||
id: rule.rule.meta.id | ||
id: rule.rule.meta.id, | ||
}); | ||
}); | ||
profiler_1.secretLintProfiler.mark({ | ||
type: "@core>setup-rules::end" | ||
type: "@core>setup-rules::end", | ||
}); | ||
@@ -69,3 +70,3 @@ // start to run | ||
.runLint({ | ||
sourceCode | ||
sourceCode, | ||
}) | ||
@@ -78,4 +79,4 @@ .then(() => { | ||
ignoredMessages, | ||
allowMessageIds: runningEvents.collectAllowMessageIds() | ||
}) | ||
allowMessageIds: runningEvents.collectAllowMessageIds(), | ||
}), | ||
}; | ||
@@ -86,6 +87,7 @@ }) | ||
type: "@core>lint::end", | ||
id: source.filePath | ||
id: source.filePath, | ||
}); | ||
}); | ||
}; | ||
exports.lintSource = lintSource; | ||
const isRulePreset = (ruleDescriptor) => { | ||
@@ -100,3 +102,3 @@ return ruleDescriptor.rule.meta.type === "preset"; | ||
*/ | ||
const registerRule = ({ sourceCode, config, descriptorRule, contextEvents, runningEvents, locale }) => { | ||
const registerRule = ({ sourceCode, config, descriptorRule, contextEvents, runningEvents, locale, }) => { | ||
var _a; | ||
@@ -121,7 +123,7 @@ const ruleId = descriptorRule.id; | ||
sharedOptions: sharedOptionsWithDefault, | ||
locale: locale | ||
locale: locale, | ||
}); | ||
runningEvents.registerRulePreset({ | ||
descriptorRulePreset: descriptorRule, | ||
context | ||
context, | ||
}); | ||
@@ -138,7 +140,7 @@ return; | ||
sharedOptions: sharedOptionsWithDefault, | ||
locale: locale | ||
locale: locale, | ||
}); | ||
runningEvents.registerRule({ | ||
descriptorRule: descriptorRule, | ||
context | ||
context, | ||
}); | ||
@@ -145,0 +147,0 @@ return; |
// LICENSE : MIT | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.filterDuplicatedMessages = void 0; | ||
/** | ||
@@ -21,3 +22,3 @@ * equal message | ||
const restMessages = messages.slice(index + 1); | ||
return !restMessages.some(restMessage => { | ||
return !restMessages.some((restMessage) => { | ||
return isEqualMessage(message, restMessage); | ||
@@ -24,0 +25,0 @@ }); |
// LICENSE : MIT | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.filterIgnoredMessages = void 0; | ||
/** | ||
@@ -21,4 +22,4 @@ * the `index` is in the `range` and return true. | ||
// if match, reject the message | ||
return reportedMessages.filter(message => { | ||
return !ignoreMessages.some(ignoreMessage => { | ||
return reportedMessages.filter((message) => { | ||
return !ignoreMessages.some((ignoreMessage) => { | ||
const isInIgnoringRange = isContainedRange(message.range[0], ignoreMessage.range) && | ||
@@ -25,0 +26,0 @@ isContainedRange(message.range[1], ignoreMessage.range); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.filterByAllowMessageIds = (messages, allowMessageIds) => { | ||
const disabledSet = new Set(allowMessageIds.map(allowMessage => { | ||
exports.filterByAllowMessageIds = void 0; | ||
const filterByAllowMessageIds = (messages, allowMessageIds) => { | ||
const disabledSet = new Set(allowMessageIds.map((allowMessage) => { | ||
return `${allowMessage.ruleId}--${allowMessage.messageId}`; | ||
})); | ||
return messages.filter(message => { | ||
return messages.filter((message) => { | ||
return !disabledSet.has(`${message.ruleId}--${message.messageId}`); | ||
}); | ||
}; | ||
exports.filterByAllowMessageIds = filterByAllowMessageIds; | ||
//# sourceMappingURL=filter-message-id.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.cleanupMessages = void 0; | ||
const filter_ignored_process_1 = require("./filter-ignored-process"); | ||
@@ -16,3 +17,3 @@ const MessageProcessManager_1 = require("./MessageProcessManager"); | ||
*/ | ||
exports.cleanupMessages = (options) => { | ||
const cleanupMessages = (options) => { | ||
const reportedMessages = filter_ignored_process_1.filterIgnoredMessages(options); | ||
@@ -23,2 +24,3 @@ const reportedMessagesWithoutAllowMessageIds = filter_message_id_1.filterByAllowMessageIds(reportedMessages, options.allowMessageIds); | ||
}; | ||
exports.cleanupMessages = cleanupMessages; | ||
//# sourceMappingURL=index.js.map |
@@ -8,3 +8,3 @@ import { SecretLintCoreResultMessage, SecretLintCoreIgnoreMessage } from "@secretlint/types"; | ||
*/ | ||
process<R extends SecretLintAllMessages>(messages: SecretLintAllMessages[]): R[]; | ||
process<R extends SecretLintAllMessages>(messages: Array<SecretLintAllMessages>): R[]; | ||
}; |
// LICENSE : MIT | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createMessageProcessor = (processors) => { | ||
exports.createMessageProcessor = void 0; | ||
const createMessageProcessor = (processors) => { | ||
return { | ||
@@ -17,5 +18,6 @@ /** | ||
}, originalMessages); | ||
} | ||
}, | ||
}; | ||
}; | ||
exports.createMessageProcessor = createMessageProcessor; | ||
//# sourceMappingURL=MessageProcessManager.js.map |
// LICENSE : MIT | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sortMessagesByLocation = void 0; | ||
/** | ||
@@ -5,0 +6,0 @@ * sort messages by line and column |
@@ -23,3 +23,3 @@ import { SecretLintCoreIgnoreMessage, SecretLintCoreResultMessage, SecretlintCoreSharedOptions, SecretLintRuleContext, SecretLintRuleCreator, SecretLintRuleLocaleTag, SecretLintRuleSeverityLevel, SecretLintSourceCode } from "@secretlint/types"; | ||
}; | ||
export declare const createRuleContext: ({ ruleId, ruleParentId, meta, severity, sourceCode, contextEvents, sharedOptions, locale }: CreateRuleContextOptions) => SecretLintRuleContext; | ||
export declare const createRuleContext: ({ ruleId, ruleParentId, meta, severity, sourceCode, contextEvents, sharedOptions, locale, }: CreateRuleContextOptions) => SecretLintRuleContext; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRuleContext = exports.createContextEvents = void 0; | ||
const events_1 = require("events"); | ||
const SecretLintRuleMessageTranslator_1 = require("./helper/SecretLintRuleMessageTranslator"); | ||
exports.createContextEvents = () => { | ||
const createContextEvents = () => { | ||
const contextEvents = new events_1.EventEmitter(); | ||
@@ -33,6 +34,7 @@ const REPORT_SYMBOL = Symbol("report"); | ||
}; | ||
} | ||
}, | ||
}; | ||
}; | ||
exports.createRuleContext = ({ ruleId, ruleParentId, meta, severity, sourceCode, contextEvents, sharedOptions, locale }) => { | ||
exports.createContextEvents = createContextEvents; | ||
const createRuleContext = ({ ruleId, ruleParentId, meta, severity, sourceCode, contextEvents, sharedOptions, locale, }) => { | ||
return { | ||
@@ -42,3 +44,3 @@ sharedOptions: sharedOptions, | ||
return SecretLintRuleMessageTranslator_1.createTranslator(messages, { | ||
defaultLocale: locale | ||
defaultLocale: locale, | ||
}); | ||
@@ -54,3 +56,3 @@ }, | ||
loc: sourceCode.rangeToLocation(descriptor.range), | ||
message: message | ||
message: message, | ||
}); | ||
@@ -71,5 +73,6 @@ }, | ||
} | ||
} | ||
}, | ||
}; | ||
}; | ||
exports.createRuleContext = createRuleContext; | ||
//# sourceMappingURL=RuleContext.js.map |
@@ -1,2 +0,2 @@ | ||
import { SecretLintCoreDescriptorRulePreset, SecretlintCoreSharedOptions, SecretLintRulePresetContext, SecretLintSourceCode } from "@secretlint/types"; | ||
import { SecretLintCoreDescriptorRulePreset, SecretlintCoreSharedOptions, SecretLintRuleLocaleTag, SecretLintRulePresetContext, SecretLintSourceCode } from "@secretlint/types"; | ||
import { RunningEvents } from "./RunningEvents"; | ||
@@ -7,4 +7,4 @@ import { ContextEvents } from "./RuleContext"; | ||
*/ | ||
export declare const createRulePresetContext: ({ descriptorRulePreset, sourceCode, runningEvents, contextEvents, sharedOptions, locale }: { | ||
descriptorRulePreset: SecretLintCoreDescriptorRulePreset<import("@secretlint/types").SecretLintRulePresetCreatorOptions>; | ||
export declare const createRulePresetContext: ({ descriptorRulePreset, sourceCode, runningEvents, contextEvents, sharedOptions, locale, }: { | ||
descriptorRulePreset: SecretLintCoreDescriptorRulePreset; | ||
sourceCode: SecretLintSourceCode; | ||
@@ -14,3 +14,3 @@ contextEvents: ContextEvents; | ||
sharedOptions: SecretlintCoreSharedOptions; | ||
locale: string; | ||
locale: SecretLintRuleLocaleTag; | ||
}) => SecretLintRulePresetContext; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRulePresetContext = void 0; | ||
const RuleContext_1 = require("./RuleContext"); | ||
@@ -7,3 +8,3 @@ /** | ||
*/ | ||
exports.createRulePresetContext = ({ descriptorRulePreset, sourceCode, runningEvents, contextEvents, sharedOptions, locale }) => { | ||
const createRulePresetContext = ({ descriptorRulePreset, sourceCode, runningEvents, contextEvents, sharedOptions, locale, }) => { | ||
const presetRules = descriptorRulePreset.rules || []; | ||
@@ -17,3 +18,3 @@ if (!Array.isArray(presetRules)) { | ||
registerRule(rule, defaultValue) { | ||
const descriptorRule = presetRules.find(descriptorRule => { | ||
const descriptorRule = presetRules.find((descriptorRule) => { | ||
return descriptorRule.id === rule.meta.id; | ||
@@ -37,3 +38,3 @@ }); | ||
sharedOptions: sharedOptions, | ||
locale | ||
locale, | ||
}); | ||
@@ -43,7 +44,8 @@ const defaultValueOfPreset = defaultValue ? defaultValue : {}; | ||
descriptorRule: Object.assign(Object.assign(Object.assign({}, defaultValueOfPreset), descriptorRule), { id: rule.meta.id, options: descriptorRuleOptions, rule, disabled: descriptorRuleDisabled, allowMessageIds: descriptorAllowMessageIds, severity: descriptorRuleSeverity }), | ||
context | ||
context, | ||
}); | ||
} | ||
}, | ||
}; | ||
}; | ||
exports.createRulePresetContext = createRulePresetContext; | ||
//# sourceMappingURL=RulePresetContext.js.map |
@@ -11,7 +11,7 @@ import { SecretLintCoreDescriptorRule, SecretLintCoreDescriptorRulePreset, SecretLintRuleContext, SecretLintRulePresetContext, SecretLintSourceCode } from "@secretlint/types"; | ||
*/ | ||
registerRule({ descriptorRule, context }: { | ||
registerRule({ descriptorRule, context, }: { | ||
descriptorRule: SecretLintCoreDescriptorRule; | ||
context: SecretLintRuleContext; | ||
}): void; | ||
registerRulePreset({ descriptorRulePreset, context }: { | ||
registerRulePreset({ descriptorRulePreset, context, }: { | ||
descriptorRulePreset: SecretLintCoreDescriptorRulePreset; | ||
@@ -18,0 +18,0 @@ context: SecretLintRulePresetContext; |
@@ -12,6 +12,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createRunningEvents = void 0; | ||
const promise_event_emitter_1 = require("./helper/promise-event-emitter"); | ||
const SecretLintRuleImpl_1 = require("./SecretLintRuleImpl"); | ||
const profiler_1 = require("@secretlint/profiler"); | ||
exports.createRunningEvents = () => { | ||
const createRunningEvents = () => { | ||
const contextEvents = new promise_event_emitter_1.PromiseEventEmitter(); | ||
@@ -24,3 +25,3 @@ const registerSet = new Set(); | ||
const allowMessageIds = []; | ||
rules.forEach(rule => { | ||
rules.forEach((rule) => { | ||
allowMessageIds.push(...rule.allowMessageIds()); | ||
@@ -37,3 +38,3 @@ }); | ||
}, | ||
registerRule({ descriptorRule, context }) { | ||
registerRule({ descriptorRule, context, }) { | ||
if (registerSet.has(descriptorRule.id)) { | ||
@@ -49,3 +50,3 @@ // TODO: more trivial implementation | ||
descriptorRule: descriptorRule, | ||
context | ||
context, | ||
}); | ||
@@ -59,3 +60,3 @@ rules.push(rule); | ||
type: "@core>rule-handler::start", | ||
id: descriptorRule.rule.meta.id | ||
id: descriptorRule.rule.meta.id, | ||
}); | ||
@@ -68,7 +69,7 @@ // if this rule support the content type | ||
type: "@core>rule-handler::end", | ||
id: descriptorRule.rule.meta.id | ||
id: descriptorRule.rule.meta.id, | ||
}); | ||
})); | ||
}, | ||
registerRulePreset({ descriptorRulePreset, context }) { | ||
registerRulePreset({ descriptorRulePreset, context, }) { | ||
// Normalized Rule Preset Options | ||
@@ -81,5 +82,6 @@ const rulePresetCreatorOptions = descriptorRulePreset.options || []; | ||
return registerSet.has(ruleId); | ||
} | ||
}, | ||
}; | ||
}; | ||
exports.createRunningEvents = createRunningEvents; | ||
//# sourceMappingURL=RunningEvents.js.map |
@@ -12,2 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SecretLintRule = void 0; | ||
class SecretLintRule { | ||
@@ -26,6 +27,6 @@ constructor({ descriptorRule, context }) { | ||
const ruleId = this.ruleCreator.meta.id; | ||
return this.descriptorRule.allowMessageIds.map(allowMessageId => { | ||
return this.descriptorRule.allowMessageIds.map((allowMessageId) => { | ||
return { | ||
messageId: allowMessageId, | ||
ruleId | ||
ruleId, | ||
}; | ||
@@ -32,0 +33,0 @@ }); |
@@ -12,3 +12,3 @@ import { SecretLintSourceCode, SecretLintSourceNodeLocation, SecretLintSourceNodePosition, SecretLintSourceNodeRange } from "@secretlint/types"; | ||
private structuredSource; | ||
constructor({ content, ext, filePath, contentType }: { | ||
constructor({ content, ext, filePath, contentType, }: { | ||
content: string; | ||
@@ -15,0 +15,0 @@ ext: string; |
"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; | ||
@@ -13,2 +25,3 @@ }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SecretLintSourceCodeImpl = void 0; | ||
const assert = __importStar(require("assert")); | ||
@@ -20,3 +33,3 @@ const structured_source_1 = __importDefault(require("structured-source")); | ||
class SecretLintSourceCodeImpl { | ||
constructor({ content = "", ext, filePath, contentType }) { | ||
constructor({ content = "", ext, filePath, contentType, }) { | ||
assert.ok(ext || filePath, "should be set either of fileExt or filePath."); | ||
@@ -54,8 +67,8 @@ this.hasBOM = content.charCodeAt(0) === 0xfeff; | ||
line: location.start.line, | ||
column: location.start.column | ||
column: location.start.column, | ||
}, | ||
end: { | ||
line: location.end.line, | ||
column: location.end.column | ||
} | ||
column: location.end.column, | ||
}, | ||
}; | ||
@@ -79,3 +92,3 @@ } | ||
line: position.line, | ||
column: position.column | ||
column: position.column, | ||
}; | ||
@@ -82,0 +95,0 @@ } |
{ | ||
"name": "@secretlint/core", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Core library for @secretlint.", | ||
@@ -43,4 +43,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@secretlint/profiler": "^2.1.1", | ||
"@secretlint/types": "^2.1.1", | ||
"@secretlint/profiler": "^2.2.0", | ||
"@secretlint/types": "^2.2.0", | ||
"debug": "^4.1.1", | ||
@@ -50,13 +50,13 @@ "structured-source": "^3.0.2" | ||
"devDependencies": { | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^13.9.3", | ||
"@types/mocha": "^8.2.2", | ||
"@types/node": "^14.14.41", | ||
"@types/structured-source": "^3.0.0", | ||
"assert-json-equal": "^1.0.1", | ||
"cross-env": "^7.0.0", | ||
"mocha": "^7.1.1", | ||
"prettier": "^2.0.2", | ||
"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" | ||
}, | ||
@@ -66,3 +66,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "ee794cdf7b9aa5f2ec756e361d269b24b6e40070" | ||
"gitHead": "64bf33d6ee6e31a8416bf2bde6ee27a700955fb1" | ||
} |
@@ -26,3 +26,3 @@ // MIT © 2017 azu | ||
this.events.listeners(event).forEach(listener => { | ||
this.events.listeners(event).forEach((listener) => { | ||
promises.push(listener(...args)); | ||
@@ -29,0 +29,0 @@ }); |
@@ -11,3 +11,3 @@ import { | ||
SecretLintRuleLocaleTag, | ||
SecretLintSourceCode | ||
SecretLintSourceCode, | ||
} from "@secretlint/types"; | ||
@@ -42,3 +42,3 @@ import { SecretLintSourceCodeImpl } from "./SecretLintSourceCodeImpl"; | ||
type: "@core>lint::start", | ||
id: source.filePath | ||
id: source.filePath, | ||
}); | ||
@@ -54,6 +54,6 @@ debug(`source filePath: %O`, source.filePath); | ||
// setup | ||
contextEvents.onReport(message => { | ||
contextEvents.onReport((message) => { | ||
reportedMessages.push(message); | ||
}); | ||
contextEvents.onIgnore(message => { | ||
contextEvents.onIgnore((message) => { | ||
ignoredMessages.push(message); | ||
@@ -66,11 +66,11 @@ }); | ||
ext: source.ext || "", | ||
contentType: source.contentType | ||
contentType: source.contentType, | ||
}); | ||
secretLintProfiler.mark({ | ||
type: "@core>setup-rules::start" | ||
type: "@core>setup-rules::start", | ||
}); | ||
rules.forEach(rule => { | ||
rules.forEach((rule) => { | ||
secretLintProfiler.mark({ | ||
type: "@core>setup-rule::start", | ||
id: rule.rule.meta.id | ||
id: rule.rule.meta.id, | ||
}); | ||
@@ -83,11 +83,11 @@ registerRule({ | ||
runningEvents, | ||
locale | ||
locale, | ||
}); | ||
secretLintProfiler.mark({ | ||
type: "@core>setup-rule::end", | ||
id: rule.rule.meta.id | ||
id: rule.rule.meta.id, | ||
}); | ||
}); | ||
secretLintProfiler.mark({ | ||
type: "@core>setup-rules::end" | ||
type: "@core>setup-rules::end", | ||
}); | ||
@@ -97,3 +97,3 @@ // start to run | ||
.runLint({ | ||
sourceCode | ||
sourceCode, | ||
}) | ||
@@ -106,4 +106,4 @@ .then(() => { | ||
ignoredMessages, | ||
allowMessageIds: runningEvents.collectAllowMessageIds() | ||
}) | ||
allowMessageIds: runningEvents.collectAllowMessageIds(), | ||
}), | ||
}; | ||
@@ -114,3 +114,3 @@ }) | ||
type: "@core>lint::end", | ||
id: source.filePath | ||
id: source.filePath, | ||
}); | ||
@@ -138,3 +138,3 @@ }); | ||
runningEvents, | ||
locale | ||
locale, | ||
}: { | ||
@@ -166,7 +166,7 @@ sourceCode: SecretLintSourceCode; | ||
sharedOptions: sharedOptionsWithDefault, | ||
locale: locale | ||
locale: locale, | ||
}); | ||
runningEvents.registerRulePreset({ | ||
descriptorRulePreset: descriptorRule, | ||
context | ||
context, | ||
}); | ||
@@ -182,7 +182,7 @@ return; | ||
sharedOptions: sharedOptionsWithDefault, | ||
locale: locale | ||
locale: locale, | ||
}); | ||
runningEvents.registerRule({ | ||
descriptorRule: descriptorRule, | ||
context | ||
context, | ||
}); | ||
@@ -189,0 +189,0 @@ return; |
@@ -25,3 +25,3 @@ // LICENSE : MIT | ||
const restMessages = messages.slice(index + 1); | ||
return !restMessages.some(restMessage => { | ||
return !restMessages.some((restMessage) => { | ||
return isEqualMessage(message, restMessage); | ||
@@ -28,0 +28,0 @@ }); |
@@ -29,4 +29,4 @@ // LICENSE : MIT | ||
// if match, reject the message | ||
return reportedMessages.filter(message => { | ||
return !ignoreMessages.some(ignoreMessage => { | ||
return reportedMessages.filter((message) => { | ||
return !ignoreMessages.some((ignoreMessage) => { | ||
const isInIgnoringRange = | ||
@@ -33,0 +33,0 @@ isContainedRange(message.range[0], ignoreMessage.range) && |
@@ -12,9 +12,9 @@ import { SecretLintCoreResultMessage } from "@secretlint/types"; | ||
const disabledSet = new Set( | ||
allowMessageIds.map(allowMessage => { | ||
allowMessageIds.map((allowMessage) => { | ||
return `${allowMessage.ruleId}--${allowMessage.messageId}`; | ||
}) | ||
); | ||
return messages.filter(message => { | ||
return messages.filter((message) => { | ||
return !disabledSet.has(`${message.ruleId}--${message.messageId}`); | ||
}); | ||
}; |
@@ -21,4 +21,4 @@ // LICENSE : MIT | ||
}, originalMessages) as R[]; | ||
} | ||
}, | ||
}; | ||
}; |
@@ -10,3 +10,3 @@ // LICENSE : MIT | ||
// sort by line and column | ||
return messages.sort(function(a, b) { | ||
return messages.sort(function (a, b) { | ||
const startIndexDiff = a.range[0] - b.range[0]; | ||
@@ -13,0 +13,0 @@ if (startIndexDiff === 0) { |
@@ -13,3 +13,3 @@ import { EventEmitter } from "events"; | ||
SecretLintRuleSeverityLevel, | ||
SecretLintSourceCode | ||
SecretLintSourceCode, | ||
} from "@secretlint/types"; | ||
@@ -53,3 +53,3 @@ import { createTranslator } from "./helper/SecretLintRuleMessageTranslator"; | ||
}; | ||
} | ||
}, | ||
}; | ||
@@ -79,3 +79,3 @@ }; | ||
sharedOptions, | ||
locale | ||
locale, | ||
}: CreateRuleContextOptions): SecretLintRuleContext => { | ||
@@ -86,3 +86,3 @@ return { | ||
return createTranslator(messages, { | ||
defaultLocale: locale | ||
defaultLocale: locale, | ||
}); | ||
@@ -98,3 +98,3 @@ }, | ||
loc: sourceCode.rangeToLocation(descriptor.range), | ||
message: message | ||
message: message, | ||
}); | ||
@@ -116,3 +116,3 @@ }, | ||
docsUrl: meta.docs?.url ? `${meta.docs.url}#${messageId}` : undefined, | ||
data | ||
data, | ||
}); | ||
@@ -128,7 +128,7 @@ } else { | ||
docsUrl: meta.docs?.url ? `${meta.docs.url}#${messageId}` : undefined, | ||
data | ||
data, | ||
}); | ||
} | ||
} | ||
}, | ||
}; | ||
}; |
@@ -9,3 +9,3 @@ import { | ||
SecretLintRulePresetContext, | ||
SecretLintSourceCode | ||
SecretLintSourceCode, | ||
} from "@secretlint/types"; | ||
@@ -24,3 +24,3 @@ import { RunningEvents } from "./RunningEvents"; | ||
sharedOptions, | ||
locale | ||
locale, | ||
}: { | ||
@@ -45,3 +45,3 @@ descriptorRulePreset: SecretLintCoreDescriptorRulePreset; | ||
): void { | ||
const descriptorRule = presetRules.find(descriptorRule => { | ||
const descriptorRule = presetRules.find((descriptorRule) => { | ||
return descriptorRule.id === rule.meta.id; | ||
@@ -65,3 +65,3 @@ }); | ||
sharedOptions: sharedOptions, | ||
locale | ||
locale, | ||
}); | ||
@@ -81,8 +81,8 @@ const defaultValueOfPreset = defaultValue ? defaultValue : {}; | ||
allowMessageIds: descriptorAllowMessageIds, | ||
severity: descriptorRuleSeverity | ||
severity: descriptorRuleSeverity, | ||
}, | ||
context | ||
context, | ||
}); | ||
} | ||
}, | ||
}; | ||
}; |
@@ -6,3 +6,3 @@ import { | ||
SecretLintRulePresetContext, | ||
SecretLintSourceCode | ||
SecretLintSourceCode, | ||
} from "@secretlint/types"; | ||
@@ -24,3 +24,3 @@ import { PromiseEventEmitter } from "./helper/promise-event-emitter"; | ||
descriptorRule, | ||
context | ||
context, | ||
}: { | ||
@@ -32,3 +32,3 @@ descriptorRule: SecretLintCoreDescriptorRule; | ||
descriptorRulePreset, | ||
context | ||
context, | ||
}: { | ||
@@ -49,3 +49,3 @@ descriptorRulePreset: SecretLintCoreDescriptorRulePreset; | ||
const allowMessageIds: AllowMessage[] = []; | ||
rules.forEach(rule => { | ||
rules.forEach((rule) => { | ||
allowMessageIds.push(...rule.allowMessageIds()); | ||
@@ -64,3 +64,3 @@ }); | ||
descriptorRule, | ||
context | ||
context, | ||
}: { | ||
@@ -80,3 +80,3 @@ descriptorRule: SecretLintCoreDescriptorRule; | ||
descriptorRule: descriptorRule, | ||
context | ||
context, | ||
}); | ||
@@ -90,3 +90,3 @@ rules.push(rule); | ||
type: "@core>rule-handler::start", | ||
id: descriptorRule.rule.meta.id | ||
id: descriptorRule.rule.meta.id, | ||
}); | ||
@@ -99,3 +99,3 @@ // if this rule support the content type | ||
type: "@core>rule-handler::end", | ||
id: descriptorRule.rule.meta.id | ||
id: descriptorRule.rule.meta.id, | ||
}); | ||
@@ -106,3 +106,3 @@ }); | ||
descriptorRulePreset, | ||
context | ||
context, | ||
}: { | ||
@@ -119,4 +119,4 @@ descriptorRulePreset: SecretLintCoreDescriptorRulePreset; | ||
return registerSet.has(ruleId); | ||
} | ||
}, | ||
}; | ||
}; |
@@ -6,3 +6,3 @@ import { | ||
SecretLintRuleReportHandler, | ||
SecretLintSourceCode | ||
SecretLintSourceCode, | ||
} from "@secretlint/types"; | ||
@@ -34,6 +34,6 @@ import { AllowMessage } from "./messages/filter-message-id"; | ||
const ruleId = this.ruleCreator.meta.id; | ||
return this.descriptorRule.allowMessageIds.map(allowMessageId => { | ||
return this.descriptorRule.allowMessageIds.map((allowMessageId) => { | ||
return { | ||
messageId: allowMessageId, | ||
ruleId | ||
ruleId, | ||
}; | ||
@@ -40,0 +40,0 @@ }); |
@@ -7,3 +7,3 @@ import * as assert from "assert"; | ||
SecretLintSourceNodePosition, | ||
SecretLintSourceNodeRange | ||
SecretLintSourceNodeRange, | ||
} from "@secretlint/types"; | ||
@@ -26,3 +26,3 @@ | ||
filePath, | ||
contentType | ||
contentType, | ||
}: { | ||
@@ -69,8 +69,8 @@ content: string; | ||
line: location.start.line, | ||
column: location.start.column | ||
column: location.start.column, | ||
}, | ||
end: { | ||
line: location.end.line, | ||
column: location.end.column | ||
} | ||
column: location.end.column, | ||
}, | ||
}; | ||
@@ -96,5 +96,5 @@ } | ||
line: position.line, | ||
column: position.column | ||
column: position.column, | ||
}; | ||
} | ||
} |
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1835
93383
59
Updated@secretlint/profiler@^2.2.0
Updated@secretlint/types@^2.2.0