Skip to content

Commit dd80dd1

Browse files
authored
Merge pull request #5 from textlint-rule/module-interop
chore(deps): upgrade dependencies
2 parents 679e5bc + 153d53d commit dd80dd1

File tree

6 files changed

+3791
-52
lines changed

6 files changed

+3791
-52
lines changed

.babelrc

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

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# textlint-rule-rousseau [![Build Status](https://travis-ci.org/azu/textlint-rule-rousseau.svg?branch=master)](https://travis-ci.org/azu/textlint-rule-rousseau)
1+
# textlint-rule-rousseau [![Build Status](https://travis-ci.org/textlint-rule/textlint-rule-rousseau.svg?branch=master)](https://travis-ci.org/textlint-rule/textlint-rule-rousseau)
22

33
A [textlint](https://github.com/textlint/textlint "textlint") rule check english sentence using [rousseau](https://github.com/GitbookIO/rousseau "rousseau").
44

@@ -16,7 +16,7 @@ Lint results:
1616
$ textlint --rule textlint-rule-rousseau README.md
1717
1818
textlint-rule-rousseau: omit 'So' from the beginning of sentences
19-
/Users/azu/.ghq/github.com/azu/textlint-rule-rousseau/README.md:11:1
19+
/Users/textlint-rule/.ghq/github.com/textlint-rule/textlint-rule-rousseau/README.md:11:1
2020
v
2121
10.
2222
11. So the cat was stolen.
@@ -26,7 +26,7 @@ textlint-rule-rousseau: omit 'So' from the beginning of sentences
2626
textlint-rule-rousseau: "was stolen" may be passive voice
2727
Suggestions:
2828
=> stole
29-
/Users/azu/.ghq/github.com/azu/textlint-rule-rousseau/README.md:11:12
29+
/Users/textlint-rule/.ghq/github.com/textlint-rule/textlint-rule-rousseau/README.md:11:12
3030
v
3131
10.
3232
11. So the cat was stolen.

package.json

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "textlint-rule-rousseau",
33
"repository": {
44
"type": "git",
5-
"url": "git+https://github.com/azu/textlint-rule-rousseau.git"
5+
"url": "git+https://github.com/textlint-rule/textlint-rule-rousseau.git"
66
},
77
"author": "azu",
88
"email": "[email protected]",
9-
"homepage": "https://github.com/azu/textlint-rule-rousseau",
9+
"homepage": "https://github.com/textlint-rule/textlint-rule-rousseau",
1010
"license": "MIT",
1111
"bugs": {
12-
"url": "https://github.com/azu/textlint-rule-rousseau/issues"
12+
"url": "https://github.com/textlint-rule/textlint-rule-rousseau/issues"
1313
},
1414
"version": "1.4.5",
1515
"description": "textlint rule check english sentence using rousseau",
@@ -22,10 +22,10 @@
2222
"test": "test"
2323
},
2424
"scripts": {
25-
"build": "babel src --out-dir lib --source-maps",
26-
"watch": "babel src --out-dir lib --watch --source-maps",
25+
"build": "textlint-scripts build",
26+
"watch": "textlint-scripts build --watch",
2727
"prepublish": "npm run --if-present build",
28-
"test": "mocha",
28+
"test": "textlint-scripts test",
2929
"example": "npm run build && textlint --rulesdir lib README.md"
3030
},
3131
"keywords": [
@@ -35,19 +35,12 @@
3535
"spellcheck"
3636
],
3737
"devDependencies": {
38-
"babel-cli": "^6.5.1",
39-
"babel-plugin-add-module-exports": "^0.2.1",
40-
"babel-preset-es2015": "^6.5.0",
41-
"babel-register": "^6.5.2",
42-
"mocha": "^2.4.5",
43-
"textlint": "^6.0.1",
44-
"textlint-tester": "^1.1.0"
38+
"textlint-scripts": "^2.1.0"
4539
},
4640
"dependencies": {
47-
"object-assign": "^4.0.1",
4841
"rousseau": "^1.0.0",
4942
"textlint-rule-helper": "^2.0.0",
50-
"textlint-util-to-string": "^1.2.1",
43+
"textlint-util-to-string": "^2.1.1",
5144
"unist-util-map": "^1.0.2"
5245
}
5346
}

src/textlint-rule-rousseau.js

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
// LICENSE : MIT
22
"use strict";
33
import {RuleHelper, IgnoreNodeManager} from "textlint-rule-helper";
4-
const StringSource = require("textlint-util-to-string").default;
4+
const StringSource = require("textlint-util-to-string");
55
const rousseau = require("rousseau");
66
const map = require("unist-util-map");
7-
const ObjectAssign = require("object-assign");
87
const defaultOptions = {
98
// "suggestion", "warning", "error"
109
showLevels: ["suggestion", "warning", "error"],
@@ -16,7 +15,7 @@ const defaultOptions = {
1615

1716
const mapNode = function (ast, mapFn) {
1817
return (function preorder(node, index, parent) {
19-
const newNode = ObjectAssign({}, mapFn(node, index, parent));
18+
const newNode = Object.assign({}, mapFn(node, index, parent));
2019
if (node.children) {
2120
newNode.children = node.children.map(function (child, index) {
2221
return preorder(child, index, node);
@@ -26,43 +25,43 @@ const mapNode = function (ast, mapFn) {
2625
}(ast, null, null));
2726
};
2827

29-
export default function textlintRousseau(context, options = defaultOptions) {
28+
module.exports = function textlintRousseau(context, options = defaultOptions) {
3029
const helper = new RuleHelper(context);
3130
const ignoreNodeManager = new IgnoreNodeManager();
3231
const {Syntax, RuleError, report, getSource} = context;
3332
const showLevels = options.showLevels || defaultOptions.showLevels;
3433
const ignoreTypes = options.ignoreTypes || defaultOptions.ignoreTypes;
3534
const ignoreInlineNodeTypes = options.ignoreInlineNodeTypes || [Syntax.Code];
36-
const isShowType = (type)=> {
35+
const isShowType = (type) => {
3736
return ignoreTypes.indexOf(type) === -1;
3837
};
3938
const isShowLevel = (level) => {
4039
return showLevels.indexOf(level) !== -1;
4140
};
4241
/*
4342
{
44-
// Type of check that output this suggestion
45-
type: "so",
43+
// Type of check that output this suggestion
44+
type: "so",
4645
47-
// Level of importance
48-
// "suggestion", "warning", "error"
49-
level: "warning",
46+
// Level of importance
47+
// "suggestion", "warning", "error"
48+
level: "warning",
5049
51-
// Index in the text
52-
index: 10,
50+
// Index in the text
51+
index: 10,
5352
54-
// Size of the section in the text
55-
offset: 2,
53+
// Size of the section in the text
54+
offset: 2,
5655
57-
// Message to describe the suggestion
58-
message: "omit 'So' from the beginning of sentences",
56+
// Message to describe the suggestion
57+
message: "omit 'So' from the beginning of sentences",
5958
60-
// Replacements suggestion
61-
replacements: [
62-
{
63-
value: ""
64-
}
65-
]
59+
// Replacements suggestion
60+
replacements: [
61+
{
62+
value: ""
63+
}
64+
]
6665
}
6766
*/
6867
const createSuggest = (replacements) => {
@@ -97,7 +96,7 @@ export default function textlintRousseau(context, options = defaultOptions) {
9796
};
9897

9998
return {
100-
[Syntax.Paragraph](node){
99+
[Syntax.Paragraph](node) {
101100
// ignore if wrapped node types
102101
if (helper.isChildNode(node, [Syntax.Link, Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
103102
return;
@@ -110,7 +109,7 @@ export default function textlintRousseau(context, options = defaultOptions) {
110109
const filteredNode = map(node, (node) => {
111110
if (node.type === Syntax.Code) {
112111
// only change `value` to dummy
113-
return ObjectAssign({}, node, {
112+
return Object.assign({}, node, {
114113
value: new Array(node.value.length + 1).join("x")
115114
});
116115
}
@@ -132,4 +131,4 @@ export default function textlintRousseau(context, options = defaultOptions) {
132131
});
133132
}
134133
}
135-
}
134+
};

test/mocha.opts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--compilers js:babel-register
1+
--require textlint-scripts/register

0 commit comments

Comments
 (0)