Update to use Node 4 features (babel/babel-eslint#425)

* Change for loops to forEach

* Change more for loops

* Arrow functions

* Use object shorthand

* Put this on one line

* Change back to using for loops
This commit is contained in:
Nazim Hajidin 2017-01-14 17:15:54 -05:00
parent fd2093914e
commit d76cfe05b1
6 changed files with 246 additions and 246 deletions

View File

@ -31,7 +31,7 @@ function changeComments(nodeComments) {
var astTransformVisitor = { var astTransformVisitor = {
noScope: true, noScope: true,
enter: function (path) { enter (path) {
var node = path.node; var node = path.node;
node.range = [node.start, node.end]; node.range = [node.start, node.end];
@ -55,12 +55,12 @@ var astTransformVisitor = {
// make '_paths' non-enumerable (babel-eslint #200) // make '_paths' non-enumerable (babel-eslint #200)
Object.defineProperty(node, "_paths", { value: node._paths, writable: true }); Object.defineProperty(node, "_paths", { value: node._paths, writable: true });
}, },
exit: function (path) { exit (path) {
var node = path.node; var node = path.node;
[ [
fixDirectives, fixDirectives,
].forEach(function (fixer) { ].forEach((fixer) => {
fixer(path); fixer(path);
}); });
@ -211,7 +211,7 @@ var astTransformVisitor = {
// template string range fixes // template string range fixes
if (path.isTemplateLiteral()) { if (path.isTemplateLiteral()) {
node.quasis.forEach(function (q) { node.quasis.forEach((q) => {
q.range[0] -= 1; q.range[0] -= 1;
if (q.tail) { if (q.tail) {
q.range[1] += 1; q.range[1] += 1;
@ -244,7 +244,7 @@ function fixDirectives (path) {
if (!directivesContainer.directives) return; if (!directivesContainer.directives) return;
directivesContainer.directives.reverse().forEach(function (directive) { directivesContainer.directives.reverse().forEach((directive) => {
directive.type = "ExpressionStatement"; directive.type = "ExpressionStatement";
directive.expression = directive.value; directive.expression = directive.value;
delete directive.value; delete directive.value;

View File

@ -4,7 +4,7 @@ var toToken = require("./toToken");
module.exports = function (tokens, tt, code) { module.exports = function (tokens, tt, code) {
// transform tokens to type "Template" // transform tokens to type "Template"
convertTemplateType(tokens, tt); convertTemplateType(tokens, tt);
var transformedTokens = tokens.filter(function (token) { var transformedTokens = tokens.filter((token) => {
return token.type !== "CommentLine" && token.type !== "CommentBlock"; return token.type !== "CommentLine" && token.type !== "CommentBlock";
}); });

View File

@ -44,7 +44,7 @@ function monkeypatch() {
estraverses.push(estraverseOfEslint); estraverses.push(estraverseOfEslint);
Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS); Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS);
estraverses.forEach(function (estraverse) { estraverses.forEach((estraverse) => {
estraverse.VisitorKeys.MethodDefinition.push("decorators"); estraverse.VisitorKeys.MethodDefinition.push("decorators");
estraverse.VisitorKeys.Property.push("decorators"); estraverse.VisitorKeys.Property.push("decorators");
}); });
@ -100,7 +100,7 @@ function monkeypatch() {
} }
// iterate through part of t.VISITOR_KEYS // iterate through part of t.VISITOR_KEYS
var visitorKeysMap = pick(t.VISITOR_KEYS, function(k) { var visitorKeysMap = pick(t.VISITOR_KEYS, (k) => {
return t.FLIPPED_ALIAS_KEYS.Flow.concat([ return t.FLIPPED_ALIAS_KEYS.Flow.concat([
"ArrayPattern", "ArrayPattern",
"ClassDeclaration", "ClassDeclaration",
@ -268,13 +268,13 @@ function monkeypatch() {
} }
// set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise // set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise
// escope will traverse into them and include the identifiers within as declarations // escope will traverse into them and include the identifiers within as declarations
estraverses.forEach(function (estraverse) { estraverses.forEach((estraverse) => {
estraverse.VisitorKeys.ObjectPattern = ["properties"]; estraverse.VisitorKeys.ObjectPattern = ["properties"];
estraverse.VisitorKeys.ArrayPattern = ["elements"]; estraverse.VisitorKeys.ArrayPattern = ["elements"];
}); });
visitFunction.call(this, node); visitFunction.call(this, node);
// set them back to normal... // set them back to normal...
estraverses.forEach(function (estraverse) { estraverses.forEach((estraverse) => {
estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern; estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern;
estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern; estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern;
}); });

View File

@ -37,7 +37,7 @@ function lookup(obj, keypath, backwardsDepth) {
if (!keypath) { return obj; } if (!keypath) { return obj; }
return keypath.split(".").slice(0, -1 * backwardsDepth) return keypath.split(".").slice(0, -1 * backwardsDepth)
.reduce(function (base, segment) { return base && base[segment], obj; }); .reduce((base, segment) => { return base && base[segment], obj; });
} }
function parseAndAssertSame(code) { function parseAndAssertSame(code) {
@ -82,57 +82,57 @@ function parseAndAssertSame(code) {
// assert.equal(esAST, babylonAST); // assert.equal(esAST, babylonAST);
} }
describe("babylon-to-esprima", function () { describe("babylon-to-esprima", () => {
describe("templates", function () { describe("templates", () => {
it("empty template string", function () { it("empty template string", () => {
parseAndAssertSame("``"); parseAndAssertSame("``");
}); });
it("template string", function () { it("template string", () => {
parseAndAssertSame("`test`"); parseAndAssertSame("`test`");
}); });
it("template string using $", function () { it("template string using $", () => {
parseAndAssertSame("`$`"); parseAndAssertSame("`$`");
}); });
it("template string with expression", function () { it("template string with expression", () => {
parseAndAssertSame("`${a}`"); parseAndAssertSame("`${a}`");
}); });
it("template string with multiple expressions", function () { it("template string with multiple expressions", () => {
parseAndAssertSame("`${a}${b}${c}`"); parseAndAssertSame("`${a}${b}${c}`");
}); });
it("template string with expression and strings", function () { it("template string with expression and strings", () => {
parseAndAssertSame("`a${a}a`"); parseAndAssertSame("`a${a}a`");
}); });
it("template string with binary expression", function () { it("template string with binary expression", () => {
parseAndAssertSame("`a${a + b}a`"); parseAndAssertSame("`a${a + b}a`");
}); });
it("tagged template", function () { it("tagged template", () => {
parseAndAssertSame("jsx`<Button>Click</Button>`"); parseAndAssertSame("jsx`<Button>Click</Button>`");
}); });
it("tagged template with expression", function () { it("tagged template with expression", () => {
parseAndAssertSame("jsx`<Button>Hi ${name}</Button>`"); parseAndAssertSame("jsx`<Button>Hi ${name}</Button>`");
}); });
it("tagged template with new operator", function () { it("tagged template with new operator", () => {
parseAndAssertSame("new raw`42`"); parseAndAssertSame("new raw`42`");
}); });
it("template with nested function/object", function () { it("template with nested function/object", () => {
parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"); parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`");
}); });
it("template with braces inside and outside of template string #96", function () { it("template with braces inside and outside of template string #96", () => {
parseAndAssertSame("if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }"); parseAndAssertSame("if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }");
}); });
it("template also with braces #96", function () { it("template also with braces #96", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
export default function f1() { export default function f1() {
@ -146,7 +146,7 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("template with destructuring #31", function () { it("template with destructuring #31", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
module.exports = { module.exports = {
@ -160,103 +160,103 @@ describe("babylon-to-esprima", function () {
}); });
}); });
it("simple expression", function () { it("simple expression", () => {
parseAndAssertSame("a = 1"); parseAndAssertSame("a = 1");
}); });
it("class declaration", function () { it("class declaration", () => {
parseAndAssertSame("class Foo {}"); parseAndAssertSame("class Foo {}");
}); });
it("class expression", function () { it("class expression", () => {
parseAndAssertSame("var a = class Foo {}"); parseAndAssertSame("var a = class Foo {}");
}); });
it("jsx expression", function () { it("jsx expression", () => {
parseAndAssertSame("<App />"); parseAndAssertSame("<App />");
}); });
it("jsx expression with 'this' as identifier", function () { it("jsx expression with 'this' as identifier", () => {
parseAndAssertSame("<this />"); parseAndAssertSame("<this />");
}); });
it("jsx expression with a dynamic attribute", function () { it("jsx expression with a dynamic attribute", () => {
parseAndAssertSame("<App foo={bar} />"); parseAndAssertSame("<App foo={bar} />");
}); });
it("jsx expression with a member expression as identifier", function () { it("jsx expression with a member expression as identifier", () => {
parseAndAssertSame("<foo.bar />"); parseAndAssertSame("<foo.bar />");
}); });
it("jsx expression with spread", function () { it("jsx expression with spread", () => {
parseAndAssertSame("var myDivElement = <div {...this.props} />;"); parseAndAssertSame("var myDivElement = <div {...this.props} />;");
}); });
it("empty jsx text", function () { it("empty jsx text", () => {
parseAndAssertSame("<a></a>"); parseAndAssertSame("<a></a>");
}); });
it("jsx text with content", function () { it("jsx text with content", () => {
parseAndAssertSame("<a>Hello, world!</a>"); parseAndAssertSame("<a>Hello, world!</a>");
}); });
it("nested jsx", function () { it("nested jsx", () => {
parseAndAssertSame("<div>\n<h1>Wat</h1>\n</div>"); parseAndAssertSame("<div>\n<h1>Wat</h1>\n</div>");
}); });
it("default import", function () { it("default import", () => {
parseAndAssertSame("import foo from \"foo\";"); parseAndAssertSame("import foo from \"foo\";");
}); });
it("import specifier", function () { it("import specifier", () => {
parseAndAssertSame("import { foo } from \"foo\";"); parseAndAssertSame("import { foo } from \"foo\";");
}); });
it("import specifier with name", function () { it("import specifier with name", () => {
parseAndAssertSame("import { foo as bar } from \"foo\";"); parseAndAssertSame("import { foo as bar } from \"foo\";");
}); });
it("import bare", function () { it("import bare", () => {
parseAndAssertSame("import \"foo\";"); parseAndAssertSame("import \"foo\";");
}); });
it("export default class declaration", function () { it("export default class declaration", () => {
parseAndAssertSame("export default class Foo {}"); parseAndAssertSame("export default class Foo {}");
}); });
it("export default class expression", function () { it("export default class expression", () => {
parseAndAssertSame("export default class {}"); parseAndAssertSame("export default class {}");
}); });
it("export default function declaration", function () { it("export default function declaration", () => {
parseAndAssertSame("export default function Foo() {}"); parseAndAssertSame("export default function Foo() {}");
}); });
it("export default function expression", function () { it("export default function expression", () => {
parseAndAssertSame("export default function () {}"); parseAndAssertSame("export default function () {}");
}); });
it("export all", function () { it("export all", () => {
parseAndAssertSame("export * from \"foo\";"); parseAndAssertSame("export * from \"foo\";");
}); });
it("export named", function () { it("export named", () => {
parseAndAssertSame("export { foo };"); parseAndAssertSame("export { foo };");
}); });
it("export named alias", function () { it("export named alias", () => {
parseAndAssertSame("export { foo as bar };"); parseAndAssertSame("export { foo as bar };");
}); });
it.skip("empty program with line comment", function () { it.skip("empty program with line comment", () => {
parseAndAssertSame("// single comment"); parseAndAssertSame("// single comment");
}); });
it.skip("empty program with block comment", function () { it.skip("empty program with block comment", () => {
parseAndAssertSame(" /* multiline\n * comment\n*/"); parseAndAssertSame(" /* multiline\n * comment\n*/");
}); });
it("line comments", function () { it("line comments", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
// single comment // single comment
@ -266,7 +266,7 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("block comments", function () { it("block comments", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
/* single comment */ /* single comment */
@ -279,7 +279,7 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("block comments #124", function () { it("block comments #124", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
React.createClass({ React.createClass({
@ -293,31 +293,31 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("null", function () { it("null", () => {
parseAndAssertSame("null"); parseAndAssertSame("null");
}); });
it("boolean", function () { it("boolean", () => {
parseAndAssertSame("if (true) {} else if (false) {}"); parseAndAssertSame("if (true) {} else if (false) {}");
}); });
it("regexp", function () { it("regexp", () => {
parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/"); parseAndAssertSame("/affix-top|affix-bottom|affix|[a-z]/");
}); });
it("regexp in a template string", function () { it("regexp in a template string", () => {
parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`");
}); });
it("first line is empty", function () { it("first line is empty", () => {
parseAndAssertSame("\nimport Immutable from \"immutable\";"); parseAndAssertSame("\nimport Immutable from \"immutable\";");
}); });
it("empty", function () { it("empty", () => {
parseAndAssertSame(""); parseAndAssertSame("");
}); });
it("jsdoc", function () { it("jsdoc", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
/** /**
@ -332,7 +332,7 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("empty block with comment", function () { it("empty block with comment", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
function a () { function a () {
@ -346,8 +346,8 @@ describe("babylon-to-esprima", function () {
); );
}); });
describe("babel 6 tests", function () { describe("babel 6 tests", () => {
it("MethodDefinition", function () { it("MethodDefinition", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
export default class A { export default class A {
@ -357,11 +357,11 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("MethodDefinition 2", function () { it("MethodDefinition 2", () => {
parseAndAssertSame("export default class Bar { get bar() { return 42; }}"); parseAndAssertSame("export default class Bar { get bar() { return 42; }}");
}); });
it("ClassMethod", function () { it("ClassMethod", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
class A { class A {
@ -372,7 +372,7 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("ClassMethod multiple params", function () { it("ClassMethod multiple params", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
class A { class A {
@ -383,7 +383,7 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("ClassMethod multiline", function () { it("ClassMethod multiline", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
class A { class A {
@ -401,11 +401,11 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("ClassMethod oneline", function () { it("ClassMethod oneline", () => {
parseAndAssertSame("class A { constructor(a, b, c) {} }"); parseAndAssertSame("class A { constructor(a, b, c) {} }");
}); });
it("ObjectMethod", function () { it("ObjectMethod", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
var a = { var a = {
@ -416,27 +416,27 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("do not allow import export everywhere", function() { it("do not allow import export everywhere", () => {
assert.throws(function () { assert.throws(() => {
parseAndAssertSame("function F() { import a from \"a\"; }"); parseAndAssertSame("function F() { import a from \"a\"; }");
}, /SyntaxError: 'import' and 'export' may only appear at the top level/); }, /SyntaxError: 'import' and 'export' may only appear at the top level/);
}); });
it("return outside function", function () { it("return outside function", () => {
parseAndAssertSame("return;"); parseAndAssertSame("return;");
}); });
it("super outside method", function () { it("super outside method", () => {
parseAndAssertSame("function F() { super(); }"); parseAndAssertSame("function F() { super(); }");
}); });
it("StringLiteral", function () { it("StringLiteral", () => {
parseAndAssertSame(""); parseAndAssertSame("");
parseAndAssertSame(""); parseAndAssertSame("");
parseAndAssertSame("a"); parseAndAssertSame("a");
}); });
it("getters and setters", function () { it("getters and setters", () => {
parseAndAssertSame("class A { get x ( ) { ; } }"); parseAndAssertSame("class A { get x ( ) { ; } }");
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
@ -475,19 +475,19 @@ describe("babylon-to-esprima", function () {
); );
}); });
it("RestOperator", function () { it("RestOperator", () => {
parseAndAssertSame("var { a, ...b } = c"); parseAndAssertSame("var { a, ...b } = c");
parseAndAssertSame("var [ a, ...b ] = c"); parseAndAssertSame("var [ a, ...b ] = c");
parseAndAssertSame("var a = function (...b) {}"); parseAndAssertSame("var a = function (...b) {}");
}); });
it("SpreadOperator", function () { it("SpreadOperator", () => {
parseAndAssertSame("var a = { b, ...c }"); parseAndAssertSame("var a = { b, ...c }");
parseAndAssertSame("var a = [ a, ...b ]"); parseAndAssertSame("var a = [ a, ...b ]");
parseAndAssertSame("var a = sum(...b)"); parseAndAssertSame("var a = sum(...b)");
}); });
it("Async/Await", function() { it("Async/Await", () => {
parseAndAssertSame( parseAndAssertSame(
unpad(` unpad(`
async function a() { async function a() {

View File

@ -24,7 +24,7 @@ var baseEslintOpts = {
* @param function done * @param function done
*/ */
function lint (opts, done) { function lint (opts, done) {
readFixture(opts.fixture, function (err, src) { readFixture(opts.fixture, (err, src) => {
if (err) return done(err); if (err) return done(err);
done(null, eslint.linter.verify(src, opts.eslint)); done(null, eslint.linter.verify(src, opts.eslint));
}); });
@ -46,7 +46,7 @@ function readFixture (id, done) {
} }
// readFixture // readFixture
describe("Rules:", function () { describe("Rules:", () => {
describe("`strict`", strictSuite); describe("`strict`", strictSuite);
}); });
// describe // describe
@ -54,19 +54,19 @@ describe("Rules:", function () {
function strictSuite () { function strictSuite () {
var ruleId = "strict"; var ruleId = "strict";
describe("when set to 'never'", function () { describe("when set to 'never'", () => {
var eslintOpts = Object.assign({}, baseEslintOpts, { var eslintOpts = Object.assign({}, baseEslintOpts, {
rules: {}, rules: {},
}); });
eslintOpts.rules[ruleId] = [errorLevel, "never"]; eslintOpts.rules[ruleId] = [errorLevel, "never"];
["global-with", "function-with"].forEach(function (fixture) { ["global-with", "function-with"].forEach((fixture) => {
it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`,
function (done) { (done) => {
lint({ lint({
fixture: ["strict", fixture], fixture: ["strict", fixture],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
assert(report[0].ruleId === ruleId); assert(report[0].ruleId === ruleId);
done(); done();
@ -78,17 +78,17 @@ function strictSuite () {
}); });
// describe // describe
describe("when set to 'global'", function () { describe("when set to 'global'", () => {
var eslintOpts = Object.assign({}, baseEslintOpts, { var eslintOpts = Object.assign({}, baseEslintOpts, {
rules: {} rules: {}
}); });
eslintOpts.rules[ruleId] = [errorLevel, "global"]; eslintOpts.rules[ruleId] = [errorLevel, "global"];
it("shouldn't error on single global directive", function (done) { it("shouldn't error on single global directive", (done) => {
lint({ lint({
fixture: ["strict", "global-with"], fixture: ["strict", "global-with"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
assert(!report.length); assert(!report.length);
done(); done();
@ -96,13 +96,13 @@ function strictSuite () {
}); });
// it // it
it("should error twice on global directive: no and function directive: yes", function (done) { it("should error twice on global directive: no and function directive: yes", (done) => {
lint({ lint({
fixture: ["strict", "function-with"], fixture: ["strict", "function-with"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
[0, 1].forEach(function (i) { [0, 1].forEach((i) => {
assert(report[i].ruleId === ruleId); assert(report[i].ruleId === ruleId);
}); });
done(); done();
@ -110,11 +110,11 @@ function strictSuite () {
}); });
// it // it
it("should error on function directive", function (done) { it("should error on function directive", (done) => {
lint({ lint({
fixture: ["strict", "global-with-function-with"], fixture: ["strict", "global-with-function-with"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
assert(report[0].ruleId === ruleId); assert(report[0].ruleId === ruleId);
@ -128,11 +128,11 @@ function strictSuite () {
}); });
// it // it
it("should error on no directive", function (done) { it("should error on no directive", (done) => {
lint({ lint({
fixture: ["strict", "none"], fixture: ["strict", "none"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
assert(report[0].ruleId === ruleId); assert(report[0].ruleId === ruleId);
done(); done();
@ -142,17 +142,17 @@ function strictSuite () {
}); });
// describe // describe
describe("when set to 'function'", function () { describe("when set to 'function'", () => {
var eslintOpts = Object.assign({}, baseEslintOpts, { var eslintOpts = Object.assign({}, baseEslintOpts, {
rules: {} rules: {}
}); });
eslintOpts.rules[ruleId] = [errorLevel, "function"]; eslintOpts.rules[ruleId] = [errorLevel, "function"];
it("shouldn't error on single function directive", function (done) { it("shouldn't error on single function directive", (done) => {
lint({ lint({
fixture: ["strict", "function-with"], fixture: ["strict", "function-with"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
assert(!report.length); assert(!report.length);
done(); done();
@ -160,13 +160,13 @@ function strictSuite () {
}); });
// it // it
it("should error twice on function directive: no and global directive: yes", function (done) { it("should error twice on function directive: no and global directive: yes", (done) => {
lint({ lint({
fixture: ["strict", "global-with-function-without"], fixture: ["strict", "global-with-function-without"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
[0, 1].forEach(function (i) { [0, 1].forEach((i) => {
assert(report[i].ruleId === ruleId); assert(report[i].ruleId === ruleId);
}); });
done(); done();
@ -174,11 +174,11 @@ function strictSuite () {
}); });
// it // it
it("should error on only global directive", function (done) { it("should error on only global directive", (done) => {
lint({ lint({
fixture: ["strict", "global-with"], fixture: ["strict", "global-with"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
assert(report[0].ruleId === ruleId); assert(report[0].ruleId === ruleId);
done(); done();
@ -186,11 +186,11 @@ function strictSuite () {
}); });
// it // it
it("should error on extraneous global directive", function (done) { it("should error on extraneous global directive", (done) => {
lint({ lint({
fixture: ["strict", "global-with-function-with"], fixture: ["strict", "global-with-function-with"],
eslint: eslintOpts, eslint: eslintOpts,
}, function (err, report) { }, (err, report) => {
if (err) return done(err); if (err) return done(err);
assert(report[0].ruleId === ruleId); assert(report[0].ruleId === ruleId);
assert(report[0].nodeType.indexOf("Function") === -1); assert(report[0].nodeType.indexOf("Function") === -1);

File diff suppressed because it is too large Load Diff