Skip to content

Commit 6de41bb

Browse files
authored
Merge pull request #1 from textlint-ja/migrate-textlint-scripts
refactor(rule): migrate textlint-scripts
2 parents 12fe5d2 + 61cb306 commit 6de41bb

8 files changed

+4144
-41
lines changed

.babelrc

-13
This file was deleted.

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# textlint-rule-no-nfd [![Build Status](https://travis-ci.org/azu/textlint-rule-no-nfd.svg?branch=master)](https://travis-ci.org/azu/textlint-rule-no-nfd) [![textlint rule](https://img.shields.io/badge/textlint-fixable-green.svg?style=social)](https://textlint.github.io/)
1+
# textlint-rule-no-nfd [![Build Status](https://travis-ci.org/textlint-ja/textlint-rule-no-nfd.svg?branch=master)](https://travis-ci.org/textlint-ja/textlint-rule-no-nfd) [![textlint rule](https://img.shields.io/badge/textlint-fixable-green.svg?style=social)](https://textlint.github.io/)
22

33
[textlint](https://textlint.github.io/ "textlint") rule that disallow to use NFD like UTF8-MAC 濁点.
44

@@ -56,7 +56,7 @@ textlint --rule no-nfd README.md
5656

5757
## Changelog
5858

59-
See [Releases page](https://github.com/azu/textlint-rule-no-nfd/releases).
59+
See [Releases page](https://github.com/textlint-ja/textlint-rule-no-nfd/releases).
6060

6161
## Running tests
6262

@@ -102,7 +102,7 @@ via [Unicodeの特殊な文字 “結合文字列” | ものかの](http://tama
102102
## Contributing
103103

104104
Pull requests and stars are always welcome.
105-
For bugs and feature requests, [please create an issue](https://github.com/azu/textlint-rule-no-nfd/issues).
105+
For bugs and feature requests, [please create an issue](https://github.com/textlint-ja/textlint-rule-no-nfd/issues).
106106

107107
1. Fork it!
108108
2. Create your feature branch: `git checkout -b my-new-feature`

package.json

+13-15
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "textlint-rule-no-nfd",
33
"repository": {
44
"type": "git",
5-
"url": "https://github.com/azu/textlint-rule-no-nfd.git"
5+
"url": "https://github.com/textlint-ja/textlint-rule-no-nfd.git"
66
},
77
"author": "azu",
88
"email": "[email protected]",
9-
"homepage": "https://github.com/azu/textlint-rule-no-nfd",
9+
"homepage": "https://github.com/textlint-ja/textlint-rule-no-nfd",
1010
"license": "MIT",
1111
"bugs": {
12-
"url": "https://github.com/azu/textlint-rule-no-nfd/issues"
12+
"url": "https://github.com/textlint-ja/textlint-rule-no-nfd/issues"
1313
},
1414
"files": [
1515
"src/",
@@ -22,27 +22,25 @@
2222
"test": "test"
2323
},
2424
"scripts": {
25-
"test": "mocha test/",
26-
"build": "NODE_ENV=production babel src --out-dir lib --source-maps",
27-
"watch": "babel src --out-dir lib --watch --source-maps",
25+
"test": "textlint-scripts test",
26+
"build": "textlint-scripts build",
27+
"watch": "textlint-scripts build --watch",
2828
"prepublish": "npm run --if-present build"
2929
},
3030
"keywords": [
3131
"textlint"
3232
],
3333
"devDependencies": {
34-
"babel-cli": "^6.8.0",
35-
"babel-preset-es2015": "^6.6.0",
36-
"babel-preset-jsdoc-to-assert": "^1.0.1",
37-
"babel-preset-power-assert": "^1.0.0",
38-
"babel-register": "^6.8.0",
39-
"mocha": "^2.4.5",
34+
"@textlint/types": "^1.2.2",
35+
"@types/node": "^12.11.1",
4036
"power-assert": "^1.3.1",
41-
"textlint-tester": "^1.2.0"
37+
"textlint-scripts": "^3.0.0",
38+
"ts-node": "^8.4.1",
39+
"typescript": "^3.6.4"
4240
},
4341
"dependencies": {
44-
"match-index": "^1.0.1",
45-
"textlint-rule-helper": "^1.1.5",
42+
"match-index": "^1.0.3",
43+
"textlint-rule-helper": "^2.1.1",
4644
"unorm": "^1.4.1"
4745
}
4846
}

src/textlint-rule-no-nfd.js renamed to src/textlint-rule-no-nfd.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// LICENSE : MIT
22
"use strict";
3-
import {RuleHelper} from "textlint-rule-helper";
43
import {matchCaptureGroupAll} from "match-index"
4+
import {RuleHelper} from "textlint-rule-helper";
5+
import {TextlintRuleReporter} from "@textlint/types";
6+
57
const unorm = require("unorm");
6-
function reporter(context) {
8+
9+
const reporter: TextlintRuleReporter = function (context) {
710
const {Syntax, RuleError, report, fixer, getSource} = context;
811
const helper = new RuleHelper(context);
912
return {
10-
[Syntax.Str](node){
13+
[Syntax.Str](node) {
1114
if (helper.isChildNode(node, [Syntax.Link, Syntax.Image, Syntax.BlockQuote, Syntax.Emphasis])) {
1215
return;
1316
}
@@ -28,8 +31,9 @@ function reporter(context) {
2831
});
2932
}
3033
}
31-
}
34+
};
35+
3236
module.exports = {
3337
linter: reporter,
3438
fixer: reporter
35-
};
39+
};

test/mocha.opts

-1
This file was deleted.

test/textlint-rule-no-nfd-test.js renamed to test/textlint-rule-no-nfd-test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const TextLintTester = require("textlint-tester");
44
const tester = new TextLintTester();
55
// rule
6-
import rule from "../src/textlint-rule-no-nfd";
6+
const rule = require("../src/textlint-rule-no-nfd");
77
// ruleName, rule, { valid, invalid }
88
tester.run("no-nfd", rule, {
99
valid: [
@@ -35,7 +35,7 @@ tester.run("no-nfd", rule, {
3535
},
3636
{
3737
text: "エンシ\u3099ン",
38-
output:"エンジン",
38+
output: "エンジン",
3939
errors: [
4040
{
4141
message: `Disallow to use NFD(well-known as UTF8-MAC 濁点): "シ\u3099" => "ジ"`,
@@ -47,7 +47,7 @@ tester.run("no-nfd", rule, {
4747

4848
{
4949
text: "エンシ゛ン",
50-
output:"エンジン",
50+
output: "エンジン",
5151
errors: [
5252
{
5353
message: `Disallow to use NFD(well-known as UTF8-MAC 濁点): "シ\u309b" => "ジ"`,
@@ -57,4 +57,4 @@ tester.run("no-nfd", rule, {
5757
]
5858
}
5959
]
60-
});
60+
});

tsconfig.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
/* Basic Options */
4+
"module": "commonjs",
5+
"moduleResolution": "node",
6+
"esModuleInterop": true,
7+
"noEmit": true,
8+
"target": "es2015",
9+
/* Strict Type-Checking Options */
10+
"strict": true,
11+
/* Additional Checks */
12+
/* Report errors on unused locals. */
13+
"noUnusedLocals": true,
14+
/* Report errors on unused parameters. */
15+
"noUnusedParameters": true,
16+
/* Report error when not all code paths in function return a value. */
17+
"noImplicitReturns": true,
18+
/* Report errors for fallthrough cases in switch statement. */
19+
"noFallthroughCasesInSwitch": true
20+
}
21+
}

0 commit comments

Comments
 (0)