Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change peer dependencies to allow eslint v9 #216

Merged
merged 4 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
eslint: [8.x, "next"]
eslint: [8.x, "9.x"]
scagood marked this conversation as resolved.
Show resolved Hide resolved
node: [18.x, 20.x]
include:
- os: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/file-extension-in-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getExistingExtensions(filePath) {
.readdirSync(directory)
.filter(filename => filename.startsWith(`${basename}.`))
.map(filename => path.extname(filename))
} catch (_error) {
} catch {
return []
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/process-exit-as-throw.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function safeRequire(...moduleNames) {
for (const moduleName of moduleNames) {
try {
return require(moduleName)
} catch (_err) {
} catch {
// Ignore.
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/util/get-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function readPackageJson(dir) {
data.filePath = filePath
return data
}
} catch (_err) {
} catch {
// do nothing.
}

Expand Down
2 changes: 1 addition & 1 deletion lib/util/get-semver-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function getSemverRange(x) {
if (!ret) {
try {
ret = new Range(s)
} catch (_error) {
} catch {
// Ignore parsing error.
}
cache.set(s, ret)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"configs/"
],
"peerDependencies": {
"eslint": "^8.23.0 || >=9.0.0-0"
"eslint": ">=8.23.0"
scagood marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
Expand All @@ -26,10 +26,10 @@
"semver": "^7.5.3"
},
"devDependencies": {
"@eslint/js": "^8.43.0",
"@eslint/js": "^9.0.0",
"@types/eslint": "^8.56.2",
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8",
"eslint": "^9.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-doc-generator": "^1.6.1",
"eslint-plugin-eslint-plugin": "^5.2.1",
Expand Down
14 changes: 7 additions & 7 deletions tests/lib/rules/no-unsupported-features/es-builtins.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ function ignores(keyword) {
}

function runTests(patterns) {
for (const pattern of patterns) {
const ruleTester = new RuleTester({
languageOptions: {
ecmaVersion: "latest",
globals: globals.builtin,
},
})
const ruleTester = new RuleTester({
languageOptions: {
ecmaVersion: "latest",
globals: globals.builtin,
},
})

for (const pattern of patterns) {
const tests = {
valid: pattern.valid,
invalid: pattern.invalid,
Expand Down
78 changes: 40 additions & 38 deletions tests/lib/rules/no-unsupported-features/es-syntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ function ignores(keyword) {
}

function runTests(patterns) {
for (const pattern of patterns) {
const ruleTester = new RuleTester({
languageOptions: { ecmaVersion: "latest", env: { node: false } },
})
const ruleTester = new RuleTester({
languageOptions: { ecmaVersion: "latest", env: { node: false } },
})

for (const pattern of patterns) {
const tests = {
valid: pattern.valid,
invalid: pattern.invalid,
Expand Down Expand Up @@ -492,40 +492,42 @@ runTests([
code: "(class { key(a = 0) {} })",
options: [{ version: "6.0.0" }],
},
{
code: "function f(a = 0) {}",
options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
},
{
code: "(function(a = 0) {})",
options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
},
{
code: "((a = 0) => a)",
options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
},
{
code: "({ key(a = 0) {} })",
options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
},
{
code: "class A { key(a = 0) {} }",
options: [
{
version: "5.9.9",
ignores: ["classes", "defaultParameters"],
},
],
},
{
code: "(class { key(a = 0) {} })",
options: [
{
version: "5.9.9",
ignores: ["classes", "defaultParameters"],
},
],
},

// detected duplicate tests by eslint v9
// {
// code: "function f(a = 0) {}",
// options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
// },
// {
// code: "(function(a = 0) {})",
// options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
// },
// {
// code: "((a = 0) => a)",
// options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
// },
// {
// code: "({ key(a = 0) {} })",
// options: [{ version: "5.9.9", ignores: ["defaultParameters"] }],
// },
// {
// code: "class A { key(a = 0) {} }",
// options: [
// {
// version: "5.9.9",
// ignores: ["classes", "defaultParameters"],
// },
// ],
// },
// {
// code: "(class { key(a = 0) {} })",
// options: [
// {
// version: "5.9.9",
// ignores: ["classes", "defaultParameters"],
// },
// ],
// },
Comment on lines +496 to +530
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not leave these here commented out? 👀

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, just want to figure out why they are duplicated - maybe a bug somewhere. :)

],
invalid: [
{
Expand Down