File tree 3 files changed +23
-19
lines changed
3 files changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,16 @@ export default function retextPassive(options = {}) {
37
37
return
38
38
}
39
39
40
+ const start = pointStart ( match [ 0 ] )
41
+ const end = pointEnd ( match [ match . length - 1 ] )
42
+
40
43
Object . assign (
41
- file . message (
42
- 'Don’t use the passive voice' ,
43
- { start : pointStart ( match [ 0 ] ) , end : pointEnd ( match [ match . length - 1 ] ) } ,
44
- [ source , phrase . replace ( / \s + / g, '-' ) . toLowerCase ( ) ] . join ( ':' )
45
- ) ,
44
+ file . message ( 'Don’t use the passive voice' , {
45
+ /* c8 ignore next -- hard to test */
46
+ place : start && end ? { start, end} : undefined ,
47
+ source,
48
+ ruleId : phrase . replace ( / \s + / g, '-' ) . toLowerCase ( )
49
+ } ) ,
46
50
{ actual : toString ( match ) , expected : [ ] , url}
47
51
)
48
52
} )
Original file line number Diff line number Diff line change 33
33
" list.js"
34
34
],
35
35
"dependencies" : {
36
- "@types/nlcst" : " ^1 .0.0" ,
37
- "nlcst-search" : " ^3 .0.0" ,
38
- "nlcst-to-string" : " ^3 .0.0" ,
39
- "unified" : " ^10 .0.0" ,
40
- "unist-util-find-before" : " ^3 .0.0" ,
41
- "unist-util-position" : " ^4 .0.0"
36
+ "@types/nlcst" : " ^2 .0.0" ,
37
+ "nlcst-search" : " ^4 .0.0" ,
38
+ "nlcst-to-string" : " ^4 .0.0" ,
39
+ "unified" : " ^11 .0.0" ,
40
+ "unist-util-find-before" : " ^4 .0.0" ,
41
+ "unist-util-position" : " ^5 .0.0"
42
42
},
43
43
"devDependencies" : {
44
44
"@types/tape" : " ^5.0.0" ,
45
45
"c8" : " ^8.0.0" ,
46
46
"prettier" : " ^3.0.0" ,
47
47
"remark-cli" : " ^11.0.0" ,
48
48
"remark-preset-wooorm" : " ^9.0.0" ,
49
- "retext" : " ^8 .0.0" ,
49
+ "retext" : " ^9 .0.0" ,
50
50
"rimraf" : " ^3.0.0" ,
51
51
"tape" : " ^5.0.0" ,
52
52
"type-coverage" : " ^2.0.0" ,
Original file line number Diff line number Diff line change @@ -27,18 +27,18 @@ test('retext-passive', (t) => {
27
27
t . deepEqual (
28
28
JSON . parse ( JSON . stringify ( file . messages [ 0 ] ) ) ,
29
29
{
30
- name : '1:8-1:16' ,
30
+ column : 8 ,
31
+ fatal : false ,
31
32
message : 'Don’t use the passive voice' ,
32
- reason : 'Don’t use the passive voice' ,
33
33
line : 1 ,
34
- column : 8 ,
35
- source : 'retext-passive' ,
36
- ruleId : 'withheld' ,
37
- position : {
34
+ name : '1:8-1:16' ,
35
+ place : {
38
36
start : { line : 1 , column : 8 , offset : 7 } ,
39
37
end : { line : 1 , column : 16 , offset : 15 }
40
38
} ,
41
- fatal : false ,
39
+ reason : 'Don’t use the passive voice' ,
40
+ ruleId : 'withheld' ,
41
+ source : 'retext-passive' ,
42
42
actual : 'withheld' ,
43
43
expected : [ ] ,
44
44
url : 'https://github.com/retextjs/retext-passive#readme'
You can’t perform that action at this time.
0 commit comments