Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'fixer' of undefined #5

Open
donganzh-zz opened this issue Jul 29, 2019 · 2 comments
Open

Cannot read property 'fixer' of undefined #5

donganzh-zz opened this issue Jul 29, 2019 · 2 comments

Comments

@donganzh-zz
Copy link
Contributor

Hi, @azu
Hope you are having a great day.

I forked this rule and tried to build it on my laptop with some new features. Before I run npm run build, I need to install the helper npm packages:

npm install textlint-scripts --save-dev
npm install --save is-capitalized
npm install --save array-includes

then I run npm run build and textlint --rulesdir lib/ example.md -f pretty-error to test the rule with some sample document, I got this error message Cannot read property 'fixer' of undefined as output. I don't think there is anything related to the fixer in this rule. Do you know what might cause this problem? Thanks

@azu
Copy link
Member

azu commented Jul 29, 2019

Probably, npm run build has converted export default function (context, options = {}) { to module.exports.default = function (context, options = {}) {.

export default function (context, options = {}) {

textlint --rulesdir expected to export module.exports = function (context, options = {}) { (without .default).

Maybe, rewrite export default function (context, options = {}) { to module.exports = function (context, options = {}) { and textlint --rulesdir can load it.


FYI: You can test the rule via npm test.

@donganzh-zz
Copy link
Contributor Author

Thanks, even if I rewrite export default function, it still reports error cannot read property 'fixer'. But I will go with the npm test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants