Fix silent warnings for invalid options

Although there was a system in place to warn users about invalid
lint options, it failed to report those messages.

*   Additionally, fix several typographic errors in documentation.

Closes GH-33.
This commit is contained in:
Burak Yiğit Kaya 2016-01-06 00:30:06 +02:00 committed by Titus Wormer
parent 298b33ae64
commit aada8e8133
11 changed files with 18 additions and 10 deletions

View File

@ -10,7 +10,7 @@ See the readme for a [list of external rules](https://github.com/wooorm/remark-l
* [Rules](#rules)
* [externals](#externals)
* [external](#external)
* [reset](#reset)
* [blockquote-indentation](#blockquote-indentation)
* [checkbox-character-style](#checkbox-character-style)
@ -74,18 +74,18 @@ Remember that rules can always be turned off by
passing false. In addition, when reset is given, values can
be null or undefined in order to be ignored.
### externals
### external
````md
<!-- Load more rules -->
```json
{
"externals": ["foo", "bar", "baz"]
"external": ["foo", "bar", "baz"]
}
```
````
Externals contains a list of extra rules to load.
External contains a list of extra rules to load.
These are, or refer to, an object mapping `ruleId`s to rules.
Note that in node.js, a string can be given (a module
@ -225,7 +225,7 @@ Options: `boolean`, default: `false`.
Warn when code-blocks do not adhere to a given style.
Options: `string`, either `'consistent'`, `'fences'`, or `'indented'`,
Options: `string`, either `'consistent'`, `'fenced'`, or `'indented'`,
default: `'consistent'`.
The default value, `consistent`, detects the first used code-block

View File

@ -6,7 +6,7 @@
* @fileoverview
* Warn when code-blocks do not adhere to a given style.
*
* Options: `string`, either `'consistent'`, `'fences'`, or `'indented'`,
* Options: `string`, either `'consistent'`, `'fenced'`, or `'indented'`,
* default: `'consistent'`.
*
* The default value, `consistent`, detects the first used code-block
@ -83,7 +83,7 @@ function codeBlockStyle(ast, file, preferred, done) {
if (STYLES[preferred] !== true) {
file.fail('Invalid code block style `' + preferred + '`: use either `\'consistent\'`, `\'fenced\'`, or `\'indented\'`');
done();
return;
}

View File

@ -57,6 +57,7 @@ function emphasisMarker(ast, file, preferred, done) {
if (MARKERS[preferred] !== true) {
file.fail('Invalid emphasis marker `' + preferred + '`: use either `\'consistent\'`, `\'*\'`, or `\'_\'`');
done();
return;
}

View File

@ -77,6 +77,7 @@ function fencedCodeMarker(ast, file, preferred, done) {
if (MARKERS[preferred] !== true) {
file.fail('Invalid fenced code marker `' + preferred + '`: use either `\'consistent\'`, `` \'\`\' ``, or `\'~\'`');
done();
return;
}

View File

@ -79,6 +79,7 @@ function linkTitleStyle(ast, file, preferred, done) {
if (MARKERS[preferred] !== true) {
file.fail('Invalid link title style marker `' + preferred + '`: use either `\'consistent\'`, `\'"\'`, `\'\\\'\'`, or `\'()\'`');
done();
return;
}

View File

@ -86,6 +86,7 @@ function listItemIndent(ast, file, preferred, done) {
if (STYLES[preferred] !== true) {
file.fail('Invalid list-item indent style `' + preferred + '`: use either `\'tab-size\'`, `\'space\'`, or `\'mixed\'`');
done();
return;
}

View File

@ -72,6 +72,7 @@ function orderedListMarkerStyle(ast, file, preferred, done) {
if (STYLES[preferred] !== true) {
file.fail('Invalid ordered list-item marker style `' + preferred + '`: use either `\'.\'` or `\')\'`');
done();
return;
}

View File

@ -88,6 +88,7 @@ function orderedListMarkerValue(ast, file, preferred, done) {
if (STYLES[preferred] !== true) {
file.fail('Invalid ordered list-item marker value `' + preferred + '`: use either `\'ordered\'` or `\'one\'`');
done();
return;
}

View File

@ -66,6 +66,7 @@ function ruleStyle(ast, file, preferred, done) {
if (validateRuleStyle(preferred) !== true) {
file.fail('Invalid preferred rule-style: provide a valid markdown rule, or `\'consistent\'`');
done();
return;
}

View File

@ -77,6 +77,7 @@ function unorderedListMarkerStyle(ast, file, preferred, done) {
if (STYLES[preferred] !== true) {
file.fail('Invalid unordered list-item marker style `' + preferred + '`: use either `\'-\'`, `\'*\'`, or `\'+\'`');
done();
return;
}

View File

@ -3,8 +3,8 @@
"description": "By default, all rules are turned on unless explicitly set to `false`.\nWhen `reset: true`, the opposite is true: all rules are turned off,\nunless when given a non-nully and non-false value.\n\nOptions: `boolean`, default: `false`.",
"example": "<!-- Explicitly activate rules: -->\n```json\n{\n \"reset\": true,\n \"final-newline\": true\n}\n```\n"
},
"externals": {
"description": "Externals contains a list of extra rules to load.\nThese are, or refer to, an object mapping `ruleId`s to rules.\n\nNote that in node.js, a string can be given (a module\nname or a file), but in the browser an object must be passed in.",
"example": "<!-- Load more rules -->\n```json\n{\n \"externals\": [\"foo\", \"bar\", \"baz\"]\n}\n```\n"
"external": {
"description": "External contains a list of extra rules to load.\nThese are, or refer to, an object mapping `ruleId`s to rules.\n\nNote that in node.js, a string can be given (a module\nname or a file), but in the browser an object must be passed in.",
"example": "<!-- Load more rules -->\n```json\n{\n \"external\": [\"foo\", \"bar\", \"baz\"]\n}\n```\n"
}
}