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

deps: upgrade eslint #6118

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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: 0 additions & 2 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc.yml

This file was deleted.

27 changes: 27 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export default [
{
// Define language options
languageOptions: {
sourceType: 'module', // or 'commonjs' based on your project
globals: {
// Add any global variables you need
__dirname: true,
process: true,
},
},
rules: {
'eol-last': 'error',
'eqeqeq': ['error', 'allow-null'],
'indent': ['error', 2, { MemberExpression: 'off', SwitchCase: 1 }],
'no-trailing-spaces': 'error',
'no-unused-vars': [
'error',
{
vars: 'all',
args: 'none',
ignoreRestSiblings: true,
}
],
},
},
];
Comment on lines +1 to +27
Copy link
Member

@UlisesGascon UlisesGascon Nov 1, 2024

Choose a reason for hiding this comment

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

I think that the config will require a team agreement.

Copy link
Author

Choose a reason for hiding this comment

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

After i upgrade eslint, it need additional file config, and no need eslintrc yml, eslintignore. eslint config is the result converted from eslintrc, and i dont add rules or changes rule.

2 changes: 1 addition & 1 deletion lib/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ function tryStat(path) {

try {
return fs.statSync(path);
} catch (e) {
} catch {
return undefined;
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"cookie-parser": "1.4.6",
"cookie-session": "2.0.0",
"ejs": "3.1.9",
"eslint": "8.47.0",
"eslint": "9.13.0",
"express-session": "1.17.2",
"hbs": "4.2.0",
"marked": "0.7.0",
Expand Down
2 changes: 1 addition & 1 deletion test/app.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ function supportsRegexp(source) {
try {
new RegExp(source)
return true
} catch (e) {
} catch {
return false
}
}
2 changes: 1 addition & 1 deletion test/express.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ function shouldContainInBody (str) {
function tryRequire (name) {
try {
return require(name)
} catch (e) {
} catch {
return {}
}
}
2 changes: 1 addition & 1 deletion test/express.raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ function createApp (options) {
function tryRequire (name) {
try {
return require(name)
} catch (e) {
} catch {
return {}
}
}
2 changes: 1 addition & 1 deletion test/express.text.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ function createApp (options) {
function tryRequire (name) {
try {
return require(name)
} catch (e) {
} catch {
return {}
}
}
2 changes: 1 addition & 1 deletion test/express.urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ function expectKeyCount (count) {
function tryRequire (name) {
try {
return require(name)
} catch (e) {
} catch {
return {}
}
}
2 changes: 1 addition & 1 deletion test/res.download.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ describe('res', function(){
function tryRequire (name) {
try {
return require(name)
} catch (e) {
Copy link
Member

Choose a reason for hiding this comment

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

Why use finally here and catch in the others?

} finally {
return {}
}
}
2 changes: 1 addition & 1 deletion test/res.sendFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ function createApp(path, options, fn) {
function tryRequire (name) {
try {
return require(name)
} catch (e) {
} catch {
return {}
}
}
Loading