mirror of
https://github.com/remarkjs/remark-lint.git
synced 2024-09-11 19:57:15 +03:00
Replace nyc
with c8
This commit is contained in:
parent
5912962720
commit
e633c2fbb7
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,7 +1,6 @@
|
||||
coverage/
|
||||
node_modules/
|
||||
.DS_Store
|
||||
*.log
|
||||
coverage/
|
||||
.nyc_output/
|
||||
node_modules/
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
12
package.json
12
package.json
@ -32,10 +32,10 @@
|
||||
"Denis Augsburger <denis.augsburger@simpleen.io> (https://simpleen.io)"
|
||||
],
|
||||
"devDependencies": {
|
||||
"c8": "^7.0.0",
|
||||
"dox": "^0.9.0",
|
||||
"lerna": "^3.0.0",
|
||||
"mdast-zone": "^4.0.0",
|
||||
"nyc": "^15.0.0",
|
||||
"parse-author": "^2.0.0",
|
||||
"prettier": "^2.0.0",
|
||||
"remark": "^13.0.0",
|
||||
@ -58,16 +58,10 @@
|
||||
"generate:presets": "node script/build-presets",
|
||||
"generate:rules": "node script/build-rules",
|
||||
"generate": "npm run generate:presets && npm run generate:rules",
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js",
|
||||
"test-api": "node --conditions development test.js",
|
||||
"test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov npm run test-api",
|
||||
"test": "npm run generate && npm run format && npm run test-coverage"
|
||||
},
|
||||
"nyc": {
|
||||
"check-coverage": true,
|
||||
"lines": 100,
|
||||
"functions": 100,
|
||||
"branches": 100
|
||||
},
|
||||
"prettier": {
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
|
@ -124,9 +124,9 @@ function checkboxCharacterStyle(tree, file, option) {
|
||||
|
||||
type = types[node.checked]
|
||||
|
||||
/* istanbul ignore next - a list item cannot be checked and empty, according
|
||||
* to GFM, but theoretically it makes sense to get the end if that were
|
||||
* possible. */
|
||||
// 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])
|
||||
// Move back to before `] `.
|
||||
point.offset -= 2
|
||||
@ -137,8 +137,8 @@ function checkboxCharacterStyle(tree, file, option) {
|
||||
contents.slice(point.offset - 2, point.offset + 1)
|
||||
)
|
||||
|
||||
/* istanbul ignore if - failsafe to make sure we don‘t crash if there
|
||||
* actually isn’t a checkbox. */
|
||||
// Failsafe to make sure we don‘t crash if there actually isn’t a checkbox.
|
||||
/* c8 ignore next */
|
||||
if (!value) return
|
||||
|
||||
style = preferred[type]
|
||||
|
@ -62,9 +62,9 @@ function checkboxContentIndent(tree, file) {
|
||||
return
|
||||
}
|
||||
|
||||
/* istanbul ignore next - a list item cannot be checked and empty, according
|
||||
* to GFM, but theoretically it makes sense to get the end if that were
|
||||
* possible. */
|
||||
// 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])
|
||||
|
||||
// Assume we start with a checkbox, because well, `checked` is set.
|
||||
@ -72,8 +72,8 @@ function checkboxContentIndent(tree, file) {
|
||||
contents.slice(point.offset - 4, point.offset + 1)
|
||||
)
|
||||
|
||||
/* istanbul ignore if - failsafe to make sure we don‘t crash if there
|
||||
* actually isn’t a checkbox. */
|
||||
// Failsafe to make sure we don‘t crash if there actually isn’t a checkbox.
|
||||
/* c8 ignore next */
|
||||
if (!value) return
|
||||
|
||||
// Move past checkbox.
|
||||
|
@ -152,7 +152,8 @@ function linkTitleStyle(tree, file, option) {
|
||||
while (last) {
|
||||
final = contents.charAt(last)
|
||||
|
||||
/* istanbul ignore if - remark before 8.0.0 */
|
||||
// Legacy for remark before 8.0.0
|
||||
/* c8 ignore next 2 */
|
||||
if (/\s/.test(final)) {
|
||||
last--
|
||||
} else {
|
||||
|
@ -88,7 +88,8 @@ function listItemContentIndent(tree, file) {
|
||||
|
||||
reason =
|
||||
'Don’t use mixed indentation for children, ' +
|
||||
/* istanbul ignore next - hard to test, I couldn’t find it at least. */
|
||||
// Hard to test, I couldn’t find it at least.
|
||||
/* c8 ignore next */
|
||||
(diff > 0 ? 'add' : 'remove') +
|
||||
' ' +
|
||||
abs +
|
||||
|
@ -139,7 +139,8 @@ function maximumLineLength(tree, file, option) {
|
||||
var initial
|
||||
var final
|
||||
|
||||
/* istanbul ignore if - Nothing to allow when generated. */
|
||||
// Nothing to allow when generated.
|
||||
/* c8 ignore next 3 */
|
||||
if (generated(node)) {
|
||||
return
|
||||
}
|
||||
@ -165,7 +166,8 @@ function maximumLineLength(tree, file, option) {
|
||||
}
|
||||
|
||||
function ignore(node) {
|
||||
/* istanbul ignore else - Hard to test, as we only run this case on `position: true` */
|
||||
// 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)
|
||||
}
|
||||
|
@ -98,7 +98,6 @@ function noParagraphContentIndent(tree, file) {
|
||||
var offset
|
||||
var lineColumn
|
||||
|
||||
/* istanbul ignore else - Custom nodes may be containers. */
|
||||
if (parent && parent.type === 'root') {
|
||||
column = 1
|
||||
} else if (parent && parent.type === 'blockquote') {
|
||||
|
@ -81,7 +81,6 @@ function noTableIndentation(tree, file) {
|
||||
var offset
|
||||
var lineColumn
|
||||
|
||||
/* istanbul ignore else - Custom nodes may be containers. */
|
||||
if (parent && parent.type === 'root') {
|
||||
column = 1
|
||||
} else if (parent && parent.type === 'blockquote') {
|
||||
@ -90,6 +89,7 @@ function noTableIndentation(tree, file) {
|
||||
column = position.start(parent.children[0]).column
|
||||
|
||||
// Skip past the first line if we’re the first child of a list item.
|
||||
/* c8 ignore next 3 */
|
||||
if (parent.children[0] === node) {
|
||||
line++
|
||||
}
|
||||
@ -108,10 +108,6 @@ function noTableIndentation(tree, file) {
|
||||
offset--
|
||||
}
|
||||
|
||||
/* istanbul ignore else - Exit if we find some other content before this
|
||||
* line.
|
||||
* This might be because the paragraph line is lazy, which isn’t this
|
||||
* rule. */
|
||||
if (!offset || /[\r\n>]/.test(content.charAt(offset - 1))) {
|
||||
offset = lineColumn
|
||||
|
||||
|
@ -10,7 +10,8 @@ function factory(id, rule) {
|
||||
var ruleId = parts[1]
|
||||
var fn = wrapped(rule)
|
||||
|
||||
/* istanbul ignore if - possibly useful if externalised later. */
|
||||
// Possibly useful if externalised later.
|
||||
/* c8 ignore next 4 */
|
||||
if (!ruleId) {
|
||||
ruleId = source
|
||||
source = null
|
||||
@ -38,7 +39,8 @@ function factory(id, rule) {
|
||||
var message
|
||||
|
||||
// Add the error, if not already properly added.
|
||||
/* istanbul ignore if - only happens for incorrect plugins */
|
||||
// Only happens for incorrect plugins.
|
||||
/* c8 ignore next 5 */
|
||||
if (error && messages.indexOf(error) === -1) {
|
||||
try {
|
||||
file.fail(error)
|
||||
@ -66,7 +68,8 @@ function coerce(name, value) {
|
||||
var result
|
||||
var level
|
||||
|
||||
/* istanbul ignore if - Handled by unified in v6.0.0 */
|
||||
// Handled by unified in v6.0.0.
|
||||
/* c8 ignore next 3 */
|
||||
if (typeof value === 'boolean') {
|
||||
result = [value]
|
||||
} else if (value == null) {
|
||||
|
@ -24,12 +24,12 @@ function ruleSync(filePath) {
|
||||
description = find(tags, 'fileoverview')
|
||||
name = find(tags, 'module')
|
||||
|
||||
/* istanbul ignore if */
|
||||
/* c8 ignore next 3 */
|
||||
if (name !== ruleId) {
|
||||
throw new Error(ruleId + ' has an incorrect `@module`: ' + name)
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
/* c8 ignore next 3 */
|
||||
if (!description) {
|
||||
throw new Error(ruleId + ' is missing a `@fileoverview`')
|
||||
}
|
||||
@ -55,8 +55,8 @@ function ruleSync(filePath) {
|
||||
|
||||
try {
|
||||
info = JSON.parse(lines[0])
|
||||
/* c8 ignore next 5 */
|
||||
} catch (error) {
|
||||
/* istanbul ignore next */
|
||||
throw new Error(
|
||||
'Could not parse example in ' + ruleId + ':\n' + error.stack
|
||||
)
|
||||
@ -83,7 +83,7 @@ function ruleSync(filePath) {
|
||||
return
|
||||
}
|
||||
|
||||
/* istanbul ignore if */
|
||||
/* c8 ignore next 9 */
|
||||
if (info.label !== 'input' && info.label !== 'output') {
|
||||
throw new Error(
|
||||
'Expected `input` or `ouput` for `label` in ' +
|
||||
|
Loading…
Reference in New Issue
Block a user