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

Is there a way to specify rulePaths based on the path of textlint.json? #31

Closed
dai0304 opened this issue Mar 15, 2018 · 4 comments
Closed

Comments

@dai0304
Copy link

dai0304 commented Mar 15, 2018

I want to share textlint configuration with multiple projects using git-subtree.
But configuration directory (subtree prefix) is not the same across all projects.

For example, there is following textlint-config repository.

.
|-- textlint.json
`-- prh-rules/
    `-- foo.yml

And the following projects, which share the configuration using git-subtree.

. (project-1)
|-- config/ (subtree)
|   |-- textlint.json
|   `-- prh-rules/
|       `-- foo.yml
`-- contents/
    `-- ...
. (project-2)
|-- src/
|   `-- ...
`-- docs/
    |-- config/ (subtree)
    |   |-- textlint.json
    |   `-- prh-rules/
    |       `-- foo.yml
    `-- contents/
        `-- ...

In the project-1 rulePaths must to be set as config/prh-rules/foo.yml,
but in the project-2 this have to be docs/config/prh-riles/foo.yml.

Any suggestions?
Thanks.

@azu
Copy link
Member

azu commented Mar 15, 2018

Thanks for report.

Does textlint.json equals to .textlintrc?
Do you use textlint --config docs/config/textlint.json docs/contents/ in project-2?

@dai0304
Copy link
Author

dai0304 commented Mar 15, 2018

Yes!
I forgot to tell you.

@azu
Copy link
Member

azu commented Mar 15, 2018

textlint-rule-prh treat rulePaths as relative path from .textlintrc(textlint.json)
(This document is missed, I've add it now #32)

For example is project-2.

. (project-2)
|-- src/
|   `-- ...
`-- docs/
    |-- config/ (subtree)
    |   |-- textlint.json
    |   `-- prh-rules/
    |       `-- foo.yml
    `-- contents/
        `-- ...

and Put following config to textlint.json:

{
  "rules": {
    "prh": {
      "rulePaths": [
        "./prh-rules/foo.yml"
      ]
    }
  }
}

textlint-rule-prh treat "./rules/rule.yml" as relative path from ./docs/config/textlint.json.
As a result, textlint-rule-prh load ./docs/config/./rules/rule.yml

I've tried to reproduce this issue.
https://github.com/azu/textlint-rule-prh-issues-31
But, it seems that it work expectly.

Can you write following results?

$ textlint --version
# Version
$ textlint --debug --config docs/config/textlint.json docs/contents/
# or
$ DEBUG=textlint* textlint --config docs/config/textlint.json docs/contents/

@dai0304
Copy link
Author

dai0304 commented Mar 15, 2018

I used textlint-rule-prh@2.4.1.
In the latest version 5.0.1, it works fully expected!

Thank you for your kindness!

@dai0304 dai0304 closed this as completed Mar 15, 2018
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