@cffnpwr/textlint-rule-no-chained-continuative 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +126 -28
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +692 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +692 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +47 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cffnpwr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,45 +1,143 @@
|
|
|
1
1
|
# @cffnpwr/textlint-rule-no-chained-continuative
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@cffnpwr/textlint-rule-no-chained-continuative)
|
|
5
|
+
[](https://jsr.io/@cffnpwr/textlint-rule-no-chained-continuative)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
A textlint rule that detects a sentence in which three or more clauses are joined by the
|
|
8
|
+
continuative form (連用中止).
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
[日本語のREADMEはこちら](./README-ja.md)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
The continuative form (ending a clause with the 連用形 of a verb, as in 「読み込み、」 or 「変換し、」)
|
|
13
|
+
does not show the relationship between clauses (order, cause, parallelism, etc.). In a sentence
|
|
14
|
+
where it is repeated, it becomes hard to read which clause relates to which.
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
16
|
+
```markdown
|
|
17
|
+
<!-- NG -->
|
|
18
|
+
CLIはファイルを読み込み、形式を変換し、結果を保存する。
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
<!-- OK -->
|
|
21
|
+
CLIはファイルを読み込み、形式を変換する。
|
|
22
|
+
変換した結果を保存する。
|
|
23
|
+
```
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
A position is counted when the 連用形 of a verb or an auxiliary verb is immediately followed by the
|
|
26
|
+
full-width comma 「、」. 「であり、」 (the 連用形 of the auxiliary verb 「ある」) and 「〜せず、」 (the
|
|
27
|
+
連用形 of the auxiliary verb 「ぬ」) are also counted. The following are not counted.
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
- The 連用形 of an adjective (「正しく、」)
|
|
30
|
+
- The te-form (「読み込んで、」)
|
|
31
|
+
- A terminal form followed by a comma (「読み込みます、」)
|
|
21
32
|
|
|
22
|
-
|
|
33
|
+
Parts of speech and conjugation forms are determined from the result of morphological analysis
|
|
34
|
+
(kuromoji with IPAdic). Inline code, HTML, and images are not included in the text used for the
|
|
35
|
+
check.
|
|
23
36
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
37
|
+
When the number of counted positions in a sentence exceeds `max`, the word at the `max + 1`th
|
|
38
|
+
position is reported. One report is made per sentence. The targets are sentences in paragraphs,
|
|
39
|
+
including those in list items.
|
|
28
40
|
|
|
29
|
-
##
|
|
41
|
+
## How to Install
|
|
30
42
|
|
|
31
|
-
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
43
|
+
### npm
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
```sh
|
|
46
|
+
npm install --save-dev @cffnpwr/textlint-rule-no-chained-continuative
|
|
47
|
+
```
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
49
|
+
or
|
|
42
50
|
|
|
43
|
-
|
|
51
|
+
```sh
|
|
52
|
+
npx jsr add -D @cffnpwr/textlint-rule-no-chained-continuative
|
|
53
|
+
```
|
|
44
54
|
|
|
45
|
-
|
|
55
|
+
### yarn
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
yarn add --dev @cffnpwr/textlint-rule-no-chained-continuative
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
or
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
yarn dlx jsr add -D @cffnpwr/textlint-rule-no-chained-continuative
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### pnpm
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
pnpm add --save-dev @cffnpwr/textlint-rule-no-chained-continuative
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
or
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
pnpm dlx jsr add -D @cffnpwr/textlint-rule-no-chained-continuative
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Bun
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
bun add --dev @cffnpwr/textlint-rule-no-chained-continuative
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
or
|
|
86
|
+
|
|
87
|
+
```sh
|
|
88
|
+
bunx jsr add -D @cffnpwr/textlint-rule-no-chained-continuative
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Deno
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
deno add --dev npm:@cffnpwr/textlint-rule-no-chained-continuative
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
or
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
deno add --dev jsr:@cffnpwr/textlint-rule-no-chained-continuative
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## How to Use
|
|
104
|
+
|
|
105
|
+
Add it to `.textlintrc.json`.
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"rules": {
|
|
110
|
+
"@cffnpwr/textlint-rule-no-chained-continuative": true
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Options
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
interface Options {
|
|
119
|
+
max?: number;
|
|
120
|
+
skipBlockQuote?: boolean;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
| Option | Default | Description |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| `max` | `1` | The number of continuative forms to allow in a sentence. Specify an integer of 0 or more |
|
|
127
|
+
| `skipBlockQuote` | `true` | Excludes content under quotes (BlockQuote) from inspection |
|
|
128
|
+
|
|
129
|
+
Specifying an unknown option key or an invalid value results in an error.
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"rules": {
|
|
134
|
+
"@cffnpwr/textlint-rule-no-chained-continuative": {
|
|
135
|
+
"max": 2
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
[MIT](./LICENSE)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@cffnpwr/textlint-rule-preset-ja-writing-extras-shared"),t=require("arktype"),n=require("kuromojin"),r=require("sentence-splitter");const i=(0,t.type)({"+":`reject`,"max?":`number.integer >= 0`,"skipBlockQuote?":`boolean`,"severity?":`unknown`}),a=e=>(0,r.splitAST)(e),o=e=>e.pos!==`動詞`&&e.pos!==`助動詞`?!1:e.conjugated_form===`連用形`||e.pos===`助動詞`&&e.basic_form===`ぬ`&&e.conjugated_form===`連用ニ接続`,s=e=>{let t=[],n=0;return e.forEach((r,i)=>{let a=n;n+=r.surface_form.length,o(r)&&e[i+1]?.surface_form===`、`&&t.push({start:a,end:n})}),t},c=(t,o={})=>{(0,e.validateOptions)(i,o);let{Syntax:c,RuleError:l,report:u,locator:d}=t,f=o.max??1,p=o.skipBlockQuote??!0,m=(0,e.createBlockQuoteDepth)(),h=async t=>{if(p&&m.isInside())return;let i=t.range[0],o=a(t).children.filter(e=>e.type===r.SentenceSplitterSyntax.Sentence);for(let r of o){let a=(0,e.toMaskedStringSource)(r),o=s(await(0,n.tokenize)(a.toString())),c=o[f];if(c===void 0)continue;let p=a.originalIndexFromIndex(c.start),m=a.originalIndexFromIndex(c.end-1);if(p===void 0||m===void 0)continue;let h=r.range[0]-i;u(t,new l(`1文の中で連用中止(動詞・助動詞の連用形+読点)が${o.length}回使われています。${f}回までにしてください。文を分けるか、接続助詞・接続詞を使って節の関係を示してください。`,{padding:d.range([h+p,h+m+1])}))}};return{[c.BlockQuote]:m.enter,[c.BlockQuoteExit]:m.exit,[c.Paragraph]:h}};module.exports=c;
|