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

@textlint/kernel

Package Overview
Dependencies
Maintainers
3
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textlint/kernel - npm Package Compare versions

Comparing version 3.1.3 to 3.1.4

lib/node_modules/@textlint/kernel/src/core/source-location.d.ts

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

<a name="3.1.4"></a>
## [3.1.4](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.3...@textlint/kernel@3.1.4) (2019-02-10)
### Bug Fixes
* **textlint:** fix regression for ignoreReport ([8d1c195](https://github.com/textlint/textlint/commit/8d1c195)), closes [#586](https://github.com/textlint/textlint/issues/586) [#586](https://github.com/textlint/textlint/issues/586)
<a name="3.1.3"></a>

@@ -8,0 +20,0 @@ ## [3.1.3](https://github.com/textlint/textlint/compare/@textlint/kernel@3.1.2...@textlint/kernel@3.1.3) (2019-02-10)

import { IgnoreReportedMessage, LintReportedMessage } from "../task/textlint-core-task";
/**
* split "preset/rule" string to {preset, rule}
*/
export declare const splitKeyToPresetSubRule: (name: string) => {
preset: string | null;
rule: string;
};
/**
* normalize `keyPath` that is specific path for rule
* This normalize function handle ambiguity `key`
* `keyPath` is one of "preset/rule` key, or "rule" key
* @param keyPath
*/
export declare const normalizeKeyPath: (keyPath: string) => string;
export declare const normalizeRuleKey: (name: string) => string;
export declare const normalizeRulePresetKey: (name: string) => string;
/**
* Remove `prefix` from `text`.
*/
export declare const removePrefixFromPackageName: (prefixList: string[], packageName: string) => string;
/**
* filter messages by ignore messages

@@ -4,0 +24,0 @@ * @param {Object[]} messages

73

lib/kernel/src/messages/filter-ignored-process.js

@@ -15,3 +15,74 @@ // LICENSE : MIT

};
// TODO: share code
// @org/preset/@org/rule
var patternOrgXOrg = /^(@.*?\/.*?)\/(@.*?\/.*?)$/;
// @org/preset/rule
var patternOrgXRule = /^(@.*?\/.*?)\/(.*?)$/;
// preset/@org/rule
var patternPresetXOrg = /^(.*?)\/(@.*?)$/;
// preset/rule
var patternPresetXRule = /^([^@].*?)\/(.*?)$/;
/**
* split "preset/rule" string to {preset, rule}
*/
exports.splitKeyToPresetSubRule = function (name) {
var patternList = [patternOrgXOrg, patternOrgXRule, patternPresetXOrg, patternPresetXRule];
for (var i = 0; i < patternList.length; i++) {
var pattern = patternList[i];
var result = name.match(pattern);
if (!result) {
continue;
}
return { preset: result[1], rule: result[2] };
}
// Other case is a single rule
// @org/rule or rule
return {
preset: null,
rule: name
};
};
/**
* normalize `keyPath` that is specific path for rule
* This normalize function handle ambiguity `key`
* `keyPath` is one of "preset/rule` key, or "rule" key
* @param keyPath
*/
exports.normalizeKeyPath = function (keyPath) {
var _a = exports.splitKeyToPresetSubRule(keyPath), preset = _a.preset, rule = _a.rule;
if (!preset) {
return exports.normalizeRuleKey(rule);
}
return exports.normalizeRulePresetKey(preset) + "/" + exports.normalizeRuleKey(rule);
};
exports.normalizeRuleKey = function (name) {
return exports.removePrefixFromPackageName(["textlint-rule-"], name);
};
exports.normalizeRulePresetKey = function (name) {
return exports.removePrefixFromPackageName(["textlint-rule-preset-", "preset-"], name);
};
/**
* Remove `prefix` from `text`.
*/
exports.removePrefixFromPackageName = function (prefixList, packageName) {
for (var i = 0; i < prefixList.length; i++) {
var prefix = prefixList[i];
// @scope/name -> @scope/name
// @scope/textlint-rule-name -> @scope/name
if (packageName.charAt(0) === "@") {
var _a = packageName.split("/"), namespace = _a[0], name_1 = _a[1];
if (name_1.startsWith(prefix)) {
return namespace + "/" + name_1.slice(prefix.length);
}
}
// name -> name
// textlint-rule-name -> name
else if (packageName.startsWith(prefix)) {
return packageName.slice(prefix.length);
}
}
// No match
return packageName;
};
/**
* filter messages by ignore messages

@@ -38,3 +109,3 @@ * @param {Object[]} messages

}
return message.ruleId === ignoreMessage.ignoringRuleId;
return message.ruleId === exports.normalizeKeyPath(ignoreMessage.ignoringRuleId);
}

@@ -41,0 +112,0 @@ return isInIgnoringRange;

4

package.json
{
"name": "@textlint/kernel",
"version": "3.1.3",
"version": "3.1.4",
"description": "textlint kernel is core logic by pure JavaScript.",

@@ -62,3 +62,3 @@ "keywords": [

},
"gitHead": "b9ec0303396b9ccdeb43fae7584b9339ca2d5e0c"
"gitHead": "f238ee1b529faef196230517c6d7f94efa587f76"
}

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