Merge pull request babel/babel-eslint#706 from kaicataldo/es6
Update ESLint config
This commit is contained in:
parent
40d9bb3a77
commit
22a1681e11
@ -5,12 +5,22 @@ module.exports = {
|
|||||||
"prettier"
|
"prettier"
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
"no-var": 0,
|
"max-len": "off",
|
||||||
"max-len": 0,
|
"strict": "error",
|
||||||
"prettier/prettier": "error",
|
"prettier/prettier": "error",
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
mocha: true
|
},
|
||||||
}
|
parserOptions: {
|
||||||
|
sourceType: "script",
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["test/**/*"],
|
||||||
|
env: {
|
||||||
|
mocha: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
1
eslint/babel-eslint-parser/.npmrc
Normal file
1
eslint/babel-eslint-parser/.npmrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
package-lock = false
|
||||||
@ -3,8 +3,8 @@
|
|||||||
// comment fixes
|
// comment fixes
|
||||||
module.exports = function(ast, comments, tokens) {
|
module.exports = function(ast, comments, tokens) {
|
||||||
if (comments.length) {
|
if (comments.length) {
|
||||||
var firstComment = comments[0];
|
const firstComment = comments[0];
|
||||||
var lastComment = comments[comments.length - 1];
|
const lastComment = comments[comments.length - 1];
|
||||||
// fixup program start
|
// fixup program start
|
||||||
if (!tokens.length) {
|
if (!tokens.length) {
|
||||||
// if no tokens, the program starts at the end of the last comment
|
// if no tokens, the program starts at the end of the last comment
|
||||||
@ -17,7 +17,7 @@ module.exports = function(ast, comments, tokens) {
|
|||||||
}
|
}
|
||||||
} else if (firstComment.start < tokens[0].start) {
|
} else if (firstComment.start < tokens[0].start) {
|
||||||
// if there are comments before the first token, the program starts at the first token
|
// if there are comments before the first token, the program starts at the first token
|
||||||
var token = tokens[0];
|
const token = tokens[0];
|
||||||
// ast.start = token.start;
|
// ast.start = token.start;
|
||||||
// ast.loc.start.line = token.loc.start.line;
|
// ast.loc.start.line = token.loc.start.line;
|
||||||
// ast.loc.start.column = token.loc.start.column;
|
// ast.loc.start.column = token.loc.start.column;
|
||||||
@ -25,18 +25,18 @@ module.exports = function(ast, comments, tokens) {
|
|||||||
// estraverse do not put leading comments on first node when the comment
|
// estraverse do not put leading comments on first node when the comment
|
||||||
// appear before the first token
|
// appear before the first token
|
||||||
if (ast.body.length) {
|
if (ast.body.length) {
|
||||||
var node = ast.body[0];
|
const node = ast.body[0];
|
||||||
node.leadingComments = [];
|
node.leadingComments = [];
|
||||||
var firstTokenStart = token.start;
|
const firstTokenStart = token.start;
|
||||||
var len = comments.length;
|
const len = comments.length;
|
||||||
for (var i = 0; i < len && comments[i].start < firstTokenStart; i++) {
|
for (let i = 0; i < len && comments[i].start < firstTokenStart; i++) {
|
||||||
node.leadingComments.push(comments[i]);
|
node.leadingComments.push(comments[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// fixup program end
|
// fixup program end
|
||||||
if (tokens.length) {
|
if (tokens.length) {
|
||||||
var lastToken = tokens[tokens.length - 1];
|
const lastToken = tokens[tokens.length - 1];
|
||||||
if (lastComment.end > lastToken.end) {
|
if (lastComment.end > lastToken.end) {
|
||||||
// If there is a comment after the last token, the program ends at the
|
// If there is a comment after the last token, the program ends at the
|
||||||
// last token and not the comment
|
// last token and not the comment
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
module.exports = function(comments) {
|
module.exports = function(comments) {
|
||||||
for (var i = 0; i < comments.length; i++) {
|
for (let i = 0; i < comments.length; i++) {
|
||||||
var comment = comments[i];
|
const comment = comments[i];
|
||||||
if (comment.type === "CommentBlock") {
|
if (comment.type === "CommentBlock") {
|
||||||
comment.type = "Block";
|
comment.type = "Block";
|
||||||
} else if (comment.type === "CommentLine") {
|
} else if (comment.type === "CommentLine") {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var attachComments = require("./attachComments");
|
const attachComments = require("./attachComments");
|
||||||
var convertComments = require("./convertComments");
|
const convertComments = require("./convertComments");
|
||||||
var toTokens = require("./toTokens");
|
const toTokens = require("./toTokens");
|
||||||
var toAST = require("./toAST");
|
const toAST = require("./toAST");
|
||||||
|
|
||||||
module.exports = function(ast, traverse, tt, code) {
|
module.exports = function(ast, traverse, tt, code) {
|
||||||
// convert tokens
|
// convert tokens
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var t = require("@babel/types");
|
const t = require("@babel/types");
|
||||||
var convertComments = require("./convertComments");
|
const convertComments = require("./convertComments");
|
||||||
|
|
||||||
module.exports = function(ast, traverse, code) {
|
module.exports = function(ast, traverse, code) {
|
||||||
var state = { source: code };
|
const state = { source: code };
|
||||||
|
|
||||||
// Monkey patch visitor keys in order to be able to traverse the estree nodes
|
// Monkey patch visitor keys in order to be able to traverse the estree nodes
|
||||||
t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty;
|
t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty;
|
||||||
@ -22,10 +22,10 @@ module.exports = function(ast, traverse, code) {
|
|||||||
delete t.VISITOR_KEYS.MethodDefinition;
|
delete t.VISITOR_KEYS.MethodDefinition;
|
||||||
};
|
};
|
||||||
|
|
||||||
var astTransformVisitor = {
|
const astTransformVisitor = {
|
||||||
noScope: true,
|
noScope: true,
|
||||||
enter(path) {
|
enter(path) {
|
||||||
var node = path.node;
|
const node = path.node;
|
||||||
|
|
||||||
// private var to track original node type
|
// private var to track original node type
|
||||||
node._babelType = node.type;
|
node._babelType = node.type;
|
||||||
@ -44,7 +44,7 @@ var astTransformVisitor = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
exit(path) {
|
exit(path) {
|
||||||
var node = path.node;
|
const node = path.node;
|
||||||
|
|
||||||
if (path.isJSXText()) {
|
if (path.isJSXText()) {
|
||||||
node.type = "Literal";
|
node.type = "Literal";
|
||||||
@ -98,8 +98,8 @@ var astTransformVisitor = {
|
|||||||
|
|
||||||
// template string range fixes
|
// template string range fixes
|
||||||
if (path.isTemplateLiteral()) {
|
if (path.isTemplateLiteral()) {
|
||||||
for (var j = 0; j < node.quasis.length; j++) {
|
for (let j = 0; j < node.quasis.length; j++) {
|
||||||
var q = node.quasis[j];
|
const q = node.quasis[j];
|
||||||
q.range[0] -= 1;
|
q.range[0] -= 1;
|
||||||
if (q.tail) {
|
if (q.tail) {
|
||||||
q.range[1] += 1;
|
q.range[1] += 1;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
module.exports = function(token, tt, source) {
|
module.exports = function(token, tt, source) {
|
||||||
var type = token.type;
|
const type = token.type;
|
||||||
token.range = [token.start, token.end];
|
token.range = [token.start, token.end];
|
||||||
|
|
||||||
if (type === tt.name) {
|
if (type === tt.name) {
|
||||||
@ -72,7 +72,7 @@ module.exports = function(token, tt, source) {
|
|||||||
token.value = source.slice(token.start, token.end);
|
token.value = source.slice(token.start, token.end);
|
||||||
} else if (type === tt.regexp) {
|
} else if (type === tt.regexp) {
|
||||||
token.type = "RegularExpression";
|
token.type = "RegularExpression";
|
||||||
var value = token.value;
|
const value = token.value;
|
||||||
token.regex = {
|
token.regex = {
|
||||||
pattern: value.pattern,
|
pattern: value.pattern,
|
||||||
flags: value.flags,
|
flags: value.flags,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var convertTemplateType = require("./convertTemplateType");
|
const convertTemplateType = require("./convertTemplateType");
|
||||||
var toToken = require("./toToken");
|
const toToken = require("./toToken");
|
||||||
|
|
||||||
module.exports = function(tokens, tt, code) {
|
module.exports = function(tokens, tt, code) {
|
||||||
return convertTemplateType(tokens, tt)
|
return convertTemplateType(tokens, tt)
|
||||||
|
|||||||
@ -1,16 +1,16 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var babylonToEspree = require("./babylon-to-espree");
|
const babylonToEspree = require("./babylon-to-espree");
|
||||||
var parse = require("@babel/parser").parse;
|
const parse = require("@babel/parser").parse;
|
||||||
var tt = require("@babel/parser").tokTypes;
|
const tt = require("@babel/parser").tokTypes;
|
||||||
var traverse = require("@babel/traverse").default;
|
const traverse = require("@babel/traverse").default;
|
||||||
var codeFrameColumns = require("@babel/code-frame").codeFrameColumns;
|
const codeFrameColumns = require("@babel/code-frame").codeFrameColumns;
|
||||||
|
|
||||||
module.exports = function(code, options) {
|
module.exports = function(code, options) {
|
||||||
const legacyDecorators =
|
const legacyDecorators =
|
||||||
options.ecmaFeatures && options.ecmaFeatures.legacyDecorators;
|
options.ecmaFeatures && options.ecmaFeatures.legacyDecorators;
|
||||||
|
|
||||||
var opts = {
|
const opts = {
|
||||||
codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true,
|
codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true,
|
||||||
sourceType: options.sourceType,
|
sourceType: options.sourceType,
|
||||||
allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree
|
allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree
|
||||||
@ -51,7 +51,7 @@ module.exports = function(code, options) {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
var ast;
|
let ast;
|
||||||
try {
|
try {
|
||||||
ast = parse(code, opts);
|
ast = parse(code, opts);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
var assert = require("assert");
|
"use strict";
|
||||||
var babelEslint = require("..");
|
|
||||||
var espree = require("espree");
|
const assert = require("assert");
|
||||||
var escope = require("eslint-scope");
|
const babelEslint = require("..");
|
||||||
var util = require("util");
|
const espree = require("espree");
|
||||||
var unpad = require("dedent");
|
const escope = require("eslint-scope");
|
||||||
var assertImplementsAST = require("./fixtures/assert-implements-ast");
|
const util = require("util");
|
||||||
|
const unpad = require("dedent");
|
||||||
|
const assertImplementsAST = require("./fixtures/assert-implements-ast");
|
||||||
|
|
||||||
function lookup(obj, keypath, backwardsDepth) {
|
function lookup(obj, keypath, backwardsDepth) {
|
||||||
if (!keypath) {
|
if (!keypath) {
|
||||||
@ -21,7 +23,7 @@ function lookup(obj, keypath, backwardsDepth) {
|
|||||||
|
|
||||||
function parseAndAssertSame(code) {
|
function parseAndAssertSame(code) {
|
||||||
code = unpad(code);
|
code = unpad(code);
|
||||||
var esAST = espree.parse(code, {
|
const esAST = espree.parse(code, {
|
||||||
ecmaFeatures: {
|
ecmaFeatures: {
|
||||||
// enable JSX parsing
|
// enable JSX parsing
|
||||||
jsx: true,
|
jsx: true,
|
||||||
@ -40,14 +42,14 @@ function parseAndAssertSame(code) {
|
|||||||
ecmaVersion: 2018,
|
ecmaVersion: 2018,
|
||||||
sourceType: "module",
|
sourceType: "module",
|
||||||
});
|
});
|
||||||
var babylonAST = babelEslint.parseForESLint(code, {
|
const babylonAST = babelEslint.parseForESLint(code, {
|
||||||
eslintVisitorKeys: true,
|
eslintVisitorKeys: true,
|
||||||
eslintScopeManager: true,
|
eslintScopeManager: true,
|
||||||
}).ast;
|
}).ast;
|
||||||
try {
|
try {
|
||||||
assertImplementsAST(esAST, babylonAST);
|
assertImplementsAST(esAST, babylonAST);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
var traversal = err.message.slice(3, err.message.indexOf(":"));
|
const traversal = err.message.slice(3, err.message.indexOf(":"));
|
||||||
err.message += unpad(`
|
err.message += unpad(`
|
||||||
espree:
|
espree:
|
||||||
${util.inspect(lookup(esAST, traversal, 2), {
|
${util.inspect(lookup(esAST, traversal, 2), {
|
||||||
@ -68,7 +70,7 @@ function parseAndAssertSame(code) {
|
|||||||
describe("babylon-to-espree", () => {
|
describe("babylon-to-espree", () => {
|
||||||
describe("compatibility", () => {
|
describe("compatibility", () => {
|
||||||
it("should allow ast.analyze to be called without options", function() {
|
it("should allow ast.analyze to be called without options", function() {
|
||||||
var esAST = babelEslint.parseForESLint("`test`", {
|
const esAST = babelEslint.parseForESLint("`test`", {
|
||||||
eslintScopeManager: true,
|
eslintScopeManager: true,
|
||||||
eslintVisitorKeys: true,
|
eslintVisitorKeys: true,
|
||||||
}).ast;
|
}).ast;
|
||||||
@ -271,7 +273,7 @@ describe("babylon-to-espree", () => {
|
|||||||
// Espree doesn't support the optional chaining operator yet
|
// Espree doesn't support the optional chaining operator yet
|
||||||
it("optional chaining operator (token)", () => {
|
it("optional chaining operator (token)", () => {
|
||||||
const code = "foo?.bar";
|
const code = "foo?.bar";
|
||||||
var babylonAST = babelEslint.parseForESLint(code, {
|
const babylonAST = babelEslint.parseForESLint(code, {
|
||||||
eslintVisitorKeys: true,
|
eslintVisitorKeys: true,
|
||||||
eslintScopeManager: true,
|
eslintScopeManager: true,
|
||||||
}).ast;
|
}).ast;
|
||||||
@ -281,7 +283,7 @@ describe("babylon-to-espree", () => {
|
|||||||
// Espree doesn't support the nullish coalescing operator yet
|
// Espree doesn't support the nullish coalescing operator yet
|
||||||
it("nullish coalescing operator (token)", () => {
|
it("nullish coalescing operator (token)", () => {
|
||||||
const code = "foo ?? bar";
|
const code = "foo ?? bar";
|
||||||
var babylonAST = babelEslint.parseForESLint(code, {
|
const babylonAST = babelEslint.parseForESLint(code, {
|
||||||
eslintVisitorKeys: true,
|
eslintVisitorKeys: true,
|
||||||
eslintScopeManager: true,
|
eslintScopeManager: true,
|
||||||
}).ast;
|
}).ast;
|
||||||
@ -291,7 +293,7 @@ describe("babylon-to-espree", () => {
|
|||||||
// Espree doesn't support the pipeline operator yet
|
// Espree doesn't support the pipeline operator yet
|
||||||
it("pipeline operator (token)", () => {
|
it("pipeline operator (token)", () => {
|
||||||
const code = "foo |> bar";
|
const code = "foo |> bar";
|
||||||
var babylonAST = babelEslint.parseForESLint(code, {
|
const babylonAST = babelEslint.parseForESLint(code, {
|
||||||
eslintVisitorKeys: true,
|
eslintVisitorKeys: true,
|
||||||
eslintScopeManager: true,
|
eslintScopeManager: true,
|
||||||
}).ast;
|
}).ast;
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
"use strict"
|
||||||
|
|
||||||
// Checks if the source ast implements the target ast. Ignores extra keys on source ast
|
// Checks if the source ast implements the target ast. Ignores extra keys on source ast
|
||||||
module.exports = function assertImplementsAST(target, source, path) {
|
module.exports = function assertImplementsAST(target, source, path) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
@ -5,13 +7,13 @@ module.exports = function assertImplementsAST(target, source, path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function error(text) {
|
function error(text) {
|
||||||
var err = new Error(`At ${path.join(".")}: ${text}:`);
|
const err = new Error(`At ${path.join(".")}: ${text}:`);
|
||||||
err.depth = path.length + 1;
|
err.depth = path.length + 1;
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
var typeA = target === null ? "null" : typeof target;
|
const typeA = target === null ? "null" : typeof target;
|
||||||
var typeB = source === null ? "null" : typeof source;
|
const typeB = source === null ? "null" : typeof source;
|
||||||
if (typeA !== typeB) {
|
if (typeA !== typeB) {
|
||||||
error(
|
error(
|
||||||
`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`
|
`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`
|
||||||
@ -26,9 +28,9 @@ module.exports = function assertImplementsAST(target, source, path) {
|
|||||||
.name} !== ${source.constructor.name}`
|
.name} !== ${source.constructor.name}`
|
||||||
);
|
);
|
||||||
} else if (typeA === "object") {
|
} else if (typeA === "object") {
|
||||||
var keysTarget = Object.keys(target);
|
const keysTarget = Object.keys(target);
|
||||||
for (var i in keysTarget) {
|
for (const i in keysTarget) {
|
||||||
var key = keysTarget[i];
|
const key = keysTarget[i];
|
||||||
path.push(key);
|
path.push(key);
|
||||||
assertImplementsAST(target[key], source[key], path);
|
assertImplementsAST(target[key], source[key], path);
|
||||||
path.pop();
|
path.pop();
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
"use strict"
|
"use strict"
|
||||||
|
|
||||||
const babelEslint = require("../..")
|
const babelEslint = require("../..")
|
||||||
|
|
||||||
// Apply monkeypatch to eslint-scope.
|
// Apply monkeypatch to eslint-scope.
|
||||||
|
|||||||
@ -1,16 +1,18 @@
|
|||||||
var assert = require("assert");
|
"use strict";
|
||||||
var eslint = require("eslint");
|
|
||||||
var fs = require("fs");
|
|
||||||
var path = require("path");
|
|
||||||
|
|
||||||
var paths = {
|
const assert = require("assert");
|
||||||
|
const eslint = require("eslint");
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
const paths = {
|
||||||
fixtures: path.join(__dirname, "fixtures", "rules"),
|
fixtures: path.join(__dirname, "fixtures", "rules"),
|
||||||
};
|
};
|
||||||
|
|
||||||
var encoding = "utf8";
|
const encoding = "utf8";
|
||||||
var errorLevel = 2;
|
const errorLevel = 2;
|
||||||
|
|
||||||
var baseEslintOpts = {
|
const baseEslintOpts = {
|
||||||
parser: require.resolve(".."),
|
parser: require.resolve(".."),
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
sourceType: "script",
|
sourceType: "script",
|
||||||
@ -48,10 +50,10 @@ describe("Rules:", () => {
|
|||||||
// describe
|
// describe
|
||||||
|
|
||||||
function strictSuite() {
|
function strictSuite() {
|
||||||
var ruleId = "strict";
|
const ruleId = "strict";
|
||||||
|
|
||||||
describe("when set to 'never'", () => {
|
describe("when set to 'never'", () => {
|
||||||
var eslintOpts = Object.assign({}, baseEslintOpts, {
|
const eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||||
rules: {},
|
rules: {},
|
||||||
});
|
});
|
||||||
eslintOpts.rules[ruleId] = [errorLevel, "never"];
|
eslintOpts.rules[ruleId] = [errorLevel, "never"];
|
||||||
@ -76,7 +78,7 @@ function strictSuite() {
|
|||||||
// describe
|
// describe
|
||||||
|
|
||||||
describe("when set to 'global'", () => {
|
describe("when set to 'global'", () => {
|
||||||
var eslintOpts = Object.assign({}, baseEslintOpts, {
|
const eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||||
rules: {},
|
rules: {},
|
||||||
});
|
});
|
||||||
eslintOpts.rules[ruleId] = [errorLevel, "global"];
|
eslintOpts.rules[ruleId] = [errorLevel, "global"];
|
||||||
@ -152,7 +154,7 @@ function strictSuite() {
|
|||||||
// describe
|
// describe
|
||||||
|
|
||||||
describe("when set to 'function'", () => {
|
describe("when set to 'function'", () => {
|
||||||
var eslintOpts = Object.assign({}, baseEslintOpts, {
|
const eslintOpts = Object.assign({}, baseEslintOpts, {
|
||||||
rules: {},
|
rules: {},
|
||||||
});
|
});
|
||||||
eslintOpts.rules[ruleId] = [errorLevel, "function"];
|
eslintOpts.rules[ruleId] = [errorLevel, "function"];
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*eslint-env mocha*/
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var eslint = require("eslint");
|
|
||||||
var unpad = require("dedent");
|
const eslint = require("eslint");
|
||||||
|
const unpad = require("dedent");
|
||||||
|
|
||||||
function verifyAndAssertMessagesWithSpecificESLint(
|
function verifyAndAssertMessagesWithSpecificESLint(
|
||||||
code,
|
code,
|
||||||
@ -11,7 +11,7 @@ function verifyAndAssertMessagesWithSpecificESLint(
|
|||||||
overrideConfig,
|
overrideConfig,
|
||||||
linter
|
linter
|
||||||
) {
|
) {
|
||||||
var config = {
|
const config = {
|
||||||
parser: require.resolve(".."),
|
parser: require.resolve(".."),
|
||||||
rules,
|
rules,
|
||||||
env: {
|
env: {
|
||||||
@ -30,12 +30,12 @@ function verifyAndAssertMessagesWithSpecificESLint(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (overrideConfig) {
|
if (overrideConfig) {
|
||||||
for (var key in overrideConfig) {
|
for (const key in overrideConfig) {
|
||||||
config[key] = overrideConfig[key];
|
config[key] = overrideConfig[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var messages = linter.verify(code, config);
|
const messages = linter.verify(code, config);
|
||||||
|
|
||||||
if (messages.length !== expectedMessages.length) {
|
if (messages.length !== expectedMessages.length) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@ -46,7 +46,7 @@ function verifyAndAssertMessagesWithSpecificESLint(
|
|||||||
}
|
}
|
||||||
|
|
||||||
messages.forEach((message, i) => {
|
messages.forEach((message, i) => {
|
||||||
var formatedMessage = `${message.line}:${message.column} ${
|
const formatedMessage = `${message.line}:${message.column} ${
|
||||||
message.message
|
message.message
|
||||||
}${message.ruleId ? ` ${message.ruleId}` : ""}`;
|
}${message.ruleId ? ` ${message.ruleId}` : ""}`;
|
||||||
if (formatedMessage !== expectedMessages[i]) {
|
if (formatedMessage !== expectedMessages[i]) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const eslint = require("eslint");
|
|||||||
const assert = require("assert");
|
const assert = require("assert");
|
||||||
const babelEslint = require("..");
|
const babelEslint = require("..");
|
||||||
const espree = require("espree");
|
const espree = require("espree");
|
||||||
var assertImplementsAST = require("./fixtures/assert-implements-ast");
|
const assertImplementsAST = require("./fixtures/assert-implements-ast");
|
||||||
|
|
||||||
describe("https://github.com/babel/babel-eslint/issues/558", () => {
|
describe("https://github.com/babel/babel-eslint/issues/558", () => {
|
||||||
it("don't crash with eslint-plugin-import", () => {
|
it("don't crash with eslint-plugin-import", () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user