mirror of
https://github.com/remarkjs/remark-lint.git
synced 2024-10-26 19:31:42 +03:00
Update dependencies
This commit is contained in:
parent
e7a7701963
commit
e3ddd9ebf8
@ -47,9 +47,9 @@
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import plural from 'pluralize'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintBlockquoteIndentation = lintRule(
|
||||
'remark-lint:blockquote-indentation',
|
||||
@ -85,7 +85,7 @@ function blockquoteIndentation(tree, file, option) {
|
||||
plural('space', abs) +
|
||||
' between block quote and content'
|
||||
|
||||
file.message(reason, position.start(node.children[0]))
|
||||
file.message(reason, pointStart(node.children[0]))
|
||||
}
|
||||
} else {
|
||||
preferred = check(node)
|
||||
@ -94,5 +94,5 @@ function blockquoteIndentation(tree, file, option) {
|
||||
}
|
||||
|
||||
function check(node) {
|
||||
return position.start(node.children[0]).column - position.start(node).column
|
||||
return pointStart(node.children[0]).column - pointStart(node).column
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
||||
"dependencies": {
|
||||
"pluralize": "^8.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -70,9 +70,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintCheckboxCharacterStyle = lintRule(
|
||||
'remark-lint:checkbox-character-style',
|
||||
@ -81,9 +81,6 @@ const remarkLintCheckboxCharacterStyle = lintRule(
|
||||
|
||||
export default remarkLintCheckboxCharacterStyle
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
var checked = {x: true, X: true}
|
||||
var unchecked = {' ': true, '\t': true}
|
||||
var types = {true: 'checked', false: 'unchecked'}
|
||||
@ -127,7 +124,8 @@ function checkboxCharacterStyle(tree, file, option) {
|
||||
// A list item cannot be checked and empty, according to GFM, but
|
||||
// theoretically it makes sense to get the end if that were possible.
|
||||
/* c8 ignore next */
|
||||
point = node.children.length === 0 ? end(node) : start(node.children[0])
|
||||
point =
|
||||
node.children.length === 0 ? pointEnd(node) : pointStart(node.children[0])
|
||||
// Move back to before `] `.
|
||||
point.offset -= 2
|
||||
point.column -= 2
|
||||
|
@ -31,9 +31,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -28,10 +28,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import vfileLocation from 'vfile-location'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {location} from 'vfile-location'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintCheckboxContentIndent = lintRule(
|
||||
'remark-lint:checkbox-content-indent',
|
||||
@ -40,14 +40,11 @@ const remarkLintCheckboxContentIndent = lintRule(
|
||||
|
||||
export default remarkLintCheckboxContentIndent
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
var reason = 'Checkboxes should be followed by a single character'
|
||||
|
||||
function checkboxContentIndent(tree, file) {
|
||||
var contents = String(file)
|
||||
var location = vfileLocation(file)
|
||||
var loc = location(file)
|
||||
|
||||
visit(tree, 'listItem', visitor)
|
||||
|
||||
@ -65,7 +62,8 @@ function checkboxContentIndent(tree, file) {
|
||||
// A list item cannot be checked and empty, according to GFM, but
|
||||
// theoretically it makes sense to get the end if that were possible.
|
||||
/* c8 ignore next */
|
||||
point = node.children.length === 0 ? end(node) : start(node.children[0])
|
||||
point =
|
||||
node.children.length === 0 ? pointEnd(node) : pointStart(node.children[0])
|
||||
|
||||
// Assume we start with a checkbox, because well, `checked` is set.
|
||||
value = /\[([\t xX])]/.exec(
|
||||
@ -84,8 +82,8 @@ function checkboxContentIndent(tree, file) {
|
||||
|
||||
if (final - initial > 0) {
|
||||
file.message(reason, {
|
||||
start: location.toPosition(initial),
|
||||
end: location.toPosition(final)
|
||||
start: loc.toPoint(initial),
|
||||
end: loc.toPoint(final)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -31,10 +31,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0",
|
||||
"vfile-location": "^3.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0",
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -93,9 +93,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintCodeBlockStyle = lintRule(
|
||||
'remark-lint:code-block-style',
|
||||
@ -104,9 +104,6 @@ const remarkLintCodeBlockStyle = lintRule(
|
||||
|
||||
export default remarkLintCodeBlockStyle
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
var styles = {null: true, fenced: true, indented: true}
|
||||
|
||||
function codeBlockStyle(tree, file, option) {
|
||||
@ -133,8 +130,8 @@ function codeBlockStyle(tree, file, option) {
|
||||
return null
|
||||
}
|
||||
|
||||
initial = start(node).offset
|
||||
final = end(node).offset
|
||||
initial = pointStart(node).offset
|
||||
final = pointEnd(node).offset
|
||||
|
||||
current =
|
||||
node.lang || /^\s*([~`])\1{2,}/.test(contents.slice(initial, final))
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintDefinitionCase = lintRule(
|
||||
'remark-lint:definition-case',
|
||||
@ -40,8 +40,8 @@ function definitionCase(tree, file) {
|
||||
visit(tree, ['definition', 'footnoteDefinition'], check)
|
||||
|
||||
function check(node) {
|
||||
var start = position.start(node).offset
|
||||
var end = position.end(node).offset
|
||||
var start = pointStart(node).offset
|
||||
var end = pointEnd(node).offset
|
||||
var value
|
||||
|
||||
if (!generated(node)) {
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintDefinitionSpacing = lintRule(
|
||||
'remark-lint:definition-spacing',
|
||||
@ -40,8 +40,8 @@ function definitionSpacing(tree, file) {
|
||||
visit(tree, ['definition', 'footnoteDefinition'], check)
|
||||
|
||||
function check(node) {
|
||||
var start = position.start(node).offset
|
||||
var end = position.end(node).offset
|
||||
var start = pointStart(node).offset
|
||||
var end = pointEnd(node).offset
|
||||
|
||||
if (
|
||||
!generated(node) &&
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -61,9 +61,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintEmphasisMarker = lintRule(
|
||||
'remark-lint:emphasis-marker',
|
||||
@ -93,7 +93,7 @@ function emphasisMarker(tree, file, option) {
|
||||
var marker
|
||||
|
||||
if (!generated(node)) {
|
||||
marker = contents.charAt(position.start(node).offset)
|
||||
marker = contents.charAt(pointStart(node).offset)
|
||||
|
||||
if (preferred) {
|
||||
if (marker !== preferred) {
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -65,9 +65,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintFencedCodeFlag = lintRule(
|
||||
'remark-lint:fenced-code-flag',
|
||||
@ -76,9 +76,6 @@ const remarkLintFencedCodeFlag = lintRule(
|
||||
|
||||
export default remarkLintFencedCodeFlag
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
var fence = /^ {0,3}([~`])\1{2,}/
|
||||
var reasonIncorrect = 'Incorrect code language flag'
|
||||
var reasonMissing = 'Missing code language flag'
|
||||
@ -109,7 +106,7 @@ function fencedCodeFlag(tree, file, option) {
|
||||
file.message(reasonIncorrect, node)
|
||||
}
|
||||
} else {
|
||||
value = contents.slice(start(node).offset, end(node).offset)
|
||||
value = contents.slice(pointStart(node).offset, pointEnd(node).offset)
|
||||
|
||||
if (!allowEmpty && fence.test(value)) {
|
||||
file.message(reasonMissing, node)
|
||||
|
@ -31,9 +31,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -82,9 +82,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintFencedCodeMarker = lintRule(
|
||||
'remark-lint:fenced-code-marker',
|
||||
@ -120,7 +120,7 @@ function fencedCodeMarker(tree, file, option) {
|
||||
var label
|
||||
|
||||
if (!generated(node)) {
|
||||
start = position.start(node).offset
|
||||
start = pointStart(node).offset
|
||||
marker = contents
|
||||
.slice(start, start + 4)
|
||||
.replace(/^\s+/, '')
|
||||
|
@ -30,9 +30,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -37,9 +37,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintFinalDefinition = lintRule(
|
||||
'remark-lint:final-definition',
|
||||
@ -48,15 +48,13 @@ const remarkLintFinalDefinition = lintRule(
|
||||
|
||||
export default remarkLintFinalDefinition
|
||||
|
||||
var start = position.start
|
||||
|
||||
function finalDefinition(tree, file) {
|
||||
var last = null
|
||||
|
||||
visit(tree, visitor, true)
|
||||
|
||||
function visitor(node) {
|
||||
var line = start(node).line
|
||||
var line = pointStart(node).line
|
||||
|
||||
// Ignore generated and HTML comment nodes.
|
||||
if (
|
||||
|
@ -30,9 +30,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -78,8 +78,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit, EXIT} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintFirstHeadingLevel = lintRule(
|
||||
'remark-lint:first-heading-level',
|
||||
@ -113,7 +113,7 @@ function firstHeadingLevel(tree, file, option) {
|
||||
)
|
||||
}
|
||||
|
||||
return visit.EXIT
|
||||
return EXIT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,8 +31,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintHardBreakSpaces = lintRule(
|
||||
'remark-lint:hard-break-spaces',
|
||||
@ -45,7 +45,7 @@ function hardBreakSpaces(tree, file) {
|
||||
|
||||
if (!generated(node)) {
|
||||
value = contents
|
||||
.slice(position.start(node).offset, position.end(node).offset)
|
||||
.slice(pointStart(node).offset, pointEnd(node).offset)
|
||||
.split('\n', 1)[0]
|
||||
.replace(/\r$/, '')
|
||||
|
||||
|
@ -31,9 +31,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintHeadingIncrement = lintRule(
|
||||
'remark-lint:heading-increment',
|
||||
|
@ -30,8 +30,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -67,9 +67,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import headingStyle from 'mdast-util-heading-style'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {headingStyle} from 'mdast-util-heading-style'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
var types = ['atx', 'atx-closed', 'setext']
|
||||
|
||||
|
@ -30,10 +30,10 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-heading-style": "^1.0.2",
|
||||
"mdast-util-heading-style": "^2.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import location from 'vfile-location'
|
||||
import {location} from 'vfile-location'
|
||||
|
||||
const remarkLintLinebreakStyle = lintRule(
|
||||
'remark-lint:linebreak-style',
|
||||
@ -62,7 +62,7 @@ function linebreakStyle(tree, file, option) {
|
||||
var preferred =
|
||||
typeof option === 'string' && option !== 'consistent' ? option : null
|
||||
var content = String(file)
|
||||
var position = location(content).toPosition
|
||||
var toPoint = location(content).toPoint
|
||||
var index = content.indexOf('\n')
|
||||
var type
|
||||
var reason
|
||||
@ -83,7 +83,7 @@ function linebreakStyle(tree, file, option) {
|
||||
escaped[type] +
|
||||
'`)'
|
||||
|
||||
file.message(reason, position(index))
|
||||
file.message(reason, toPoint(index))
|
||||
}
|
||||
} else {
|
||||
preferred = type
|
||||
|
@ -34,7 +34,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"vfile-location": "^3.0.0"
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -87,10 +87,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import vfileLocation from 'vfile-location'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {location} from 'vfile-location'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintLinkTitleStyle = lintRule(
|
||||
'remark-lint:link-title-style',
|
||||
@ -101,9 +101,6 @@ export default remarkLintLinkTitleStyle
|
||||
|
||||
var own = {}.hasOwnProperty
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
var markers = {
|
||||
'"': '"',
|
||||
"'": "'",
|
||||
@ -112,7 +109,7 @@ var markers = {
|
||||
|
||||
function linkTitleStyle(tree, file, option) {
|
||||
var contents = String(file)
|
||||
var location = vfileLocation(file)
|
||||
var loc = location(file)
|
||||
var preferred =
|
||||
typeof option === 'string' && option !== 'consistent' ? option : null
|
||||
|
||||
@ -143,9 +140,9 @@ function linkTitleStyle(tree, file, option) {
|
||||
return
|
||||
}
|
||||
|
||||
last = end(node).offset - 1
|
||||
last = pointEnd(node).offset - 1
|
||||
tail = node.children ? node.children[node.children.length - 1] : null
|
||||
begin = tail ? end(tail) : start(node)
|
||||
begin = tail ? pointEnd(tail) : pointStart(node)
|
||||
|
||||
if (node.type !== 'definition') {
|
||||
last--
|
||||
@ -188,8 +185,8 @@ function linkTitleStyle(tree, file, option) {
|
||||
'` as a quote'
|
||||
|
||||
file.message(reason, {
|
||||
start: location.toPosition(first),
|
||||
end: location.toPosition(last + 1)
|
||||
start: loc.toPoint(first),
|
||||
end: loc.toPoint(last + 1)
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
@ -31,10 +31,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0",
|
||||
"vfile-location": "^3.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0",
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -36,8 +36,8 @@
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import plural from 'pluralize'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintListItemBulletIndent = lintRule(
|
||||
'remark-lint:list-item-bullet-indent',
|
||||
|
@ -31,8 +31,8 @@
|
||||
"dependencies": {
|
||||
"pluralize": "^8.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import plural from 'pluralize'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintListItemContentIndent = lintRule(
|
||||
'remark-lint:list-item-content-indent',
|
||||
@ -34,8 +34,6 @@ const remarkLintListItemContentIndent = lintRule(
|
||||
|
||||
export default remarkLintListItemContentIndent
|
||||
|
||||
var start = position.start
|
||||
|
||||
function listItemContentIndent(tree, file) {
|
||||
var contents = String(file)
|
||||
|
||||
@ -58,7 +56,7 @@ function listItemContentIndent(tree, file) {
|
||||
return
|
||||
}
|
||||
|
||||
begin = start(item)
|
||||
begin = pointStart(item)
|
||||
column = begin.column
|
||||
|
||||
// Get indentation for the first child. Only the first item can have a
|
||||
@ -97,7 +95,7 @@ function listItemContentIndent(tree, file) {
|
||||
plural('space', abs)
|
||||
|
||||
file.message(reason, {
|
||||
line: start(item).line,
|
||||
line: pointStart(item).line,
|
||||
column: column
|
||||
})
|
||||
}
|
||||
|
@ -32,9 +32,9 @@
|
||||
"dependencies": {
|
||||
"pluralize": "^8.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -105,9 +105,9 @@
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import plural from 'pluralize'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintListItemIndent = lintRule(
|
||||
'remark-lint:list-item-indent',
|
||||
@ -116,8 +116,6 @@ const remarkLintListItemIndent = lintRule(
|
||||
|
||||
export default remarkLintListItemIndent
|
||||
|
||||
var start = position.start
|
||||
|
||||
var styles = {'tab-size': true, mixed: true, space: true}
|
||||
|
||||
function listItemIndent(tree, file, option) {
|
||||
@ -143,7 +141,7 @@ function listItemIndent(tree, file, option) {
|
||||
|
||||
function visitItem(item) {
|
||||
var head = item.children[0]
|
||||
var final = start(head)
|
||||
var final = pointStart(head)
|
||||
var marker
|
||||
var bulletSize
|
||||
var style
|
||||
@ -152,7 +150,7 @@ function listItemIndent(tree, file, option) {
|
||||
var abs
|
||||
|
||||
marker = contents
|
||||
.slice(start(item).offset, final.offset)
|
||||
.slice(pointStart(item).offset, final.offset)
|
||||
.replace(/\[[x ]?]\s*$/i, '')
|
||||
|
||||
bulletSize = marker.replace(/\s+$/, '').length
|
||||
|
@ -31,9 +31,9 @@
|
||||
"dependencies": {
|
||||
"pluralize": "^8.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -108,9 +108,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintListItemSpacing = lintRule(
|
||||
'remark-lint:list-item-spacing',
|
||||
@ -119,9 +119,6 @@ const remarkLintListItemSpacing = lintRule(
|
||||
|
||||
export default remarkLintListItemSpacing
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
var reasonLoose = 'Missing new line after list item'
|
||||
var reasonTight = 'Extraneous new line after list item'
|
||||
|
||||
@ -159,10 +156,10 @@ function listItemSpacing(tree, file, option) {
|
||||
while (++index < length) {
|
||||
next = children[index]
|
||||
|
||||
if (start(next).line - end(child).line < 2 !== tight) {
|
||||
if (pointStart(next).line - pointEnd(child).line < 2 !== tight) {
|
||||
file.message(tight ? reasonTight : reasonLoose, {
|
||||
start: end(child),
|
||||
end: start(next)
|
||||
start: pointEnd(child),
|
||||
end: pointStart(next)
|
||||
})
|
||||
}
|
||||
|
||||
@ -183,7 +180,7 @@ function inferBlankLine(node) {
|
||||
next = children[index]
|
||||
|
||||
// All children in `listItem`s are block.
|
||||
if (start(next).line - end(child).line > 1) {
|
||||
if (pointStart(next).line - pointEnd(child).line > 1) {
|
||||
return true
|
||||
}
|
||||
|
||||
@ -195,5 +192,9 @@ function inferBlankLine(node) {
|
||||
|
||||
function inferMultiline(node) {
|
||||
var children = node.children
|
||||
return end(children[children.length - 1]).line - start(children[0]).line > 0
|
||||
return (
|
||||
pointEnd(children[children.length - 1]).line -
|
||||
pointStart(children[0]).line >
|
||||
0
|
||||
)
|
||||
}
|
||||
|
@ -31,9 +31,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -26,9 +26,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import toString from 'mdast-util-to-string'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
|
||||
const remarkLintMaximumHeadingLength = lintRule(
|
||||
'remark-lint:maximum-heading-length',
|
||||
|
@ -28,10 +28,10 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-to-string": "^1.0.2",
|
||||
"mdast-util-to-string": "^3.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -91,9 +91,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintMaximumLineLength = lintRule(
|
||||
'remark-lint:maximum-line-length',
|
||||
@ -102,9 +102,6 @@ const remarkLintMaximumLineLength = lintRule(
|
||||
|
||||
export default remarkLintMaximumLineLength
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
function maximumLineLength(tree, file, option) {
|
||||
var preferred = typeof option === 'number' && !isNaN(option) ? option : 80
|
||||
var content = String(file)
|
||||
@ -148,8 +145,8 @@ function maximumLineLength(tree, file, option) {
|
||||
return
|
||||
}
|
||||
|
||||
initial = start(node)
|
||||
final = end(node)
|
||||
initial = pointStart(node)
|
||||
final = pointEnd(node)
|
||||
|
||||
// Not allowing when starting after the border, or ending before it.
|
||||
if (initial.column > preferred || final.column < preferred) {
|
||||
@ -159,7 +156,7 @@ function maximumLineLength(tree, file, option) {
|
||||
// Not allowing when there’s whitespace after the link.
|
||||
if (
|
||||
next &&
|
||||
start(next).line === initial.line &&
|
||||
pointStart(next).line === initial.line &&
|
||||
(!next.value || /^(.+?[ \t].+?)/.test(next.value))
|
||||
) {
|
||||
return
|
||||
@ -172,7 +169,7 @@ function maximumLineLength(tree, file, option) {
|
||||
// Hard to test, as we only run this case on `position: true`.
|
||||
/* c8 ignore next 3 */
|
||||
if (!generated(node)) {
|
||||
allowList(start(node).line - 1, end(node).line)
|
||||
allowList(pointStart(node).line - 1, pointEnd(node).line)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -34,10 +34,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import toString from 'mdast-util-to-string'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
|
||||
const remarkLintNoAutoLinkWithoutProtocol = lintRule(
|
||||
'remark-lint:no-auto-link-without-protocol',
|
||||
@ -46,9 +46,6 @@ const remarkLintNoAutoLinkWithoutProtocol = lintRule(
|
||||
|
||||
export default remarkLintNoAutoLinkWithoutProtocol
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
// Protocol expression.
|
||||
// See: <https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax>.
|
||||
var protocol = /^[a-z][a-z+.-]+:\/?/i
|
||||
@ -65,8 +62,9 @@ function noAutoLinkWithoutProtocol(tree, file) {
|
||||
children = node.children
|
||||
|
||||
if (
|
||||
start(node).column === start(children[0]).column - 1 &&
|
||||
end(node).column === end(children[children.length - 1]).column + 1 &&
|
||||
pointStart(node).column === pointStart(children[0]).column - 1 &&
|
||||
pointEnd(node).column ===
|
||||
pointEnd(children[children.length - 1]).column + 1 &&
|
||||
!protocol.test(toString(node))
|
||||
) {
|
||||
file.message(reason, node)
|
||||
|
@ -29,11 +29,11 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-to-string": "^1.0.2",
|
||||
"mdast-util-to-string": "^3.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -50,10 +50,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import vfileLocation from 'vfile-location'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {location} from 'vfile-location'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoBlockquoteWithoutMarker = lintRule(
|
||||
'remark-lint:no-blockquote-without-marker',
|
||||
@ -66,7 +66,7 @@ var reason = 'Missing marker in block quote'
|
||||
|
||||
function noBlockquoteWithoutMarker(tree, file) {
|
||||
var contents = String(file)
|
||||
var location = vfileLocation(file)
|
||||
var loc = location(file)
|
||||
|
||||
visit(tree, 'blockquote', visitor)
|
||||
|
||||
@ -77,13 +77,13 @@ function noBlockquoteWithoutMarker(tree, file) {
|
||||
var offset
|
||||
|
||||
if (node.type === 'paragraph' && !generated(node)) {
|
||||
line = position.start(node).line
|
||||
end = position.end(node).line
|
||||
column = position.start(node).column
|
||||
line = pointStart(node).line
|
||||
end = pointEnd(node).line
|
||||
column = pointStart(node).column
|
||||
|
||||
// Skip past the first line.
|
||||
while (++line <= end) {
|
||||
offset = location.toOffset({line: line, column: column})
|
||||
offset = loc.toOffset({line: line, column: column})
|
||||
|
||||
if (/>[\t ]+$/.test(contents.slice(offset - 5, offset))) {
|
||||
continue
|
||||
|
@ -30,10 +30,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.0.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0",
|
||||
"vfile-location": "^3.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0",
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -42,9 +42,9 @@
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import plural from 'pluralize'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoConsecutiveBlankLines = lintRule(
|
||||
'remark-lint:no-consecutive-blank-lines',
|
||||
@ -66,7 +66,7 @@ function noConsecutiveBlankLines(tree, file) {
|
||||
|
||||
if (head && !generated(head)) {
|
||||
// Compare parent and first child.
|
||||
compare(position.start(node), position.start(head), 0)
|
||||
compare(pointStart(node), pointStart(head), 0)
|
||||
|
||||
// Compare between each child.
|
||||
children.forEach(visitChild)
|
||||
@ -75,7 +75,7 @@ function noConsecutiveBlankLines(tree, file) {
|
||||
|
||||
// Compare parent and last child.
|
||||
if (tail !== head && !generated(tail)) {
|
||||
compare(position.end(node), position.end(tail), 1)
|
||||
compare(pointEnd(node), pointEnd(tail), 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -106,7 +106,7 @@ function noConsecutiveBlankLines(tree, file) {
|
||||
var previous = all[index - 1]
|
||||
|
||||
if (previous && !generated(previous) && !generated(child)) {
|
||||
compare(position.end(previous), position.start(child), 2)
|
||||
compare(pointEnd(previous), pointStart(child), 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@
|
||||
"dependencies": {
|
||||
"pluralize": "^8.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -22,10 +22,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import stringify from 'unist-util-stringify-position'
|
||||
import visit from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {stringifyPosition} from 'unist-util-stringify-position'
|
||||
import {visit} from 'unist-util-visit'
|
||||
|
||||
const remarkLintNoDuplicateDefinedUrls = lintRule(
|
||||
'remark-lint:no-duplicate-defined-urls',
|
||||
@ -51,7 +51,7 @@ function noDuplicateDefinedUrls(tree, file) {
|
||||
|
||||
if (duplicate && duplicate.type) {
|
||||
file.message(
|
||||
reason + ' (' + stringify(position.start(duplicate)) + ')',
|
||||
reason + ' (' + stringifyPosition(pointStart(duplicate)) + ')',
|
||||
node
|
||||
)
|
||||
}
|
||||
|
@ -30,10 +30,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.0.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-stringify-position": "^3.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -22,10 +22,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import stringify from 'unist-util-stringify-position'
|
||||
import visit from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {stringifyPosition} from 'unist-util-stringify-position'
|
||||
import {visit} from 'unist-util-visit'
|
||||
|
||||
const remarkLintNoDuplicateDefinitions = lintRule(
|
||||
'remark-lint:no-duplicate-definitions',
|
||||
@ -51,7 +51,7 @@ function noDuplicateDefinitions(tree, file) {
|
||||
|
||||
if (duplicate && duplicate.type) {
|
||||
file.message(
|
||||
reason + ' (' + stringify(position.start(duplicate)) + ')',
|
||||
reason + ' (' + stringifyPosition(pointStart(duplicate)) + ')',
|
||||
node
|
||||
)
|
||||
}
|
||||
|
@ -29,10 +29,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-stringify-position": "^3.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -55,11 +55,11 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import visit from 'unist-util-visit'
|
||||
import stringify from 'unist-util-stringify-position'
|
||||
import toString from 'mdast-util-to-string'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {stringifyPosition} from 'unist-util-stringify-position'
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
|
||||
const remarkLintNoDuplicateHeadingsInSection = lintRule(
|
||||
'remark-lint:no-duplicate-headings-in-section',
|
||||
@ -84,7 +84,7 @@ function noDuplicateHeadingsInSection(tree, file) {
|
||||
|
||||
if (!generated(node) && duplicate) {
|
||||
file.message(
|
||||
reason + ' (' + stringify(position.start(duplicate)) + ')',
|
||||
reason + ' (' + stringifyPosition(pointStart(duplicate)) + ')',
|
||||
node
|
||||
)
|
||||
}
|
||||
|
@ -29,12 +29,12 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-to-string": "^1.0.2",
|
||||
"mdast-util-to-string": "^3.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-stringify-position": "^3.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -27,11 +27,11 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import visit from 'unist-util-visit'
|
||||
import stringify from 'unist-util-stringify-position'
|
||||
import toString from 'mdast-util-to-string'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {stringifyPosition} from 'unist-util-stringify-position'
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
|
||||
const remarkLintNoDuplicateHeadings = lintRule(
|
||||
'remark-lint:no-duplicate-headings',
|
||||
@ -57,7 +57,7 @@ function noDuplicateHeadings(tree, file) {
|
||||
|
||||
if (duplicate && duplicate.type === 'heading') {
|
||||
file.message(
|
||||
reason + ' (' + stringify(position.start(duplicate)) + ')',
|
||||
reason + ' (' + stringifyPosition(pointStart(duplicate)) + ')',
|
||||
node
|
||||
)
|
||||
}
|
||||
|
@ -28,12 +28,12 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-to-string": "^1.0.2",
|
||||
"mdast-util-to-string": "^3.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-stringify-position": "^3.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -30,8 +30,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoEmphasisAsHeading = lintRule(
|
||||
'remark-lint:no-emphasis-as-heading',
|
||||
|
@ -29,8 +29,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoEmptyUrl = lintRule('remark-lint:no-empty-url', noEmptyURL)
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -47,11 +47,11 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import headingStyle from 'mdast-util-heading-style'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {headingStyle} from 'mdast-util-heading-style'
|
||||
import plural from 'pluralize'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoHeadingContentIndent = lintRule(
|
||||
'remark-lint:no-heading-content-indent',
|
||||
@ -60,9 +60,6 @@ const remarkLintNoHeadingContentIndent = lintRule(
|
||||
|
||||
export default remarkLintNoHeadingContentIndent
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
|
||||
function noHeadingContentIndent(tree, file) {
|
||||
visit(tree, 'heading', visitor)
|
||||
|
||||
@ -85,14 +82,14 @@ function noHeadingContentIndent(tree, file) {
|
||||
type = headingStyle(node, 'atx')
|
||||
|
||||
if (type === 'atx' || type === 'atx-closed') {
|
||||
head = start(children[0]).column
|
||||
head = pointStart(children[0]).column
|
||||
|
||||
// Ignore empty headings.
|
||||
if (!head) {
|
||||
return
|
||||
}
|
||||
|
||||
diff = head - start(node).column - 1 - depth
|
||||
diff = head - pointStart(node).column - 1 - depth
|
||||
|
||||
if (diff) {
|
||||
abs = Math.abs(diff)
|
||||
@ -104,15 +101,15 @@ function noHeadingContentIndent(tree, file) {
|
||||
plural('space', abs) +
|
||||
' before this heading’s content'
|
||||
|
||||
file.message(reason, start(children[0]))
|
||||
file.message(reason, pointStart(children[0]))
|
||||
}
|
||||
}
|
||||
|
||||
// Closed ATX headings always must have a space between their content and
|
||||
// the final hashes, thus, there is no `add x spaces`.
|
||||
if (type === 'atx-closed') {
|
||||
final = end(children[children.length - 1])
|
||||
diff = end(node).column - final.column - 1 - depth
|
||||
final = pointEnd(children[children.length - 1])
|
||||
diff = pointEnd(node).column - final.column - 1 - depth
|
||||
|
||||
if (diff) {
|
||||
reason =
|
||||
|
@ -29,12 +29,12 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-heading-style": "^1.0.2",
|
||||
"mdast-util-heading-style": "^2.0.0",
|
||||
"pluralize": "^8.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -48,9 +48,9 @@
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import plural from 'pluralize'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoHeadingIndent = lintRule(
|
||||
'remark-lint:no-heading-indent',
|
||||
@ -59,8 +59,6 @@ const remarkLintNoHeadingIndent = lintRule(
|
||||
|
||||
export default remarkLintNoHeadingIndent
|
||||
|
||||
var start = position.start
|
||||
|
||||
function noHeadingIndent(tree, file) {
|
||||
visit(tree, 'heading', visitor)
|
||||
|
||||
@ -73,12 +71,12 @@ function noHeadingIndent(tree, file) {
|
||||
return
|
||||
}
|
||||
|
||||
diff = start(node).column - 1
|
||||
diff = pointStart(node).column - 1
|
||||
|
||||
if (diff) {
|
||||
file.message(
|
||||
'Remove ' + diff + ' ' + plural('space', diff) + ' before this heading',
|
||||
start(node)
|
||||
pointStart(node)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@
|
||||
"dependencies": {
|
||||
"pluralize": "^8.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoHeadingLikeParagraph = lintRule(
|
||||
'remark-lint:no-heading-like-paragraph',
|
||||
|
@ -29,8 +29,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -41,9 +41,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import toString from 'mdast-util-to-string'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
|
||||
const remarkLintNoHeadingPunctuation = lintRule(
|
||||
'remark-lint:no-heading-punctuation',
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"mdast-util-to-string": "^1.0.2",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"mdast-util-to-string": "^3.0.0",
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -25,8 +25,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoHtml = lintRule('remark-lint:no-html', noHTML)
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import toString from 'mdast-util-to-string'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
|
||||
const remarkLintNoInlinePadding = lintRule(
|
||||
'remark-lint:no-inline-padding',
|
||||
|
@ -28,10 +28,10 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-to-string": "^1.0.2",
|
||||
"mdast-util-to-string": "^3.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -32,10 +32,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import toString from 'mdast-util-to-string'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {toString} from 'mdast-util-to-string'
|
||||
|
||||
const remarkLintNoLiteralUrls = lintRule(
|
||||
'remark-lint:no-literal-urls',
|
||||
@ -44,8 +44,6 @@ const remarkLintNoLiteralUrls = lintRule(
|
||||
|
||||
export default remarkLintNoLiteralUrls
|
||||
|
||||
var start = position.start
|
||||
var end = position.end
|
||||
var mailto = 'mailto:'
|
||||
var reason = 'Don’t use literal URLs without angle brackets'
|
||||
|
||||
@ -58,8 +56,9 @@ function noLiteralURLs(tree, file) {
|
||||
|
||||
if (
|
||||
!generated(node) &&
|
||||
start(node).column === start(children[0]).column &&
|
||||
end(node).column === end(children[children.length - 1]).column &&
|
||||
pointStart(node).column === pointStart(children[0]).column &&
|
||||
pointEnd(node).column ===
|
||||
pointEnd(children[children.length - 1]).column &&
|
||||
(node.url === mailto + value || node.url === value)
|
||||
) {
|
||||
file.message(reason, node)
|
||||
|
@ -28,11 +28,11 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"mdast-util-to-string": "^1.0.2",
|
||||
"mdast-util-to-string": "^3.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -64,9 +64,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoMissingBlankLines = lintRule(
|
||||
'remark-lint:no-missing-blank-lines',
|
||||
@ -107,7 +107,7 @@ function noMissingBlankLines(tree, file, option) {
|
||||
if (
|
||||
next &&
|
||||
types.indexOf(next.type) !== -1 &&
|
||||
position.start(next).line === position.end(node).line + 1
|
||||
pointStart(next).line === pointEnd(node).line + 1
|
||||
) {
|
||||
file.message(reason, next)
|
||||
}
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -26,10 +26,10 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import generated from 'unist-util-generated'
|
||||
import stringify from 'unist-util-stringify-position'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {pointStart} from 'unist-util-position'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {stringifyPosition} from 'unist-util-stringify-position'
|
||||
|
||||
const remarkLintNoMultipleToplevelHeadings = lintRule(
|
||||
'remark-lint:no-multiple-toplevel-headings',
|
||||
@ -52,7 +52,7 @@ function noMultipleToplevelHeadings(tree, file, option) {
|
||||
node
|
||||
)
|
||||
} else {
|
||||
duplicate = stringify(position.start(node))
|
||||
duplicate = stringifyPosition(pointStart(node))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,10 +29,10 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-stringify-position": "^2.0.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-stringify-position": "^3.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -72,9 +72,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import vfileLocation from 'vfile-location'
|
||||
import {visit, SKIP} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {location} from 'vfile-location'
|
||||
|
||||
const remarkLintNoParagraphContentIndent = lintRule(
|
||||
'remark-lint:no-paragraph-content-indent',
|
||||
@ -87,13 +87,13 @@ var reason = 'Expected no indentation in paragraph content'
|
||||
|
||||
function noParagraphContentIndent(tree, file) {
|
||||
var content = String(file)
|
||||
var location = vfileLocation(content)
|
||||
var loc = location(content)
|
||||
|
||||
visit(tree, 'paragraph', visitor)
|
||||
|
||||
function visitor(node, _, parent) {
|
||||
var line = position.start(node).line
|
||||
var end = position.end(node).line
|
||||
var line = pointStart(node).line
|
||||
var end = pointEnd(node).line
|
||||
var column
|
||||
var offset
|
||||
var lineColumn
|
||||
@ -101,9 +101,9 @@ function noParagraphContentIndent(tree, file) {
|
||||
if (parent && parent.type === 'root') {
|
||||
column = 1
|
||||
} else if (parent && parent.type === 'blockquote') {
|
||||
column = position.start(parent).column + 2
|
||||
column = pointStart(parent).column + 2
|
||||
} else if (parent && parent.type === 'listItem') {
|
||||
column = position.start(parent.children[0]).column
|
||||
column = pointStart(parent.children[0]).column
|
||||
|
||||
// Skip past the first line if we’re the first child of a list item.
|
||||
if (parent.children[0] === node) {
|
||||
@ -117,7 +117,7 @@ function noParagraphContentIndent(tree, file) {
|
||||
}
|
||||
|
||||
while (line <= end) {
|
||||
offset = location.toOffset({line: line, column: column})
|
||||
offset = loc.toOffset({line: line, column: column})
|
||||
lineColumn = offset
|
||||
|
||||
while (/[ \t]/.test(content.charAt(offset - 1))) {
|
||||
@ -135,13 +135,13 @@ function noParagraphContentIndent(tree, file) {
|
||||
}
|
||||
|
||||
if (lineColumn !== offset) {
|
||||
file.message(reason, location.toPosition(offset))
|
||||
file.message(reason, loc.toPoint(offset))
|
||||
}
|
||||
}
|
||||
|
||||
line++
|
||||
}
|
||||
|
||||
return visit.SKIP
|
||||
return SKIP
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0",
|
||||
"vfile-location": "^3.0.0"
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0",
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -24,8 +24,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import generated from 'unist-util-generated'
|
||||
import visit from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
|
||||
const remarkLintNoReferenceLikeUrl = lintRule(
|
||||
'remark-lint:no-reference-like-url',
|
||||
|
@ -30,8 +30,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -54,8 +54,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoShellDollars = lintRule(
|
||||
'remark-lint:no-shell-dollars',
|
||||
|
@ -29,8 +29,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -30,8 +30,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoShortcutReferenceImage = lintRule(
|
||||
'remark-lint:no-shortcut-reference-image',
|
||||
|
@ -30,8 +30,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -30,8 +30,8 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
|
||||
const remarkLintNoShortcutReferenceLink = lintRule(
|
||||
'remark-lint:no-shortcut-reference-link',
|
||||
|
@ -30,8 +30,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -58,9 +58,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import position from 'unist-util-position'
|
||||
import vfileLocation from 'vfile-location'
|
||||
import {visit, SKIP} from 'unist-util-visit'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {location} from 'vfile-location'
|
||||
|
||||
const remarkLintNoTableIndentation = lintRule(
|
||||
'remark-lint:no-table-indentation',
|
||||
@ -73,13 +73,13 @@ var reason = 'Do not indent table rows'
|
||||
|
||||
function noTableIndentation(tree, file) {
|
||||
var content = String(file)
|
||||
var location = vfileLocation(content)
|
||||
var loc = location(content)
|
||||
|
||||
visit(tree, 'table', visitor)
|
||||
|
||||
function visitor(node, _, parent) {
|
||||
var line = position.start(node).line
|
||||
var end = position.end(node).line
|
||||
var line = pointStart(node).line
|
||||
var end = pointEnd(node).line
|
||||
var column
|
||||
var offset
|
||||
var lineColumn
|
||||
@ -87,9 +87,9 @@ function noTableIndentation(tree, file) {
|
||||
if (parent && parent.type === 'root') {
|
||||
column = 1
|
||||
} else if (parent && parent.type === 'blockquote') {
|
||||
column = position.start(parent).column + 2
|
||||
column = pointStart(parent).column + 2
|
||||
} else if (parent && parent.type === 'listItem') {
|
||||
column = position.start(parent.children[0]).column
|
||||
column = pointStart(parent.children[0]).column
|
||||
|
||||
// Skip past the first line if we’re the first child of a list item.
|
||||
/* c8 ignore next 3 */
|
||||
@ -104,7 +104,7 @@ function noTableIndentation(tree, file) {
|
||||
}
|
||||
|
||||
while (line <= end) {
|
||||
offset = location.toOffset({line: line, column: column})
|
||||
offset = loc.toOffset({line: line, column: column})
|
||||
lineColumn = offset
|
||||
|
||||
while (/[ \t]/.test(content.charAt(offset - 1))) {
|
||||
@ -119,13 +119,13 @@ function noTableIndentation(tree, file) {
|
||||
}
|
||||
|
||||
if (lineColumn !== offset) {
|
||||
file.message(reason, location.toPosition(offset))
|
||||
file.message(reason, loc.toPoint(offset))
|
||||
}
|
||||
}
|
||||
|
||||
line++
|
||||
}
|
||||
|
||||
return visit.SKIP
|
||||
return SKIP
|
||||
}
|
||||
}
|
||||
|
@ -29,9 +29,9 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-position": "^3.0.0",
|
||||
"unist-util-visit": "^2.0.0",
|
||||
"vfile-location": "^3.0.0"
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0",
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import location from 'vfile-location'
|
||||
import {location} from 'vfile-location'
|
||||
|
||||
const remarkLintNoTabs = lintRule('remark-lint:no-tabs', noTabs)
|
||||
|
||||
@ -61,11 +61,11 @@ var reason = 'Use spaces instead of tabs'
|
||||
|
||||
function noTabs(tree, file) {
|
||||
var content = String(file)
|
||||
var position = location(file).toPosition
|
||||
var toPoint = location(file).toPoint
|
||||
var index = content.indexOf('\t')
|
||||
|
||||
while (index !== -1) {
|
||||
file.message(reason, position(index))
|
||||
file.message(reason, toPoint(index))
|
||||
index = content.indexOf('\t', index + 1)
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"vfile-location": "^3.0.0"
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -62,12 +62,12 @@
|
||||
* 17:23-17:26: Found reference to undefined definition
|
||||
*/
|
||||
|
||||
import collapseWhiteSpace from 'collapse-white-space'
|
||||
import vfileLocation from 'vfile-location'
|
||||
import {collapseWhiteSpace} from 'collapse-white-space'
|
||||
import {location} from 'vfile-location'
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import generated from 'unist-util-generated'
|
||||
import position from 'unist-util-position'
|
||||
import visit from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {pointStart, pointEnd} from 'unist-util-position'
|
||||
import {visit, SKIP, EXIT} from 'unist-util-visit'
|
||||
|
||||
const remarkLintNoUndefinedReferences = lintRule(
|
||||
'remark-lint:no-undefined-references',
|
||||
@ -88,7 +88,7 @@ function normalize(s) {
|
||||
|
||||
function noUndefinedReferences(tree, file, option) {
|
||||
var contents = String(file)
|
||||
var location = vfileLocation(file)
|
||||
var loc = location(file)
|
||||
var lineEnding = /(\r?\n|\r)[\t ]*(>[\t ]*)*/g
|
||||
var allow = ((option || {}).allow || []).map(normalize)
|
||||
var map = {}
|
||||
@ -120,7 +120,7 @@ function noUndefinedReferences(tree, file, option) {
|
||||
|
||||
ranges.forEach(handleRange)
|
||||
|
||||
return visit.SKIP
|
||||
return SKIP
|
||||
|
||||
function onchild(child) {
|
||||
var start
|
||||
@ -142,17 +142,17 @@ function noUndefinedReferences(tree, file, option) {
|
||||
// Can’t have links in links, so reset ranges.
|
||||
if (child.type === 'link' || child.type === 'linkReference') {
|
||||
ranges = []
|
||||
return visit.SKIP
|
||||
return SKIP
|
||||
}
|
||||
|
||||
// Enter non-text.
|
||||
if (child.type !== 'text') return
|
||||
|
||||
start = position.start(child).offset
|
||||
end = position.end(child).offset
|
||||
start = pointStart(child).offset
|
||||
end = pointEnd(child).offset
|
||||
|
||||
// Bail if there’s no positional info.
|
||||
if (!end) return visit.EXIT
|
||||
if (!end) return EXIT
|
||||
|
||||
source = contents.slice(start, end)
|
||||
lines = [[start, '']]
|
||||
@ -247,8 +247,8 @@ function noUndefinedReferences(tree, file, option) {
|
||||
.slice(range[0 + offset] + 1, range[1 + offset] - 1)
|
||||
.replace(lineEnding, ' '),
|
||||
position: {
|
||||
start: location.toPosition(range[0]),
|
||||
end: location.toPosition(range[range.length - 1])
|
||||
start: loc.toPoint(range[0]),
|
||||
end: loc.toPoint(range[range.length - 1])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -28,12 +28,12 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"collapse-white-space": "^1.0.4",
|
||||
"collapse-white-space": "^2.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-position": "^3.1.0",
|
||||
"unist-util-visit": "^2.0.0",
|
||||
"vfile-location": "^3.1.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-position": "^4.0.0",
|
||||
"unist-util-visit": "^4.0.0",
|
||||
"vfile-location": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -38,9 +38,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import collapseWhiteSpace from 'collapse-white-space'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {collapseWhiteSpace} from 'collapse-white-space'
|
||||
|
||||
const remarkLintNoUnneededFullReferenceImage = lintRule(
|
||||
'remark-lint:no-unneeded-full-reference-image',
|
||||
|
@ -30,10 +30,10 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"collapse-white-space": "^1.0.0",
|
||||
"collapse-white-space": "^2.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
@ -44,9 +44,9 @@
|
||||
*/
|
||||
|
||||
import {lintRule} from 'unified-lint-rule'
|
||||
import visit from 'unist-util-visit'
|
||||
import generated from 'unist-util-generated'
|
||||
import collapseWhiteSpace from 'collapse-white-space'
|
||||
import {visit} from 'unist-util-visit'
|
||||
import {generated} from 'unist-util-generated'
|
||||
import {collapseWhiteSpace} from 'collapse-white-space'
|
||||
|
||||
const remarkLintNoUnneededFullReferenceLink = lintRule(
|
||||
'remark-lint:no-unneeded-full-reference-link',
|
||||
|
@ -30,10 +30,10 @@
|
||||
"index.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"collapse-white-space": "^1.0.0",
|
||||
"collapse-white-space": "^2.0.0",
|
||||
"unified-lint-rule": "^1.0.0",
|
||||
"unist-util-generated": "^1.1.0",
|
||||
"unist-util-visit": "^2.0.0"
|
||||
"unist-util-generated": "^2.0.0",
|
||||
"unist-util-visit": "^4.0.0"
|
||||
},
|
||||
"xo": false
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user