remark-lint
Advanced tools
Comparing version 5.1.0 to 5.2.0
@@ -189,2 +189,3 @@ /** | ||
var result; | ||
var level; | ||
@@ -197,3 +198,7 @@ if (value == null) { | ||
typeof value === 'object' && | ||
(typeof value[0] === 'number' || typeof value[0] === 'boolean') | ||
( | ||
typeof value[0] === 'number' || | ||
typeof value[0] === 'boolean' || | ||
typeof value[0] === 'string' | ||
) | ||
) { | ||
@@ -205,9 +210,22 @@ result = value.concat(); | ||
if (typeof result[0] === 'boolean') { | ||
result[0] = result[0] ? 1 : 0; | ||
level = result[0]; | ||
if (typeof level === 'boolean') { | ||
level = level ? 1 : 0; | ||
} else if (typeof level === 'string') { | ||
if (level === 'off') { | ||
level = 0; | ||
} else if (level === 'on' || level === 'warn') { | ||
level = 1; | ||
} else if (level === 'error') { | ||
level = 2; | ||
} else { | ||
level = 1; | ||
result = [level, result]; | ||
} | ||
} | ||
if (result[0] < 0 || result[0] > 2) { | ||
if (level < 0 || level > 2) { | ||
throw new Error( | ||
'Invalid severity `' + result[0] + '` for `' + name + '`, ' + | ||
'Invalid severity `' + level + '` for `' + name + '`, ' + | ||
'expected 0, 1, or 2' | ||
@@ -217,3 +235,5 @@ ); | ||
result[0] = level; | ||
return result; | ||
} |
@@ -31,2 +31,3 @@ /* This file is generated. */ | ||
'no-duplicate-definitions': require('./rules/no-duplicate-definitions.js'), | ||
'no-duplicate-headings-in-section': require('./rules/no-duplicate-headings-in-section.js'), | ||
'no-duplicate-headings': require('./rules/no-duplicate-headings.js'), | ||
@@ -47,2 +48,3 @@ 'no-emphasis-as-heading': require('./rules/no-emphasis-as-heading.js'), | ||
'no-multiple-toplevel-headings': require('./rules/no-multiple-toplevel-headings.js'), | ||
'no-reference-like-url': require('./rules/no-reference-like-url.js'), | ||
'no-shell-dollars': require('./rules/no-shell-dollars.js'), | ||
@@ -49,0 +51,0 @@ 'no-shortcut-reference-image': require('./rules/no-shortcut-reference-image.js'), |
@@ -82,3 +82,3 @@ /** | ||
if (position.generated(node) || !node.children.length) { | ||
if (position.generated(node) || node.children.length === 0) { | ||
return; | ||
@@ -85,0 +85,0 @@ } |
@@ -32,3 +32,3 @@ /** | ||
/* Expressions. */ | ||
var LABEL = /^\s*\[((?:\\[\s\S]|[^\[\]])+)\]/; | ||
var LABEL = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/; | ||
@@ -35,0 +35,0 @@ /** |
@@ -32,3 +32,3 @@ /** | ||
/* Expressions. */ | ||
var LABEL = /^\s*\[((?:\\[\s\S]|[^\[\]])+)\]/; | ||
var LABEL = /^\s*\[((?:\\[\s\S]|[^[\]])+)]/; | ||
@@ -35,0 +35,0 @@ /** |
@@ -70,4 +70,4 @@ /** | ||
'*': true, | ||
'_': true, | ||
'null': true | ||
_: true, | ||
null: true | ||
}; | ||
@@ -74,0 +74,0 @@ |
@@ -112,3 +112,3 @@ /** | ||
if (node.lang) { | ||
if (flags.length && flags.indexOf(node.lang) === -1) { | ||
if (flags.length !== 0 && flags.indexOf(node.lang) === -1) { | ||
file.message('Invalid code-language flag', node); | ||
@@ -115,0 +115,0 @@ } |
@@ -73,3 +73,3 @@ /** | ||
'~': true, | ||
'null': true | ||
null: true | ||
}; | ||
@@ -76,0 +76,0 @@ |
@@ -83,3 +83,3 @@ /** | ||
')': true, | ||
'null': true | ||
null: true | ||
}; | ||
@@ -86,0 +86,0 @@ |
@@ -86,4 +86,4 @@ /** | ||
'tab-size': true, | ||
'mixed': true, | ||
'space': true | ||
mixed: true, | ||
space: true | ||
}; | ||
@@ -132,3 +132,3 @@ | ||
/* Support checkboxes. */ | ||
marker = marker.replace(/\[[x ]?\]\s*$/i, ''); | ||
marker = marker.replace(/\[[x ]?]\s*$/i, ''); | ||
@@ -135,0 +135,0 @@ bulletSize = marker.trimRight().length; |
@@ -52,3 +52,3 @@ /** | ||
if (position.generated(node) || !indent || !indent.length) { | ||
if (position.generated(node) || !indent || indent.length === 0) { | ||
return; | ||
@@ -55,0 +55,0 @@ } |
@@ -52,3 +52,3 @@ /** | ||
function noFileNameIrregularCharacters(ast, file, preferred) { | ||
var expression = preferred || /[^\\\.a-zA-Z0-9-]/; | ||
var expression = preferred || /[^\\.a-zA-Z0-9-]/; | ||
var match; | ||
@@ -55,0 +55,0 @@ |
@@ -67,3 +67,3 @@ /** | ||
'.': true, | ||
'null': true | ||
null: true | ||
}; | ||
@@ -110,3 +110,3 @@ | ||
/* Support checkboxes. */ | ||
marker = marker.replace(/\[[x ]?\]\s*$/i, ''); | ||
marker = marker.replace(/\[[x ]?]\s*$/i, ''); | ||
@@ -113,0 +113,0 @@ if (!preferred) { |
@@ -146,6 +146,6 @@ /** | ||
marker = contents.slice(initial, final).replace(/[\s\.\)]/g, ''); | ||
marker = contents.slice(initial, final).replace(/[\s.)]/g, ''); | ||
/* Support checkboxes. */ | ||
marker = Number(marker.replace(/\[[x ]?\]\s*$/i, '')); | ||
marker = Number(marker.replace(/\[[x ]?]\s*$/i, '')); | ||
@@ -152,0 +152,0 @@ if (marker !== shouldBe) { |
@@ -57,4 +57,4 @@ /** | ||
'*': true, | ||
'_': true, | ||
'null': true | ||
_: true, | ||
null: true | ||
}; | ||
@@ -61,0 +61,0 @@ |
@@ -49,2 +49,10 @@ /** | ||
* 1:1: Invalid table-cell-padding style `invalid` | ||
* | ||
* @example {"name": "empty.md"} | ||
* | ||
* <!-- Empty cells are always OK. --> | ||
* | ||
* | Alpha | | | ||
* | ----- | ------- | | ||
* | Bravo | Charlie | | ||
*/ | ||
@@ -96,2 +104,3 @@ | ||
var ends = []; | ||
var cells; | ||
var locations; | ||
@@ -161,9 +170,3 @@ var positions; | ||
style = null; | ||
} | ||
if (preferred === 'padded') { | ||
style = 1; | ||
} else if (preferred === 'compact') { | ||
style = 0; | ||
} else { | ||
positions.some(function (pos) { | ||
@@ -178,8 +181,11 @@ /* `some` skips non-existant indices, so | ||
locations = children[0].children.map(function (cell) { | ||
cells = children[0].children; | ||
locations = cells.map(function (cell) { | ||
return start(cell); | ||
}).concat(children[0].children.map(function (cell) { | ||
}).concat(cells.map(function (cell) { | ||
return end(cell); | ||
})); | ||
cells = cells.concat(cells); | ||
type = style === 1 ? 'padded' : 'compact'; | ||
@@ -189,3 +195,5 @@ warning = 'Cell should be ' + type + ', isn’t'; | ||
positions.forEach(function (diff, index) { | ||
if (diff !== style && diff !== undefined && diff !== null) { | ||
var cell = cells[index]; | ||
if (cell && cell.children.length !== 0 && diff !== style && diff !== undefined && diff !== null) { | ||
file.message(warning, locations[index]); | ||
@@ -192,0 +200,0 @@ } |
@@ -62,3 +62,3 @@ /** | ||
'+': true, | ||
'null': true | ||
null: true | ||
}; | ||
@@ -105,3 +105,3 @@ | ||
/* Support checkboxes. */ | ||
marker = marker.replace(/\[[x ]?\]\s*$/i, ''); | ||
marker = marker.replace(/\[[x ]?]\s*$/i, ''); | ||
@@ -108,0 +108,0 @@ if (!preferred) { |
{ | ||
"name": "remark-lint", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "Lint markdown with remark", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136485
64
5025