Skip to content

Commit 1eb509b

Browse files
committed
feat(rule): contractions
1 parent 8362fc3 commit 1eb509b

File tree

3 files changed

+120
-39
lines changed

3 files changed

+120
-39
lines changed

Crystal/Contractions.yml

+31
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,25 @@ swap:
1717
"hasn't": has not
1818
"haven't": have not
1919
"he'd": he had|he would
20+
"he's": he is|he has
21+
"he'll": he will|he shall
2022
"here'd": here had|here would
23+
"here's": here is|here has
2124
"how'd": how did|how would
2225
"how's": how is
2326
"how'll": how will
27+
"I'm": I am
2428
"I'd": I had|I would
29+
"I've": I have
30+
"I'll": I will
2531
"isn't": is not
2632
"it'd": it had|it would
2733
"it's": it is|it has
2834
"it'll": it will|it shall
2935
"let's": let us
3036
"she'd": she had|she would
37+
"she's": she is|she has
38+
"she'll": she will|she shall
3139
"should've": should have
3240
"shouldn't": should not
3341
"somebody'd": somebody had|somebody would
@@ -37,17 +45,40 @@ swap:
3745
"that'll": that will
3846
"they're": they are
3947
"they'd": they had|they would
48+
"they've": they have
4049
"they'll": they will|they shall
4150
"there'd": there would|there had
51+
"there's": there is|there has
4252
"wasn't": was not
4353
"we're": we are
4454
"we've": we have
4555
"we'll": we will
4656
"we'd": we would|we had
57+
"weren't": were not
4758
# "what'd": what did|what had|what would
59+
# "what's": what is
60+
# "what'll": what will
4861
# "when'd": when did|when had|when would
62+
# "when's": when is
63+
# "when'll": when will
4964
# "where'd": where did|where had|where would
65+
# "where's": where is
66+
# "where'll": where will
5067
# "which'd": which did|which had|which would
5168
# "who'd": who did|who had|who would
69+
# "who're": who are
70+
# "who's": who is
71+
# "who'll": who will
5272
# "why'd": why did|why had|why would
73+
# "why's": why is|why has
74+
# "why'll": why will|why shall
75+
# "will've": will have
76+
# "won't": will not
77+
# "w/(?!o) ": "with "
78+
# "w/o": without
79+
# "would've": would have
80+
# "wouldn't": would not
81+
# "you're": you are
5382
# "you'd": you did|you had|you would
83+
# "you've": you have
84+
# "you'll": you will|you shall

fixtures/Contractions/test.md

+36
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,20 @@ They haven't decided on a venue for the wedding.
3838
He'd already finished his homework before dinner.
3939
He'd like to go to the movies tonight.
4040

41+
<!-- he's -->
42+
He's going to the store to buy some groceries.
43+
He's always been a reliable friend who can be counted on.
44+
45+
<!-- he'll -->
46+
He'll be here soon, so please wait for him patiently.
47+
4148
<!-- here'd -->
4249
Here'd been where we parked the car.
4350
Here'd we go again with another delay.
4451

52+
<!-- here's -->
53+
Here's your coat; you left it in the car.
54+
4555
<!-- how'd -->
4656
How'd you get here so fast?
4757
How'd you feel about going on a trip?
@@ -52,9 +62,18 @@ How's the weather outside?
5262
<!-- how'll -->
5363
How'll it affect our plans to spin off the stock?
5464

65+
<!-- I'm -->
66+
I'm thinking of starting a new hobby.
67+
5568
<!-- I'd -->
5669
I'd visited Paris once before, but I'd like to go again.
5770

71+
<!-- I've -->
72+
I've heard great things about that restaurant; we should try it.
73+
74+
<!-- I'll -->
75+
I'll call you as soon as I get home.
76+
5877
<!-- isn't -->
5978
The store isn't open on Sundays.
6079

@@ -76,6 +95,13 @@ Let's not waste any more time on this problem.
7695
She'd already left by the time I arrived.
7796
She'd love to join us for dinner tonight.
7897

98+
<!-- she's -->
99+
She's coming over for dinner tonight.
100+
She's been working at the company for ten years.
101+
102+
<!-- she'll -->
103+
She'll probably choose the red dress for the party.
104+
79105
<!-- should've -->
80106
I should've studied more for the exam.
81107

@@ -108,10 +134,17 @@ Do you know where they're from?
108134
There'd always been a strong sense of community in that neighborhood.
109135
There'd be no problem if you arrive a bit earlier.
110136

137+
<!-- there's -->
138+
There's a problem with the printer.
139+
There's been a conflict in this region for ages.
140+
111141
<!-- they'd -->
112142
I heard they'd finished the project ahead of schedule.
113143
They'd love to join us for dinner tonight.
114144

145+
<!-- they've -->
146+
They've decided to move to a different city.
147+
115148
<!-- they'll -->
116149
If they finish their work early, they'll join us for dinner.
117150

@@ -130,3 +163,6 @@ We'll have to wait and see what happens.
130163
<!-- we'd -->
131164
We'd love to join you for dinner tomorrow.
132165
We'd already finished our homework by the time you called.
166+
167+
<!-- weren't -->
168+
The roads weren't as congested as we had anticipated.

test/parameters/Contractions/index.js

+53-39
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,58 @@ export default [
1515
test.md:34:6:Crystal.Contractions:Avoid contractions. Use 'have not' instead of 'haven't'.
1616
test.md:38:1:Crystal.Contractions:Avoid contractions. Use 'He had' or 'He would' instead of 'He'd'.
1717
test.md:39:1:Crystal.Contractions:Avoid contractions. Use 'He had' or 'He would' instead of 'He'd'.
18-
test.md:42:1:Crystal.Contractions:Avoid contractions. Use 'Here had' or 'Here would' instead of 'Here'd'.
19-
test.md:43:1:Crystal.Contractions:Avoid contractions. Use 'Here had' or 'Here would' instead of 'Here'd'.
20-
test.md:46:1:Crystal.Contractions:Avoid contractions. Use 'How did' or 'How would' instead of 'How'd'.
21-
test.md:47:1:Crystal.Contractions:Avoid contractions. Use 'How did' or 'How would' instead of 'How'd'.
22-
test.md:50:1:Crystal.Contractions:Avoid contractions. Use 'How is' instead of 'How's'.
23-
test.md:53:1:Crystal.Contractions:Avoid contractions. Use 'How will' instead of 'How'll'.
24-
test.md:56:1:Crystal.Contractions:Avoid contractions. Use 'I had' or 'I would' instead of 'I'd'.
25-
test.md:59:11:Crystal.Contractions:Avoid contractions. Use 'is not' instead of 'isn't'.
26-
test.md:62:1:Crystal.Contractions:Avoid contractions. Use 'It had' or 'It would' instead of 'It'd'.
27-
test.md:63:1:Crystal.Contractions:Avoid contractions. Use 'It had' or 'It would' instead of 'It'd'.
28-
test.md:66:1:Crystal.Contractions:Avoid contractions. Use 'It is' or 'It has' instead of 'It's'.
29-
test.md:67:1:Crystal.Contractions:Avoid contractions. Use 'It is' or 'It has' instead of 'It's'.
30-
test.md:70:1:Crystal.Contractions:Avoid contractions. Use 'It will' or 'It shall' instead of 'It'll'.
31-
test.md:73:1:Crystal.Contractions:Avoid contractions. Use 'Let us' instead of 'Let's'.
32-
test.md:76:1:Crystal.Contractions:Avoid contractions. Use 'She had' or 'She would' instead of 'She'd'.
33-
test.md:77:1:Crystal.Contractions:Avoid contractions. Use 'She had' or 'She would' instead of 'She'd'.
34-
test.md:80:3:Crystal.Contractions:Avoid contractions. Use 'should have' instead of 'should've'.
35-
test.md:83:4:Crystal.Contractions:Avoid contractions. Use 'should not' instead of 'shouldn't'.
36-
test.md:86:1:Crystal.Contractions:Avoid contractions. Use 'Somebody had' or 'Somebody would' instead of 'Somebody'd'.
37-
test.md:87:1:Crystal.Contractions:Avoid contractions. Use 'Somebody had' or 'Somebody would' instead of 'Somebody'd'.
38-
test.md:90:1:Crystal.Contractions:Avoid contractions. Use 'Someone had' or 'Someone would' instead of 'Someone'd'.
39-
test.md:91:1:Crystal.Contractions:Avoid contractions. Use 'Someone had' or 'Someone would' instead of 'Someone'd'.
40-
test.md:94:12:Crystal.Contractions:Avoid contractions. Use 'that had' or 'that would' instead of 'that'd'.
41-
test.md:95:1:Crystal.Contractions:Avoid contractions. Use 'That had' or 'That would' instead of 'That'd'.
42-
test.md:98:1:Crystal.Contractions:Avoid contractions. Use 'That is' or 'That has' instead of 'That's'.
43-
test.md:99:9:Crystal.Contractions:Avoid contractions. Use 'that is' or 'that has' instead of 'that's'.
44-
test.md:102:25:Crystal.Contractions:Avoid contractions. Use 'that will' instead of 'that'll'.
45-
test.md:105:19:Crystal.Contractions:Avoid contractions. Use 'they are' instead of 'they're'.
46-
test.md:108:1:Crystal.Contractions:Avoid contractions. Use 'There would' or 'There had' instead of 'There'd'.
47-
test.md:109:1:Crystal.Contractions:Avoid contractions. Use 'There would' or 'There had' instead of 'There'd'.
48-
test.md:112:9:Crystal.Contractions:Avoid contractions. Use 'they had' or 'they would' instead of 'they'd'.
49-
test.md:113:1:Crystal.Contractions:Avoid contractions. Use 'They had' or 'They would' instead of 'They'd'.
50-
test.md:116:34:Crystal.Contractions:Avoid contractions. Use 'they will' or 'they shall' instead of 'they'll'.
51-
test.md:119:4:Crystal.Contractions:Avoid contractions. Use 'was not' instead of 'wasn't'.
52-
test.md:122:1:Crystal.Contractions:Avoid contractions. Use 'We are' instead of 'We're'.
53-
test.md:125:1:Crystal.Contractions:Avoid contractions. Use 'We have' instead of 'We've'.
54-
test.md:128:1:Crystal.Contractions:Avoid contractions. Use 'We will' instead of 'We'll'.
55-
test.md:131:1:Crystal.Contractions:Avoid contractions. Use 'We would' or 'We had' instead of 'We'd'.
56-
test.md:132:1:Crystal.Contractions:Avoid contractions. Use 'We would' or 'We had' instead of 'We'd'.
18+
test.md:42:1:Crystal.Contractions:Avoid contractions. Use 'He is' or 'He has' instead of 'He's'.
19+
test.md:43:1:Crystal.Contractions:Avoid contractions. Use 'He is' or 'He has' instead of 'He's'.
20+
test.md:46:1:Crystal.Contractions:Avoid contractions. Use 'He will' or 'He shall' instead of 'He'll'.
21+
test.md:49:1:Crystal.Contractions:Avoid contractions. Use 'Here had' or 'Here would' instead of 'Here'd'.
22+
test.md:50:1:Crystal.Contractions:Avoid contractions. Use 'Here had' or 'Here would' instead of 'Here'd'.
23+
test.md:53:1:Crystal.Contractions:Avoid contractions. Use 'Here is' or 'Here has' instead of 'Here's'.
24+
test.md:56:1:Crystal.Contractions:Avoid contractions. Use 'How did' or 'How would' instead of 'How'd'.
25+
test.md:57:1:Crystal.Contractions:Avoid contractions. Use 'How did' or 'How would' instead of 'How'd'.
26+
test.md:60:1:Crystal.Contractions:Avoid contractions. Use 'How is' instead of 'How's'.
27+
test.md:63:1:Crystal.Contractions:Avoid contractions. Use 'How will' instead of 'How'll'.
28+
test.md:66:1:Crystal.Contractions:Avoid contractions. Use 'I am' instead of 'I'm'.
29+
test.md:69:1:Crystal.Contractions:Avoid contractions. Use 'I had' or 'I would' instead of 'I'd'.
30+
test.md:72:1:Crystal.Contractions:Avoid contractions. Use 'I have' instead of 'I've'.
31+
test.md:75:1:Crystal.Contractions:Avoid contractions. Use 'I will' instead of 'I'll'.
32+
test.md:78:11:Crystal.Contractions:Avoid contractions. Use 'is not' instead of 'isn't'.
33+
test.md:81:1:Crystal.Contractions:Avoid contractions. Use 'It had' or 'It would' instead of 'It'd'.
34+
test.md:82:1:Crystal.Contractions:Avoid contractions. Use 'It had' or 'It would' instead of 'It'd'.
35+
test.md:85:1:Crystal.Contractions:Avoid contractions. Use 'It is' or 'It has' instead of 'It's'.
36+
test.md:86:1:Crystal.Contractions:Avoid contractions. Use 'It is' or 'It has' instead of 'It's'.
37+
test.md:89:1:Crystal.Contractions:Avoid contractions. Use 'It will' or 'It shall' instead of 'It'll'.
38+
test.md:92:1:Crystal.Contractions:Avoid contractions. Use 'Let us' instead of 'Let's'.
39+
test.md:95:1:Crystal.Contractions:Avoid contractions. Use 'She had' or 'She would' instead of 'She'd'.
40+
test.md:96:1:Crystal.Contractions:Avoid contractions. Use 'She had' or 'She would' instead of 'She'd'.
41+
test.md:99:1:Crystal.Contractions:Avoid contractions. Use 'She is' or 'She has' instead of 'She's'.
42+
test.md:100:1:Crystal.Contractions:Avoid contractions. Use 'She is' or 'She has' instead of 'She's'.
43+
test.md:103:1:Crystal.Contractions:Avoid contractions. Use 'She will' or 'She shall' instead of 'She'll'.
44+
test.md:106:3:Crystal.Contractions:Avoid contractions. Use 'should have' instead of 'should've'.
45+
test.md:109:4:Crystal.Contractions:Avoid contractions. Use 'should not' instead of 'shouldn't'.
46+
test.md:112:1:Crystal.Contractions:Avoid contractions. Use 'Somebody had' or 'Somebody would' instead of 'Somebody'd'.
47+
test.md:113:1:Crystal.Contractions:Avoid contractions. Use 'Somebody had' or 'Somebody would' instead of 'Somebody'd'.
48+
test.md:116:1:Crystal.Contractions:Avoid contractions. Use 'Someone had' or 'Someone would' instead of 'Someone'd'.
49+
test.md:117:1:Crystal.Contractions:Avoid contractions. Use 'Someone had' or 'Someone would' instead of 'Someone'd'.
50+
test.md:120:12:Crystal.Contractions:Avoid contractions. Use 'that had' or 'that would' instead of 'that'd'.
51+
test.md:121:1:Crystal.Contractions:Avoid contractions. Use 'That had' or 'That would' instead of 'That'd'.
52+
test.md:124:1:Crystal.Contractions:Avoid contractions. Use 'That is' or 'That has' instead of 'That's'.
53+
test.md:125:9:Crystal.Contractions:Avoid contractions. Use 'that is' or 'that has' instead of 'that's'.
54+
test.md:128:25:Crystal.Contractions:Avoid contractions. Use 'that will' instead of 'that'll'.
55+
test.md:131:19:Crystal.Contractions:Avoid contractions. Use 'they are' instead of 'they're'.
56+
test.md:134:1:Crystal.Contractions:Avoid contractions. Use 'There would' or 'There had' instead of 'There'd'.
57+
test.md:135:1:Crystal.Contractions:Avoid contractions. Use 'There would' or 'There had' instead of 'There'd'.
58+
test.md:138:1:Crystal.Contractions:Avoid contractions. Use 'There is' or 'There has' instead of 'There's'.
59+
test.md:139:1:Crystal.Contractions:Avoid contractions. Use 'There is' or 'There has' instead of 'There's'.
60+
test.md:142:9:Crystal.Contractions:Avoid contractions. Use 'they had' or 'they would' instead of 'they'd'.
61+
test.md:143:1:Crystal.Contractions:Avoid contractions. Use 'They had' or 'They would' instead of 'They'd'.
62+
test.md:146:1:Crystal.Contractions:Avoid contractions. Use 'They have' instead of 'They've'.
63+
test.md:149:34:Crystal.Contractions:Avoid contractions. Use 'they will' or 'they shall' instead of 'they'll'.
64+
test.md:152:4:Crystal.Contractions:Avoid contractions. Use 'was not' instead of 'wasn't'.
65+
test.md:155:1:Crystal.Contractions:Avoid contractions. Use 'We are' instead of 'We're'.
66+
test.md:158:1:Crystal.Contractions:Avoid contractions. Use 'We have' instead of 'We've'.
67+
test.md:161:1:Crystal.Contractions:Avoid contractions. Use 'We will' instead of 'We'll'.
68+
test.md:164:1:Crystal.Contractions:Avoid contractions. Use 'We would' or 'We had' instead of 'We'd'.
69+
test.md:165:1:Crystal.Contractions:Avoid contractions. Use 'We would' or 'We had' instead of 'We'd'.
70+
test.md:168:11:Crystal.Contractions:Avoid contractions. Use 'were not' instead of 'weren't'.
5771
`
5872
];

0 commit comments

Comments
 (0)