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

@textlint-rule/textlint-rule-no-unmatched-pair

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textlint-rule/textlint-rule-no-unmatched-pair - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

10

lib/textlint-rule-no-unmatched-pair.js

@@ -9,2 +9,4 @@ "use strict";

var _textlintRuleHelper = require("textlint-rule-helper");
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

@@ -16,4 +18,6 @@

RuleError = context.RuleError;
var ignoreNodeManager = new _textlintRuleHelper.IgnoreNodeManager();
return _defineProperty({}, Syntax.Paragraph, function (node) {
var sentences = (0, _sentenceSplitter.splitAST)(node);
ignoreNodeManager.ignoreChildrenByTypes(node, [Syntax.CodeBlock, Syntax.Code, Syntax.Link, Syntax.Strong, Syntax.Emphasis, Syntax.BlockQuote, Syntax.Comment]);
sentences.children.filter(function (node) {

@@ -32,2 +36,6 @@ return node.type === _sentenceSplitter.Syntax.Sentence;

source.contextLocations.forEach(function (contextLocation) {
if (ignoreNodeManager.isIgnoredIndex(node.range[0] + contextLocation.index)) {
return;
}
report(node, new RuleError("Not found pair character for ".concat(contextLocation.pairMark.start, ".\n \nYou should close this sentence with ").concat(contextLocation.pairMark.end, ".\nThis pair mark is called ").concat(contextLocation.pairMark.key, "."), {

@@ -37,4 +45,2 @@ index: contextLocation.index

});
if (source.contextLocations.length > 0) {}
});

@@ -41,0 +47,0 @@ });

{
"name": "@textlint-rule/textlint-rule-no-unmatched-pair",
"version": "1.0.1",
"version": "1.0.2",
"description": "textlint rule that check unmatched pairs like \"(\" and \")\"",

@@ -61,4 +61,5 @@ "keywords": [

"dependencies": {
"sentence-splitter": "^3.0.11"
"sentence-splitter": "^3.0.11",
"textlint-rule-helper": "^2.0.0"
}
}

17

src/textlint-rule-no-unmatched-pair.js

@@ -5,8 +5,19 @@ // MIT © 2018 azu

import { SourceCode } from "./parser/SourceCode.js";
import { IgnoreNodeManager } from "textlint-rule-helper";
const report = context => {
const { Syntax, report, RuleError } = context;
const ignoreNodeManager = new IgnoreNodeManager();
return {
[Syntax.Paragraph](node) {
const sentences = splitAST(node);
ignoreNodeManager.ignoreChildrenByTypes(node, [
Syntax.CodeBlock,
Syntax.Code,
Syntax.Link,
Syntax.Strong,
Syntax.Emphasis,
Syntax.BlockQuote,
Syntax.Comment
]);
sentences.children.filter(node => node.type === SentenceSyntax.Sentence).forEach(sentence => {

@@ -21,2 +32,5 @@ const source = new SourceCode(sentence.raw);

source.contextLocations.forEach((contextLocation) => {
if (ignoreNodeManager.isIgnoredIndex(node.range[0] + contextLocation.index)) {
return;
}
report(node, new RuleError(`Not found pair character for ${contextLocation.pairMark.start}.

@@ -29,5 +43,2 @@

});
if (source.contextLocations.length > 0) {
}
});

@@ -34,0 +45,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