Skip to content

Commit e2ae905

Browse files
committed
chore: update linter deps to eslint v9
1 parent e954b71 commit e2ae905

File tree

8 files changed

+42
-51
lines changed

8 files changed

+42
-51
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.lintstagedrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
22
'*.md': (filenames) => filenames.map((filename) => `remark ${filename} -qfo`),
33
'package.json': 'fixpack',
4-
'*.js': 'xo --fix'
4+
'*.js': 'eslint . --fix'
55
};

.xo-config.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
> Router middleware for [Koa](https://github.com/koajs/koa). Maintained by [Forward Email][forward-email] and [Lad][].
44
55
[![build status](https://github.com/koajs/router/actions/workflows/ci.yml/badge.svg)](https://github.com/koajs/router/actions/workflows/ci.yml)
6-
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
6+
7+
<!-- [![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) -->
8+
79
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
810
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
911
[![license](https://img.shields.io/github/license/koajs/router.svg)](LICENSE)

eslint.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const js = require('@eslint/js');
2+
const eslintPluginUnicorn = require('eslint-plugin-unicorn');
3+
4+
module.exports = [
5+
js.configs.recommended,
6+
{
7+
languageOptions: {
8+
ecmaVersion: 2022,
9+
sourceType: 'commonjs',
10+
globals: {
11+
console: true,
12+
setTimeout: true,
13+
__dirname: true,
14+
// Mocha globals
15+
before: true,
16+
after: true,
17+
beforeEach: true,
18+
describe: true,
19+
it: true
20+
}
21+
},
22+
plugins: {
23+
unicorn: eslintPluginUnicorn,
24+
},
25+
rules: {
26+
'promise/prefer-await-to-then': 0,
27+
'logical-assignment-operators': 0,
28+
'arrow-body-style': 0,
29+
}
30+
}
31+
];

lib/router.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Router {
5151
* @constructor
5252
*/
5353
constructor(opts = {}) {
54-
if (!(this instanceof Router)) return new Router(opts); // eslint-disable-line no-constructor-return
54+
if (!(this instanceof Router)) return new Router(opts);
5555

5656
this.opts = opts;
5757
this.methods = this.opts.methods || [
@@ -581,7 +581,6 @@ class Router {
581581

582582
debug('test %s %s', layer.path, layer.regexp);
583583

584-
// eslint-disable-next-line unicorn/prefer-regexp-test
585584
if (layer.match(path)) {
586585
matched.path.push(layer);
587586

@@ -830,7 +829,7 @@ for (const method of methods) {
830829
}
831830

832831
// Alias for `router.delete()` because delete is a reserved word
833-
// eslint-disable-next-line dot-notation
832+
834833
Router.prototype.del = Router.prototype['delete'];
835834

836835
module.exports = Router;

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"@commitlint/config-conventional": "^17.7.0",
3232
"@ladjs/env": "^4.0.0",
3333
"chalk": "^5.4.1",
34-
"eslint": "^8.39.0",
35-
"eslint-config-xo-lass": "^2.0.1",
34+
"eslint": "^9.32.0",
35+
"eslint-plugin-unicorn": "^60.0.0",
3636
"fixpack": "^4.0.0",
3737
"husky": "^9.1.7",
3838
"jsdoc-to-markdown": "^8.0.0",
@@ -42,8 +42,7 @@
4242
"nyc": "^17.0.0",
4343
"remark-cli": "11",
4444
"remark-preset-github": "^4.0.4",
45-
"supertest": "^7.0.0",
46-
"xo": "0.53.1"
45+
"supertest": "^7.0.0"
4746
},
4847
"engines": {
4948
"node": ">= 18"
@@ -69,7 +68,7 @@
6968
"benchmark": "node bench/run.js",
7069
"coverage": "nyc npm run test",
7170
"docs": "NODE_ENV=test jsdoc2md -t ./lib/API_tpl.hbs --src ./lib/*.js >| API.md",
72-
"lint": "xo --fix && remark . -qfo && fixpack",
71+
"lint": "eslint . --fix && remark . -qfo && fixpack",
7372
"prepare": "husky install",
7473
"pretest": "npm run lint",
7574
"test": "mocha test/**/*.js",

test/lib/router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ describe('Router', () => {
270270
router
271271
.get(
272272
'users_single',
273-
new RegExp('/users/:id(.*)'), // eslint-disable-line prefer-regex-literals
273+
new RegExp('/users/:id(.*)'),
274274
(ctx, next) => {
275275
ctx.body = { single: true };
276276
next();

0 commit comments

Comments
 (0)