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

3.0.0 #28

Closed
3 tasks done
azu opened this issue Jun 23, 2019 · 6 comments
Closed
3 tasks done

3.0.0 #28

azu opened this issue Jun 23, 2019 · 6 comments

Comments

@azu
Copy link
Member

azu commented Jun 23, 2019

3.0.0 Beta-0

This is beta release

You can try it:

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

Summary

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 ⭐️

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"

📝 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.

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";
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:

@azu
Copy link
Member Author

azu commented Jul 7, 2019

@azu
Copy link
Member Author

azu commented Jul 13, 2019

@azu
Copy link
Member Author

azu commented Oct 19, 2019

Browser suppport test tool
https://github.com/textlint/browser-run

@azu
Copy link
Member Author

azu commented Oct 19, 2019

@azu
Copy link
Member Author

azu commented Oct 19, 2019

We will release it at tommorow.

If you found an issue, please tell us.

Try to beta:

npm install -D [email protected]

@azu
Copy link
Member Author

azu commented Oct 20, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant