remark-lint-unordered-list-marker-style
Advanced tools
Comparing version 1.0.3 to 1.0.4
36
index.js
@@ -26,3 +26,3 @@ /** | ||
* | ||
* @example {"name": "valid.md"} | ||
* @example {"name": "ok.md"} | ||
* | ||
@@ -42,15 +42,15 @@ * By default (`'consistent'`), if the file uses only one marker, | ||
* | ||
* @example {"name": "valid.md", "setting": "*"} | ||
* @example {"name": "ok.md", "setting": "*"} | ||
* | ||
* * Foo | ||
* | ||
* @example {"name": "valid.md", "setting": "-"} | ||
* @example {"name": "ok.md", "setting": "-"} | ||
* | ||
* - Foo | ||
* | ||
* @example {"name": "valid.md", "setting": "+"} | ||
* @example {"name": "ok.md", "setting": "+"} | ||
* | ||
* + Foo | ||
* | ||
* @example {"name": "invalid.md", "label": "input"} | ||
* @example {"name": "not-ok.md", "label": "input"} | ||
* | ||
@@ -61,3 +61,3 @@ * * Foo | ||
* | ||
* @example {"name": "invalid.md", "label": "output"} | ||
* @example {"name": "not-ok.md", "label": "output"} | ||
* | ||
@@ -67,5 +67,5 @@ * 2:1-2:6: Marker style should be `*` | ||
* | ||
* @example {"name": "invalid.md", "label": "output", "setting": "!", "config": {"positionless": true}} | ||
* @example {"name": "not-ok.md", "label": "output", "setting": "💩", "config": {"positionless": true}} | ||
* | ||
* 1:1: Invalid unordered list-item marker style `!`: use either `'-'`, `'*'`, or `'+'` | ||
* 1:1: Incorrect unordered list item marker style `💩`: use either `'-'`, `'*'`, or `'+'` | ||
*/ | ||
@@ -94,11 +94,11 @@ | ||
function unorderedListMarkerStyle(tree, file, pref) { | ||
function unorderedListMarkerStyle(tree, file, option) { | ||
var contents = String(file) | ||
var preferred = | ||
typeof option === 'string' && option !== 'consistent' ? option : null | ||
pref = typeof pref === 'string' && pref !== 'consistent' ? pref : null | ||
if (styles[pref] !== true) { | ||
if (styles[preferred] !== true) { | ||
file.fail( | ||
'Invalid unordered list-item marker style `' + | ||
pref + | ||
'Incorrect unordered list item marker style `' + | ||
preferred + | ||
"`: use either `'-'`, `'*'`, or `'+'`" | ||
@@ -126,8 +126,8 @@ ) | ||
if (pref) { | ||
if (marker !== pref) { | ||
file.message('Marker style should be `' + pref + '`', child) | ||
if (preferred) { | ||
if (marker !== preferred) { | ||
file.message('Marker style should be `' + preferred + '`', child) | ||
} | ||
} else { | ||
pref = marker | ||
preferred = marker | ||
} | ||
@@ -134,0 +134,0 @@ } |
{ | ||
"name": "remark-lint-unordered-list-marker-style", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "remark-lint rule to warn when markers of unordered lists violate a given style", | ||
@@ -10,2 +10,3 @@ "license": "MIT", | ||
"rule", | ||
"remark-lint-rule", | ||
"ordered", | ||
@@ -17,2 +18,6 @@ "list", | ||
"bugs": "https://github.com/remarkjs/remark-lint/issues", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/unified" | ||
}, | ||
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)", | ||
@@ -19,0 +24,0 @@ "contributors": [ |
@@ -42,3 +42,3 @@ <!--This file is generated--> | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -66,3 +66,3 @@ ###### In | ||
##### `invalid.md` | ||
##### `not-ok.md` | ||
@@ -84,3 +84,3 @@ ###### In | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -99,3 +99,3 @@ When configured with `'*'`. | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -114,3 +114,3 @@ When configured with `'-'`. | ||
##### `valid.md` | ||
##### `ok.md` | ||
@@ -129,5 +129,5 @@ When configured with `'+'`. | ||
##### `invalid.md` | ||
##### `not-ok.md` | ||
When configured with `'!'`. | ||
When configured with `'💩'`. | ||
@@ -137,3 +137,3 @@ ###### Out | ||
```text | ||
1:1: Invalid unordered list-item marker style `!`: use either `'-'`, `'*'`, or `'+'` | ||
1:1: Incorrect unordered list item marker style `💩`: use either `'-'`, `'*'`, or `'+'` | ||
``` | ||
@@ -154,12 +154,12 @@ | ||
```diff | ||
... | ||
… | ||
"remarkConfig": { | ||
"plugins": [ | ||
... | ||
… | ||
"lint", | ||
+ "lint-unordered-list-marker-style", | ||
... | ||
… | ||
] | ||
} | ||
... | ||
… | ||
``` | ||
@@ -176,4 +176,4 @@ | ||
```diff | ||
var remark = require('remark'); | ||
var report = require('vfile-reporter'); | ||
var remark = require('remark') | ||
var report = require('vfile-reporter') | ||
@@ -184,4 +184,4 @@ remark() | ||
.process('_Emphasis_ and **importance**', function (err, file) { | ||
console.error(report(err || file)); | ||
}); | ||
console.error(report(err || file)) | ||
}) | ||
``` | ||
@@ -195,4 +195,4 @@ | ||
This project has a [Code of Conduct][coc]. | ||
By interacting with this repository, organisation, or community you agree to | ||
This project has a [code of conduct][coc]. | ||
By interacting with this repository, organization, or community you agree to | ||
abide by its terms. | ||
@@ -226,3 +226,3 @@ | ||
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg | ||
[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg | ||
@@ -229,0 +229,0 @@ [chat]: https://spectrum.chat/unified/remark |
8917
119