diff --git a/package.json b/package.json index 98fbeb1e..edb134bd 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/helpers.js b/tests/helpers.js new file mode 100644 index 00000000..fe685cdc --- /dev/null +++ b/tests/helpers.js @@ -0,0 +1,10 @@ +/** + * @fileoverview Helpers for tests. + * @author 唯然 + */ +"use strict" + +const eslintVersion = require("eslint/package.json").version + +// greater than or equal to ESLint v8 +exports.gtEslintV8 = +eslintVersion.split(".")[0] >= 8 diff --git a/tests/lib/configs/recommended.js b/tests/lib/configs/recommended.js index 4a013ea1..0111f475 100644 --- a/tests/lib/configs/recommended.js +++ b/tests/lib/configs/recommended.js @@ -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} */ @@ -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, }, ]) @@ -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, }, ]) @@ -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'", {