Git Product home page Git Product logo

linter-textlint's Introduction

linter-textlint

Dependency Status Build Status Build Status Build Status

A plugin for Atom Linter providing an interface to textlint.

Installation

$ apm install linter-textlint

Configuration

Use your project .textlintrc and the rule

You have to do following steps before using.

  1. Put .textlintrc in your workspace ( .textlintrc file format ).
  2. Install textlint plugins (textlint-rule-*) in your workspace via npm install.
  3. Open the workspace with Atom Editor.

Use global .textlintrc and the rule

You have to do following steps before using.

  1. Put .textlintrc in any directory ( .textlintrc file format ).
  2. Install textlint plugins (textlint-rule-*) in any directory via npm install.
  3. Open Atom and Show linter-textlint's setting.
  4. Set following setting:
  • .textlintrc Path : path to .textlintrc. It will only be used when there's no config file in project
    • e.g.) /Users/work/my-textlint-config/.textlintrc
  • textlint Rules Dir: path to node_modules directory. It will only be used when there's no config file in project
    • e.g.) /Users/work/my-textlint-config/node_modules

setting

Open any file(The workspace has not config file) with Atom Editor.

License

MIT © Shogo Sensui

linter-textlint's People

Contributors

1000ch avatar azu avatar dependabot-preview[bot] avatar dependabot[bot] avatar ej-yahata avatar io-monad avatar kateinoigakukun avatar kesin11 avatar mkwtys avatar nodaguti avatar steelbrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linter-textlint's Issues

Atom 1.25.0 で linter-textlint 4.0.0 のインストールに失敗する

Atom 1.25.0 に linter-textlint 4.0.0 をインストールしようとしたところ、以下のようなエラーメッセージが出てインストールできませんでした。

> [email protected] install C:\Users\[MyName]\AppData\Local\Temp\apm-install-dir-118223-10812-ap0x0t.87s55hr529\node_modules\linter-textlint\node_modules\utf-8-validate
> prebuild-install || node-gyp rebuild


C:\Users\[MyName]\AppData\Local\Temp\apm-install-dir-118223-10812-ap0x0t.87s55hr529\node_modules\linter-textlint\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "D:\Atom\Atom\resources\app\apm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\Atom\Atom\resources\app\apm\bin\\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
C:\Users\[MyName]\AppData\Local\Temp\apm-install-dir-118223-10812-ap0x0t.87s55hr529
`-- (empty)


prebuild-install info begin Prebuild-install version 2.3.0
prebuild-install info looking for local prebuild @ prebuilds\utf-8-validate-v4.0.0-electron-v54-win32-x64.tar.gz
prebuild-install info looking for cached prebuild @ C:\Users\[MyName]\.atom\.apm\_prebuilds\https-github.com-websockets-utf-8-validate-releases-download-v4.0.0-utf-8-validate-v4.0.0-electron-v54-win32-x64.tar.gz
prebuild-install http request GET https://github.com/websockets/utf-8-validate/releases/download/v4.0.0/utf-8-validate-v4.0.0-electron-v54-win32-x64.tar.gz
prebuild-install http 404 https://github.com/websockets/utf-8-validate/releases/download/v4.0.0/utf-8-validate-v4.0.0-electron-v54-win32-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=1.7.11 runtime=electron arch=x64 platform=win32)
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (D:\Atom\Atom\resources\app\apm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack     at D:\Atom\Atom\resources\app\apm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack     at D:\Atom\Atom\resources\app\apm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "D:\\Atom\\Atom\\resources\\app\\apm\\bin\\node.exe" "D:\\Atom\\Atom\\resources\\app\\apm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\[MyName]\AppData\Local\Temp\apm-install-dir-118223-10812-ap0x0t.87s55hr529\node_modules\linter-textlint\node_modules\utf-8-validate
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\[MyName]\AppData\Local\Temp\apm-install-dir-118223-10812-ap0x0t.87s55hr529\package.json'
npm WARN apm-install-dir-118223-10812-ap0x0t.87s55hr529 No description
npm WARN apm-install-dir-118223-10812-ap0x0t.87s55hr529 No repository field.
npm WARN apm-install-dir-118223-10812-ap0x0t.87s55hr529 No README data
npm WARN apm-install-dir-118223-10812-ap0x0t.87s55hr529 No license field.
npm ERR! Windows_NT 10.0.16299
npm ERR! argv "D:\\Atom\\Atom\\resources\\app\\apm\\bin\\node.exe" "D:\\Atom\\Atom\\resources\\app\\apm\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\[MyName]\\.atom\\.apm\\.apmrc" "--userconfig" "C:\\Users\\[MyName]\\.atom\\.apmrc" "install" "C:\\Users\\[MyName]\\AppData\\Local\\Temp\\d-118223-10812-11th3u6.6bu51att9\\package.tgz" "--runtime=electron" "--target=1.7.11" "--arch=x64" "--global-style"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'prebuild-install || node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the utf-8-validate package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     prebuild-install || node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs utf-8-validate
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls utf-8-validate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\[MyName]\AppData\Local\Temp\apm-install-dir-118223-10812-ap0x0t.87s55hr529\npm-debug.log
npm ERR! code 1

(ファイルパス中のユーザ名は [MyName] に置き換えています)

エラーメッセージの最後3行で C:\Users\[MyName]\AppData\Local\Temp\apm-install-dir-118223-10812-ap0x0t.87s55hr529\npm-debug.log なるファイルを含めるように書かれていますが、該当するファイルが無かったので添付しません。

Atom 1.25.0 は64bitのWindows用で、 https://github.com/atom/atom/releases にある「atom-x64-windows.zip」をダウンロード・解凍して導入しました。

OSはWindows 10 Proの64bit版のバージョン1709です。

Support for reStructuredText and Re:VIEW format

Checking does not work while editing reStructuredText or Re:VIEW file.

I hope to be able to use reStructuredText and Re:VIEW files as well.

(It will be helpful if you can communicate in Japanese.)

support textlint-plugin-html ?

I want to lint .html file on Atom.

Added option "plugins": ["html"] in .textlintrc, then worked textlint *.html in cmd.

But lint error isn't previewed in LinterView on Atom.

What's other settings ?

env:

  • Windows10
  • Atom 1.36.0
  • textlint: 11.2.3
  • textlint-plugin-html: 0.2.0
  • linter-textlint 5.0.0

linter-textlintが全く反応しない

下記の環境で利用としても、linter-textlintまったく反応せず、
lintの結果がAtom側に表示されない。

  • Atom: 1.0.19
    • linter-textlint: 1.1.0
  • OS: OS X El Capitan

.textlintrc

{
  "rules": {
    "max-ten": true,
    "spellcheck-tech-word": true,
    "no-mix-dearu-desumasu": true,
    "prh": {
      "rulePaths": ["prh.yml"]
    },
    "max-number-of-lines": false
  }
}

package.json

{
  "name": "document",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "textlint-rule-max-number-of-lines": "^1.0.2",
    "textlint-rule-max-ten": "^1.2.2",
    "textlint-rule-no-mix-dearu-desumasu": "^1.3.0",
    "textlint-rule-prh": "^2.0.0",
    "textlint-rule-spellcheck-tech-word": "^4.1.0"
  }
}

なお、textlint及びpackage.jsonに記載している各種ルールを、グローバルでインストールし、
texilintコマンドを実行すると正常にlint結果が表示される

Atom 1.31.1 で動かない

AtomでMarkdownファイルを開いた時に、次のようなエラーがコンソールに出て、lintされません。

linter-registry.js:137 [Linter] Error running textlint AssertionError: Processor.availableExtensions() should be implemented
    at D:\Atom\.atom\packages\linter-textlint\node_modules\textlint\lib\textlint\src\config\plugin-loader.js:89:9
    at Array.forEach (<anonymous>)
    at Object.loadAvailableExtensions (D:\Atom\.atom\packages\linter-textlint\node_modules\textlint\lib\textlint\src\config\plugin-loader.js:81:17)
    at new Config (D:\Atom\.atom\packages\linter-textlint\node_modules\textlint\lib\textlint\src\config\config.js:165:52)
    at Function.Config.initWithAutoLoading (D:\Atom\.atom\packages\linter-textlint\node_modules\textlint\lib\textlint\src\config\config.js:353:16)
    at TextLintEngine.AbstractTextLintEngine (D:\Atom\.atom\packages\linter-textlint\node_modules\textlint\lib\textlint\src\engine\textlint-engine-core.js:45:43)
    at new TextLintEngine (D:\Atom\.atom\packages\linter-textlint\node_modules\textlint\lib\textlint\src\textlint-engine.js:22:47)
    at Object.lint (file:///D:/Atom/.atom/packages/linter-textlint/lib/index.js:71:24)
    at promises.push.Promise.then._this2.emitter.emit.number (file:///D:/Atom/.atom/packages/linter/lib/linter-registry.js:101:24)
    at new Promise (<anonymous>)
    at _loop (file:///D:/Atom/.atom/packages/linter/lib/linter-registry.js:99:21)
    at LinterRegistry.<anonymous> (file:///D:/Atom/.atom/packages/linter/lib/linter-registry.js:87:40)
    at Generator.next (<anonymous>)
    at LinterRegistry.<anonymous> (file:///D:/Atom/.atom/packages/linter/lib/linter-registry.js:143:4)
    at Generator.next (<anonymous>)
    at step (D:\Atom\.atom\packages\linter\lib\linter-registry.js:5:273)
    at D:\Atom\.atom\packages\linter\lib\linter-registry.js:5:443
    at new Promise (<anonymous>)
    at LinterRegistry.<anonymous> (D:\Atom\.atom\packages\linter\lib\linter-registry.js:5:99)
    at file:///D:/Atom/.atom/packages/linter/lib/main.js:125:30
    at Function.module.exports.Emitter.simpleDispatch (D:\Atom\Atom\resources\app\node_modules\event-kit\lib\emitter.js:27:20)
    at Emitter.module.exports.Emitter.emit (D:\Atom\Atom\resources\app\node_modules\event-kit\lib\emitter.js:156:34)
    at EditorLinter.lint (file:///D:/Atom/.atom/packages/linter/lib/editor-linter.js:40:18)
    at EditorRegistry.createFromTextEditor (file:///D:/Atom/.atom/packages/linter/lib/editor-registry.js:43:20)
    at file:///D:/Atom/.atom/packages/linter/lib/editor-registry.js:25:12
    at onDidAddTextEditor (D:\Atom\Atom\resources\app\src\workspace.js:648:60)
    at Function.module.exports.Emitter.simpleDispatch (D:\Atom\Atom\resources\app\node_modules\event-kit\lib\emitter.js:27:20)
    at Emitter.module.exports.Emitter.emit (D:\Atom\Atom\resources\app\node_modules\event-kit\lib\emitter.js:156:34)
    at onDidAddPaneItem (D:\Atom\Atom\resources\app\src\workspace.js:520:28)
    at Function.module.exports.Emitter.simpleDispatch (D:\Atom\Atom\resources\app\node_modules\event-kit\lib\emitter.js:27:20)
    at Emitter.module.exports.Emitter.emit (D:\Atom\Atom\resources\app\node_modules\event-kit\lib\emitter.js:156:34)
    at PaneContainer.didAddPaneItem (D:\Atom\Atom\resources\app\src\pane-container.js:271:24)
    at Pane.addItem (D:\Atom\Atom\resources\app\src\pane.js:640:48)
    at Pane.activateItem (D:\Atom\Atom\resources\app\src\pane.js:582:18)
    at Workspace.open (D:\Atom\Atom\resources\app\src\workspace.js:1063:20)
    at <anonymous>
(anonymous) @ linter-registry.js:137
Promise rejected (async)
_loop @ linter-registry.js:102
(anonymous) @ linter-registry.js:87
(anonymous) @ linter-registry.js:143
step @ D:\Atom\.atom\packages\linter\lib\linter-registry.js:5
(anonymous) @ D:\Atom\.atom\packages\linter\lib\linter-registry.js:5
(anonymous) @ D:\Atom\.atom\packages\linter\lib\linter-registry.js:5
(anonymous) @ main.js:125
module.exports.Emitter.simpleDispatch @ VM22 <embedded>:68263
module.exports.Emitter.emit @ VM22 <embedded>:68392
lint @ editor-linter.js:40
createFromTextEditor @ editor-registry.js:43
(anonymous) @ editor-registry.js:25
onDidAddTextEditor @ VM22 <embedded>:29105
module.exports.Emitter.simpleDispatch @ VM22 <embedded>:68263
module.exports.Emitter.emit @ VM22 <embedded>:68392
onDidAddPaneItem @ VM22 <embedded>:28977
module.exports.Emitter.simpleDispatch @ VM22 <embedded>:68263
module.exports.Emitter.emit @ VM22 <embedded>:68392
didAddPaneItem @ VM22 <embedded>:30788
addItem @ VM22 <embedded>:31732
activateItem @ VM22 <embedded>:31674
open @ VM22 <embedded>:29520
async function (async)
open @ VM22 <embedded>:29550
module.exports.TreeView.fileViewEntryClicked @ VM22 <embedded>:124253
module.exports.TreeView.entryClicked @ VM22 <embedded>:124241
(anonymous) @ VM22 <embedded>:123967

使用環境は次の通りです。

  • OS: Windows 10 Pro version 1803, 64-bit
  • Atom: 1.31.1
    • ポータブルモードで使用
  • linter: 2.2.0
  • linter-textlint: 4.2.0
  • textlint: 11.0.1
    • textlint はついさっき更新したばかりです。更新前の[email protected]でも同様のエラーが出て動きませんでした。
  • Node.js: 10.11.0

linterの「Lint As You Type」オプションを利用しているとエラーが出る

以下の環境で利用しています。

  • Atom 1.10.2
  • linter-textlint 2.0.0
  • linter 1.11.16
    • Lint As You Type オプション有効
  • textlint 7.1.1

lint自体は正常に行われるのですが、ファイルを更新するたびにエラーダイアログが表示されます。
エラーメッセージは次の通りです。

Error: Column start (31) greater than line length (0)
    at rangeFromLineNumber (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\atom-linter\lib\index.js:179:11)
    at D:/PortableApplications/Atom/.atom/packages/linter-textlint/lib/index.js:116:20
    at Array.map (native)
    at D:/PortableApplications/Atom/.atom/packages/linter-textlint/lib/index.js:112:25
    at tryCatcher (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:510:31)
    at Promise._settlePromise (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:567:18)
    at Promise._settlePromise0 (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:612:10)
    at Promise._settlePromises (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:691:18)
    at Promise._fulfill (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:636:18)
    at PromiseArray._resolve (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise_array.js:125:19)
    at PromiseArray._promiseFulfilled (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise_array.js:143:14)
    at Promise._settlePromise (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:572:26)
    at Promise._settlePromise0 (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:612:10)
    at Promise._settlePromises (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\promise.js:691:18)
    at Async._drainQueue (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\async.js:138:16)
    at Async._drainQueues (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\async.js:148:10)
    at Async.drainQueues (D:\PortableApplications\Atom\.atom\packages\linter-textlint\node_modules\bluebird\js\release\async.js:17:14)

なお、保存されたファイルを初めて読み込んだ時にはエラーは出ず、そこから何か変更を加えるたびにエラーが出るという感じです。
また、linterの Lint As You Type オプションを無効にするとエラーは出なくなります。

Re:VIEWにlintが効かない

期待する動作

Atomの編集中画面でtext-lintが実行されて、エラーが表示されて欲しいです。

実際の動作

Re:VIEW

.reファイルではエラーが検出されません。

2018-02-20 10 04 57

Markdown

.mdファイルではエラーが検出されます。

2018-02-20 10 05 10

CLI

CLIからtextlintを実行した場合は、エラーが検出されます。

~ npx textlint src/preface.re

/Users/shigerunakajima/modern-web-front-end-design-pattern/src/preface.re
   5:10  error  "" が連続して2回使われています。                         preset-ja-technical-writing/ja-no-successive-word
   7:25  error  一つの文で""を3つ以上使用しています                     preset-ja-technical-writing/max-ten
  10:7   error  一文に二回以上利用されている助詞 "" がみつかりました。  preset-ja-technical-writing/no-doubled-joshi
  10:11  error  一文に二回以上利用されている助詞 "" がみつかりました。  preset-ja-technical-writing/no-doubled-joshi
  14:34  error  一つの文で""を3つ以上使用しています                     preset-ja-technical-writing/max-ten
  18:37  error  一文に二回以上利用されている助詞 "" がみつかりました。  preset-ja-technical-writing/no-doubled-joshi
  27:30  error  弱い表現: "思います" が使われています。                   preset-ja-technical-writing/ja-no-weak-phrase

✖ 7 problems (7 errors, 0 warnings)

Versions

  • macOS Sierra 10.12.6
  • Atom 1.24.0 x64
  • linter 2.2.0
  • linter-textlint 4.0.0
  • textlint 10.1.4
  • textlint-plugin-review 0.3.3
  • textlint-rule-preset-ja-technical-writing 2.0.0.

.textlintrc

{
  "rules": {
    "preset-ja-technical-writing": true
  },
  "plugins": [
    "review"
  ]
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.