Skip to content

Commit

Permalink
Fix silent warnings for invalid options
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BYK authored and wooorm committed Jan 6, 2016
1 parent 298b33a commit aada8e8
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 10 deletions.
10 changes: 5 additions & 5 deletions doc/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/rules/code-block-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions lib/rules/emphasis-marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/fenced-code-marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/link-title-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/list-item-indent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/ordered-list-marker-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/ordered-list-marker-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/rule-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/rules/unordered-list-marker-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions script/additional.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit aada8e8

Please sign in to comment.