textlint-ja / textlint-rule-no-doubled-conjunction

textlint plugin to check duplicated same conjunctions.
MIT License
8 stars 4 forks source link

Fix "TypeError: Reduce of empty array with no initial value" #1

Closed azu closed 8 years ago

azu commented 8 years ago

This pull request contain these changes:

[].reduce()
// emptryArray.reduce() throw error in JavaScript

Lint follwing text with "no-doubled-conjunction" rule.

![](path/to/image.png)"

Expected

No Error

Actual

Throw Error

TypeError: Reduce of empty array with no initial value
    at Array.reduce (native)
    at no-doubled-conjunction.js:39:48
azu commented 8 years ago

@takahashim ping

azu commented 8 years ago

Workaround: temporaly disable "no-doubled-conjunction".

{
    "rules": {
        "no-doubled-conjunction": false
    }
}

If you use https://github.com/azu/textlint-rule-preset-japanese, set following

{
    "rules" : {
        "preset-japanese": {
            "no-doubled-conjunction": false
        }
    }
}
takahashim commented 8 years ago

@azu Sorry that I did not notice this issue so ! And thanks to fix.

azu commented 8 years ago

@takahashim Thanks!

Please publish to npm 🙇

npm install && npm test && npm version patch && npm publish && git push
# result: patch version update