Skip to content

Commit

Permalink
fix: Update all dependencies. Fix a few tests where eslint now report…
Browse files Browse the repository at this point in the history
…s nodeType: null.

chore: fix eslint < v8 tests failing

fix: revert minimatch to 3.1.2
  • Loading branch information
hildjj authored and aladdin-add committed Jun 25, 2023
1 parent 239be7d commit 44cec62
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 40 deletions.
42 changes: 21 additions & 21 deletions package.json
Expand Up @@ -16,39 +16,39 @@
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"builtins": "^5.0.1",
"eslint-plugin-es-x": "^6.1.0",
"ignore": "^5.1.1",
"is-core-module": "^2.12.0",
"eslint-plugin-es-x": "^7.1.0",
"ignore": "^5.2.4",
"is-core-module": "^2.12.1",
"minimatch": "^3.1.2",
"resolve": "^1.22.2",
"semver": "^7.5.0"
"semver": "^7.5.3"
},
"devDependencies": {
"@eslint/eslintrc": "^2.0.2",
"@eslint/js": "^8.38.0",
"@typescript-eslint/parser": "^5.59.0",
"codecov": "^3.3.0",
"esbuild": "^0.17.17",
"eslint": "^8.38.0",
"@eslint/eslintrc": "^2.0.3",
"@eslint/js": "^8.43.0",
"@typescript-eslint/parser": "^5.60.0",
"codecov": "^3.8.2",
"esbuild": "^0.18.7",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-doc-generator": "^1.4.3",
"eslint-plugin-eslint-plugin": "^5.0.8",
"eslint-plugin-eslint-plugin": "^5.1.0",
"eslint-plugin-n": "file:.",
"fast-glob": "^3.2.12",
"globals": "^13.20.0",
"husky": "^8.0.2",
"import-meta-resolve": "^2.2.2",
"lint-staged": "^13.2.1",
"markdownlint-cli": "^0.33.0",
"mocha": "^10.1.0",
"husky": "^8.0.3",
"import-meta-resolve": "^3.0.0",
"lint-staged": "^13.2.2",
"markdownlint-cli": "^0.35.0",
"mocha": "^10.2.0",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"opener": "^1.5.1",
"prettier": "^2.8.7",
"opener": "^1.5.2",
"prettier": "^2.8.8",
"punycode": "^2.3.0",
"release-it": "^15.10.1",
"rimraf": "^5.0.0",
"typescript": "^5.0.4"
"release-it": "^15.11.0",
"rimraf": "^5.0.1",
"typescript": "^5.1.3"
},
"scripts": {
"build": "node scripts/update",
Expand Down
10 changes: 10 additions & 0 deletions tests/helpers.js
@@ -0,0 +1,10 @@
/**
* @fileoverview Helpers for tests.
* @author 唯然<weiran.zsd@outlook.com>
*/
"use strict"

const eslintVersion = require("eslint/package.json").version

// greater than or equal to ESLint v8
exports.gtEslintV8 = +eslintVersion.split(".")[0] >= 8
45 changes: 26 additions & 19 deletions tests/lib/configs/recommended.js
Expand Up @@ -3,10 +3,12 @@
const assert = require("assert")
const path = require("path")
const { ESLint } = require("eslint")
const { gtEslintV8 } = require("../../helpers")

const originalCwd = process.cwd()

describe("node/recommended config", () => {
describe("in CJS directory", () => {
;(gtEslintV8 ? describe : describe.skip)("in CJS directory", () => {
const root = path.resolve(__dirname, "../../fixtures/configs/cjs/")

/** @type {Linter} */
Expand Down Expand Up @@ -37,6 +39,7 @@ describe("node/recommended config", () => {
message:
"Parsing error: 'import' and 'export' may appear only with 'sourceType: module'",
ruleId: null,
nodeType: null,
severity: 2,
},
])
Expand All @@ -55,6 +58,7 @@ describe("node/recommended config", () => {
message:
"Parsing error: 'import' and 'export' may appear only with 'sourceType: module'",
ruleId: null,
nodeType: null,
severity: 2,
},
])
Expand Down Expand Up @@ -118,24 +122,27 @@ describe("node/recommended config", () => {
},
])
})

it("*.cjs files should be a script.", async () => {
const report = await linter.lintText("import 'foo'", {
filePath: path.join(root, "test.cjs"),
})

assert.deepStrictEqual(report[0].messages, [
{
column: 1,
fatal: true,
line: 1,
message:
"Parsing error: 'import' and 'export' may appear only with 'sourceType: module'",
ruleId: null,
severity: 2,
},
])
})
;(gtEslintV8 ? it : it.skip)(
"*.cjs files should be a script.",
async () => {
const report = await linter.lintText("import 'foo'", {
filePath: path.join(root, "test.cjs"),
})

assert.deepStrictEqual(report[0].messages, [
{
column: 1,
fatal: true,
line: 1,
message:
"Parsing error: 'import' and 'export' may appear only with 'sourceType: module'",
ruleId: null,
nodeType: null,
severity: 2,
},
])
}
)

it("*.mjs files should be a module.", async () => {
const report = await linter.lintText("import 'foo'", {
Expand Down

0 comments on commit 44cec62

Please sign in to comment.