Run new lint rules (#5413)

This commit is contained in:
Brian Ng
2017-03-04 09:46:01 -06:00
committed by Henry Zhu
parent f7e2d88f6c
commit 8a82cc060a
181 changed files with 1459 additions and 1454 deletions

View File

@@ -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}`;

View File

@@ -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"))
);
});