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:
parent
fd2093914e
commit
d76cfe05b1
@ -31,7 +31,7 @@ function changeComments(nodeComments) {
|
||||
|
||||
var astTransformVisitor = {
|
||||
noScope: true,
|
||||
enter: function (path) {
|
||||
enter (path) {
|
||||
var node = path.node;
|
||||
|
||||
node.range = [node.start, node.end];
|
||||
@ -55,12 +55,12 @@ var astTransformVisitor = {
|
||||
// make '_paths' non-enumerable (babel-eslint #200)
|
||||
Object.defineProperty(node, "_paths", { value: node._paths, writable: true });
|
||||
},
|
||||
exit: function (path) {
|
||||
exit (path) {
|
||||
var node = path.node;
|
||||
|
||||
[
|
||||
fixDirectives,
|
||||
].forEach(function (fixer) {
|
||||
].forEach((fixer) => {
|
||||
fixer(path);
|
||||
});
|
||||
|
||||
@ -211,7 +211,7 @@ var astTransformVisitor = {
|
||||
|
||||
// template string range fixes
|
||||
if (path.isTemplateLiteral()) {
|
||||
node.quasis.forEach(function (q) {
|
||||
node.quasis.forEach((q) => {
|
||||
q.range[0] -= 1;
|
||||
if (q.tail) {
|
||||
q.range[1] += 1;
|
||||
@ -244,7 +244,7 @@ function fixDirectives (path) {
|
||||
|
||||
if (!directivesContainer.directives) return;
|
||||
|
||||
directivesContainer.directives.reverse().forEach(function (directive) {
|
||||
directivesContainer.directives.reverse().forEach((directive) => {
|
||||
directive.type = "ExpressionStatement";
|
||||
directive.expression = directive.value;
|
||||
delete directive.value;
|
||||
|
||||
@ -4,7 +4,7 @@ var toToken = require("./toToken");
|
||||
module.exports = function (tokens, tt, code) {
|
||||
// transform tokens to type "Template"
|
||||
convertTemplateType(tokens, tt);
|
||||
var transformedTokens = tokens.filter(function (token) {
|
||||
var transformedTokens = tokens.filter((token) => {
|
||||
return token.type !== "CommentLine" && token.type !== "CommentBlock";
|
||||
});
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ function monkeypatch() {
|
||||
estraverses.push(estraverseOfEslint);
|
||||
Object.assign(estraverseOfEslint.VisitorKeys, t.VISITOR_KEYS);
|
||||
|
||||
estraverses.forEach(function (estraverse) {
|
||||
estraverses.forEach((estraverse) => {
|
||||
estraverse.VisitorKeys.MethodDefinition.push("decorators");
|
||||
estraverse.VisitorKeys.Property.push("decorators");
|
||||
});
|
||||
@ -100,7 +100,7 @@ function monkeypatch() {
|
||||
}
|
||||
|
||||
// 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([
|
||||
"ArrayPattern",
|
||||
"ClassDeclaration",
|
||||
@ -268,13 +268,13 @@ function monkeypatch() {
|
||||
}
|
||||
// set ArrayPattern/ObjectPattern visitor keys back to their original. otherwise
|
||||
// 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.ArrayPattern = ["elements"];
|
||||
});
|
||||
visitFunction.call(this, node);
|
||||
// set them back to normal...
|
||||
estraverses.forEach(function (estraverse) {
|
||||
estraverses.forEach((estraverse) => {
|
||||
estraverse.VisitorKeys.ObjectPattern = t.VISITOR_KEYS.ObjectPattern;
|
||||
estraverse.VisitorKeys.ArrayPattern = t.VISITOR_KEYS.ArrayPattern;
|
||||
});
|
||||
|
||||
@ -37,7 +37,7 @@ function lookup(obj, keypath, backwardsDepth) {
|
||||
if (!keypath) { return obj; }
|
||||
|
||||
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) {
|
||||
@ -82,57 +82,57 @@ function parseAndAssertSame(code) {
|
||||
// assert.equal(esAST, babylonAST);
|
||||
}
|
||||
|
||||
describe("babylon-to-esprima", function () {
|
||||
describe("templates", function () {
|
||||
it("empty template string", function () {
|
||||
describe("babylon-to-esprima", () => {
|
||||
describe("templates", () => {
|
||||
it("empty template string", () => {
|
||||
parseAndAssertSame("``");
|
||||
});
|
||||
|
||||
it("template string", function () {
|
||||
it("template string", () => {
|
||||
parseAndAssertSame("`test`");
|
||||
});
|
||||
|
||||
it("template string using $", function () {
|
||||
it("template string using $", () => {
|
||||
parseAndAssertSame("`$`");
|
||||
});
|
||||
|
||||
it("template string with expression", function () {
|
||||
it("template string with expression", () => {
|
||||
parseAndAssertSame("`${a}`");
|
||||
});
|
||||
|
||||
it("template string with multiple expressions", function () {
|
||||
it("template string with multiple expressions", () => {
|
||||
parseAndAssertSame("`${a}${b}${c}`");
|
||||
});
|
||||
|
||||
it("template string with expression and strings", function () {
|
||||
it("template string with expression and strings", () => {
|
||||
parseAndAssertSame("`a${a}a`");
|
||||
});
|
||||
|
||||
it("template string with binary expression", function () {
|
||||
it("template string with binary expression", () => {
|
||||
parseAndAssertSame("`a${a + b}a`");
|
||||
});
|
||||
|
||||
it("tagged template", function () {
|
||||
it("tagged template", () => {
|
||||
parseAndAssertSame("jsx`<Button>Click</Button>`");
|
||||
});
|
||||
|
||||
it("tagged template with expression", function () {
|
||||
it("tagged template with expression", () => {
|
||||
parseAndAssertSame("jsx`<Button>Hi ${name}</Button>`");
|
||||
});
|
||||
|
||||
it("tagged template with new operator", function () {
|
||||
it("tagged template with new operator", () => {
|
||||
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`");
|
||||
});
|
||||
|
||||
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(); }");
|
||||
});
|
||||
|
||||
it("template also with braces #96", function () {
|
||||
it("template also with braces #96", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
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(
|
||||
unpad(`
|
||||
module.exports = {
|
||||
@ -160,103 +160,103 @@ describe("babylon-to-esprima", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it("simple expression", function () {
|
||||
it("simple expression", () => {
|
||||
parseAndAssertSame("a = 1");
|
||||
});
|
||||
|
||||
it("class declaration", function () {
|
||||
it("class declaration", () => {
|
||||
parseAndAssertSame("class Foo {}");
|
||||
});
|
||||
|
||||
it("class expression", function () {
|
||||
it("class expression", () => {
|
||||
parseAndAssertSame("var a = class Foo {}");
|
||||
});
|
||||
|
||||
it("jsx expression", function () {
|
||||
it("jsx expression", () => {
|
||||
parseAndAssertSame("<App />");
|
||||
});
|
||||
|
||||
it("jsx expression with 'this' as identifier", function () {
|
||||
it("jsx expression with 'this' as identifier", () => {
|
||||
parseAndAssertSame("<this />");
|
||||
});
|
||||
|
||||
it("jsx expression with a dynamic attribute", function () {
|
||||
it("jsx expression with a dynamic attribute", () => {
|
||||
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 />");
|
||||
});
|
||||
|
||||
it("jsx expression with spread", function () {
|
||||
it("jsx expression with spread", () => {
|
||||
parseAndAssertSame("var myDivElement = <div {...this.props} />;");
|
||||
});
|
||||
|
||||
it("empty jsx text", function () {
|
||||
it("empty jsx text", () => {
|
||||
parseAndAssertSame("<a></a>");
|
||||
});
|
||||
|
||||
it("jsx text with content", function () {
|
||||
it("jsx text with content", () => {
|
||||
parseAndAssertSame("<a>Hello, world!</a>");
|
||||
});
|
||||
|
||||
it("nested jsx", function () {
|
||||
it("nested jsx", () => {
|
||||
parseAndAssertSame("<div>\n<h1>Wat</h1>\n</div>");
|
||||
});
|
||||
|
||||
it("default import", function () {
|
||||
it("default import", () => {
|
||||
parseAndAssertSame("import foo from \"foo\";");
|
||||
});
|
||||
|
||||
it("import specifier", function () {
|
||||
it("import specifier", () => {
|
||||
parseAndAssertSame("import { foo } from \"foo\";");
|
||||
});
|
||||
|
||||
it("import specifier with name", function () {
|
||||
it("import specifier with name", () => {
|
||||
parseAndAssertSame("import { foo as bar } from \"foo\";");
|
||||
});
|
||||
|
||||
it("import bare", function () {
|
||||
it("import bare", () => {
|
||||
parseAndAssertSame("import \"foo\";");
|
||||
});
|
||||
|
||||
it("export default class declaration", function () {
|
||||
it("export default class declaration", () => {
|
||||
parseAndAssertSame("export default class Foo {}");
|
||||
});
|
||||
|
||||
it("export default class expression", function () {
|
||||
it("export default class expression", () => {
|
||||
parseAndAssertSame("export default class {}");
|
||||
});
|
||||
|
||||
it("export default function declaration", function () {
|
||||
it("export default function declaration", () => {
|
||||
parseAndAssertSame("export default function Foo() {}");
|
||||
});
|
||||
|
||||
it("export default function expression", function () {
|
||||
it("export default function expression", () => {
|
||||
parseAndAssertSame("export default function () {}");
|
||||
});
|
||||
|
||||
it("export all", function () {
|
||||
it("export all", () => {
|
||||
parseAndAssertSame("export * from \"foo\";");
|
||||
});
|
||||
|
||||
it("export named", function () {
|
||||
it("export named", () => {
|
||||
parseAndAssertSame("export { foo };");
|
||||
});
|
||||
|
||||
it("export named alias", function () {
|
||||
it("export named alias", () => {
|
||||
parseAndAssertSame("export { foo as bar };");
|
||||
});
|
||||
|
||||
it.skip("empty program with line comment", function () {
|
||||
it.skip("empty program with line comment", () => {
|
||||
parseAndAssertSame("// single comment");
|
||||
});
|
||||
|
||||
it.skip("empty program with block comment", function () {
|
||||
it.skip("empty program with block comment", () => {
|
||||
parseAndAssertSame(" /* multiline\n * comment\n*/");
|
||||
});
|
||||
|
||||
it("line comments", function () {
|
||||
it("line comments", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
// single comment
|
||||
@ -266,7 +266,7 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("block comments", function () {
|
||||
it("block comments", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
/* single comment */
|
||||
@ -279,7 +279,7 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("block comments #124", function () {
|
||||
it("block comments #124", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
React.createClass({
|
||||
@ -293,31 +293,31 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("null", function () {
|
||||
it("null", () => {
|
||||
parseAndAssertSame("null");
|
||||
});
|
||||
|
||||
it("boolean", function () {
|
||||
it("boolean", () => {
|
||||
parseAndAssertSame("if (true) {} else if (false) {}");
|
||||
});
|
||||
|
||||
it("regexp", function () {
|
||||
it("regexp", () => {
|
||||
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]}`");
|
||||
});
|
||||
|
||||
it("first line is empty", function () {
|
||||
it("first line is empty", () => {
|
||||
parseAndAssertSame("\nimport Immutable from \"immutable\";");
|
||||
});
|
||||
|
||||
it("empty", function () {
|
||||
it("empty", () => {
|
||||
parseAndAssertSame("");
|
||||
});
|
||||
|
||||
it("jsdoc", function () {
|
||||
it("jsdoc", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
/**
|
||||
@ -332,7 +332,7 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("empty block with comment", function () {
|
||||
it("empty block with comment", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
function a () {
|
||||
@ -346,8 +346,8 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
describe("babel 6 tests", function () {
|
||||
it("MethodDefinition", function () {
|
||||
describe("babel 6 tests", () => {
|
||||
it("MethodDefinition", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
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; }}");
|
||||
});
|
||||
|
||||
it("ClassMethod", function () {
|
||||
it("ClassMethod", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
class A {
|
||||
@ -372,7 +372,7 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("ClassMethod multiple params", function () {
|
||||
it("ClassMethod multiple params", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
class A {
|
||||
@ -383,7 +383,7 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("ClassMethod multiline", function () {
|
||||
it("ClassMethod multiline", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
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) {} }");
|
||||
});
|
||||
|
||||
it("ObjectMethod", function () {
|
||||
it("ObjectMethod", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
var a = {
|
||||
@ -416,27 +416,27 @@ describe("babylon-to-esprima", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("do not allow import export everywhere", function() {
|
||||
assert.throws(function () {
|
||||
it("do not allow import export everywhere", () => {
|
||||
assert.throws(() => {
|
||||
parseAndAssertSame("function F() { import a from \"a\"; }");
|
||||
}, /SyntaxError: 'import' and 'export' may only appear at the top level/);
|
||||
});
|
||||
|
||||
it("return outside function", function () {
|
||||
it("return outside function", () => {
|
||||
parseAndAssertSame("return;");
|
||||
});
|
||||
|
||||
it("super outside method", function () {
|
||||
it("super outside method", () => {
|
||||
parseAndAssertSame("function F() { super(); }");
|
||||
});
|
||||
|
||||
it("StringLiteral", function () {
|
||||
it("StringLiteral", () => {
|
||||
parseAndAssertSame("");
|
||||
parseAndAssertSame("");
|
||||
parseAndAssertSame("a");
|
||||
});
|
||||
|
||||
it("getters and setters", function () {
|
||||
it("getters and setters", () => {
|
||||
parseAndAssertSame("class A { get x ( ) { ; } }");
|
||||
parseAndAssertSame(
|
||||
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 = function (...b) {}");
|
||||
});
|
||||
|
||||
it("SpreadOperator", function () {
|
||||
it("SpreadOperator", () => {
|
||||
parseAndAssertSame("var a = { b, ...c }");
|
||||
parseAndAssertSame("var a = [ a, ...b ]");
|
||||
parseAndAssertSame("var a = sum(...b)");
|
||||
});
|
||||
|
||||
it("Async/Await", function() {
|
||||
it("Async/Await", () => {
|
||||
parseAndAssertSame(
|
||||
unpad(`
|
||||
async function a() {
|
||||
|
||||
@ -24,7 +24,7 @@ var baseEslintOpts = {
|
||||
* @param function done
|
||||
*/
|
||||
function lint (opts, done) {
|
||||
readFixture(opts.fixture, function (err, src) {
|
||||
readFixture(opts.fixture, (err, src) => {
|
||||
if (err) return done(err);
|
||||
done(null, eslint.linter.verify(src, opts.eslint));
|
||||
});
|
||||
@ -46,7 +46,7 @@ function readFixture (id, done) {
|
||||
}
|
||||
// readFixture
|
||||
|
||||
describe("Rules:", function () {
|
||||
describe("Rules:", () => {
|
||||
describe("`strict`", strictSuite);
|
||||
});
|
||||
// describe
|
||||
@ -54,19 +54,19 @@ describe("Rules:", function () {
|
||||
function strictSuite () {
|
||||
var ruleId = "strict";
|
||||
|
||||
describe("when set to 'never'", function () {
|
||||
describe("when set to 'never'", () => {
|
||||
var eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||
rules: {},
|
||||
});
|
||||
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`,
|
||||
function (done) {
|
||||
(done) => {
|
||||
lint({
|
||||
fixture: ["strict", fixture],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
assert(report[0].ruleId === ruleId);
|
||||
done();
|
||||
@ -78,17 +78,17 @@ function strictSuite () {
|
||||
});
|
||||
// describe
|
||||
|
||||
describe("when set to 'global'", function () {
|
||||
describe("when set to 'global'", () => {
|
||||
var eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||
rules: {}
|
||||
});
|
||||
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({
|
||||
fixture: ["strict", "global-with"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
assert(!report.length);
|
||||
done();
|
||||
@ -96,13 +96,13 @@ function strictSuite () {
|
||||
});
|
||||
// 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({
|
||||
fixture: ["strict", "function-with"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
[0, 1].forEach(function (i) {
|
||||
[0, 1].forEach((i) => {
|
||||
assert(report[i].ruleId === ruleId);
|
||||
});
|
||||
done();
|
||||
@ -110,11 +110,11 @@ function strictSuite () {
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on function directive", function (done) {
|
||||
it("should error on function directive", (done) => {
|
||||
lint({
|
||||
fixture: ["strict", "global-with-function-with"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
assert(report[0].ruleId === ruleId);
|
||||
|
||||
@ -128,11 +128,11 @@ function strictSuite () {
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on no directive", function (done) {
|
||||
it("should error on no directive", (done) => {
|
||||
lint({
|
||||
fixture: ["strict", "none"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
assert(report[0].ruleId === ruleId);
|
||||
done();
|
||||
@ -142,17 +142,17 @@ function strictSuite () {
|
||||
});
|
||||
// describe
|
||||
|
||||
describe("when set to 'function'", function () {
|
||||
describe("when set to 'function'", () => {
|
||||
var eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||
rules: {}
|
||||
});
|
||||
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({
|
||||
fixture: ["strict", "function-with"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
assert(!report.length);
|
||||
done();
|
||||
@ -160,13 +160,13 @@ function strictSuite () {
|
||||
});
|
||||
// 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({
|
||||
fixture: ["strict", "global-with-function-without"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
[0, 1].forEach(function (i) {
|
||||
[0, 1].forEach((i) => {
|
||||
assert(report[i].ruleId === ruleId);
|
||||
});
|
||||
done();
|
||||
@ -174,11 +174,11 @@ function strictSuite () {
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on only global directive", function (done) {
|
||||
it("should error on only global directive", (done) => {
|
||||
lint({
|
||||
fixture: ["strict", "global-with"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
assert(report[0].ruleId === ruleId);
|
||||
done();
|
||||
@ -186,11 +186,11 @@ function strictSuite () {
|
||||
});
|
||||
// it
|
||||
|
||||
it("should error on extraneous global directive", function (done) {
|
||||
it("should error on extraneous global directive", (done) => {
|
||||
lint({
|
||||
fixture: ["strict", "global-with-function-with"],
|
||||
eslint: eslintOpts,
|
||||
}, function (err, report) {
|
||||
}, (err, report) => {
|
||||
if (err) return done(err);
|
||||
assert(report[0].ruleId === ruleId);
|
||||
assert(report[0].nodeType.indexOf("Function") === -1);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user