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

Add textlint checker #1534

Merged
merged 1 commit into from Jan 25, 2019

Conversation

@kisaragi-hiu
Copy link
Contributor

commented Jan 19, 2019

This integrates a modified version of @robstewart57's A textlint flycheck checker in Emacs into flycheck. I first packaged it in https://github.com/kisaragi-hiu/flycheck-textlint; that repo will be turned into a tutorial if this gets merged.

As textlint supports multiple formats, I have to add a new option to let users add their own mode → textlint plugin associations, otherwise textlint would just fail with a backtrace.

This implements #899.

@kisaragi-hiu kisaragi-hiu changed the title Feature/add textlint checker Add textlint checker Jan 19, 2019

@kisaragi-hiu kisaragi-hiu referenced this pull request Jan 19, 2019
@fmdkdd
Copy link
Member

left a comment

Thanks, this is a nice PR.

I have made some suggestions for improvements.

flycheck.el Outdated Show resolved Hide resolved
flycheck.el Outdated Show resolved Hide resolved
flycheck.el Outdated Show resolved Hide resolved
flycheck.el Outdated Show resolved Hide resolved
@kai2nenobu

This comment has been minimized.

Copy link

commented Jan 22, 2019

This is a very attractive feature 😄. I hope this feature will be merged ASAP.

BTW, I have one comment about a lint result parsing.

textlint can output a lint result as JSON and its format is compatible with a eslint format. Fortunately, flycheck already has the parser function of eslint result (flycheck-parse-eslint). If flycheck-parse-eslint is used with :error-parser, flycheck may handle error results more precisely (severity, rule id, multi-line message), I think.

Checker implementation is something like this. (My emacs configuration repository)

Sample textlint Output
> textlint --config textlintrc.json --format unix text.txt
C:\Users\user\tmp\flycheck\test\resources\language\text\text.txt:1:7: "very" is a weasel word and can weaken meaning [Error/write-good]

1 problem

> textlint --config textlintrc.json --format json text.txt | jq .
[
  {
    "messages": [
      {
        "type": "lint",
        "ruleId": "write-good",
        "message": "\"very\" is a weasel word and can weaken meaning",
        "index": 6,
        "line": 1,
        "column": 7,
        "severity": 2
      }
    ],
    "filePath": "C:\\Users\\user\\tmp\\flycheck\\test\\resources\\language\\text\\text.txt"
  }
]

@kisaragi-hiu kisaragi-hiu force-pushed the kisaragi-hiu:feature/add-textlint-checker branch 2 times, most recently from a8e37de to d5a22c7 Jan 22, 2019

@kisaragi-hiu

This comment has been minimized.

Copy link
Contributor Author

commented Jan 22, 2019

@kai2nenobu Yeah, that seems like a good idea.

test/flycheck-test.el Outdated Show resolved Hide resolved
@fmdkdd

fmdkdd approved these changes Jan 24, 2019

@fmdkdd

This comment has been minimized.

Copy link
Member

commented Jan 24, 2019

LGTM. Please squash your commits and I well merge.

@kisaragi-hiu kisaragi-hiu force-pushed the kisaragi-hiu:feature/add-textlint-checker branch from 9cfdcb6 to 7e97836 Jan 24, 2019

@fmdkdd fmdkdd merged commit 3dc6dff into flycheck:master Jan 25, 2019

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details
@fmdkdd

This comment has been minimized.

Copy link
Member

commented Jan 25, 2019

Thank you for this nice work, and for iterating quickly on this PR. 👍

kai2nenobu added a commit to kai2nenobu/.emacs.d that referenced this pull request Jan 28, 2019

独自定義の flycheck-textlint チェッカーを除去する
flycheckに組み込みでtextlintチェッカーが入ったので、独自のものはいらなくなった。

ref. flycheck/flycheck#1534

kai2nenobu added a commit to kai2nenobu/.emacs.d that referenced this pull request Jul 19, 2019

独自定義の flycheck-textlint チェッカーを除去する
flycheckに組み込みでtextlintチェッカーが入ったので、独自のものはいらなくなった。

ref. flycheck/flycheck#1534
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.