Skip to content

Commit aec4a35

Browse files
committed
chore: bump eslint
1 parent 9d50602 commit aec4a35

File tree

14 files changed

+63
-56
lines changed

14 files changed

+63
-56
lines changed

.eslintignore

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

.eslintrc.json

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

assets

Submodule assets updated 1 file

eslint.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const config = require('eslint-config-hexo/ts');
2+
const testConfig = require('eslint-config-hexo/test');
3+
4+
module.exports = [
5+
// Configurations applied globally
6+
...config,
7+
{
8+
rules: {
9+
'@typescript-eslint/no-explicit-any': 0,
10+
'@typescript-eslint/no-var-requires': 0,
11+
'@typescript-eslint/no-require-imports': 0
12+
}
13+
},
14+
// Configurations applied only to test files
15+
{
16+
files: [
17+
'test/**/*.ts'
18+
],
19+
languageOptions: {
20+
...testConfig.languageOptions
21+
},
22+
rules: {
23+
...testConfig.rules,
24+
'@typescript-eslint/no-var-requires': 0,
25+
'@typescript-eslint/ban-ts-comment': 0,
26+
'@typescript-eslint/no-unused-expressions': 0
27+
}
28+
}
29+
];

lib/console/init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function initConsole(this: Context, args: InitArgs) {
3535
await spawn('git', ['clone', '--recurse-submodules', '--depth=1', '--quiet', GIT_REPO_URL, target], {
3636
stdio: 'inherit'
3737
});
38-
} catch (err) {
38+
} catch {
3939
log.warn('git clone failed. Copying data instead');
4040
await copyAsset(target);
4141
}
@@ -85,7 +85,7 @@ async function initConsole(this: Context, args: InitArgs) {
8585
});
8686
}
8787
log.info('Start blogging with Hexo!');
88-
} catch (err) {
88+
} catch {
8989
log.warn(`Failed to install dependencies. Please run 'npm install' in "${target}" folder.`);
9090
}
9191
}

lib/hexo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import goodbye from './goodbye';
77
import minimist from 'minimist';
88
import resolve from 'resolve';
99
import { camelCaseKeys } from 'hexo-util';
10-
import registerConsole from './console';
10+
import registerConsole from './console/index';
1111
import helpConsole from './console/help';
1212
import initConsole from './console/init';
1313
import versionConsole from './console/version';
@@ -89,7 +89,7 @@ function watchSignal(hexo: Context) {
8989
hexo.unwatch();
9090

9191
hexo.exit().then(() => {
92-
// eslint-disable-next-line no-process-exit
92+
// eslint-disable-next-line n/no-process-exit
9393
process.exit();
9494
});
9595
});

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"prepublishOnly": "npm install && npm run clean && npm run build",
1818
"build": "tsc -b",
1919
"clean": "tsc -b --clean",
20-
"eslint": "eslint .",
20+
"eslint": "eslint lib test",
2121
"pretest": "npm run clean && npm run build",
2222
"test": "mocha test/**/*.ts --require ts-node/register",
2323
"test-cov": "nyc --reporter=lcovonly npm test",
@@ -64,8 +64,8 @@
6464
"@types/rewire": "^2.5.30",
6565
"@types/sinon": "^17.0.3",
6666
"chai": "^4.3.4",
67-
"eslint": "^8.2.0",
68-
"eslint-config-hexo": "^5.0.0",
67+
"eslint": "^9.39.1",
68+
"eslint-config-hexo": "^6.0.0",
6969
"hexo-renderer-marked": "^6.0.0",
7070
"mocha": "^11.7.5",
7171
"nyc": "^15.1.0",

test/.eslintrc.json

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

test/scripts/console.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe('console', () => {
99
try {
1010
// @ts-expect-error
1111
consoleExtend.register();
12-
} catch (err) {
12+
} catch (err: any) {
1313
err.should.have.property('message', 'name is required');
1414
}
1515
});
@@ -19,7 +19,7 @@ describe('console', () => {
1919
try {
2020
// @ts-expect-error
2121
consoleExtend.register('test', 'fn');
22-
} catch (err) {
22+
} catch (err: any) {
2323
err.should.have.property('message', 'fn must be a function');
2424
}
2525
});
@@ -29,7 +29,7 @@ describe('console', () => {
2929
try {
3030
// @ts-expect-error
3131
consoleExtend.register('test', 'desc', 'fn');
32-
} catch (err) {
32+
} catch (err: any) {
3333
err.should.have.property('message', 'fn must be a function');
3434
}
3535
});

test/scripts/context.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('context', () => {
2626
try {
2727
await hexo.call('wtf');
2828
should.fail();
29-
} catch (err) {
29+
} catch (err: any) {
3030
err.should.have.property('message', 'Console `wtf` has not been registered yet!');
3131
}
3232
});
@@ -46,7 +46,7 @@ describe('context', () => {
4646
});
4747

4848
it('with callback but no args', done => {
49-
hexo.call('test', err => {
49+
hexo.call('test', (err: any) => {
5050
if (err) return done(err);
5151

5252
spy.calledOnce.should.be.true;
@@ -57,7 +57,7 @@ describe('context', () => {
5757
});
5858

5959
describe('exit', () => {
60-
let hexo, fatal;
60+
let hexo: Context, fatal: any;
6161

6262
beforeEach(() => {
6363
hexo = new Context();

0 commit comments

Comments
 (0)