Skip to content

Commit b170fa6

Browse files
committed
fix(rule): tone down aggressive oxford comma rule
1 parent 4aca612 commit b170fa6

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

Prim/OxfordComma.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ level: suggestion
44
scope: sentence
55
nonword: true
66
tokens:
7-
- '\b[\w\s]+?(?:,\s*[\w\s]+){1,}\s+(?:and|or)\s+[\w\s]+[.?!]?'
7+
- '(?:[^\s,]+,){1,} \w+ (?:and|or) \w+[.?!]'

test/fixtures/OxfordComma/test.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44
The ingredients for the recipe included flour, sugar, eggs and butter.
55
Should I first unpack my clothes, toiletries or books?
66

7-
<!-- ❌ trigger on the missing comma before and/or for listing three or more clauses -->
8-
He enjoys reading, playing the guitar and hiking in his free time.
9-
You can choose to visit the museum, go hiking or relax at home.
10-
Why don't you try out fishing on the lake, taking a hike, reading on the beach or just lazing around?
11-
127
<!-- ✅ ignore on the use of two items around and/or -->
138
The improvements come in bits and pieces.
149
You can choose to go fast or go smoothly.
15-
<!-- TODO: This site has no ads, no tracking or analytics, no sponsored posts, and no paywall. -->
10+
At this point, I could have gone ahead and generated a subset of this font.
11+
This site has no ads, no tracking or analytics, no sponsored posts, and no paywall.

test/snapshots/OxfordComma.log

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
test.md:4:1:Prim.OxfordComma:Use the Oxford comma in 'The ingredients for the recipe included flour, sugar, eggs and butter.'.
2-
test.md:5:1:Prim.OxfordComma:Use the Oxford comma in 'Should I first unpack my clothes, toiletries or books?'.
3-
test.md:8:1:Prim.OxfordComma:Use the Oxford comma in 'He enjoys reading, playing the guitar and hiking in his free time.'.
4-
test.md:9:1:Prim.OxfordComma:Use the Oxford comma in 'You can choose to visit the museum, go hiking or relax at home.'.
5-
test.md:10:9:Prim.OxfordComma:Use the Oxford comma in 't you try out fishing on the lake, taking a hike, reading on the beach or just lazing around?'.
1+
test.md:4:48:Prim.OxfordComma:Use the Oxford comma in 'sugar, eggs and butter.'.
2+
test.md:5:26:Prim.OxfordComma:Use the Oxford comma in 'clothes, toiletries or books?'.

0 commit comments

Comments
 (0)