Skip to content

Commit 82d9b63

Browse files
not-an-aardvarkilyavolodin
authored andcommitted
Chore: enable prefer-arrow-callback on ESLint codebase (fixes #6407) (#7503)
* Chore: enable `prefer-arrow-callback` on ESLint codebase (fixes #6407) * Move some complex expressions onto multiple lines * Use `.returns(value)` instead of `() => value` with sinon
1 parent 0e87b5c commit 82d9b63

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

test.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,31 @@ const formatter = proxyquire("../../../lib/formatters/codeframe", { chalk: chalk
4040
// Tests
4141
//------------------------------------------------------------------------------
4242

43-
describe("formatter:codeframe", function() {
43+
describe("formatter:codeframe", () => {
4444
let sandbox;
4545

46-
beforeEach(function() {
46+
beforeEach(() => {
4747
sandbox = sinon.sandbox.create();
4848
});
4949

50-
afterEach(function() {
50+
afterEach(() => {
5151
sandbox.verifyAndRestore();
5252
});
5353

54-
describe("when passed no messages", function() {
54+
describe("when passed no messages", () => {
5555
const code = [{
5656
filePath: "foo.js",
5757
messages: []
5858
}];
5959

60-
it("should return nothing", function() {
60+
it("should return nothing", () => {
6161
const result = formatter(code);
6262

6363
assert.equal(result, "");
6464
});
6565
});
6666

67-
describe("when passed a single message", function() {
67+
describe("when passed a single message", () => {
6868
const code = [{
6969
filePath: path.join(process.cwd(), "lib", "foo.js"),
7070
source: "var foo = 1;\n var bar = 2;\n",
@@ -77,7 +77,7 @@ describe("formatter:codeframe", function() {
7777
}]
7878
}];
7979

80-
it("should return a string in the correct format for errors", function() {
80+
it("should return a string in the correct format for errors", () => {
8181
const result = formatter(code);
8282

8383
assert.equal(chalk.stripColor(result), [
@@ -91,7 +91,7 @@ describe("formatter:codeframe", function() {
9191
].join("\n"));
9292
});
9393

94-
it("should return a string in the correct format for warnings", function() {
94+
it("should return a string in the correct format for warnings", () => {
9595
code[0].messages[0].severity = 1;
9696

9797
const result = formatter(code);
@@ -107,7 +107,7 @@ describe("formatter:codeframe", function() {
107107
].join("\n"));
108108
});
109109

110-
it("should return bold red summary when there are errors", function() {
110+
it("should return bold red summary when there are errors", () => {
111111
sandbox.spy(chalkStub.yellow, "bold");
112112
sandbox.spy(chalkStub.red, "bold");
113113
code[0].messages[0].severity = 2;
@@ -118,7 +118,7 @@ describe("formatter:codeframe", function() {
118118
assert.equal(chalkStub.red.bold.callCount, 1);
119119
});
120120

121-
it("should return bold yellow summary when there are only warnings", function() {
121+
it("should return bold yellow summary when there are only warnings", () => {
122122
sandbox.spy(chalkStub.yellow, "bold");
123123
sandbox.spy(chalkStub.red, "bold");
124124
code[0].messages[0].severity = 1;
@@ -130,7 +130,7 @@ describe("formatter:codeframe", function() {
130130
});
131131
});
132132

133-
describe("when passed multiple messages", function() {
133+
describe("when passed multiple messages", () => {
134134
const code = [{
135135
filePath: "foo.js",
136136
source: "const foo = 1\n",
@@ -149,7 +149,7 @@ describe("formatter:codeframe", function() {
149149
}],
150150
}];
151151

152-
it("should return a string with multiple entries", function() {
152+
it("should return a string with multiple entries", () => {
153153
const result = formatter(code);
154154

155155
assert.equal(chalk.stripColor(result), [
@@ -167,7 +167,7 @@ describe("formatter:codeframe", function() {
167167
].join("\n"));
168168
});
169169

170-
it("should return bold red summary when at least 1 of the messages is an error", function() {
170+
it("should return bold red summary when at least 1 of the messages is an error", () => {
171171
sandbox.spy(chalkStub.yellow, "bold");
172172
sandbox.spy(chalkStub.red, "bold");
173173
code[0].messages[0].severity = 1;
@@ -179,7 +179,7 @@ describe("formatter:codeframe", function() {
179179
});
180180
});
181181

182-
describe("when passed one file with 1 message and fixes applied", function() {
182+
describe("when passed one file with 1 message and fixes applied", () => {
183183
const code = [{
184184
filePath: "foo.js",
185185
messages: [{
@@ -193,7 +193,7 @@ describe("formatter:codeframe", function() {
193193
output: "function foo() {\n\n // a comment\n const foo = 1;\n}\n\n"
194194
}];
195195

196-
it("should return a string with code preview pointing to the correct location after fixes", function() {
196+
it("should return a string with code preview pointing to the correct location after fixes", () => {
197197
const result = formatter(code);
198198

199199
assert.equal(chalk.stripColor(result), [
@@ -211,7 +211,7 @@ describe("formatter:codeframe", function() {
211211
});
212212
});
213213

214-
describe("when passed multiple files with 1 message each", function() {
214+
describe("when passed multiple files with 1 message each", () => {
215215
const code = [{
216216
filePath: "foo.js",
217217
source: "const foo = 1\n",
@@ -234,7 +234,7 @@ describe("formatter:codeframe", function() {
234234
}]
235235
}];
236236

237-
it("should return a string with multiple entries", function() {
237+
it("should return a string with multiple entries", () => {
238238
const result = formatter(code);
239239

240240
assert.equal(chalk.stripColor(result), [
@@ -253,7 +253,7 @@ describe("formatter:codeframe", function() {
253253
});
254254
});
255255

256-
describe("when passed a fatal error message", function() {
256+
describe("when passed a fatal error message", () => {
257257
const code = [{
258258
filePath: "foo.js",
259259
source: "e{}\n",
@@ -268,7 +268,7 @@ describe("formatter:codeframe", function() {
268268
}]
269269
}];
270270

271-
it("should return a string in the correct format", function() {
271+
it("should return a string in the correct format", () => {
272272
const result = formatter(code);
273273

274274
assert.equal(chalk.stripColor(result), [
@@ -282,7 +282,7 @@ describe("formatter:codeframe", function() {
282282
});
283283
});
284284

285-
describe("when passed one file not found message", function() {
285+
describe("when passed one file not found message", () => {
286286
const code = [{
287287
filePath: "foo.js",
288288
messages: [{
@@ -291,14 +291,14 @@ describe("formatter:codeframe", function() {
291291
}]
292292
}];
293293

294-
it("should return a string without code preview (codeframe)", function() {
294+
it("should return a string without code preview (codeframe)", () => {
295295
const result = formatter(code);
296296

297297
assert.equal(chalk.stripColor(result), "error: Couldn't find foo.js at foo.js\n\n\n1 error found.");
298298
});
299299
});
300300

301-
describe("when passed a single message with no line or column", function() {
301+
describe("when passed a single message with no line or column", () => {
302302
const code = [{
303303
filePath: "foo.js",
304304
messages: [{
@@ -309,13 +309,13 @@ describe("formatter:codeframe", function() {
309309
}]
310310
}];
311311

312-
it("should return a string without code preview (codeframe)", function() {
312+
it("should return a string without code preview (codeframe)", () => {
313313
const result = formatter(code);
314314

315315
assert.equal(chalk.stripColor(result), "error: Unexpected foo (foo) at foo.js\n\n\n1 error found.");
316316
});
317317

318-
it("should output filepath but without 'line:column' appended", function() {
318+
it("should output filepath but without 'line:column' appended", () => {
319319
const result = formatter(code);
320320

321321
assert.equal(chalk.stripColor(result), "error: Unexpected foo (foo) at foo.js\n\n\n1 error found.");

0 commit comments

Comments
 (0)