Run new lint rules (#5413)
This commit is contained in:
@@ -8,18 +8,18 @@ import Chalk from "chalk";
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
keyword: chalk.cyan,
|
||||
keyword: chalk.cyan,
|
||||
capitalized: chalk.yellow,
|
||||
jsx_tag: chalk.yellow,
|
||||
punctuator: chalk.yellow,
|
||||
jsx_tag: chalk.yellow,
|
||||
punctuator: chalk.yellow,
|
||||
// bracket: intentionally omitted.
|
||||
number: chalk.magenta,
|
||||
string: chalk.green,
|
||||
regex: chalk.magenta,
|
||||
comment: chalk.grey,
|
||||
invalid: chalk.white.bgRed.bold,
|
||||
gutter: chalk.grey,
|
||||
marker: chalk.red.bold,
|
||||
number: chalk.magenta,
|
||||
string: chalk.green,
|
||||
regex: chalk.magenta,
|
||||
comment: chalk.grey,
|
||||
invalid: chalk.white.bgRed.bold,
|
||||
gutter: chalk.grey,
|
||||
marker: chalk.red.bold,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ export default function (
|
||||
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
let start = Math.max(lineNumber - (linesAbove + 1), 0);
|
||||
let end = Math.min(lines.length, lineNumber + linesBelow);
|
||||
let end = Math.min(lines.length, lineNumber + linesBelow);
|
||||
|
||||
if (!lineNumber && !colNumber) {
|
||||
start = 0;
|
||||
@@ -138,14 +138,14 @@ export default function (
|
||||
"\n ",
|
||||
maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")),
|
||||
markerSpacing,
|
||||
maybeHighlight(defs.marker, "^")
|
||||
maybeHighlight(defs.marker, "^"),
|
||||
].join("");
|
||||
}
|
||||
return [
|
||||
maybeHighlight(defs.marker, ">"),
|
||||
maybeHighlight(defs.gutter, gutter),
|
||||
line,
|
||||
markerLine
|
||||
markerLine,
|
||||
].join("");
|
||||
} else {
|
||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
|
||||
|
||||
@@ -55,7 +55,7 @@ describe("babel-code-frame", function () {
|
||||
"",
|
||||
"function sum(a, b) {",
|
||||
" return a + b",
|
||||
"}"
|
||||
"}",
|
||||
].join("\n");
|
||||
assert.equal(codeFrame(rawLines, 7, 2), [
|
||||
" 5 | * @param b Number",
|
||||
@@ -80,7 +80,7 @@ describe("babel-code-frame", function () {
|
||||
"",
|
||||
"function sum(a, b) {",
|
||||
" return a + b",
|
||||
"}"
|
||||
"}",
|
||||
].join("\n");
|
||||
assert.equal(codeFrame(rawLines, 6, 2), [
|
||||
" 4 | * @param a Number",
|
||||
@@ -130,7 +130,7 @@ describe("babel-code-frame", function () {
|
||||
"",
|
||||
"function sum(a, b) {",
|
||||
" return a + b",
|
||||
"}"
|
||||
"}",
|
||||
].join("\n");
|
||||
assert.equal(codeFrame(rawLines, 7, 2, { linesAbove: 1 }), [
|
||||
" 6 | * @returns Number",
|
||||
@@ -154,14 +154,14 @@ describe("babel-code-frame", function () {
|
||||
"",
|
||||
"function sum(a, b) {",
|
||||
" return a + b",
|
||||
"}"
|
||||
"}",
|
||||
].join("\n");
|
||||
assert.equal(codeFrame(rawLines, 7, 2, { linesBelow: 1 }), [
|
||||
" 5 | * @param b Number",
|
||||
" 6 | * @returns Number",
|
||||
"> 7 | */",
|
||||
" | ^",
|
||||
" 8 | "
|
||||
" 8 | ",
|
||||
].join("\n"));
|
||||
});
|
||||
|
||||
@@ -177,13 +177,13 @@ describe("babel-code-frame", function () {
|
||||
"",
|
||||
"function sum(a, b) {",
|
||||
" return a + b",
|
||||
"}"
|
||||
"}",
|
||||
].join("\n");
|
||||
assert.equal(codeFrame(rawLines, 7, 2, { linesAbove: 1, linesBelow: 1 }), [
|
||||
" 6 | * @returns Number",
|
||||
"> 7 | */",
|
||||
" | ^",
|
||||
" 8 | "
|
||||
" 8 | ",
|
||||
].join("\n"));
|
||||
});
|
||||
|
||||
@@ -195,13 +195,13 @@ describe("babel-code-frame", function () {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
""
|
||||
"",
|
||||
].join("\n");
|
||||
assert.equal(codeFrame(rawLines, 3, null, { linesAbove: 1, linesBelow: 1, forceColor: true }),
|
||||
chalk.reset([
|
||||
" " + gutter(" 2 | "),
|
||||
marker(">") + gutter(" 3 | "),
|
||||
" " + gutter(" 4 | ")
|
||||
" " + gutter(" 4 | "),
|
||||
].join("\n"))
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user