sapegin / textlint-rule-terminology

Textlint rule to check correct terms spelling
MIT License
50 stars 17 forks source link

Error on loading terms from JSON file #6

Closed timothymcmackin closed 6 years ago

timothymcmackin commented 6 years ago

Hello! I'm trying to load terms from a JSON file as described in the README.md.

Here's my .textlint.rc, in the root of my npm project:

{
  "rules": {
    "terminology": {
      "terms": "myterms.json"
    }
  }
}

And in the same folder is myterms.json:

[
  "myKeyWord"
]

When I run textlint README.md, I get this error:

✖ Stack trace
Error: Error while loading rule 'terminology': Cannot find module 'myterms.json'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.resolve (internal/module.js:18:19)
    at loadJson (/documentation/node_modules/textlint-rule-terminology/index.js:73:39)
    at getTerms (/documentation/node_modules/textlint-rule-terminology/index.js:67:45)
    at reporter (/documentation/node_modules/textlint-rule-terminology/index.js:15:16)

Is the .textlintrc syntax different for loading terms from JSON files?

sapegin commented 6 years ago

Have you tried ./myterms.json? Otherwise it would try to load it from node_modules.

timothymcmackin commented 6 years ago

No, when I switch it to ./myterms.json I get this:

✖ Stack trace
Error: Error while loading rule 'terminology': Cannot find module './myterms.json'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.resolve (internal/module.js:18:19)
    at loadJson (/documentation/node_modules/textlint-rule-terminology/index.js:73:39)
    at getTerms (/documentation/node_modules/textlint-rule-terminology/index.js:67:45)
    at reporter (/documentation/node_modules/textlint-rule-terminology/index.js:15:16)
    at TextLintCoreTask.tryToGetRuleObject (/documentation/node_modules/@textlint/kernel/l
ib/task/textlint-core-task.js:152:20)
    at TextLintCoreTask.tryToAddListenRule (/documentation/node_modules/@textlint/kernel/l
ib/task/textlint-core-task.js:181:20)
    at /documentation/node_modules/@textlint/kernel/lib/task/linter-task.js:62:19
    at Array.forEach (<anonymous>)
    at TextLintCoreTask._setupRules (/documentation/node_modules/@textlint/kernel/lib/task
/linter-task.js:52:20)
    at new TextLintCoreTask (/documentation/node_modules/@textlint/kernel/lib/task/linter-
task.js:36:15)
    at LinterProcessor.process (/documentation/node_modules/@textlint/kernel/lib/linter/li
nter-processor.js:31:20)
    at TextlintKernel._parallelProcess (/documentation/node_modules/@textlint/kernel/lib/t
extlint-kernel.js:158:14)
    at /documentation/node_modules/@textlint/kernel/lib/textlint-kernel.js:103:26
    at <anonymous>
timothymcmackin commented 6 years ago

thanks!