mirror of
https://github.com/forketyfork/obsidian-food-tracker.git
synced 2026-07-22 05:51:38 +00:00
chore(lint): remove unnecessary type assertions
The updated @typescript-eslint 8.59.3 flags type assertions that don't change the expression type or whose receiver already accepts the original type.
This commit is contained in:
parent
1bf4ec0290
commit
e4cd388e9d
5 changed files with 7 additions and 7 deletions
|
|
@ -276,7 +276,7 @@ export default class FoodTrackerPlugin extends Plugin {
|
|||
...DEFAULT_SETTINGS,
|
||||
// On mobile devices, default to "document" display mode for better visibility
|
||||
totalDisplayMode: Platform.isMobile ? "document" : DEFAULT_SETTINGS.totalDisplayMode,
|
||||
} as FoodTrackerPluginSettings;
|
||||
};
|
||||
|
||||
const merged = Object.assign({}, mobileAwareDefaults, savedData);
|
||||
merged.frontmatterFieldNames = {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function sanitizeFrontmatterFieldNames(
|
|||
...fieldNames,
|
||||
};
|
||||
|
||||
const sanitized: FrontmatterFieldNames = { ...merged } as FrontmatterFieldNames;
|
||||
const sanitized: FrontmatterFieldNames = { ...merged };
|
||||
const seen = new Set<string>();
|
||||
|
||||
for (const key of FRONTMATTER_KEYS_ORDER) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ describe("NutrientCache", () => {
|
|||
const file = createFile("nutrients/apple.md");
|
||||
|
||||
const frontmatterMap: FrontmatterMap = {
|
||||
[file.path]: { frontmatter: { name: "apple" } } as unknown as CachedMetadata,
|
||||
[file.path]: { frontmatter: { name: "apple" } },
|
||||
};
|
||||
|
||||
const app = createApp(frontmatterMap, [file]);
|
||||
|
|
@ -51,7 +51,7 @@ describe("NutrientCache", () => {
|
|||
expect(cache.hasPendingMetadataFor("apple")).toBe(true);
|
||||
|
||||
// Metadata becomes available after parsing finishes
|
||||
frontmatterMap[file.path] = { frontmatter: { name: "apple", calories: 10 } } as unknown as CachedMetadata;
|
||||
frontmatterMap[file.path] = { frontmatter: { name: "apple", calories: 10 } };
|
||||
cache.updateCache(file, "modify");
|
||||
|
||||
expect(cache.getNutrientNames()).toEqual(["apple"]);
|
||||
|
|
@ -69,7 +69,7 @@ describe("NutrientCache", () => {
|
|||
nutrition_per: 28,
|
||||
serving_size: 28,
|
||||
},
|
||||
} as unknown as CachedMetadata,
|
||||
},
|
||||
};
|
||||
const app = createApp(frontmatterMap, [file]);
|
||||
const cache = new NutrientCache(app, "nutrients");
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ global.createEl = jest.fn().mockImplementation((tag: string, options?: any) => {
|
|||
}
|
||||
if (options?.attr) {
|
||||
Object.entries(options.attr).forEach(([key, value]) => {
|
||||
element.setAttribute(key, value as string);
|
||||
element.setAttribute(key, value);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ function createApp(config: AppTestConfig): App {
|
|||
if (frontmatter === null) {
|
||||
return null;
|
||||
}
|
||||
return { frontmatter } as unknown as CachedMetadata;
|
||||
return { frontmatter };
|
||||
};
|
||||
|
||||
const fileManager = app.fileManager as unknown as {
|
||||
|
|
|
|||
Loading…
Reference in a new issue