Skip to content

Commit d30fc81

Browse files
committed
fix(rule): correct punctuation regexp
1 parent c5c4776 commit d30fc81

File tree

5 files changed

+11
-311
lines changed

5 files changed

+11
-311
lines changed

src/max-ten.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function countTen(text) {
99
*/
1010
export default function (context) {
1111
var maxLen = 3;
12-
const punctuation = /./;
12+
const punctuation = /[.]/;
1313
let helper = new RuleHelper(context);
1414
let {Syntax, RuleError, report, getSource} = context;
1515
var currentParagraphText = "";

test/fixtures/README.md

Lines changed: 0 additions & 308 deletions
This file was deleted.

test/fixtures/error.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
テキスト、テキスト、テキスト、です。

test/fixtures/pass.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
テキスト、テキスト、テキスト。テキスト、テキスト、テキスト。

test/max-ten-test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ describe("max-ten", function () {
1111
afterEach(function () {
1212
textlint.resetRules();
1313
});
14-
it("should lint wrong tech words", function () {
15-
var filePath = path.join(__dirname, "/fixtures/README.md");
14+
it("should report error", function () {
15+
var filePath = path.join(__dirname, "/fixtures/error.md");
1616
var result = textlint.lintFile(filePath);
1717
assert(result.filePath === filePath);
1818
assert(result.messages.length > 0);
1919
assert.equal(result.messages[0].ruleId, "max-ten");
2020
});
21+
it("should not report error", function () {
22+
var filePath = path.join(__dirname, "/fixtures/pass.md");
23+
var result = textlint.lintFile(filePath);
24+
assert(result.filePath === filePath);
25+
assert(result.messages.length === 0);
26+
});
2127
});

0 commit comments

Comments
 (0)