@azu azu released this Oct 28, 2017 · 656 commits to master since this release

Assets 2

♻️ Refactor

textlint-kernel: Convert JavaScript to TypeScript #248 #301

Convert @textlint/kernel from JavaScript to Typescript.

If you instersting in TypeScript support, please see #248 .

Currently, Type definition is unstable. It means that break change in minor version.

🆕 Feature

Plugins can be initialized with plugin options #296

Allow to specify following options.

{
  "plugins": {
     "text": { "custom": "value" }
  }
}

For mode details, See document of plugin.

textlint-tester: support "index" expected param #324

Allow to write following index based testing.

const TextLintTester = require("textlint-tester");
const tester = new TextLintTester();
tester.run("rule", rule, {
    invalid: [
        // index
        {
            text: "- [ ] string",
            errors: [
                {
                    message: "Found TODO: '- [ ] string'",
                    index: 2
                }
            ]
        }
    ]
});

🐛 Bug Fixes

textlint: don't use error.code when catch error #323

Fix to use correct exit code. Thanks to @buzztaiki

🔥 BREAKING CHANGE

These breaking change is for plugin/rule author.

Remove context.config #294 #295

You can use context.getConfigBaseDir() instead of context.config.

  • getConfigBaseDir() return config base directory path that is the place of .textlintrc
    • e.g.) /path/to/dir/.textlintrc
    • getConfigBaseDir() return "/path/to/dir/".

Related rules changes:

Drop "rules" and "rulesConfig" from plugin #291 #313

You can use preset feature instead of plugin.
The textlint plugin should focus on processor.

Disallow to use 3rd argument of context.report function #316

It prevent wrong usage of report function:

NG:

report(node,
  new RuleError(`using "please" in a set of instructions is overdoing the politeness.`), {
    index,
    fix: fixer.replaceTextRange(range, result.replace)
  }
)

OK:

report(node,
  new RuleError(`using "please" in a set of instructions is overdoing the politeness.`, {
    index,
    fix: fixer.replaceTextRange(range, result.replace)
  });
)