https://github.com/textlint/babel-plugin-textlint-scripts
A babel plugin for textlint-script.
https://github.com/textlint/babel-plugin-textlint-scripts
Last synced: about 1 month ago
JSON representation
A babel plugin for textlint-script.
- Host: GitHub
- URL: https://github.com/textlint/babel-plugin-textlint-scripts
- Owner: textlint
- License: mit
- Created: 2020-09-09T02:51:41.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-09T13:29:39.000Z (almost 6 years ago)
- Last Synced: 2025-11-28T06:22:59.688Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 74.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-textlint-scripts
A babel plugin for textlint-scripts.
- Generate `meta` data for the rule automatically
- Convert TypeScript's `Option` type to JSON Schema
## Example
**In**
```ts
export type Options = {
str_key: string;
};
const report = () => {
return {};
};
export default report;
```
**Out**
```js
const report = () => {
return {};
};
export default report;
export const meta = {
name: "@textlint/babel-plugin-textlint-scripts",
description: "A babel plugin for textlint-scripts.",
homepage: "https://github.com/textlint/babel-plugin-textlint-scripts",
schema: {
"type": "object",
"properties": {
"str_key": {
"type": "string"
}
},
"additionalProperties": false,
"required": ["str_key"],
"$schema": "http://json-schema.org/draft-07/schema#"
}
};
```
## Installation
```sh
$ npm install @textlint/babel-plugin-textlint-scripts
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["@textlint/textlint-scripts"]
}
```
### Via CLI
```sh
$ babel --plugins textlint-scripts script.js
```
### Via Node API
```javascript
require("babel-core").transform("code", {
plugins: ["@textlint/textlint-scripts"]
});
```
## Contributing
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D
## License
MIT