textlint/textlint-scripts
### [`v3.0.0`](https://togithub.com/textlint/textlint-scripts/releases/3.0.0)
[Compare Source](https://togithub.com/textlint/textlint-scripts/compare/2.1.0...3.0.0)
### 3.0.0
Major release of textlint-scripts!
Also, update [create-textlint-rule@1.4.0](https://togithub.com/textlint/create-textlint-rule/releases/tag/1.4.0).
You can create TypeScript project for textlint rule:
$ npx create-textlint-rule example --typescript
#### Summary
- [x] Support Async Function [#23](https://togithub.com/textlint/textlint-scripts/issues/23)
- [x] Inline static resources in building for Browser [#31](https://togithub.com/textlint/textlint-scripts/issues/31)
- [x] Support TypeScript [#27](https://togithub.com/textlint/textlint-scripts/issues/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](https://nodejs.org/api/fs.html) with [babel-plugin-static-fs](https://togithub.com/Jam3/babel-plugin-static-fs) for browser compatibility.
```js
const fs = require("fs");
const path = require("path");
const text = fs.readFileSync(path.join(__dirname, "readme.md"), "utf-8");
```
will be
```js
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](https://togithub.com/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](https://togithub.com/textlint/create-textlint-rule).
$ npx create-textlint-rule example --typescript
##### Migration Guide
- Migration Script: [@textlint/migrate-textlint-scripts-typescript](https://togithub.com/textlint/migrate-textlint-scripts-typescript)
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
2. Rename `.js` to `.ts`
3. Fix TypeScript Error
[@textlint/types](https://togithub.com/textlint/textlint/tree/master/packages/%40textlint/types) provide types for textlint rule.
```ts
import { TextlintRuleModule, TextlintRuleReporter } from "@textlint/types";
export interface RuleOptions {
foo: boolean;
}
const report: TextlintRuleReporter = function(context, options = {}) {
const { Syntax, RuleError, report, getSource } = context;
return {
[Syntax.Str](node) {
// ...
}
};
};
export default {
linter: report,
fixer: report
} as TextlintRuleModule;
```
4. `npm test` and `npm run build`.
**Migration Scrips**: [@textlint/migrate-textlint-scripts-typescript](https://togithub.com/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](https://togithub.com/textlint/migrate-textlint-scripts-typescript).
**Examples:**
Following examples are migrated to TypeScript from JavaScript.
- [textlint-ja/textlint-rule-no-doubled-joshi#24](https://togithub.com/textlint-ja/textlint-rule-no-doubled-joshi/pull/24)
- [textlint-ja/textlint-rule-ja-no-abusage#11](https://togithub.com/textlint-ja/textlint-rule-ja-no-abusage/pull/11)
- [textlint-ja/textlint-rule-no-nfd#1](https://togithub.com/textlint-ja/textlint-rule-no-nfd/pull/1)
- [textlint-ja/textlint-rule-ja-no-redundant-expression#22](https://togithub.com/textlint-ja/textlint-rule-ja-no-redundant-expression/pull/22)
- [textlint-ja/textlint-rule-preset-JTF-style#69](https://togithub.com/textlint-ja/textlint-rule-preset-JTF-style/pull/69)
- preset example
Renovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.
:recycle: Rebasing: Whenever PR becomes conflicted, or if you modify the PR title to begin with "rebase!".
:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Renovate Bot. View repository job log here.
This PR contains the following updates:
^2.1.0
->^3.0.0
Release Notes
textlint/textlint-scripts
### [`v3.0.0`](https://togithub.com/textlint/textlint-scripts/releases/3.0.0) [Compare Source](https://togithub.com/textlint/textlint-scripts/compare/2.1.0...3.0.0) ### 3.0.0 Major release of textlint-scripts! Also, update [create-textlint-rule@1.4.0](https://togithub.com/textlint/create-textlint-rule/releases/tag/1.4.0). You can create TypeScript project for textlint rule: $ npx create-textlint-rule example --typescript #### Summary - [x] Support Async Function [#23](https://togithub.com/textlint/textlint-scripts/issues/23) - [x] Inline static resources in building for Browser [#31](https://togithub.com/textlint/textlint-scripts/issues/31) - [x] Support TypeScript [#27](https://togithub.com/textlint/textlint-scripts/issues/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](https://nodejs.org/api/fs.html) with [babel-plugin-static-fs](https://togithub.com/Jam3/babel-plugin-static-fs) for browser compatibility. ```js const fs = require("fs"); const path = require("path"); const text = fs.readFileSync(path.join(__dirname, "readme.md"), "utf-8"); ``` will be ```js 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](https://togithub.com/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](https://togithub.com/textlint/create-textlint-rule). $ npx create-textlint-rule example --typescript ##### Migration Guide - Migration Script: [@textlint/migrate-textlint-scripts-typescript](https://togithub.com/textlint/migrate-textlint-scripts-typescript) 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 2. Rename `.js` to `.ts` 3. Fix TypeScript Error [@textlint/types](https://togithub.com/textlint/textlint/tree/master/packages/%40textlint/types) provide types for textlint rule. ```ts import { TextlintRuleModule, TextlintRuleReporter } from "@textlint/types"; export interface RuleOptions { foo: boolean; } const report: TextlintRuleReporterRenovate configuration
:date: Schedule: At any time (no schedule defined).
:vertical_traffic_light: Automerge: Disabled by config. Please merge this manually once you are satisfied.
:recycle: Rebasing: Whenever PR becomes conflicted, or if you modify the PR title to begin with "
rebase!
".:no_bell: Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot. View repository job log here.