Skip to content

Commit

Permalink
chore: bump eslint and its plugins (#13412)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jun 4, 2021
1 parent 8720919 commit 4eda1c8
Show file tree
Hide file tree
Showing 27 changed files with 905 additions and 723 deletions.
4 changes: 2 additions & 2 deletions eslint/babel-eslint-parser/package.json
Expand Up @@ -30,13 +30,13 @@
"eslint": ">=7.5.0"
},
"dependencies": {
"eslint-scope": "^5.1.0",
"eslint-scope": "^5.1.1",
"eslint-visitor-keys": "^2.1.0",
"semver": "condition:BABEL_8_BREAKING ? ^7.3.4 : ^6.3.0"
},
"devDependencies": {
"@babel/core": "workspace:*",
"dedent": "^0.7.0",
"eslint": "^7.5.0"
"eslint": "^7.27.0"
}
}
Expand Up @@ -20,6 +20,6 @@
"eslint": ">=7.5.0"
},
"devDependencies": {
"eslint": "^7.5.0"
"eslint": "^7.27.0"
}
}
2 changes: 1 addition & 1 deletion eslint/babel-eslint-plugin-development/package.json
Expand Up @@ -31,6 +31,6 @@
},
"homepage": "https://babel.dev/",
"devDependencies": {
"eslint": "^7.5.0"
"eslint": "^7.27.0"
}
}
2 changes: 1 addition & 1 deletion eslint/babel-eslint-plugin/package.json
Expand Up @@ -41,6 +41,6 @@
},
"devDependencies": {
"clone-deep": "^4.0.1",
"eslint": "^7.5.0"
"eslint": "^7.27.0"
}
}
2 changes: 1 addition & 1 deletion eslint/babel-eslint-shared-fixtures/package.json
Expand Up @@ -15,6 +15,6 @@
"@babel/preset-env": "workspace:^7.12.13",
"@babel/preset-flow": "workspace:^7.12.13",
"@babel/preset-react": "workspace:^7.12.13",
"eslint": "^7.5.0"
"eslint": "^7.27.0"
}
}
4 changes: 2 additions & 2 deletions eslint/babel-eslint-tests/package.json
Expand Up @@ -8,8 +8,8 @@
"@babel/eslint-parser": "workspace:^7.14.4",
"@babel/preset-react": "workspace:^7.13.13",
"dedent": "^0.7.0",
"eslint": "^7.5.0",
"eslint-plugin-import": "^2.22.0",
"eslint": "^7.27.0",
"eslint-plugin-import": "^2.23.4",
"npm-babel-parser": "npm:@babel/parser@^7.14.0"
}
}
190 changes: 70 additions & 120 deletions eslint/babel-eslint-tests/test/integration/eslint/rules/strict.js
Expand Up @@ -33,10 +33,12 @@ const baseEslintOpts = {
* @param object opts
* @param function done
*/
function lint(opts, done) {
readFixture(opts.fixture, (err, src) => {
if (err) return done(err);
done(null, eslint.linter.verify(src, opts.eslint));
function lint(opts) {
return new Promise((resolve, reject) => {
readFixture(opts.fixture, (err, src) => {
if (err) return reject(err);
resolve(eslint.linter.verify(src, opts.eslint));
});
});
}

Expand Down Expand Up @@ -66,18 +68,14 @@ function strictSuite() {
eslintOpts.rules[ruleId] = [errorLevel, "never"];

["global-with", "function-with"].forEach(fixture => {
it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, done => {
lint(
{
fixture: ["strict", fixture],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report[0].ruleId).toBe(ruleId);
done();
},
);
it(`should error on ${
fixture.match(/^[^-]+/)[0]
} directive`, async () => {
const report = await lint({
fixture: ["strict", fixture],
eslint: eslintOpts,
});
expect(report[0].ruleId).toBe(ruleId);
});
});
});
Expand All @@ -88,65 +86,41 @@ function strictSuite() {
});
eslintOpts.rules[ruleId] = [errorLevel, "global"];

it("shouldn't error on single global directive", done => {
lint(
{
fixture: ["strict", "global-with"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report.length).toBe(0);
done();
},
);
it("shouldn't error on single global directive", async () => {
const report = await lint({
fixture: ["strict", "global-with"],
eslint: eslintOpts,
});
expect(report.length).toBe(0);
});

it("should error twice on global directive: no and function directive: yes", done => {
lint(
{
fixture: ["strict", "function-with"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report[0].ruleId).toBe(ruleId);
done();
},
);
it("should error twice on global directive: no and function directive: yes", async () => {
const report = await lint({
fixture: ["strict", "function-with"],
eslint: eslintOpts,
});
expect(report[0].ruleId).toBe(ruleId);
});

it("should error on function directive", done => {
lint(
{
fixture: ["strict", "global-with-function-with"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report[0].ruleId).toBe(ruleId);
// This is to make sure the test fails prior to adapting Babel AST
// directive representation to ESLint format. Otherwise it reports an
// error for missing global directive that masquerades as the expected
// result of the previous assertion.
expect(report[0].nodeType).not.toBe("Program");
done();
},
);
it("should error on function directive", async () => {
const report = await lint({
fixture: ["strict", "global-with-function-with"],
eslint: eslintOpts,
});
expect(report[0].ruleId).toBe(ruleId);
// This is to make sure the test fails prior to adapting Babel AST
// directive representation to ESLint format. Otherwise it reports an
// error for missing global directive that masquerades as the expected
// result of the previous assertion.
expect(report[0].nodeType).not.toBe("Program");
});

it("should error on no directive", done => {
lint(
{
fixture: ["strict", "none"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report[0].ruleId).toBe(ruleId);
done();
},
);
it("should error on no directive", async () => {
const report = await lint({
fixture: ["strict", "none"],
eslint: eslintOpts,
});
expect(report[0].ruleId).toBe(ruleId);
});
});

Expand All @@ -156,63 +130,39 @@ function strictSuite() {
});
eslintOpts.rules[ruleId] = [errorLevel, "function"];

it("shouldn't error on single function directive", done => {
lint(
{
fixture: ["strict", "function-with"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report.length).toBe(0);
done();
},
);
it("shouldn't error on single function directive", async () => {
const report = await lint({
fixture: ["strict", "none"],
eslint: eslintOpts,
});
expect(report.length).toBe(0);
});

it("should error twice on function directive: no and global directive: yes", done => {
lint(
{
fixture: ["strict", "global-with-function-without"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
[0, 1].forEach(i => {
expect(report[i].ruleId).toBe(ruleId);
});
done();
},
);
it("should error twice on function directive: no and global directive: yes", async () => {
const report = await lint({
fixture: ["strict", "global-with-function-without"],
eslint: eslintOpts,
});
[0, 1].forEach(i => {
expect(report[i].ruleId).toBe(ruleId);
});
});

it("should error on only global directive", done => {
lint(
{
fixture: ["strict", "global-with"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report[0].ruleId).toBe(ruleId);
done();
},
);
it("should error on only global directive", async () => {
const report = await lint({
fixture: ["strict", "global-with"],
eslint: eslintOpts,
});
expect(report[0].ruleId).toBe(ruleId);
});

it("should error on extraneous global directive", done => {
lint(
{
fixture: ["strict", "global-with-function-with"],
eslint: eslintOpts,
},
(err, report) => {
if (err) return done(err);
expect(report[0].ruleId).toBe(ruleId);
expect(report[0].nodeType.indexOf("Function")).toBe(-1);
done();
},
);
it("should error on extraneous global directive", async () => {
const report = await lint({
fixture: ["strict", "global-with-function-with"],
eslint: eslintOpts,
});
expect(report[0].ruleId).toBe(ruleId);
expect(report[0].nodeType.indexOf("Function")).toBe(-1);
});
});
}
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -43,12 +43,12 @@
"babel-plugin-transform-charcodes": "^0.2.0",
"chalk": "^2.4.2",
"charcodes": "^0.2.0",
"eslint": "^7.5.0",
"eslint-import-resolver-node": "^0.3.3",
"eslint-plugin-flowtype": "^4.6.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-prettier": "^3.1.2",
"eslint": "^7.27.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-flowtype": "^5.7.2",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-prettier": "^3.4.0",
"fancy-log": "^1.3.3",
"flow-bin": "^0.123.0",
"gulp": "^4.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-cli/test/index.js
Expand Up @@ -273,7 +273,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) {
// copy .babelignore file to tmp directory
opts.inFiles[".babelignore"] = helper.readFile(babelIgnoreLoc);
}

// eslint-disable-next-line jest/valid-title
it(testName, buildTest(binName, testName, opts), 20000);
});
});
Expand Down

0 comments on commit 4eda1c8

Please sign in to comment.