Add ESLint and fix issues (#133)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
# Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Add ESLint to the project - Fix issues which ESLint found #49 ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://gitea.vylpes.xyz/External/card-drop/pulls/133 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
84749c3381
commit
39529cf20c
44 changed files with 1590 additions and 280 deletions
|
@ -2,12 +2,12 @@ import { readFileSync } from "fs";
|
|||
import path from "path";
|
||||
import Config from "../database/entities/app/Config";
|
||||
import { glob } from "glob";
|
||||
import SeriesMetadata from "../contracts/SeriesMetadata";
|
||||
import { SeriesMetadata } from "../contracts/SeriesMetadata";
|
||||
import { CoreClient } from "../client/client";
|
||||
|
||||
export default class CardMetadataFunction {
|
||||
public static async Execute(overrideSafeMode: boolean = false): Promise<boolean> {
|
||||
if (!overrideSafeMode && await Config.GetValue('safemode') == "true") return false;
|
||||
if (!overrideSafeMode && await Config.GetValue("safemode") == "true") return false;
|
||||
|
||||
try {
|
||||
CoreClient.Cards = await this.FindMetadataJSONs();
|
||||
|
@ -16,7 +16,7 @@ export default class CardMetadataFunction {
|
|||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
await Config.SetValue('safemode', 'true');
|
||||
await Config.SetValue("safemode", "true");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,9 @@ export default class CardMetadataFunction {
|
|||
private static async FindMetadataJSONs(): Promise<SeriesMetadata[]> {
|
||||
const res: SeriesMetadata[] = [];
|
||||
|
||||
const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, 'cards', '/**/*.json'));
|
||||
const seriesJSONs = await glob(path.join(process.env.DATA_DIR!, "cards", "/**/*.json"));
|
||||
|
||||
for (let jsonPath of seriesJSONs) {
|
||||
for (const jsonPath of seriesJSONs) {
|
||||
console.log(`Reading file ${jsonPath}`);
|
||||
const jsonFile = readFileSync(jsonPath);
|
||||
const parsedJson: SeriesMetadata[] = JSON.parse(jsonFile.toString());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue