代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/Sourcegraph 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
// The default ESLint formatter with relative paths.
// Forked from https://github.com/eslint/eslint/blob/main/lib/cli-engine/formatters/stylish.js
const path = require('path')
const chalk = require('chalk')
const stripAnsi = require('strip-ansi')
const table = require('text-table')
function pluralize(word, count) {
return count === 1 ? word : `${word}s`
}
module.exports = function (results) {
let output = '\n',
errorCount = 0,
warningCount = 0,
fixableErrorCount = 0,
fixableWarningCount = 0,
summaryColor = 'yellow'
results.forEach(result => {
const messages = result.messages
if (messages.length === 0) {
return
}
errorCount += result.errorCount
warningCount += result.warningCount
fixableErrorCount += result.fixableErrorCount
fixableWarningCount += result.fixableWarningCount
// This is the only line that is different from the original stylish formatter.
output += `${chalk.underline(path.relative(process.cwd(), result.filePath))}\n`
output += `${table(
messages.map(message => {
let messageType
if (message.fatal || message.severity === 2) {
messageType = chalk.red('error')
summaryColor = 'red'
} else {
messageType = chalk.yellow('warning')
}
return [
'',
message.line || 0,
message.column || 0,
messageType,
message.message.replace(/([^ ])\.$/u, '$1'),
chalk.dim(message.ruleId || ''),
]
}),
{
align: ['', 'r', 'l'],
stringLength(str) {
return stripAnsi(str).length
},
}
)
.split('\n')
.map(el => el.replace(/(\d+)\s+(\d+)/u, (m, p1, p2) => chalk.dim(`${p1}:${p2}`)))
.join('\n')}\n\n`
})
const total = errorCount + warningCount
if (total > 0) {
output += chalk[summaryColor].bold(
[
'\u2716 ',
total,
pluralize(' problem', total),
' (',
errorCount,
pluralize(' error', errorCount),
', ',
warningCount,
pluralize(' warning', warningCount),
')\n',
].join('')
)
if (fixableErrorCount > 0 || fixableWarningCount > 0) {
output += chalk[summaryColor].bold(
[
' ',
fixableErrorCount,
pluralize(' error', fixableErrorCount),
' and ',
fixableWarningCount,
pluralize(' warning', fixableWarningCount),
' potentially fixable with the `--fix` option.\n',
].join('')
)
}
}
// Resets output color, for prevent change on top level
return total > 0 ? chalk.reset(output) : ''
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。