Skip to content

Commit a0901c6

Browse files
committed
feat(preset): add textlint-rule-preset-ja-spacing
close #3
1 parent 53e5575 commit a0901c6

File tree

6 files changed

+208
-0
lines changed

6 files changed

+208
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,52 @@
44

55
日本語周りにおけるスペースの有無を決定するtextlintルールプリセットを提供します。
66

7+
- [textlint-rule-preset-ja-spacing](./packages/textlint-rule-preset-ja-spacing)
8+
9+
## Install
10+
11+
Install with [npm](https://www.npmjs.com/):
12+
13+
npm install textlint-rule-preset-ja-spacing
14+
15+
## Usage
16+
17+
Via `.textlintrc`(Recommended)
18+
19+
```json
20+
{
21+
"rules": {
22+
"preset-ja-spacing": true
23+
}
24+
}
25+
```
26+
27+
Via CLI
28+
29+
```
30+
textlint --rule preset-ja-spacing" README.md
31+
```
32+
33+
34+
## Options
35+
36+
デフォルトでは、[textlint-rule-ja-space-around-code](https://github.com/textlint-ja/textlint-rule-spacing/tree/master/packages/textlint-rule-ja-space-around-code)は無効になっています。
37+
38+
次のように設定することで、プリセットに含まれるすべてのルールを有効にできます。
39+
40+
```json
41+
{
42+
"rules": {
43+
"preset-ja-spacing": {
44+
"ja-space-around-code": {
45+
"before": false,
46+
"after": false
47+
}
48+
}
49+
}
50+
}
51+
```
52+
753
それぞれのルールは個別のモジュールであるため、必要なルールのみをインストールすることも可能です。
854

955
## ルール一覧
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015"]
3+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# textlint-rule-preset-ja-spacing
2+
3+
日本語周りにおけるスペースの有無を決定するtextlintルールプリセットです。
4+
5+
含まれているルールに関しては以下を参照してください。
6+
7+
- [textlint-ja/textlint-rule-spacing: スペース周りのスタイルを扱うtextlintルール集](https://github.com/textlint-ja/textlint-rule-spacing "textlint-ja/textlint-rule-spacing: スペース周りのスタイルを扱うtextlintルール集")
8+
9+
それぞれのルールは個別のモジュールであるため、必要なルールのみをインストールすることも可能です。
10+
11+
## Install
12+
13+
Install with [npm](https://www.npmjs.com/):
14+
15+
npm install textlint-rule-preset-ja-spacing
16+
17+
## Usage
18+
19+
Via `.textlintrc`(Recommended)
20+
21+
```json
22+
{
23+
"rules": {
24+
"preset-ja-spacing": true
25+
}
26+
}
27+
```
28+
29+
Via CLI
30+
31+
```
32+
textlint --rule preset-ja-spacing" README.md
33+
```
34+
35+
36+
## Options
37+
38+
デフォルトでは、[textlint-rule-ja-space-around-code](https://github.com/textlint-ja/textlint-rule-spacing/tree/master/packages/textlint-rule-ja-space-around-code)は無効になっています。
39+
40+
次のように設定することで、プリセットに含まれるすべてのルールを有効にできます。
41+
42+
```json
43+
{
44+
"rules": {
45+
"preset-ja-spacing": {
46+
"ja-space-around-code": {
47+
"before": false,
48+
"after": false
49+
}
50+
}
51+
}
52+
}
53+
```
54+
55+
## Changelog
56+
57+
See [Releases page](https://github.com/textlint-ja/textlint-rule-spacing/releases).
58+
59+
## Running tests
60+
61+
Install devDependencies and Run `npm test`:
62+
63+
npm i -d && npm test
64+
65+
## Contributing
66+
67+
Pull requests and stars are always welcome.
68+
69+
For bugs and feature requests, [please create an issue](https://github.com/textlint-ja/textlint-rule-spacing/issues).
70+
71+
1. Fork it!
72+
2. Create your feature branch: `git checkout -b my-new-feature`
73+
3. Commit your changes: `git commit -am 'Add some feature'`
74+
4. Push to the branch: `git push origin my-new-feature`
75+
5. Submit a pull request :D
76+
77+
## Author
78+
79+
- [github/azu](https://github.com/azu)
80+
- [twitter/azu_re](https://twitter.com/azu_re)
81+
82+
## License
83+
84+
MIT © azu
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "textlint-rule-preset-ja-spacing",
3+
"version": "1.0.0",
4+
"description": "textlint-rule-spacingのルールプリセット",
5+
"main": "lib/index.js",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/textlint-ja/textlint-rule-spacing.git"
9+
},
10+
"author": "azu",
11+
"email": "azuciao@gmail.com",
12+
"homepage": "https://github.com/textlint-ja/textlint-rule-spacing",
13+
"license": "MIT",
14+
"bugs": {
15+
"url": "https://github.com/textlint-ja/textlint-rule-spacing/issues"
16+
},
17+
"scripts": {
18+
"build": "NODE_ENV=production babel src --out-dir lib --source-maps",
19+
"watch": "babel src --out-dir lib --watch --source-maps",
20+
"prepublish": "npm run --if-present build",
21+
"test": "mocha"
22+
},
23+
"keywords": [
24+
"textlint"
25+
],
26+
"devDependencies": {
27+
"babel-cli": "^6.0.0",
28+
"babel-preset-es2015": "^6.0.0",
29+
"textlint-tester": "^2.0.0",
30+
"mocha": "^2.3.3"
31+
},
32+
"dependencies": {
33+
"textlint-rule-ja-nakaguro-or-halfwidth-space-between-katakana": "^1.0.0",
34+
"textlint-rule-ja-no-space-around-parentheses": "^1.0.0",
35+
"textlint-rule-ja-no-space-between-full-width": "^1.0.0",
36+
"textlint-rule-ja-no-space-between-half-and-full-width": "^1.0.0",
37+
"textlint-rule-ja-space-after-exclamation": "^1.0.0",
38+
"textlint-rule-ja-space-after-question": "^1.0.0",
39+
"textlint-rule-ja-space-around-code": "^1.0.0"
40+
}
41+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// LICENSE : MIT
2+
"use strict";
3+
module.exports = {
4+
rules: {
5+
"ja-nakaguro-or-halfwidth-space-between-katakana": require("textlint-rule-ja-nakaguro-or-halfwidth-space-between-katakana"),
6+
"ja-no-space-around-parentheses": require("textlint-rule-ja-no-space-around-parentheses"),
7+
"ja-no-space-between-full-width": require("textlint-rule-ja-no-space-between-full-width"),
8+
"ja-no-space-between-half-and-full-width": require("textlint-rule-ja-no-space-between-half-and-full-width"),
9+
"ja-space-after-exclamation": require("textlint-rule-ja-space-after-exclamation"),
10+
"ja-space-after-question": require("textlint-rule-ja-space-after-question"),
11+
"ja-space-around-code": require("textlint-rule-ja-space-around-code"),
12+
},
13+
rulesConfig: {
14+
"ja-nakaguro-or-halfwidth-space-between-katakana": true,
15+
"ja-no-space-around-parentheses": true,
16+
"ja-no-space-between-full-width": true,
17+
"ja-no-space-between-half-and-full-width": true,
18+
"ja-space-after-exclamation": true,
19+
"ja-space-after-question": true,
20+
"ja-space-around-code": false,
21+
}
22+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// LICENSE : MIT
2+
"use strict";
3+
const assert = require("assert");
4+
const rules = require("../src/index").rules;
5+
const rulesConfig = require("../src/index").rulesConfig;
6+
describe("textlint-rule-preset-ja-spacing", function() {
7+
it("not missing key", function() {
8+
const ruleKeys = Object.keys(rules).sort();
9+
const ruleConfigKeys = Object.keys(rulesConfig).sort();
10+
assert.deepEqual(ruleKeys, ruleConfigKeys);
11+
});
12+
});

0 commit comments

Comments
 (0)