chore: Update deps and fix tests for new mocha and eslint (babel/babel-eslint#781)
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- "11"
|
||||
- "12"
|
||||
- "10"
|
||||
- "8"
|
||||
- "6"
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
@@ -19,9 +19,7 @@ exports.parse = function(code, options) {
|
||||
exports.parseForESLint = function(code, options = {}) {
|
||||
if (!IS_RUNNING_SUPPORTED_VERSION) {
|
||||
throw new Error(
|
||||
`babel-eslint@${
|
||||
packageJson.version
|
||||
} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`
|
||||
`babel-eslint@${packageJson.version} does not support @babel/core@${CURRENT_BABEL_VERSION}. Please downgrade to babel-eslint@^10 or upgrade to @babel/core@${SUPPORTED_BABEL_VERSION_RANGE}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,7 @@ module.exports = function(code, options) {
|
||||
if (config !== null) {
|
||||
if (!config.hasFilesystemConfig()) {
|
||||
throw new Error(
|
||||
`No Babel config file detected for ${
|
||||
config.options.filename
|
||||
}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`
|
||||
`No Babel config file detected for ${config.options.filename}. Either disable config file checking with requireConfigFile: false, or configure Babel so that it can find the config files.`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,17 +52,17 @@
|
||||
"@babel/preset-env": "^7.1.5",
|
||||
"@babel/preset-flow": "^7.0.0",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"babel-eslint": "^8.2.6",
|
||||
"babel-eslint": "^10.0.2",
|
||||
"dedent": "^0.7.0",
|
||||
"eslint": "^5.6.0",
|
||||
"eslint-config-babel": "^7.0.1",
|
||||
"eslint-plugin-flowtype": "^2.30.3",
|
||||
"eslint": "^6.0.1",
|
||||
"eslint-config-babel": "^9.0.0",
|
||||
"eslint-plugin-flowtype": "^3.11.1",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-prettier": "^2.1.2",
|
||||
"eslint-plugin-prettier": "^3.1.0",
|
||||
"espree": "^3.5.2",
|
||||
"husky": "^1.0.0-rc.13",
|
||||
"lint-staged": "^7.2.2",
|
||||
"mocha": "^5.0.1",
|
||||
"mocha": "^6.1.4",
|
||||
"prettier": "^1.4.4"
|
||||
},
|
||||
"lint-staged": {
|
||||
|
||||
@@ -24,9 +24,7 @@ module.exports = function assertImplementsAST(target, source, path) {
|
||||
target.constructor.name !== source.constructor.name
|
||||
) {
|
||||
error(
|
||||
`object have different constructors (${target.constructor.name} !== ${
|
||||
source.constructor.name
|
||||
}`
|
||||
`object have different constructors (${target.constructor.name} !== ${source.constructor.name}`
|
||||
);
|
||||
} else if (typeA === "object") {
|
||||
const keysTarget = Object.keys(target);
|
||||
|
||||
@@ -230,11 +230,11 @@ describe("babylon-to-espree", () => {
|
||||
});
|
||||
|
||||
it("export named", () => {
|
||||
parseAndAssertSame("export { foo };");
|
||||
parseAndAssertSame("var foo = 1;export { foo };");
|
||||
});
|
||||
|
||||
it("export named alias", () => {
|
||||
parseAndAssertSame("export { foo as bar };");
|
||||
parseAndAssertSame("var foo = 1;export { foo as bar };");
|
||||
});
|
||||
|
||||
// Espree doesn't support the optional chaining operator yet
|
||||
|
||||
@@ -5,6 +5,10 @@ const eslint = require("eslint");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const parser = require("../..");
|
||||
|
||||
eslint.linter.defineParser("current-babel-eslint", parser);
|
||||
|
||||
const paths = {
|
||||
fixtures: path.join(__dirname, "..", "fixtures", "rules"),
|
||||
};
|
||||
@@ -13,7 +17,7 @@ const encoding = "utf8";
|
||||
const errorLevel = 2;
|
||||
|
||||
const baseEslintOpts = {
|
||||
parser: require.resolve("../.."),
|
||||
parser: "current-babel-eslint",
|
||||
parserOptions: {
|
||||
sourceType: "script",
|
||||
},
|
||||
|
||||
@@ -4,6 +4,8 @@ const eslint = require("eslint");
|
||||
const path = require("path");
|
||||
const unpad = require("dedent");
|
||||
|
||||
const parser = require("../..");
|
||||
|
||||
function verifyAndAssertMessagesWithSpecificESLint(
|
||||
code,
|
||||
rules,
|
||||
@@ -13,7 +15,7 @@ function verifyAndAssertMessagesWithSpecificESLint(
|
||||
linter
|
||||
) {
|
||||
const config = {
|
||||
parser: require.resolve("../.."),
|
||||
parser: "current-babel-eslint",
|
||||
rules,
|
||||
env: {
|
||||
node: true,
|
||||
@@ -66,13 +68,16 @@ function verifyAndAssertMessages(
|
||||
sourceType,
|
||||
overrideConfig
|
||||
) {
|
||||
const linter = new eslint.Linter();
|
||||
linter.defineParser("current-babel-eslint", parser);
|
||||
|
||||
verifyAndAssertMessagesWithSpecificESLint(
|
||||
unpad(`${code}`),
|
||||
rules || {},
|
||||
expectedMessages || [],
|
||||
sourceType,
|
||||
overrideConfig,
|
||||
new eslint.Linter()
|
||||
linter
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user