Skip to content

Commit

Permalink
Chore/lint format (#49)
Browse files Browse the repository at this point in the history
* chore:format import

* chore:delete test

* chore:biome lint

* chore:lint
  • Loading branch information
Onelevenvy authored Sep 25, 2024
1 parent 0fb1fb1 commit aacda2f
Show file tree
Hide file tree
Showing 126 changed files with 2,595 additions and 2,374 deletions.
31 changes: 31 additions & 0 deletions web/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://biomejs.dev/schemas/1.6.1/schema.json",
"organizeImports": {
"enabled": true
},
"files": {
"ignore": ["node_modules", "src/client/", ".next"]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noExplicitAny": "off",
"noArrayIndexKey": "off"
},
"style": {
"noNonNullAssertion": "off"
}
}
},
"formatter": {
"indentStyle": "space"
},
"javascript": {
"formatter": {
"quoteStyle": "double",
"semicolons": "always"
}
}
}
32 changes: 16 additions & 16 deletions web/modify-openapi-operationids.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import * as fs from "node:fs"
import * as fs from "node:fs";

async function modifyOpenAPIFile(filePath) {
try {
const data = await fs.promises.readFile(filePath)
const openapiContent = JSON.parse(data)
const data = await fs.promises.readFile(filePath);
const openapiContent = JSON.parse(data);

const paths = openapiContent.paths
const paths = openapiContent.paths;
for (const pathKey of Object.keys(paths)) {
const pathData = paths[pathKey]
const pathData = paths[pathKey];
for (const method of Object.keys(pathData)) {
const operation = pathData[method]
const operation = pathData[method];
if (operation.tags && operation.tags.length > 0) {
const tag = operation.tags[0]
const operationId = operation.operationId
const toRemove = `${tag}-`
const tag = operation.tags[0];
const operationId = operation.operationId;
const toRemove = `${tag}-`;
if (operationId.startsWith(toRemove)) {
const newOperationId = operationId.substring(toRemove.length)
operation.operationId = newOperationId
const newOperationId = operationId.substring(toRemove.length);
operation.operationId = newOperationId;
}
}
}
Expand All @@ -25,12 +25,12 @@ async function modifyOpenAPIFile(filePath) {
await fs.promises.writeFile(
filePath,
JSON.stringify(openapiContent, null, 2),
)
console.log("File successfully modified")
);
console.log("File successfully modified");
} catch (err) {
console.error("Error:", err)
console.error("Error:", err);
}
}

const filePath = "./openapi.json"
modifyOpenAPIFile(filePath)
const filePath = "./openapi.json";
modifyOpenAPIFile(filePath);
Loading

0 comments on commit aacda2f

Please sign in to comment.