Giter Site home page Giter Site logo

textlint / textlint Goto Github PK

View Code? Open in Web Editor NEW
2.8K 39.0 152.0 22.15 MB

The pluggable natural language linter for text and markdown.

Home Page: https://textlint.github.io/

License: MIT License

JavaScript 15.56% TypeScript 83.77% HTML 0.05% CSS 0.62% Shell 0.01%
javascript natural-language markdown linter lint textlint nlp

textlint's Issues

Error is missing

// index.md
もっとです。
もっとする。もっとだ。
$ textlint --plugin textlint-plugin-jtf-style index.md

D:\develop\personal\falsandtru.github.io\index.md
  2:10  error  本文を敬体(ですます調)に統一して下さい。
本文の文体は、敬体(ですます調)あるいは常体(である調)のどちらかで統一します。
"だ。"が常体(である調)です。  jtf-style/1.1.1.本文

✖ 1 problem (1 error, 0 warnings)


should be error:

// index.md
もっとです。
もっとする。もっとだ。もっと。
$ textlint --plugin textlint-plugin-jtf-style index.md

$ textlint --rule textlint-rule-no-mix-dearu-desumasu index.md

Is this correct behavior?

html should show warning message

textlint html support is experimetanl.
it's used and show warning message.

  • currently, experimtal
  • if you found, please file issue

Remove singleton rule-manager

textlint-core.js is not single, but rule-manager.js is a singleton.

var textlint1 = new TextLintCore();
textlint1.setupRule()
// do lint...
var textlint2 = new TextLintCore();
// textlint2 has rules that are defined by textlint1.

That is too bad.

Modulable textlint

texlint is a Node module.
It mean that use of textlint for purpose other than linting.

textlint structure:

textlint

I'm creating https://github.com/azu/textstat.
It is not linting tool, but is statistics tool top on the textlint.

Currently, bottleneck object is Config that is not expose public.

Is Config should public?

Add exmples/

We want to add example/ that is actually executable.
These examples are used for testing(so-called example testing).

logo

We need logo and icon for oraganization.#55

Rule: async support

Currently, textlint's rule not support async.

Use case: Allow to create the rule that use REST API like 校正支援Web API.

Add New API on the rule and change lintFile API for support async.

Processor Plugin: Custome Parser

We want to support custom parser.

e.g.) textlint can lint .rst file by custom parser.

  • custom pre/post process(parse/modified) #36
  • custom AST traverse and Syntax => lator
  • customize support file extensions #36

These are needed to realize.

show available formatter in help

$ textlint -h
textlint [options] file.md [file.txt] [dir]

Options:
  -h, --help                 Show help.
  -c, --config path::String  Use configuration from this file or sharable config.
  --plugin [String]          Specify plugins
  --rule [path::String]      Set rule package name and set all default rules to off.
  --rulesdir [path::String]  Set rules from this directory and set all default rules to off.
  -f, --format String        Use a specific output format. - default: stylish
                          ===>      Available : XXX
  -v, --version              Outputs the version number.
  --ext [String]             Specify text file extensions.
  --no-color                 Enable color in piped output.
  -o, --output-file path::String  Enable report to be written to a file.
  --quiet                    Report errors only. - default: false
  --stdin                    Lint code provided on <STDIN>. - default: false

Implementation

description: "Use a specific output format.",

Implementation Options

Which is better?

Blocker

Following Issues need to resolve before try to implement this feature

Related

accept rule as anónymous function

Current:

var TextLintEngine = require("textlint").TextLintEngine;
var engine = new TextLintEngine({
    rules: ["textlint-rule-spellcheck-tech-word"]
});
var TextLintEngine = require("textlint").TextLintEngine;
var engine = new TextLintEngine({
    rules: [require("textlint-rule-spellcheck-tech-word")]
});

Good?

EventEmitter memory leak detected

When many rule is loaded, occur this warning

(node) warning: possible EventEmitter memory leak detected. 11 Str listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at TextlintCore.addListener (events.js:239:17)
    at /Users/azu/.ghq/github.com/azu/JavaScript-Plugin-Architecture/node_modules/textlint/lib/textlint-core.js:31:16
    at Array.forEach (native)
    at addListenRule (/Users/azu/.ghq/github.com/azu/JavaScript-Plugin-Architecture/node_modules/textlint/lib/textlint-core.js:30:23)
    at /Users/azu/.ghq/github.com/azu/JavaScript-Plugin-Architecture/node_modules/textlint/lib/textlint-core.js:80:21
    at Array.forEach (native)
    at TextlintCore.setupRules (/Users/azu/.ghq/github.com/azu/JavaScript-Plugin-Architecture/node_modules/textlint/lib/textlint-core.js:65:32)
    at TextLintEngine.setupRules (/Users/azu/.ghq/github.com/azu/JavaScript-Plugin-Architecture/node_modules/textlint/lib/textlint-engine.js:81:22)
    at TextLintEngine.executeOnFiles (/Users/azu/.ghq/github.com/azu/JavaScript-Plugin-Architecture/node_modules/textlint/lib/textlint-engine.js:172:18)
    at Object.execute (/Users/azu/.ghq/github.com/azu/JavaScript-Plugin-Architecture/node_modules/textlint/lib/cli.js:75:70)

textlint-rule-*をロードするIFが欲しい

Atomのプラグインを作りたいときに、Atomで開かれているディレクトリのnode_modules/textlint-rule-*をtextlintにロードしてあげると、そのプロジェクトのpackage.json.textlintrcに依存関係を完結させることが出来そうなので・・・。

つまり、
https://github.com/azu/textlint/blob/master/lib/textlint-engine.js#L65-L80
あたりをTextLintEngineのインスタンスから実行したいです。

https://github.com/1000ch/linter-textlint/blob/master/index.js#L20-L26

textlint rule naming

I good to like that textlint rule naming start with textlint-rule-*.

It is inspired by Babel.

  • recommend textlint rule naming textlint-rule-*
  • Add --rule <rule name> for CLI
  • Set rule by function? separated issue

should be more meaningful ReferenceError

ReferenceError: rule: 4.3.8.一重引用符 is not found

to be

ReferenceError: rule: 4.3.8.一重引用符 is not found
Did you mean: jtf-style/4.3.8.一重引用符

ReferenceError: overwrite config of Plugin

from: textlint-ja/textlint-rule-preset-JTF-style#5 (comment)

try to set the following and textlint throw ReferenceError.

{
  "plugins": [
    "jtf-style"
  ],
  "rules": {
    "jtf-style/2.1.2.漢字": {
      "severity" : "warning"
    },
    "jtf-style/4.1.1.句点(。)": false,
    "jtf-style/3.1.1.全角文字と半角文字の間": false
  }
}

Error mesasage:

[ReferenceError: rule: jtf-style/2.1.2.漢字 is not found]

But, following case is safe.(no error)

  "rules": {
    "jtf-style/2.1.2.漢字": true,
    "jtf-style/4.1.1.句点(。)": false,
    "jtf-style/3.1.1.全角文字と半角文字の間": false
  }

It seem bug in textlint. @

throw new ReferenceError(`rule: ${ ruleName } is not found`);

Duplicated error messages caused by file order

// index.md
もっとです。
もっとする。もっとだ。

// README.md (empty)
$ textlint --plugin textlint-plugin-jtf-style README.md index.md

~\index.md
  10:10  error  本文を敬体(ですます調)に統一して下さい。
本文の文体は、敬体(ですます調)あるいは常体(である調)のどちらかで統一します。
"だ。"が常体(である調)です。  jtf-style/1.1.1.本文

✖ 1 problem (1 error, 0 warnings)


$ textlint --plugin textlint-plugin-jtf-style index.md README.md

~\index.md
  10:10  error  本文を敬体(ですます調)に統一して下さい。
本文の文体は、敬体(ですます調)あるいは常体(である調)のどちらかで統一します。
"だ。"が常体(である調)です。  jtf-style/1.1.1.本文

~\README.md
  10:10  error  本文を敬体(ですます調)に統一して下さい。
本文の文体は、敬体(ですます調)あるいは常体(である調)のどちらかで統一します。
"だ。"が常体(である調)です。  jtf-style/1.1.1.本文

✖ 2 problems (2 errors, 0 warnings)


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.