Skip to content
This repository was archived by the owner on May 23, 2021. It is now read-only.

Releases: textlint/textlint-scripts

3.0.0

20 Oct 00:25
@azu azu
Compare
Choose a tag to compare

3.0.0

Major release of textlint-scripts!

Also, update [email protected].

You can create TypeScript project for textlint rule:

$ npx create-textlint-rule example --typescript

Summary

  • Support Async Function #23
  • Inline static resources in building for Browser #31
  • Support TypeScript #27

Breaking Changes 🔥

textlint-script build output compatible code for ES2015+.
It means that output code is not work on IE11.

Support Async Function ⭐️

Async/Await is supported by default.

Inline static resources by default ⭐️

For Web Browser support, textlint-script build inline static file by default.

textlint-script build inline Node fs calls with babel-plugin-static-fs for browser compatibility.

const fs = require("fs");
const path = require("path");
const text = fs.readFileSync(path.join(__dirname, "readme.md"), "utf-8");

will be

const text = "README CONTENT"

Web Browser does not support Node.js's fs module, this inlining feature aim to improve compatibility between Node.js and Web Browser.

ℹ️ @textlint/browser-run help you to test your textlint rule work on browser.

📝 You want to disable this behavior, set NO_INLINE env like NO_INLINE=1 textlint-scripts build.

Support TypeScript 🌟

textlint-script build and textlint-script test support TypeScript.
You can write textlint rule with TypeScript.

ℹ️ textlint-script detect the project is TypeScript by tsconfig.json.

Start Guide

You just pass --typescript flag to create-textlint-rule.

$ npx create-textlint-rule example --typescript

Migration Guide

If you want to write textlint rule with TypeScript, you can migrate it by following steps:

  1. Install TypeScript env
npm install textlint-scripts@beta --save-dev
npm install --save-dev typescript ts-node @textlint/types @types/node
npx tsc --init # create tsconfig.json
  1. Rename .js to .ts
  2. Fix TypeScript Error

@textlint/types provide types for textlint rule.

import { TextlintRuleModule, TextlintRuleReporter } from "@textlint/types";
export interface RuleOptions {
  foo: boolean;
}
const report: TextlintRuleReporter<RuleOptions> = function(context, options = {}) {
    const { Syntax, RuleError, report, getSource } = context;
    return {
        [Syntax.Str](node) {
            // ...
        }
    };
};
export default {
    linter: report,
    fixer: report
} as TextlintRuleModule;
  1. npm test and npm run build.

Migration Scrips: @textlint/migrate-textlint-scripts-typescript

We also prepare migration script from textlint-script with JavaScript to textlint-script with TypeScript.

Migration script help you to do step 1.

# in you textlint rule project
npx @textlint/migrate-textlint-scripts-typescript

For more details, see @textlint/migrate-textlint-scripts-typescript.

Examples:

Following examples are migrated to TypeScript from JavaScript.

3.0.0-beta.2

19 Oct 15:29
@azu azu
Compare
Choose a tag to compare
3.0.0-beta.2 Pre-release
Pre-release

Bug Fixes

  • deps: update babel monorepo to ^7.5.4 (1738588)
  • deps: update babel monorepo to ^7.5.5 (86aad73)
  • deps: update dependency @babel/register to ^7.5.5 (e117152)
  • deps: update dependency babel-plugin-static-fs to ^1.2.1 (00a865e)
  • deps: update dependency babel-plugin-static-fs to v3 (#34) (8386d9c)
  • deps: update dependency cross-spawn to v7 (#36) (ff0120c)
  • deps: update dependency mocha to ^6.2.0 (cdf7f78)
  • deps: update dependency mocha to ^6.2.1 (5c87e53)
  • deps: update dependency prh to ^5.4.4 (05cdef8)
  • deps: update dependency textlint-tester to ^5.1.8 (45706bd)
  • deps: update dependency textlint-tester to ^5.1.9 (d1cc222)
  • deps: update minor updates to ^7.6.0 (fbbba3b)
  • deps: update patch updates (5187ecf)
  • deps: update patch updates to ^7.6.2 (a430e5f)
  • deps: update patch updates to ^7.6.4 (89cbeff)

Features

  • build: support NO_INLINE (#37) (8d34452)
  • typescript: add "pretty" option for ts-node (311406a)

3.0.0-beta.1

07 Jul 03:49
@azu azu
Compare
Choose a tag to compare
3.0.0-beta.1 Pre-release
Pre-release

Bug Fixes

3.0.0-beta.0

07 Jul 03:33
@azu azu
Compare
Choose a tag to compare
3.0.0-beta.0 Pre-release
Pre-release

3.0.0 Beta-0

This is beta release

You can try it:

npm install textlint-scripts@beta --save-dev

Summary

  • Support Async Function #23
  • Inline static resources in building for Browser #31
  • Support TypeScript #27

Breaking Changes 🔥

textlint-script build output compatible code for ES2015+.
It means that output code is not work on IE11.

Support Async Function ⭐️

Async/Await is supported by default.

Inline static resources in building ⭐️

textlint-script build inline Node fs calls with babel-plugin-static-fs for browser compatibility.

const fs = require("fs");
const path = require("path");
const text = fs.readFileSync(path.join(__dirname, "readme.md"), "utf-8");

will be

const fs = require("fs");
const path = require("path");
const text = "README CONTENT"

Support TypeScript 🌟

textlint-script build and textlint-script test support TypeScript.
You can write textlint rule with TypeScript.

Migration Guide

If you want to write textlint rule with TypeScript, you can migrate it by following steps:

  1. Install TypeScript env
npm install textlint-scripts@beta --save-dev
npm install --save-dev typescript ts-node @textlint/types @types/node
  1. Rename .js to .ts
  2. Fix TypeScript Error

@textlint/types provide types for textlint rule.

import { TextlintRuleModule, TextlintRuleReporter } from "@textlint/types";
const report: TextlintRuleReporter = function(context, options = {}) {
    const { Syntax, RuleError, report, getSource } = context;
    return {
        [Syntax.Str](node) {
            // ...
        }
    };
};
export default {
    linter: report,
    fixer: report
} as TextlintRuleModule;
  1. npm test and npm run build.

Migration Scrips: We also prepare migration script from textlint-script with JavaScript to textlint-script with TypeScript.

Migration script help to step 1.

# in you textlint rule project
npx @textlint/migrate-textlint-scripts-typescript

For more details, see @textlint/migrate-textlint-scripts-typescript.

Example

2.1.0

16 Sep 08:53
@azu azu
Compare
Choose a tag to compare

Bug Fixes

  • deps: update dependency confirmer to ^1.1.2 (000b442)

Features

2.0.0

08 Aug 07:05
@azu azu
Compare
Choose a tag to compare

Chores

  • deps: update to textlint@11 (877d3b7)

BREAKING CHANGES

  • deps: update to textlint@11 and textlint-tester@5

For more details, See blog

1.4.2

27 Jan 00:32
@azu azu
Compare
Choose a tag to compare
1.4.2

1.4.1

25 Dec 08:32
@azu azu
Compare
Choose a tag to compare
1.4.1

1.4.0

04 Nov 01:56
@azu azu
Compare
Choose a tag to compare

Features

  • register: add textlint-scripts/register (3e724f1)

1.3.0

28 Oct 08:16
@azu azu
Compare
Choose a tag to compare

Features

  • test: Update textlint-tester (#4) (0de715d)