textlint-rule / textlint-rule-rousseau

textlint rule check english sentence using rousseau
MIT License
7 stars 0 forks source link

Bug: Do not overwrite children #2

Closed azu closed 8 years ago

azu commented 8 years ago

https://github.com/azu/textlint-rule-rousseau/blob/ca23e4096073ba172355ab73ab44ca5bdc0ba26b/src/textlint-rule-rousseau.js#L79-L105

is bad pattern.

            // fake `code`
            if (fakeInlineCode) {
                node.children = node.children.map(childNode => {
                    if (childNode.type === Syntax.Code) {
                        return {
                            type: Syntax.Str,
                            value: "code",
                            raw: "code",
                            loc: childNode.loc,
                            range: childNode.range
                        }
                    }
                    return childNode;
                });
            }

overwrite childred affect other rules.

We'll fix this.

ref https://github.com/textlint/textlint/issues/166