Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit49fc02b

Browse files
committed
chore: add biome linting
1 parent76ec701 commit49fc02b

33 files changed

+223
-62
lines changed

‎biome.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"$schema":"https://biomejs.dev/schemas/2.1.2/schema.json",
3+
"vcs": {
4+
"enabled":true,
5+
"clientKind":"git",
6+
"useIgnoreFile":true
7+
},
8+
"files": {
9+
"ignoreUnknown":true,
10+
"includes": ["**"]
11+
},
12+
"formatter": {
13+
"enabled":false
14+
},
15+
"assist": {"actions": {"source": {"organizeImports":"off" } } },
16+
"linter": {
17+
"enabled":true,
18+
"rules": {
19+
"recommended":true,
20+
"correctness": {
21+
"noUnusedImports":"error"
22+
},
23+
"style": {
24+
"noNonNullAssertion":"off",
25+
"noParameterAssign":"error",
26+
"useAsConstAssertion":"error",
27+
"useDefaultParameterLast":"error",
28+
"useEnumInitializers":"error",
29+
"useSelfClosingElements":"error",
30+
"useSingleVarDeclarator":"error",
31+
"noUnusedTemplateLiteral":"error",
32+
"useNumberNamespace":"error",
33+
"noInferrableTypes":"error",
34+
"noUselessElse":"error"
35+
},
36+
"suspicious": {
37+
"noDoubleEquals":"off"
38+
},
39+
"complexity": {
40+
"noForEach":"error"
41+
}
42+
}
43+
},
44+
"overrides": [
45+
{
46+
"includes": ["**/*.svelte"],
47+
"linter": {
48+
"rules": {
49+
"style": {
50+
"useConst":"off"
51+
},
52+
"correctness": {
53+
"noUnusedImports":"off",
54+
"noSelfAssign":"off"
55+
}
56+
}
57+
}
58+
}
59+
]
60+
}

‎package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"dev":"nodemon -e js,ts --loader tsm .",
88
"format":"prettier --write .",
99
"db:dev":"./pocketbase/dev.sh",
10-
"start":"tsm ."
10+
"start":"tsm .",
11+
"check":"biome check"
1112
},
1213
"license":"MIT",
1314
"dependencies": {
@@ -20,6 +21,7 @@
2021
"url-regex":"^5.0.0"
2122
},
2223
"devDependencies": {
24+
"@biomejs/biome":"2.1.2",
2325
"@types/node":"^24.0.14",
2426
"nodemon":"^3.1.10",
2527
"pocketbase":"^0.26.1",

‎pnpm-lock.yaml

Lines changed: 91 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/buttons/tags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default button({
55
id:/^tags_page_\d+$/,
66

77
asyncrun({ interaction}){
8-
constpage=parseInt(interaction.customId.split('_')[2],10);
8+
constpage=Number.parseInt(interaction.customId.split('_')[2],10);
99

1010
constresponse=awaitget_tags_list(page);
1111

‎src/commands/docs/_docs_cache.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export async function build_cache(repo: Repos) {
3030
consttitle=block.breadcrumbs.join('/');
3131
lookup.set(block.href,title);
3232

33+
// biome-ignore lint/suspicious/noAssignInExpressions: todo
3334
(indexes[block.rank??0]??=newflexsearch.Index({
3435
tokenize:'forward',
3536
})).add(block.href,`${title}${block.content}`);

‎src/commands/docs/docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default command({
7676
list_embed_builder(results,`${repo_details.NAME} Docs`),
7777
],
7878
});
79-
}catch(error){
79+
}catch{
8080
awaitinteraction.reply({
8181
content:'An error occurred while searching the docs.',
8282
ephemeral:true,

‎src/commands/docs/mdn.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import{list_embed_builder}from'../../utils/embed_helpers.js';
22
import{wrap_in_embed}from'../../utils/embed_helpers.js';
33
import{command}from'jellycommands';
4-
import{URL}from'url';
4+
import{URL}from'node:url';
55

66
exportdefaultcommand({
77
name:'mdn',
@@ -23,7 +23,7 @@ export default command({
2323
if(!search_topic){
2424
awaitinteraction.reply(
2525
wrap_in_embed(
26-
`Have a HTML, CSS or JS question? Check the [MDN docs](https://developer.mozilla.org/en-US/docs/Web)`,
26+
'Have a HTML, CSS or JS question? Check the [MDN docs](https://developer.mozilla.org/en-US/docs/Web)',
2727
),
2828
);
2929
return;
@@ -47,7 +47,7 @@ export default command({
4747

4848
asyncfunctionmdn_search(
4949
query:string,
50-
max_results:number=5,
50+
max_results=5,
5151
):Promise<null|string[]>{
5252
constreq_url=newURL('https://developer.mozilla.org/api/v1/search');
5353
req_url.searchParams.set('q',query);
@@ -56,15 +56,15 @@ async function mdn_search(
5656
constres=awaitfetch(req_url.toString());
5757

5858
if(res.ok){
59-
letresults:any=awaitres.json();
59+
// biome-ignore lint/suspicious/noExplicitAny: laziness
60+
constresults:any=awaitres.json();
6061
constcount=results.metadata.total.value;
6162

6263
returncount===0
6364
?null
6465
:results.documents.map(doc_to_formatted_link);
65-
}else{
66-
returnnull;
6766
}
67+
returnnull;
6868
}
6969

7070
functiondoc_to_formatted_link(doc:{

‎src/commands/docs/tutorial.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default command({
3939
`Have you gone through the tutorial page on${top_result}?`,
4040
)
4141
:{
42-
content:`No matching result found. Try again with a different search term.`,
42+
content:"No matching result found. Try again with a different search term.",
4343
ephemeral:true,
4444
},
4545
);

‎src/commands/github/_common.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import{Repos,RepositoryDetails}from'../../utils/repositories.js';
1+
import{typeRepos,RepositoryDetails}from'../../utils/repositories.js';
22
import{list_embed_builder}from'../../utils/embed_helpers.js';
3-
import{ChatInputCommandInteraction}from'discord.js';
3+
importtype{ChatInputCommandInteraction}from'discord.js';
44
import{GITHUB_TOKEN}from'../../config.js';
55

66
constquery=
@@ -62,6 +62,7 @@ async function search_github(
6262

6363
if(!res.ok)returnnull;
6464

65+
// biome-ignore lint/suspicious/noExplicitAny: laziness
6566
constbody=(awaitres.json())asRecord<string,any>;
6667

6768
constresults:SearchResult[]=body.data.search.nodes;
@@ -110,10 +111,10 @@ export async function github_command_handler(
110111
);
111112
}
112113

113-
exportconstenumGithubResultType{
114-
ISSUE,
115-
PULL_REQUEST,
116-
DISCUSSION,
114+
exportenumGithubResultType{
115+
ISSUE=0,
116+
PULL_REQUEST=1,
117+
DISCUSSION=2,
117118
}
118119

119120
interfaceSearchResult{

‎src/commands/questions/question.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import {
1111
ActionRowBuilder,
1212
ButtonBuilder,
1313
ButtonStyle,
14-
InteractionReplyOptions,
15-
Snowflake,
14+
typeInteractionReplyOptions,
15+
typeSnowflake,
1616
ThreadAutoArchiveDuration,
17-
ThreadChannel,
17+
typeThreadChannel,
1818
}from'discord.js';
1919

2020
exportdefaultcommand({

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp