Skip to content

Commit d98ed68

Browse files
chore: fix eslint
1 parent 1c4bfcb commit d98ed68

File tree

11 files changed

+22
-9
lines changed

11 files changed

+22
-9
lines changed

eslint.config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ const config = require('eslint-config-hexo/ts');
33
module.exports = [
44
...config,
55
{
6-
"rules": {
7-
"@typescript-eslint/no-explicit-any": 0,
8-
"@typescript-eslint/no-var-requires": 0,
9-
"n/no-missing-require": 0
6+
'rules': {
7+
'@typescript-eslint/no-explicit-any': 0,
8+
'@typescript-eslint/no-var-requires': 0,
9+
'@typescript-eslint/no-require-imports': 0,
10+
'n/no-missing-require': 0,
11+
'n/no-missing-import': 0
1012
}
1113
}
1214
];

lib/extend/injector.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Cache } from 'hexo-util';
2-
import { LocalsType, PageSchema, PostSchema } from '../types';
32

43
type Entry = 'head_begin' | 'head_end' | 'body_begin' | 'body_end';
54

lib/extend/tag.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class NunjucksTag {
5959
return node;
6060
}
6161

62+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6263
run(context, args, body, callback) {
6364
return this._run(context, args, '');
6465
}
@@ -80,13 +81,15 @@ class NunjucksBlock extends NunjucksTag {
8081
return new nodes.CallExtension(this, 'run', node, [body]);
8182
}
8283

84+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8385
_parseBody(parser, nodes, lexer) {
8486
const body = parser.parseUntilBlocks(`end${this.tags[0]}`);
8587

8688
parser.advanceAfterBlockEnd();
8789
return body;
8890
}
8991

92+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
9093
run(context, args, body, callback) {
9194
return this._run(context, args, trimBody(body));
9295
}

lib/hexo/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ declare module 'module' {
188188
_cache: any;
189189
}
190190

191+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
191192
interface Hexo {
192193

193194
/**
@@ -270,6 +271,7 @@ interface Hexo {
270271
emit(event: string, ...args: any[]): any;
271272
}
272273

274+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
273275
class Hexo extends EventEmitter {
274276
public base_dir: string;
275277
public public_dir: string;
@@ -500,7 +502,7 @@ class Hexo extends EventEmitter {
500502
try {
501503
// Try to resolve the plugin with the Node.js's built-in require.resolve.
502504
return require.resolve(name, { paths: [basedir] });
503-
} catch (err) {
505+
} catch {
504506
// There was an error (likely the node_modules is corrupt or from early version of npm),
505507
// so return a possibly non-existing path that a later part of the resolution process will check.
506508
return join(basedir, 'node_modules', name);

lib/hexo/validate_config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export = (ctx: Hexo): void => {
1313
try {
1414
// eslint-disable-next-line no-new
1515
new URL(config.url);
16-
// eslint-disable-next-line no-new
1716
assert(new URL(config.url).protocol.startsWith('http'));
1817
} catch {
1918
throw new TypeError('Invalid config detected: "url" should be a valid URL!');

lib/models/cache.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type fs from 'fs';
55
import type Document from 'warehouse/dist/document';
66
import type { CacheSchema } from '../types';
77

8+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
89
export = (ctx: Hexo) => {
910
const Cache = new warehouse.Schema<CacheSchema>({
1011
_id: {type: String, required: true},

lib/models/data.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import warehouse from 'warehouse';
22
import type Hexo from '../hexo';
33
import { DataSchema } from '../types';
44

5+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
56
export = (ctx: Hexo) => {
67
const Data = new warehouse.Schema<DataSchema>({
78
_id: {type: String, required: true},

lib/models/types/moment.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class SchemaTypeMoment extends warehouse.SchemaType<moment.Moment> {
4242
return value;
4343
}
4444

45+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4546
match(value, query, data?) {
4647
return value ? value.valueOf() === query.valueOf() : false;
4748
}
@@ -60,28 +61,34 @@ class SchemaTypeMoment extends warehouse.SchemaType<moment.Moment> {
6061
if (value) return toMoment(value);
6162
}
6263

64+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6365
value(value?, data?) {
6466
// FIXME: Same as above. Also a dirty hack.
6567
return value ? value._d.toISOString() : value;
6668
}
6769

70+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6871
q$day(value, query, data?) {
6972
return value ? value.date() === query : false;
7073
}
7174

75+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7276
q$month(value, query, data?) {
7377
return value ? value.month() === query : false;
7478
}
7579

80+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7681
q$year(value, query, data?) {
7782
return value ? value.year() === query : false;
7883
}
7984

85+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8086
u$inc(value, update, data?) {
8187
if (!value) return value;
8288
return value.add(update);
8389
}
8490

91+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8592
u$dec(value, update, data?) {
8693
if (!value) return value;
8794
return value.subtract(update);

lib/plugins/console/deploy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ function deployConsole(this: Hexo, args: DeployArgs): Promise<any> {
5353

5454
this.log.info('Deploying: %s', magenta(type));
5555

56-
// eslint-disable-next-line no-extra-parens
5756
return (Reflect.apply(deployers[type], this, [{ ...item, ...args }]) as any).then(() => {
5857
this.log.info('Deploy done: %s', magenta(type));
5958
});

lib/plugins/generator/asset.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/ban-ts-comment */
21
import { exists, createReadStream } from 'hexo-fs';
32
import Promise from 'bluebird';
43
import { extname } from 'path';

0 commit comments

Comments
 (0)