Added eslint to webpack config

This commit is contained in:
Elio Struyf
2024-09-27 11:14:34 +02:00
parent 017a2d7597
commit 6fd526e962
123 changed files with 555 additions and 347 deletions
+3 -1
View File
@@ -13,6 +13,8 @@
"no-unused-expressions": "error",
"curly": "error",
"class-methods-use-this": "warn",
"no-console": "warn"
"no-console": "warn",
"@typescript-eslint/no-empty-interface": "off",
"no-extra-boolean-cast": "off"
}
}
+183 -3
View File
@@ -48,6 +48,7 @@
"dotenv": "^16.3.1",
"downshift": "6.0.6",
"eslint": "^8.33.0",
"eslint-webpack-plugin": "^4.2.0",
"fuse.js": "6.5.3",
"github-directory-downloader": "^1.3.6",
"glob": "^10.3.12",
@@ -679,6 +680,35 @@
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
"node_modules/@jest/schemas": {
"version": "29.6.3",
"resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz",
"integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==",
"dev": true,
"dependencies": {
"@sinclair/typebox": "^0.27.8"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/@jest/types": {
"version": "29.6.3",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz",
"integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==",
"dev": true,
"dependencies": {
"@jest/schemas": "^29.6.3",
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-reports": "^3.0.0",
"@types/node": "*",
"@types/yargs": "^17.0.8",
"chalk": "^4.0.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
@@ -1650,6 +1680,12 @@
"node": ">=6"
}
},
"node_modules/@sinclair/typebox": {
"version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
"integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==",
"dev": true
},
"node_modules/@tailwindcss/forms": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.7.tgz",
@@ -1737,9 +1773,9 @@
}
},
"node_modules/@types/eslint": {
"version": "8.56.2",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz",
"integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==",
"version": "8.56.12",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.12.tgz",
"integrity": "sha512-03ruubjWyOHlmljCVoxSuNDdmfZDzsrrz0P2LeJsOXr+ZwFQ+0yQIwNCwt/GYhV7Z31fgtXJTAEs+FYlEL851g==",
"dev": true,
"dependencies": {
"@types/estree": "*",
@@ -1822,6 +1858,30 @@
"integrity": "sha512-IwpIMieE55oGWiXkQPSBY1nw1nFs6bsKXTFskNY8sdS17K24vyEBRQZEwlRS7ZmXCWnJcQtbxWzly+cODWGs2A==",
"dev": true
},
"node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
"integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==",
"dev": true
},
"node_modules/@types/istanbul-lib-report": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz",
"integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==",
"dev": true,
"dependencies": {
"@types/istanbul-lib-coverage": "*"
}
},
"node_modules/@types/istanbul-reports": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz",
"integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==",
"dev": true,
"dependencies": {
"@types/istanbul-lib-report": "*"
}
},
"node_modules/@types/js-yaml": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz",
@@ -2126,6 +2186,21 @@
"@types/node": "*"
}
},
"node_modules/@types/yargs": {
"version": "17.0.33",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz",
"integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==",
"dev": true,
"dependencies": {
"@types/yargs-parser": "*"
}
},
"node_modules/@types/yargs-parser": {
"version": "21.0.3",
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz",
"integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz",
@@ -3328,6 +3403,21 @@
"node": ">=6.0"
}
},
"node_modules/ci-info": {
"version": "3.9.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
"integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/sibiraj-s"
}
],
"engines": {
"node": ">=8"
}
},
"node_modules/classnames": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
@@ -4343,6 +4433,79 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-webpack-plugin": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-4.2.0.tgz",
"integrity": "sha512-rsfpFQ01AWQbqtjgPRr2usVRxhWDuG0YDYcG8DJOteD3EFnpeuYuOwk0PQiN7PRBTqS6ElNdtPZPggj8If9WnA==",
"dev": true,
"dependencies": {
"@types/eslint": "^8.56.10",
"jest-worker": "^29.7.0",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"schema-utils": "^4.2.0"
},
"engines": {
"node": ">= 14.15.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"peerDependencies": {
"eslint": "^8.0.0 || ^9.0.0",
"webpack": "^5.0.0"
}
},
"node_modules/eslint-webpack-plugin/node_modules/jest-worker": {
"version": "29.7.0",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz",
"integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==",
"dev": true,
"dependencies": {
"@types/node": "*",
"jest-util": "^29.7.0",
"merge-stream": "^2.0.0",
"supports-color": "^8.0.0"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/eslint-webpack-plugin/node_modules/schema-utils": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz",
"integrity": "sha512-L0jRsrPpjdckP3oPug3/VxNKt2trR8TcabrM6FOAAlvC/9Phcmm+cuAgTlxBqdBR1WJx7Naj9WHw+aOmheSVbw==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"ajv": "^8.9.0",
"ajv-formats": "^2.1.1",
"ajv-keywords": "^5.1.0"
},
"engines": {
"node": ">= 12.13.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
}
},
"node_modules/eslint-webpack-plugin/node_modules/supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/eslint/node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
@@ -6371,6 +6534,23 @@
"@pkgjs/parseargs": "^0.11.0"
}
},
"node_modules/jest-util": {
"version": "29.7.0",
"resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz",
"integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==",
"dev": true,
"dependencies": {
"@jest/types": "^29.6.3",
"@types/node": "*",
"chalk": "^4.0.0",
"ci-info": "^3.2.0",
"graceful-fs": "^4.2.9",
"picomatch": "^2.2.3"
},
"engines": {
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/jest-worker": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz",
+1
View File
@@ -2869,6 +2869,7 @@
"dotenv": "^16.3.1",
"downshift": "6.0.6",
"eslint": "^8.33.0",
"eslint-webpack-plugin": "^4.2.0",
"fuse.js": "6.5.3",
"github-directory-downloader": "^1.3.6",
"glob": "^10.3.12",
+21 -16
View File
@@ -33,26 +33,31 @@ export class Chatbot {
const cspSource = webView.webview.cspSource;
const fetchLocalization = async (requestId: string) => {
if (!requestId) {
return;
}
const fileContents = await getLocalizationFile();
webView.webview.postMessage({
command: GeneralCommands.toVSCode.getLocalization,
requestId,
payload: fileContents
});
};
webView.webview.onDidReceiveMessage(async (message) => {
switch (message.command) {
const { command, requestId, payload, data } = message;
switch (command) {
case PreviewCommands.toVSCode.open:
if (message.data) {
commands.executeCommand('vscode.open', message.data);
if (payload || data) {
commands.executeCommand('vscode.open', payload || data);
}
return;
break;
case GeneralCommands.toVSCode.getLocalization:
const { requestId } = message;
if (!requestId) {
return;
}
const fileContents = await getLocalizationFile();
webView.webview.postMessage({
command: GeneralCommands.toVSCode.getLocalization,
requestId,
payload: fileContents
});
fetchLocalization(requestId);
return;
}
});
+2 -2
View File
@@ -401,8 +401,8 @@ export class Folders {
folder.locales && folder.locales.length > 0 ? folder.locales : i18nSettings;
let defaultLocale;
let sourcePath = folderPath;
let localeFolders: ContentFolder[] = [];
const sourcePath = folderPath;
const localeFolders: ContentFolder[] = [];
if (i18nConfig && i18nConfig.length > 0) {
for (const i18n of i18nConfig) {
+22 -17
View File
@@ -110,27 +110,32 @@ export class Preview {
webView.dispose();
});
const fetchLocalization = async (requestId: string) => {
if (!requestId) {
return;
}
const fileContents = await getLocalizationFile();
webView.webview.postMessage({
command: GeneralCommands.toVSCode.getLocalization,
requestId,
payload: fileContents
});
};
webView.webview.onDidReceiveMessage(async (message) => {
switch (message.command) {
const { command, payload, requestId } = message;
switch (command) {
case PreviewCommands.toVSCode.open:
if (message.payload) {
commands.executeCommand('vscode.open', message.payload);
if (payload) {
commands.executeCommand('vscode.open', payload);
}
return;
break;
case GeneralCommands.toVSCode.getLocalization:
const { requestId } = message;
if (!requestId) {
return;
}
const fileContents = await getLocalizationFile();
webView.webview.postMessage({
command: GeneralCommands.toVSCode.getLocalization,
requestId,
payload: fileContents
});
return;
fetchLocalization(requestId);
break;
}
});
+1 -1
View File
@@ -42,7 +42,7 @@ categories: []
// Initialize command
subscriptions.push(
commands.registerCommand(COMMAND_NAME.init, async (cb: Function) => {
commands.registerCommand(COMMAND_NAME.init, async (cb: () => void) => {
await Project.init();
if (cb) {
+2 -2
View File
@@ -403,8 +403,8 @@ export class i18n {
sourceLocale: I18nConfig,
targetLocale: I18nConfig
) {
return new Promise<ParsedFrontMatter>(async (resolve) => {
await window.withProgress(
return new Promise<ParsedFrontMatter>((resolve) => {
window.withProgress(
{
location: ProgressLocation.Notification,
title: l10n.t(LocalizationKey.commandsI18nTranslateProgressTitle),
+1 -1
View File
@@ -54,7 +54,7 @@ export const App: React.FunctionComponent<IAppProps> = ({
return isAllowed(mode?.features || [], FEATURE_FLAG.dashboard.taxonomy.view);
}, [mode?.features]);
const checkDevMode = (retry: number = 0) => {
const checkDevMode = (retry = 0) => {
if (!window.fmExternal) {
if (retry < 5) {
setTimeout(() => checkDevMode(retry + 1), 150);
@@ -11,10 +11,11 @@ import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../../../localization';
import { messageHandler } from '@estruyf/vscode/dist/client';
import { GeneralCommands, WEBSITE_LINKS } from '../../../constants';
import { l10nJsonFormat } from '@vscode/l10n';
export interface IChatbotProps { }
export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.PropsWithChildren<IChatbotProps>) => {
export const Chatbot: React.FunctionComponent<IChatbotProps> = () => {
const { aiUrl } = useSettingsContext();
const [company, setCompany] = React.useState<string | undefined>(undefined);
const [chatId, setChatId] = React.useState<number | undefined>(undefined);
@@ -27,7 +28,7 @@ export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.Props
const init = async () => {
setLoading(true);
messageHandler.request<any>(GeneralCommands.toVSCode.getLocalization).then((data) => {
messageHandler.request<l10nJsonFormat>(GeneralCommands.toVSCode.getLocalization).then((data) => {
if (data) {
l10n.config({
contents: data
@@ -53,7 +53,7 @@ export const DataForm: React.FunctionComponent<IDataFormProps> = ({
};
} catch (error) {
setError((error as Error).message);
return () => { };
return () => void 0;
}
};
@@ -68,15 +68,14 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
);
const onSubmit = useCallback(
(data: any) => {
(data: unknown) => {
if (selectedData?.singleEntry) {
// Needs to add a single entry
updateData(data);
return;
}
debugger
const dataClone: any[] = Object.assign([], dataEntries);
const dataClone: unknown[] = Object.assign([], dataEntries);
if (selectedIndex !== null && selectedIndex !== undefined) {
dataClone[selectedIndex] = data;
} else {
@@ -140,7 +139,7 @@ export const DataView: React.FunctionComponent<IDataViewProps> = (
return dataEntries && selectedIndex !== null && selectedIndex !== undefined
? dataEntries[selectedIndex]
: null;
}, [selectedData, , dataEntries, selectedIndex]);
}, [selectedData, dataEntries, selectedIndex]);
// Retrieve the data files, check if they have a schema or ID, if not, they shouldn't be shown
const dataFiles = useMemo(() => {
@@ -9,7 +9,7 @@ import { LocalizationKey } from '../../../localization';
export interface ILanguageFilterProps { }
export const LanguageFilter: React.FunctionComponent<ILanguageFilterProps> = ({ }: React.PropsWithChildren<ILanguageFilterProps>) => {
export const LanguageFilter: React.FunctionComponent<ILanguageFilterProps> = () => {
const locales = useRecoilValue(LocalesAtom);
const [crntLocale, setCrntLocale] = useRecoilState(LocaleAtom);
@@ -21,16 +21,16 @@ import { useEffect, useMemo } from 'react';
import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../../../localization';
export const guardRecoilDefaultValue = (candidate: any): candidate is DefaultValue => {
if (candidate instanceof DefaultValue) return true;
export const guardRecoilDefaultValue = (candidate: unknown): candidate is DefaultValue => {
if (candidate instanceof DefaultValue) {
return true;
}
return false;
};
export interface IClearFiltersProps { }
export const ClearFilters: React.FunctionComponent<IClearFiltersProps> = (
_: React.PropsWithChildren<IClearFiltersProps>
) => {
export const ClearFilters: React.FunctionComponent<IClearFiltersProps> = () => {
const [show, setShow] = React.useState(false);
const folder = useRecoilValue(FolderSelector);
@@ -75,7 +75,9 @@ export const ClearFilters: React.FunctionComponent<IClearFiltersProps> = (
}
}, [folder, tag, category, locale, hasCustomFilters]);
if (!show) return null;
if (!show) {
return null;
}
return (
<button
@@ -36,7 +36,7 @@ export const Filters: React.FunctionComponent<IFiltersProps> = (_: React.PropsWi
activeItem={crntFilters[filterName]}
items={values}
onClick={(value) => setCrntFilters((prev) => {
let clone = Object.assign({}, prev);
const clone = Object.assign({}, prev);
if (!clone[filterName] && value) {
clone[filterName] = value;
} else {
@@ -10,7 +10,7 @@ export interface IFoldersFilterProps { }
export const FoldersFilter: React.FunctionComponent<
IFoldersFilterProps
> = ({ }: React.PropsWithChildren<IFoldersFilterProps>) => {
> = () => {
const DEFAULT_TYPE = l10n.t(LocalizationKey.dashboardHeaderFoldersDefault);
const [crntFolder, setCrntFolder] = useRecoilState(FolderAtom);
const settings = useRecoilValue(SettingsSelector);
@@ -11,12 +11,12 @@ export interface IGroupingProps { }
export const Grouping: React.FunctionComponent<
IGroupingProps
> = ({ }: React.PropsWithChildren<IGroupingProps>) => {
> = () => {
const [group, setGroup] = useRecoilState(GroupingAtom);
const pages = useRecoilValue(AllPagesAtom);
const GROUP_OPTIONS = React.useMemo(() => {
let options: { name: string, id: GroupOption }[] = [];
const options: { name: string, id: GroupOption }[] = [];
if (pages.length > 0) {
if (pages.some((x) => x.fmYear)) {
@@ -37,9 +37,7 @@ const NavigationItem: React.FunctionComponent<INavigationItemProps> = ({
)
};
export const Navigation: React.FunctionComponent<INavigationProps> = ({
}: React.PropsWithChildren<INavigationProps>) => {
export const Navigation: React.FunctionComponent<INavigationProps> = () => {
const [crntTab, setCrntTab] = useRecoilState(TabAtom);
const tabInfo = useRecoilValue(TabInfoAtom);
const settings = useRecoilValue(SettingsAtom);
@@ -21,9 +21,7 @@ import { ArrowClockwiseIcon } from '../../../components/icons/ArrowClockwiseIcon
export interface IRefreshDashboardDataProps { }
export const RefreshDashboardData: React.FunctionComponent<IRefreshDashboardDataProps> = (
{ }: React.PropsWithChildren<IRefreshDashboardDataProps>
) => {
export const RefreshDashboardData: React.FunctionComponent<IRefreshDashboardDataProps> = () => {
const view = useRecoilValue(DashboardViewAtom);
const [, setLoading] = useRecoilState(LoadingAtom);
const resetSearch = useResetRecoilState(SearchAtom);
@@ -165,7 +165,7 @@ export const Sorting: React.FunctionComponent<ISortingProps> = ({
}
}
let sort = allOptions.find((x) => x.id === crntSortingOption?.id) || sortOptions[0];
const sort = allOptions.find((x) => x.id === crntSortingOption?.id) || sortOptions[0];
setCrntSort(sort);
};
@@ -67,7 +67,7 @@ export const Media: React.FunctionComponent<IMediaProps> = (
return [];
}
let groupedFolders = [];
const groupedFolders = [];
for (const cFolder of settings?.contentFolders || []) {
const foldersPath = parseWinPath(cFolder.path);
@@ -23,7 +23,7 @@ export interface IMediaHeaderTopProps { }
export const MediaHeaderTop: React.FunctionComponent<
IMediaHeaderTopProps
> = ({ }: React.PropsWithChildren<IMediaHeaderTopProps>) => {
> = () => {
const [lastUpdated, setLastUpdated] = React.useState<string | null>(null);
const selectedFolder = useRecoilValue(SelectedMediaFolderSelector);
const crntSorting = useRecoilValue(SortingSelector);
@@ -20,7 +20,8 @@ export const Preview: React.FunctionComponent<IPreviewProps> = ({
const onRefresh = () => {
if (iframeRef.current?.src) {
iframeRef.current.src = iframeRef.current.src;
const url = iframeRef.current.src;
iframeRef.current.src = url;
}
};
@@ -34,10 +35,12 @@ export const Preview: React.FunctionComponent<IPreviewProps> = ({
navUrl = `https://${navUrl}`;
setCrntUrl(navUrl);
}
iframeRef.current!.src = navUrl;
if (iframeRef.current) {
iframeRef.current.src = navUrl;
}
};
const msgListener = (message: MessageEvent<EventData<any>>) => {
const msgListener = (message: MessageEvent<EventData<string>>) => {
if (message.data.command === PreviewCommands.toWebview.updateUrl) {
setCrntUrl(message.data.payload);
}
@@ -8,7 +8,7 @@ import { Button as VSCodeButton } from 'vscrui';
export interface IIntegrationsViewProps { }
export const IntegrationsView: React.FunctionComponent<IIntegrationsViewProps> = ({ }: React.PropsWithChildren<IIntegrationsViewProps>) => {
export const IntegrationsView: React.FunctionComponent<IIntegrationsViewProps> = () => {
const [deeplApiKey, setDeeplApiKey] = React.useState<string>('');
const [azureApiKey, setAzureApiKey] = React.useState<string>('');
const [azureRegion, setAzureRegion] = React.useState<string>('');
@@ -24,7 +24,7 @@ export const SettingsView: React.FunctionComponent<ISettingsViewProps> = (_: Rea
const settings = useRecoilValue(SettingsSelector);
const tabs: ITab[] = React.useMemo(() => {
let temp = [
const temp = [
{ id: "view-1", label: l10n.t(LocalizationKey.settingsViewCommon) },
{ id: "view-2", label: l10n.t(LocalizationKey.settingsViewContentFolders) }
];
@@ -44,7 +44,7 @@ export const SettingsView: React.FunctionComponent<ISettingsViewProps> = (_: Rea
return [];
}
let temp = [
const temp = [
{
id: "view-1",
content: <CommonSettings />
@@ -75,7 +75,7 @@ export const Item: React.FunctionComponent<IItemProps> = ({
return;
}
let snippets: Snippets = Object.assign({}, settings?.snippets || {});
const snippets: Snippets = Object.assign({}, settings?.snippets || {});
const snippetLines = snippetOriginalBody.split('\n');
const crntSnippet = Object.assign({}, snippets[snippetKey]);
@@ -79,11 +79,11 @@ const SnippetForm: React.ForwardRefRenderFunction<SnippetFormHandle, ISnippetFor
);
const snippetBody = useMemo(() => {
let body = typeof snippet.body === 'string' ? snippet.body : snippet.body.join(`\n`);
const body = typeof snippet.body === 'string' ? snippet.body : snippet.body.join(`\n`);
const obj: any = {};
const obj: { [key: string]: string } = {};
for (const field of fields) {
obj[field.name] = field.value;
obj[field.name] = field.value as string;
}
return SnippetParser.render(body, obj, snippet.openingTags, snippet.closingTags);
@@ -31,7 +31,7 @@ export const SnippetInputField: React.FunctionComponent<ISnippetInputFieldProps>
<div className="relative">
<select
name={field.name}
value={field.value || ''}
value={field.value as string || ''}
className={`block w-full sm:text-sm pr-2 appearance-none disabled:opacity-50 rounded bg-[var(--vscode-input-background)] text-[var(--vscode-input-foreground)] placeholder-[var(--vscode-input-placeholderForeground)] border-[var(--frontmatter-border)] focus:border-[var(--vscode-focusBorder)] focus:outline-0`}
style={{
boxShadow: "none"
@@ -69,7 +69,7 @@ export const SnippetInputField: React.FunctionComponent<ISnippetInputFieldProps>
return (
<TextField
name={field.name}
value={field.value || ''}
value={field.value as string || ''}
description={field.description}
onChange={(e) => onValueChange(field, e)}
rows={4}
@@ -81,7 +81,7 @@ export const SnippetInputField: React.FunctionComponent<ISnippetInputFieldProps>
return (
<TextField
name={field.name}
value={field.value || ''}
value={field.value as string || ''}
description={field.description}
onChange={(e) => onValueChange(field, e)}
/>
@@ -41,7 +41,7 @@ export const TaxonomyLookup: React.FunctionComponent<ITaxonomyLookupProps> = ({
return false;
}
let fieldName = getTaxonomyField(taxonomy, contentType);
const fieldName = getTaxonomyField(taxonomy, contentType);
return fieldName && page[fieldName] ? page[fieldName].includes(value) : false;
}).length;
@@ -80,7 +80,7 @@ export const TaxonomyManager: React.FunctionComponent<ITaxonomyManagerProps> = (
}, [data, taxonomy, debounceFilterValue]);
const unmappedItems = useMemo(() => {
let unmapped: string[] = [];
const unmapped: string[] = [];
if (!pages || !settings?.contentTypes || !taxonomy) {
return unmapped;
@@ -100,7 +100,7 @@ export const TaxonomyManager: React.FunctionComponent<ITaxonomyManagerProps> = (
return false;
}
let fieldName = getTaxonomyField(taxonomy, contentType);
const fieldName = getTaxonomyField(taxonomy, contentType);
if (fieldName && page[fieldName]) {
values = page[fieldName];
@@ -70,7 +70,7 @@ export const TaxonomyTagging: React.FunctionComponent<ITaxonomyTaggingProps> = (
continue;
}
let fieldName = getTaxonomyField(taxonomy, contentType);
const fieldName = getTaxonomyField(taxonomy, contentType);
if (fieldName && (!page[fieldName] || page[fieldName].indexOf(value) === -1)) {
untagged.push(page);
@@ -78,7 +78,7 @@ export const TaxonomyTagging: React.FunctionComponent<ITaxonomyTaggingProps> = (
}
}
untagged = untagged.sort(Sorting.number('fmPublished')).reverse();
untagged = untagged.sort(Sorting.numerically('fmPublished')).reverse();
if (debounceFilterValue) {
return untagged.filter((p) => p.title.toLowerCase().includes(debounceFilterValue.toLowerCase()));
+1 -1
View File
@@ -42,7 +42,7 @@ export default function useMediaInfo(media?: MediaInfo) {
}, [media]);
const mediaDetails = useMemo(() => {
let sizeDetails = [];
const sizeDetails = [];
if (mediaDimensions) {
sizeDetails.push(mediaDimensions);
+2 -6
View File
@@ -159,8 +159,6 @@ export default function usePages(pages: Page[]) {
if (tab !== Tab.All) {
crntPages = crntPages.filter((page) => page.fmDraft === tab);
} else {
crntPages = crntPages;
}
} else {
// Draft field is a boolean field
@@ -194,8 +192,6 @@ export default function usePages(pages: Page[]) {
crntPages = drafts;
} else if (tab === Tab.Scheduled) {
crntPages = scheduled;
} else {
crntPages = crntPages;
}
}
}
@@ -240,11 +236,11 @@ export default function usePages(pages: Page[]) {
};
useEffect(() => {
let usedSorting = sorting;
const usedSorting = sorting;
const startPageProcessing = () => {
// Check if search needs to be performed
let searchedPages = pages;
const searchedPages = pages;
if (search) {
Messenger.send(DashboardMessage.searchPages, { query: search });
} else {
+6 -1
View File
@@ -14,6 +14,7 @@ import { I10nProvider } from './providers/I10nProvider';
import { SentryInit } from '../utils/sentryInit';
import { WEBSITE_LINKS } from '../constants';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare const acquireVsCodeApi: <T = unknown>() => {
getState: () => T;
setState: (data: T) => void;
@@ -119,4 +120,8 @@ if (elm) {
}
// Webpack HMR
if ((module as any).hot) (module as any).hot.accept();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
if ((module as any).hot) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(module as any).hot.accept();
}
+1 -1
View File
@@ -57,7 +57,7 @@ export const darkenColor = (color: string | undefined, percentage: number) => {
// Check if the color is in rgba format
if (color.startsWith('rgba')) {
// Extract the alpha value
const alphaMatch = color.match(/[\d\.]+(?=\))/);
const alphaMatch = color.match(/[\d.]+(?=\))/);
const alpha = alphaMatch ? Number(alphaMatch[0]) : 1;
return `rgba(${darkenedR}, ${darkenedG}, ${darkenedB}, ${alpha})`;
@@ -1,6 +1,6 @@
import { darkenColor, opacityColor, preserveColor } from '.';
export const updateCssVariables = (isDarkTheme: boolean = true) => {
export const updateCssVariables = (isDarkTheme = true) => {
const styles = getComputedStyle(document.documentElement);
// Lightbox
+4 -2
View File
@@ -39,6 +39,7 @@ import { i18n } from './commands/i18n';
import { UriHandler } from './providers/UriHandler';
let pageUpdateDebouncer: { (fnc: any, time: number): void };
// eslint-disable-next-line @typescript-eslint/no-unused-vars
let editDebounce: { (fnc: any, time: number): void };
let collection: vscode.DiagnosticCollection;
@@ -56,7 +57,7 @@ export async function activate(context: vscode.ExtensionContext) {
}
// Sponsor check
Backers.init(context).then(() => {});
Backers.init(context);
// Make sure the EN language file is loaded
if (!vscode.l10n.uri) {
@@ -143,7 +144,7 @@ export async function activate(context: vscode.ExtensionContext) {
SettingsHelper.startListening();
// Create the status bar
let fmStatusBarItem = vscode.window.createStatusBarItem(
const fmStatusBarItem = vscode.window.createStatusBarItem(
'fm-statusBarItem',
vscode.StatusBarAlignment.Right,
-100
@@ -243,6 +244,7 @@ export async function activate(context: vscode.ExtensionContext) {
console.log(`𝖥𝗋𝗈𝗇𝗍 𝖬𝖺𝗍𝗍𝖾𝗋 𝖢𝖬𝖲 𝖺𝖼𝗍𝗂𝗏𝖺𝗍𝖾𝖽! 𝖱𝖾𝖺𝖽𝗒 𝗍𝗈 𝗌𝗍𝖺𝗋𝗍 𝗐𝗋𝗂𝗍𝗂𝗇𝗀... 👩‍💻🧑‍💻👨‍💻`);
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
export function deactivate() {}
const handleAutoDateUpdate = (e: vscode.TextDocumentWillSaveEvent) => {
+2 -2
View File
@@ -356,7 +356,7 @@ export class ArticleHelper {
* @returns A boolean indicating whether the file is a page bundle or not.
*/
public static async isPageBundle(filePath: string) {
let article = await ArticleHelper.getFrontMatterByPath(filePath);
const article = await ArticleHelper.getFrontMatterByPath(filePath);
if (!article) {
return false;
}
@@ -913,7 +913,7 @@ export class ArticleHelper {
const commaSeparated = Settings.get<string[]>(SETTING_COMMA_SEPARATED_FIELDS);
if (fileContents) {
let article = FrontMatterParser.fromFile(fileContents);
const article = FrontMatterParser.fromFile(fileContents);
if (article?.data) {
if (commaSeparated) {
+6 -5
View File
@@ -564,7 +564,7 @@ export class ContentType {
const allRequiredFields = ContentType.findRequiredFieldsDeep(contentType.fields);
let emptyFields: Field[][] = [];
const emptyFields: Field[][] = [];
for (const fields of allRequiredFields) {
const fieldValue = this.getFieldValue(
@@ -656,7 +656,7 @@ export class ContentType {
return [];
}
let foundBlocks = [];
const foundBlocks = [];
for (const group of groups) {
const block = blocks.find((block) => block.id === group);
if (!block) {
@@ -960,11 +960,12 @@ export class ContentType {
templateData = await ArticleHelper.getFrontMatterByPath(templatePath);
}
let newFilePath: string | undefined = await ArticleHelper.createContent(
const newFilePath: string | undefined = await ArticleHelper.createContent(
contentType,
folderPath,
titleValue
);
if (!newFilePath) {
return;
}
@@ -1045,7 +1046,7 @@ export class ContentType {
filePath: string,
clearEmpty: boolean,
contentType: IContentType,
isRoot: boolean = true
isRoot = true
): Promise<any> {
if (obj.fields) {
const titleField = getTitleField();
@@ -1106,7 +1107,7 @@ export class ContentType {
filePath
);
} else if (defaultValue && Array.isArray(defaultValue)) {
let defaultValues = [];
const defaultValues = [];
for (let value of defaultValue as string[]) {
if (typeof value === 'string') {
value = await ContentType.processFieldPlaceholders(
+8 -4
View File
@@ -72,7 +72,9 @@ export class CustomScript {
if (!path) {
const editor = window.activeTextEditor;
if (!editor) return;
if (!editor) {
return;
}
articlePath = editor.document.uri.fsPath;
article = ArticleHelper.getFrontMatter(editor);
@@ -120,7 +122,7 @@ export class CustomScript {
return;
}
let output: string[] = [];
const output: string[] = [];
window.withProgress(
{
@@ -283,7 +285,9 @@ export class CustomScript {
const editor = window.activeTextEditor;
if (!articlePath) {
if (!editor) return;
if (!editor) {
return;
}
articlePath = editor.document.uri.fsPath;
article = ArticleHelper.getFrontMatter(editor);
@@ -469,7 +473,7 @@ export class CustomScript {
* @returns
*/
private static async executeScriptAsync(fullScript: string, wsPath: string): Promise<string> {
return new Promise(async (resolve, reject) => {
return new Promise((resolve, reject) => {
exec(fullScript, { cwd: wsPath }, (error, stdout) => {
if (error) {
Logger.error(error.message);
+4 -4
View File
@@ -63,7 +63,7 @@ import { DataListener } from '../listeners/dashboard';
export class DashboardSettings {
private static cachedSettings: ISettings | undefined = undefined;
public static async get(clear: boolean = false) {
public static async get(clear = false) {
if (!this.cachedSettings || clear) {
this.cachedSettings = await this.getSettings();
}
@@ -192,9 +192,9 @@ export class DashboardSettings {
const files = Settings.get<DataFile[]>(SETTING_DATA_FILES);
const folders = Settings.get<DataFolder[]>(SETTING_DATA_FOLDERS);
let clonedFiles = Object.assign([], files);
const clonedFiles = Object.assign([], files);
if (folders) {
for (let folder of folders) {
for (const folder of folders) {
if (!folder.path) {
continue;
}
@@ -218,7 +218,7 @@ export class DashboardSettings {
);
const dataFiles = [...dataJsonFiles, ...dataYmlFiles, ...dataYamlFiles];
for (let dataFile of dataFiles) {
for (const dataFile of dataFiles) {
clonedFiles.push(DataListener.createDataFileObject(dataFile.fsPath, folder));
}
}
+1 -1
View File
@@ -293,7 +293,7 @@ export class Extension {
propKey: string,
propValue: T,
type: 'workspace' | 'global' = 'global',
setState: boolean = false
setState = false
): Promise<void> {
if (this.isFileStorageNeeded(propKey)) {
let storageUri: Uri | undefined = undefined;
+1 -1
View File
@@ -38,7 +38,7 @@ export class FilesHelper {
*/
public static relToAbsPath(filePath: string): string {
const wsFolder = Folders.getWorkspaceFolder();
let absPath = join(parseWinPath(wsFolder?.fsPath || ''), filePath);
const absPath = join(parseWinPath(wsFolder?.fsPath || ''), filePath);
return parseWinPath(absPath);
}
+2 -2
View File
@@ -17,7 +17,7 @@ export class ImageHelper {
* @returns
*/
public static allRelToAbs(field: Field, value: string | string[] | undefined) {
let filePath =
const filePath =
window.activeTextEditor?.document.uri.fsPath ||
Preview.filePath ||
ArticleHelper.getActiveFile();
@@ -54,7 +54,7 @@ export class ImageHelper {
*/
public static relToAbs(filePath: string, value: string) {
const wsFolder = Folders.getWorkspaceFolder();
let staticFolder = Folders.getStaticFolderRelativePath();
const staticFolder = Folders.getStaticFolderRelativePath();
if (staticFolder === STATIC_FOLDER_PLACEHOLDER.hexo.placeholder) {
const editor = window.activeTextEditor;
+3 -2
View File
@@ -45,8 +45,9 @@ export class MediaHelpers {
* @returns
*/
public static async getMedia(
page: number = 0,
requestedFolder: string = '',
// eslint-disable-next-line @typescript-eslint/no-unused-vars
page = 0,
requestedFolder = '',
sort: SortingOption | null = null
) {
const wsFolder = Folders.getWorkspaceFolder();
+1 -1
View File
@@ -162,7 +162,7 @@ export class Notifications {
* @returns
*/
private static shouldShow(level: NotificationType): boolean {
let levels = Settings.get<string[]>(SETTING_GLOBAL_NOTIFICATIONS);
const levels = Settings.get<string[]>(SETTING_GLOBAL_NOTIFICATIONS);
if (!levels) {
return true;
+4 -4
View File
@@ -39,7 +39,7 @@ export class Questions {
* @param showWarning
* @returns
*/
public static async ContentTitle(showWarning: boolean = true): Promise<string | undefined> {
public static async ContentTitle(showWarning = true): Promise<string | undefined> {
const aiEnabled = Settings.get<boolean>(SETTING_SPONSORS_AI_ENABLED);
let title: string | undefined = '';
const isCopilotInstalled = await Copilot.isInstalled();
@@ -122,7 +122,7 @@ export class Questions {
title: string | undefined,
aiTitles: string[],
isCopilotInstalled: boolean,
showWarning: boolean = true
showWarning = true
): Promise<string | undefined> {
if (title && aiTitles && aiTitles.length > 0) {
const options: QuickPickItem[] = [
@@ -174,7 +174,7 @@ export class Questions {
* @returns
*/
public static async SelectContentFolder(
showWarning: boolean = true
showWarning = true
): Promise<FolderQuickPickItem | undefined> {
let folders = await Folders.get();
folders = folders.filter((f) => !f.disableCreation);
@@ -230,7 +230,7 @@ export class Questions {
*/
public static async SelectContentType(
allowedCts: string[],
showWarning: boolean = true
showWarning = true
): Promise<string | undefined> {
let contentTypes = ContentType.getAll();
if (!contentTypes || contentTypes.length === 0) {
+9 -8
View File
@@ -1,14 +1,15 @@
var illegalRe = /[\/\?<>\\:\*\|"]/g;
var controlRe = /[\x00-\x1f\x80-\x9f]/g;
var reservedRe = /^\.+$/;
var windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
var windowsTrailingRe = /[\. ]+$/;
const illegalRe = /[/?<>\\:*|"]/g;
// eslint-disable-next-line no-control-regex
const controlRe = /[\x00-\x1F\x80-\x9F]/g;
const reservedRe = /^\.+$/;
const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
const windowsTrailingRe = /[. ]+$/;
function sanitize(input: string, replacement: string) {
if (typeof input !== 'string') {
throw new Error('Input must be string');
}
var sanitized = input
const sanitized = input
.replace(illegalRe, replacement)
.replace(controlRe, replacement)
.replace(reservedRe, replacement)
@@ -18,8 +19,8 @@ function sanitize(input: string, replacement: string) {
}
export default function (input: string, options?: any) {
var replacement = (options && options.replacement) || '';
var output = sanitize(input, replacement);
const replacement = (options && options.replacement) || '';
const output = sanitize(input, replacement);
if (replacement === '') {
return output;
}
+9 -17
View File
@@ -67,7 +67,7 @@ export class Settings {
public static globalConfigPath: string | undefined = undefined;
public static globalConfig: any;
private static config: WorkspaceConfiguration;
private static isInitialized: boolean = false;
private static isInitialized = false;
private static listeners: { id: string; callback: (global?: any) => void }[] = [];
private static fileCreationWatcher: FileSystemWatcher | undefined;
private static fileChangeWatcher: FileSystemWatcher | undefined;
@@ -76,7 +76,7 @@ export class Settings {
private static readConfigPromise: Promise<void> | undefined = undefined;
private static project: Project | undefined = undefined;
private static configDebouncer = debounceCallback();
private static hasExtendedConfig: boolean = false;
private static hasExtendedConfig = false;
private static extendedConfig: { extended: any[]; splitted: any[]; dynamic: boolean } = {} as any;
public static async registerCommands() {
@@ -335,7 +335,7 @@ export class Settings {
/**
* Retrieve a setting from global and local config
*/
public static get<T>(name: string, merging: boolean = false): T | undefined {
public static get<T>(name: string, merging = false): T | undefined {
if (!Settings.config) {
return;
}
@@ -383,11 +383,7 @@ export class Settings {
* @param updateGlobal - Indicates whether to update the global setting or not. Default is `false`.
* @returns A promise that resolves when the setting is updated.
*/
public static async safeUpdate<T>(
name: string,
value: T,
updateGlobal: boolean = false
): Promise<void> {
public static async safeUpdate<T>(name: string, value: T, updateGlobal = false): Promise<void> {
if (Settings.hasExtendedConfig) {
const configKey = `${CONFIG_KEY}.${name}`;
@@ -418,11 +414,7 @@ ${JSON.stringify(value, null, 2)}`,
* @param name
* @param value
*/
public static async update<T>(
name: string,
value: T,
updateGlobal: boolean = false
): Promise<void> {
public static async update<T>(name: string, value: T, updateGlobal = false): Promise<void> {
const fmConfig = await Settings.projectConfigPath();
if (updateGlobal) {
@@ -571,7 +563,7 @@ ${JSON.stringify(value, null, 2)}`,
*/
public static async updateCustomTaxonomyOptions(id: string, options: string[]) {
const customTaxonomies = Settings.get<CustomTaxonomy[]>(SETTING_TAXONOMY_CUSTOM, true) || [];
let taxIdx = customTaxonomies?.findIndex((o) => o.id === id);
const taxIdx = customTaxonomies?.findIndex((o) => o.id === id);
if (taxIdx !== -1) {
customTaxonomies[taxIdx].options = options;
@@ -753,7 +745,7 @@ ${JSON.stringify(value, null, 2)}`,
Logger.info(`Reading dynamic config file: ${absFilePath}`);
if (absFilePath) {
if (await existsAsync(absFilePath)) {
const configFunction = require(absFilePath);
const configFunction = await import(absFilePath);
const dynamicConfig = await configFunction(
Object.assign({}, Settings.globalConfig)
);
@@ -858,7 +850,7 @@ ${JSON.stringify(value, null, 2)}`,
// We need to loop through the config to make sure the objects and arrays are merged
for (const key in config) {
if (config.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(config, key)) {
const value = config[key];
const settingName = key.replace(`${CONFIG_KEY}.`, '');
@@ -1209,7 +1201,7 @@ ${JSON.stringify(value, null, 2)}`,
* Reload the config
* @param debounced
*/
private static async reloadConfig(debounced: boolean = true) {
private static async reloadConfig(debounced = true) {
Logger.info(`Reloading config...`);
// Clear the folder cache as we need to see the latest folders
Folders.clearCached();
+1 -1
View File
@@ -69,7 +69,7 @@ export class SlugHelper {
return '';
}
const punctuationless = value?.replace(/[\.,-\/#!$@%\^&\*;:{}=\-_`'"~()+\?<>]/g, ' ');
const punctuationless = value?.replace(/[.,-/#!$@%^&*;:{}=\-_`'"~()+?<>]/g, ' ');
// Remove double spaces
return punctuationless?.replace(/\s{2,}/g, ' ');
}
+7 -7
View File
@@ -4,8 +4,8 @@ import { SnippetField } from '../models';
export class SnippetParser {
public static getPlaceholders(
value: string[] | string,
openingTags: string = '[[',
closingTags: string = ']]'
openingTags = '[[',
closingTags = ']]'
): string[] {
const template = SnippetParser.template(value);
const parseTree = Mustache.parse(template, [openingTags, closingTags]);
@@ -29,9 +29,9 @@ export class SnippetParser {
public static render(
value: string[] | string,
data: any,
openingTags: string = '[[',
closingTags: string = ']]'
data: unknown,
openingTags = '[[',
closingTags = ']]'
): string {
const template = SnippetParser.template(value);
return Mustache.render(template, data, undefined, [openingTags, closingTags]);
@@ -40,8 +40,8 @@ export class SnippetParser {
public static getFields(
value: string[] | string,
fields: SnippetField[],
openingTags: string = '[[',
closingTags: string = ']]'
openingTags = '[[',
closingTags = ']]'
) {
const placeholders = SnippetParser.getPlaceholders(value, openingTags, closingTags);
+9 -14
View File
@@ -7,6 +7,7 @@ export class Sorting {
* @returns
*/
public static alphabetically = (property: string) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (a: any, b: any) => {
if (a[property] < b[property]) {
return -1;
@@ -24,6 +25,7 @@ export class Sorting {
* @returns
*/
public static numerically = (property: string) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (a: any, b: any) => {
return a[property] - b[property];
};
@@ -35,6 +37,7 @@ export class Sorting {
* @returns
*/
public static date = (property: string) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (a: any, b: any) => {
const dateA = DateHelper.tryParse(a[property]);
const dateB = DateHelper.tryParse(b[property]);
@@ -49,13 +52,16 @@ export class Sorting {
* @returns
*/
public static dateWithFallback = (property: string, fallback: string) => {
return (a: any, b: any) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (a: any, b: any): number => {
const dateA = DateHelper.tryParse(a[property]);
const dateB = DateHelper.tryParse(b[property]);
// Sort by date
var dCount = (dateA || new Date(0)).getTime() - (dateB || new Date(0)).getTime();
if (dCount) return dCount;
const dCount = (dateA || new Date(0)).getTime() - (dateB || new Date(0)).getTime();
if (dCount) {
return dCount;
}
// If there is a tie, sort by fallback property
if (a[fallback] < b[fallback]) {
@@ -67,15 +73,4 @@ export class Sorting {
return 0;
};
};
/**
* Sort by number
* @param property
* @returns
*/
public static number = (property: string) => {
return (a: any, b: any) => {
return a[property] - b[property];
};
};
}
+5 -5
View File
@@ -273,7 +273,7 @@ export class TaxonomyHelper {
oldValue: string,
newValue?: string,
pages?: Page[],
needsSettingsUpdate: boolean = true
needsSettingsUpdate = true
) {
// Retrieve all the markdown files
const allFiles = pages
@@ -349,7 +349,7 @@ export class TaxonomyHelper {
const article = FrontMatterParser.fromFile(mdFile);
const contentType = await ArticleHelper.getContentType(article);
let fieldNames: string[] = this.getFieldsHierarchy(taxonomyType, contentType);
const fieldNames: string[] = this.getFieldsHierarchy(taxonomyType, contentType);
if (fieldNames.length > 0 && article && article.data) {
const { data } = article;
@@ -484,8 +484,8 @@ export class TaxonomyHelper {
const article = FrontMatterParser.fromFile(mdFile);
const contentType = await ArticleHelper.getContentType(article);
let oldFieldNames: string[] = this.getFieldsHierarchy(oldType, contentType);
let newFieldNames: string[] = this.getFieldsHierarchy(newType, contentType, true);
const oldFieldNames: string[] = this.getFieldsHierarchy(oldType, contentType);
const newFieldNames: string[] = this.getFieldsHierarchy(newType, contentType, true);
if (oldFieldNames.length > 0 && newFieldNames.length > 0 && article && article.data) {
const { data } = article;
@@ -559,7 +559,7 @@ export class TaxonomyHelper {
private static getFieldsHierarchy(
taxonomyType: TaxonomyType | string,
contentType: IContentType,
fallback: boolean = false
fallback = false
): string[] {
let fieldNames: string[] = [];
if (taxonomyType === TaxonomyType.Tag) {
+1 -1
View File
@@ -8,7 +8,7 @@ export const decodeBase64 = (dataString: string) => {
const typePart = dataParts[0].split(':').pop() as string;
const dataPart = dataParts.pop() as string;
let response: any = {};
const response: any = {};
response.type = typePart;
response.data = Buffer.from(dataPart, 'base64');
+1 -1
View File
@@ -17,7 +17,7 @@ export const processDateTimePlaceholders = (value: string, articleDate?: Date) =
for (const match of matches) {
const placeholderParts = match.split('|');
if (placeholderParts.length > 1) {
let dateFormat = placeholderParts[1].trim().replace('}}', '');
const dateFormat = placeholderParts[1].trim().replace('}}', '');
if (dateFormat) {
if (dateFormat && typeof dateFormat === 'string') {
+2 -2
View File
@@ -25,7 +25,7 @@ export const processFilePrefixPlaceholders = async (value: string, folderPath?:
);
let chars = 3;
let idxValue = files.length + 1;
const idxValue = files.length + 1;
if (value.includes('{{filePrefix.index}}')) {
const regex = new RegExp('{{filePrefix.index}}', 'g');
@@ -40,7 +40,7 @@ export const processFilePrefixPlaceholders = async (value: string, folderPath?:
for (const match of matches) {
const placeholderParts = match.split('|');
if (placeholderParts.length > 1) {
let options = placeholderParts[1].trim().replace('}}', '').split(',');
const options = placeholderParts[1].trim().replace('}}', '').split(',');
for (const option of options) {
if (option.startsWith('zeros:')) {
+1 -1
View File
@@ -11,7 +11,7 @@ export const processPathPlaceholders = (
const relPathToken = '{{pathToken.relPath}}';
if (value.includes(relPathToken) && contentFolder?.path) {
const dirName = dirname(filePath);
let relPath = relative(contentFolder.path, dirName);
const relPath = relative(contentFolder.path, dirName);
value = value.replace(relPathToken, relPath);
}
+1
View File
@@ -5,6 +5,7 @@ import { Logger } from '../../helpers/Logger';
import { PostMessageData } from '../../models';
export abstract class BaseListener {
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
public static process(msg: PostMessageData) {}
/**
+15 -10
View File
@@ -17,9 +17,10 @@ export class MediaListener extends BaseListener {
public static async process(msg: PostMessageData) {
super.process(msg);
const { page, folder, sorting } = msg.payload ?? {};
switch (msg.command) {
case DashboardMessage.getMedia:
const { page, folder, sorting } = msg?.payload;
this.sendMediaFiles(page, folder, sorting);
break;
case DashboardMessage.refreshMedia:
@@ -67,11 +68,7 @@ export class MediaListener extends BaseListener {
* @param folder
* @param sorting
*/
public static async sendMediaFiles(
page: number = 0,
folder: string = '',
sorting: SortingOption | null = null
) {
public static async sendMediaFiles(page = 0, folder = '', sorting: SortingOption | null = null) {
MediaLibrary.reset();
const files = await MediaHelpers.getMedia(page, folder, sorting);
this.sendMsg(DashboardCommand.media, files);
@@ -143,7 +140,7 @@ export class MediaListener extends BaseListener {
}
if (unmappedFiles && unmappedFiles.length > 0) {
this.sendRequest(command as any, requestId, unmappedFiles);
this.sendRequest(command as DashboardCommand, requestId, unmappedFiles);
}
}
@@ -151,6 +148,7 @@ export class MediaListener extends BaseListener {
* Store the file and send a message after multiple uploads
* @param data
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private static async store(data: any) {
try {
const { folder } = data;
@@ -167,7 +165,9 @@ export class MediaListener extends BaseListener {
this.sendMediaFiles(0, folder || '');
delete this.timers[folderPath];
}, 500);
} catch {}
} catch {
// Do nothing
}
}
/**
@@ -178,13 +178,16 @@ export class MediaListener extends BaseListener {
try {
MediaHelpers.deleteFile(data.file);
this.sendMediaFiles(data.page || 0, data.folder || '');
} catch {}
} catch {
// Do nothing
}
}
/**
* Update media metadata
* @param data
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private static async update(data: any) {
try {
const { page, folder } = data;
@@ -192,6 +195,8 @@ export class MediaListener extends BaseListener {
await MediaHelpers.updateMetadata(data);
this.sendMediaFiles(page || 0, folder || '');
} catch {}
} catch {
// Do nothing
}
}
}
+2 -2
View File
@@ -97,7 +97,7 @@ export class PagesListener extends BaseListener {
// Recreate all the watchers
for (const folder of folders) {
const folderUri = Uri.parse(folder.path);
let watcher = workspace.createFileSystemWatcher(
const watcher = workspace.createFileSystemWatcher(
new RelativePattern(folderUri, '**/*'),
false,
false,
@@ -200,7 +200,7 @@ export class PagesListener extends BaseListener {
/**
* Retrieve all the markdown pages
*/
public static async getPagesData(clear: boolean = false, cb?: (pages: Page[]) => void) {
public static async getPagesData(clear = false, cb?: (pages: Page[]) => void) {
const ext = Extension.getInstance();
// Get data from the cache
+2 -2
View File
@@ -198,7 +198,7 @@ export class SettingsListener extends BaseListener {
/**
* Retrieve the settings for the dashboard
*/
public static async getSettings(clear: boolean = false) {
public static async getSettings(clear = false) {
Logger.verbose(`SettingsListener:getSettings:start - clear: ${clear}`);
const settings = await DashboardSettings.get(clear);
Logger.verbose(
@@ -315,7 +315,7 @@ export class SettingsListener extends BaseListener {
private static async copyTemplateFiles(
files: [string, FileType][],
templateFileLocation: string,
extRelPath: string = ''
extRelPath = ''
) {
const wsFolder = Folders.getWorkspaceFolder();
if (!wsFolder) {
+11 -4
View File
@@ -30,6 +30,8 @@ import { Event, commands, extensions } from 'vscode';
import { GitAPIState, GitRepository, PostMessageData } from '../../models';
import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../../localization';
import { DashboardCommand } from '../../dashboardWebView/DashboardCommand';
import { DashboardMessage } from '../../dashboardWebView/DashboardMessage';
export class GitListener {
private static gitAPI: {
@@ -39,7 +41,7 @@ export class GitListener {
getAPI: (version: number) => any;
repositories: GitRepository[];
} | null = null;
private static isRegistered: boolean = false;
private static isRegistered = false;
private static client: SimpleGit | null = null;
private static subClient: SimpleGit | null = null;
private static repository: GitRepository | null = null;
@@ -123,6 +125,7 @@ export class GitListener {
break;
case GeneralCommands.toVSCode.git.selectBranch:
this.selectBranch();
break;
case GeneralCommands.toVSCode.git.isRepo:
this.checkIsGitRepo(msg.command, msg.requestId);
break;
@@ -135,7 +138,11 @@ export class GitListener {
}
const isRepo = await GitListener.isGitRepository();
Dashboard.postWebviewMessage({ command: command as any, payload: isRepo, requestId });
Dashboard.postWebviewMessage({
command: command as DashboardCommand | DashboardMessage,
payload: isRepo,
requestId
});
}
/**
@@ -152,7 +159,7 @@ export class GitListener {
* @param commitMsg The commit message for the push operation.
* @param isSync Determines whether to perform a sync operation (default: true) or a fetch operation.
*/
public static async sync(commitMsg?: string, isSync: boolean = true) {
public static async sync(commitMsg?: string, isSync = true) {
try {
this.sendMsg(GeneralCommands.toWebview.git.syncingStart, isSync ? 'syncing' : 'fetching');
@@ -320,7 +327,7 @@ export class GitListener {
* @param submoduleFolder The path to the submodule folder.
* @returns The Git client instance or null if it cannot be retrieved.
*/
private static getClient(submoduleFolder: string = ''): SimpleGit | null {
private static getClient(submoduleFolder = ''): SimpleGit | null {
if (!submoduleFolder && this.client) {
return this.client;
} else if (submoduleFolder && this.subClient) {
+2 -1
View File
@@ -5,7 +5,8 @@ import { Command } from '../../panelWebView/Command';
import { PostMessageData } from '../../models';
export abstract class BaseListener {
public static process(msg: PostMessageData) {}
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
public static process(_: PostMessageData) {}
/**
* Send a message to the webview
+7 -4
View File
@@ -349,7 +349,7 @@ export class DataListener extends BaseListener {
metadata.articleDetails = articleDetails;
}
let updatedMetadata = Object.assign({}, metadata);
const updatedMetadata = Object.assign({}, metadata);
if (commaSeparated) {
for (const key of commaSeparated) {
if (updatedMetadata[key] && typeof updatedMetadata[key] === 'string') {
@@ -587,13 +587,14 @@ export class DataListener extends BaseListener {
* @returns
*/
public static async getParentObject(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any,
article: ParsedFrontMatter,
parents: string[] | undefined,
blockData?: BlockFieldData
) {
let parentObj = data;
let allParents = Object.assign([], parents);
const allParents = Object.assign([], parents);
const contentType = await ArticleHelper.getContentType(article);
let selectedIndexes: number[] = [];
if (blockData?.selectedIndex) {
@@ -611,7 +612,7 @@ export class DataListener extends BaseListener {
parentObj = article.data;
// Loop through the parents of the block field
for (const parent of blockData?.parentFields) {
for (const parent of blockData?.parentFields ?? []) {
if (!parentObj) {
continue;
}
@@ -769,6 +770,7 @@ export class DataListener extends BaseListener {
articleData: {
field: string;
value: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: { [key: string]: any };
contentType?: IContentType;
},
@@ -778,7 +780,8 @@ export class DataListener extends BaseListener {
return;
}
let { field, value, data, contentType } = articleData;
const { field, data, contentType } = articleData;
let { value } = articleData;
value = value || '';
const valueBefore = value;
+1 -1
View File
@@ -1,5 +1,5 @@
import * as l10n from '@vscode/l10n';
export const localize = (key: string, ...args: any[]): string => {
export const localize = (key: string, ...args: (string | number)[]): string => {
return l10n.t(key, ...args);
};
+1
View File
@@ -4,6 +4,7 @@ export interface DataFile {
file: string;
fileType: 'json' | 'yaml';
labelField: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
schema?: any;
type?: string;
singleEntry?: boolean;
+1
View File
@@ -2,6 +2,7 @@ export interface DataFolder {
id: string;
path: string;
labelField: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
schema?: any;
type?: string;
singleEntry?: boolean;
+1
View File
@@ -1,4 +1,5 @@
export interface DataType {
id: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
schema: any;
}
+1
View File
@@ -169,6 +169,7 @@ export enum WhenOperator {
export interface WhenClause {
fieldRef: string;
operator: WhenOperator;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value: any;
caseSensitive?: boolean;
}
+1
View File
@@ -1,5 +1,6 @@
export interface PostMessageData {
command: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
payload: any;
requestId?: string;
}
+1
View File
@@ -1,5 +1,6 @@
export interface Project {
name: string;
default?: boolean;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
configuration: any;
}
+1 -1
View File
@@ -19,5 +19,5 @@ export type SnippetSpecialPlaceholders = 'FM_SELECTED_TEXT' | string;
export interface SnippetField extends Field {
default?: SnippetSpecialPlaceholders;
value?: any;
value?: unknown;
}
+2 -4
View File
@@ -21,9 +21,7 @@ import { DEFAULT_PANEL_FEATURE_FLAGS } from '../constants/DefaultFeatureFlags';
export interface IViewPanelProps { }
export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
{ }: React.PropsWithChildren<IViewPanelProps>
) => {
export const ViewPanel: React.FunctionComponent<IViewPanelProps> = () => {
const [isDevMode, setIsDevMode] = useState(false);
const {
loading,
@@ -38,7 +36,7 @@ export const ViewPanel: React.FunctionComponent<IViewPanelProps> = (
const prevMediaSelection = usePrevious(mediaSelecting);
const [scrollY, setScrollY] = useState(0);
const scollListener = useCallback((e: Event) => {
const scollListener = useCallback(() => {
if (!mediaSelecting) {
setScrollY(window.scrollY);
}
+1 -1
View File
@@ -35,7 +35,7 @@ const Actions: React.FunctionComponent<IActionsProps> = ({
};
const actions = React.useMemo(() => {
let allActions: JSX.Element[] = [];
const allActions: JSX.Element[] = [];
if (!disableActions.includes(`openDashboard`)) {
allActions.push(
+2 -2
View File
@@ -26,7 +26,7 @@ const Collapsible: React.FunctionComponent<ICollapsibleProps> = ({
return;
}
const prevState: any = Messenger.getState();
const prevState = Messenger.getState() as { [key: string]: string };
if (
!prevState ||
@@ -51,7 +51,7 @@ const Collapsible: React.FunctionComponent<ICollapsibleProps> = ({
}, [collapseKey]);
const updateStorage = (value: boolean) => {
const prevState: any = Messenger.getState();
const prevState = Messenger.getState() as { [key: string]: string };
Messenger.setState({
...prevState,
[collapseKey]: value.toString()
@@ -16,7 +16,7 @@ export interface IDataBlockFieldProps {
settings: PanelSettings;
field: Field;
parentFields: string[];
value: any;
value: unknown[];
blockData: BlockFieldData | undefined;
filePath: string;
fieldsRenderer: (
@@ -24,10 +24,10 @@ export interface IDataBlockFieldProps {
parent: IMetadata,
parentFields: string[],
blockData?: BlockFieldData,
onFieldUpdate?: (field: string | undefined, value: any, parents: string[]) => void,
onFieldUpdate?: (field: string | undefined, value: unknown, parents: string[]) => void,
parentBlock?: string | null
) => (JSX.Element | null)[] | undefined;
onSubmit: (data: any) => void;
onSubmit: (data: unknown) => void;
parentBlock: string | null | undefined;
required?: boolean;
}
@@ -48,7 +48,7 @@ export const DataBlockField: React.FunctionComponent<IDataBlockFieldProps> = ({
}: React.PropsWithChildren<IDataBlockFieldProps>) => {
const [selectedIndex, setSelectedIndex] = useState<number | null>(null);
const [selectedGroup, setSelectedGroup] = useState<FieldGroup | undefined | null>(null);
const [selectedBlockData, setSelectedBlockData] = useState<any | null>(null);
const [selectedBlockData, setSelectedBlockData] = useState<unknown | null>(null);
const [hideSubBlock, setHideSubBlock] = useState<boolean>(true);
const SELECTION_STATE_KEY = useMemo(
@@ -61,19 +61,20 @@ export const DataBlockField: React.FunctionComponent<IDataBlockFieldProps> = ({
);
const onFieldUpdate = useCallback(
(crntField: string | undefined, crntValue: any, parents: string[]) => {
const dataClone: any[] = Object.assign([], value);
(crntField: string | undefined, crntValue: unknown, parents: string[]) => {
const dataClone: unknown[] = Object.assign([], value);
if (!crntField) {
return;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let data: any = {};
if (selectedIndex !== null && selectedIndex !== undefined) {
data = Object.assign({}, dataClone[selectedIndex]);
}
let parentObj: any = data;
let parentObj: { [key: string]: unknown } = data;
if (parents.length > 1) {
// Get last parent
@@ -85,7 +86,7 @@ export const DataBlockField: React.FunctionComponent<IDataBlockFieldProps> = ({
if (!parentObj[lastParent]) {
parentObj[lastParent] = {};
}
parentObj = parentObj[lastParent];
parentObj = parentObj[lastParent] as { [key: string]: unknown };
}
}
@@ -125,7 +126,7 @@ export const DataBlockField: React.FunctionComponent<IDataBlockFieldProps> = ({
const deleteItem = useCallback(
(index: number) => {
const dataClone: any[] = Object.assign([], value);
const dataClone: unknown[] = Object.assign([], value);
if (!value) {
return;
@@ -204,7 +205,7 @@ export const DataBlockField: React.FunctionComponent<IDataBlockFieldProps> = ({
// Show the form
onShowForm();
const fieldData = value[index];
const fieldData = value[index] as { fieldGroup?: string };
if (index !== null && settings?.fieldGroups) {
const fieldGroup = fieldData?.fieldGroup;
const group = settings?.fieldGroups.find((group) => group.id === fieldGroup);
@@ -244,13 +245,13 @@ export const DataBlockField: React.FunctionComponent<IDataBlockFieldProps> = ({
// Storing the state to local storage (does not need to be persistent)
const updateSelectionState = useCallback(
(value: number | undefined) => {
localStorage.setItem(SELECTION_STATE_KEY, value as any);
localStorage.setItem(SELECTION_STATE_KEY, value?.toString() || '');
},
[SELECTION_STATE_KEY]
);
const getSelectedIndex = useCallback(() => {
let crntValue = [];
const crntValue = [];
if (blockData?.selectedIndex !== null && blockData?.selectedIndex !== undefined) {
crntValue.push(blockData.selectedIndex);
@@ -10,7 +10,7 @@ import { VSCodeLabel } from '../VSCode';
export interface IDataBlockRecordsProps {
fieldGroups?: FieldGroup[];
records: any[];
records: unknown[];
selectedIndex: number | null;
onAdd: () => void;
onSort: (obj: SortEnd) => void;
@@ -18,7 +18,7 @@ export interface IDataBlockRecordsProps {
onDelete: (id: number) => void;
}
const Container = SortableContainer(({ children }: React.PropsWithChildren<any>) => {
const Container = SortableContainer(({ children }: React.PropsWithChildren<unknown>) => {
return <ul>{children}</ul>;
});
@@ -27,11 +27,10 @@ export const DataBlockRecords = ({
records,
selectedIndex,
onSort,
onAdd,
onEdit,
onDelete
}: React.PropsWithChildren<IDataBlockRecordsProps>) => {
const getLabel = useCallback((record: any) => {
const getLabel = useCallback((record) => {
if (record.fieldGroup) {
if (fieldGroups) {
const fieldGroup = fieldGroups.find((f) => f.id === record.fieldGroup);
@@ -64,7 +63,7 @@ export const DataBlockRecords = ({
</VSCodeLabel>
<Container onSortEnd={onSort} useDragHandle>
{records.map((v: any, idx: number) => (
{records.map((v: unknown, idx: number) => (
<DataBlockRecord
key={idx}
id={idx}
@@ -36,7 +36,7 @@ export const ContentTypeRelationshipField: React.FunctionComponent<IContentTypeR
const [crntSelected, setCrntSelected] = React.useState<string | string[] | null>(value);
const [filter, setFilter] = React.useState<string | undefined>(undefined);
const inputRef = React.useRef<HTMLInputElement | null>(null);
const { getDropdownStyle } = useDropdownStyle(inputRef as any, '6px');
const { getDropdownStyle } = useDropdownStyle(inputRef, '6px');
/**
* Check the required state
@@ -53,7 +53,7 @@ export const ContentTypeRelationshipField: React.FunctionComponent<IContentTypeR
* @param type
* @returns
*/
const getValue = (value: Page, type: string = "path") => {
const getValue = (value: Page, type = "path") => {
if (type === 'path') {
return value.fmRelFilePath || value.fmFilePath;
}
@@ -175,7 +175,7 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
* Inserts a tag which is not known
* @param closeMenu
*/
const insertUnkownTag = (closeMenu: (cb?: any) => void) => {
const insertUnkownTag = (closeMenu: (cb?: unknown) => void) => {
if (inputValue) {
onSelect(inputValue);
closeMenu();
@@ -211,7 +211,7 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
* @param e
*/
const onEnterData = useCallback(
(e: React.KeyboardEvent<HTMLInputElement>, closeMenu: Function, highlightedIndex: any) => {
(e: React.KeyboardEvent<HTMLInputElement>, closeMenu: () => void, highlightedIndex: number | null) => {
if (
e.key === 'Enter' &&
e.type === 'keydown' &&
@@ -433,8 +433,8 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
<input
{...getInputProps({
ref: inputRef,
onFocus: openMenu as any,
onClick: openMenu as any,
onFocus: openMenu as () => void,
onClick: openMenu as () => void,
onKeyDown: (e) => onEnterData(e, closeMenu, highlightedIndex),
onBlur: () => {
closeMenu();
@@ -453,7 +453,7 @@ const TagPicker: React.FunctionComponent<ITagPickerProps> = ({
className={`article__tags__input__button`}
title={localize(LocalizationKey.panelTagPickerUnkown)}
disabled={!inputValue || checkIsDisabled()}
onClick={() => insertUnkownTag(closeMenu)}
onClick={() => insertUnkownTag(closeMenu as (cb?: unknown) => void)}
>
<AddIcon />
</button>
@@ -1,4 +1,5 @@
import * as React from 'react';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ReactQuill = require('react-quill');
import 'react-quill/dist/quill.snow.css';
@@ -38,8 +38,6 @@ export const GitAction: React.FunctionComponent<IGitActionProps> = ({
if (command === GeneralCommands.toWebview.git.syncingStart) {
setIsSyncing(payload || "syncing");
} else if (command === GeneralCommands.toWebview.git.syncingStart) {
setIsSyncing("syncing");
} else if (command === GeneralCommands.toWebview.git.syncingEnd) {
setCommitMessage(undefined);
setIsSyncing("idle");
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IAddIconProps {}
export interface IAddIconProps { }
export const AddIcon: React.FunctionComponent<IAddIconProps> = (
props: React.PropsWithChildren<IAddIconProps>
) => {
export const AddIcon: React.FunctionComponent<IAddIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IArchiveIconProps {}
export interface IArchiveIconProps { }
export const ArchiveIcon: React.FunctionComponent<IArchiveIconProps> = (
props: React.PropsWithChildren<IArchiveIconProps>
) => {
export const ArchiveIcon: React.FunctionComponent<IArchiveIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IBugIconProps {}
export interface IBugIconProps { }
export const BugIcon: React.FunctionComponent<IBugIconProps> = (
props: React.PropsWithChildren<IBugIconProps>
) => {
export const BugIcon: React.FunctionComponent<IBugIconProps> = () => {
return (
<svg
width="16"
@@ -2,9 +2,7 @@ import * as React from 'react';
export interface ICenterIconProps { }
export const CenterIcon: React.FunctionComponent<ICenterIconProps> = (
props: React.PropsWithChildren<ICenterIconProps>
) => {
export const CenterIcon: React.FunctionComponent<ICenterIconProps> = () => {
return (
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<rect
@@ -2,7 +2,7 @@ import * as React from 'react';
export interface ICopilotIconProps { }
export const CopilotIcon: React.FunctionComponent<ICopilotIconProps> = (props: React.PropsWithChildren<ICopilotIconProps>) => {
export const CopilotIcon: React.FunctionComponent<ICopilotIconProps> = () => {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 208">
<path fill='currentcolor' d="M205.28 31.36c14.096 14.88 20.016 35.2 22.512 63.68c6.626 0 12.805 1.47 16.976 7.152l7.792 10.56A17.55 17.55 0 0 1 256 123.2v28.688c-.008 3.704-1.843 7.315-4.832 9.504C215.885 187.222 172.35 208 128 208c-49.066 0-98.19-28.273-123.168-46.608c-2.989-2.189-4.825-5.8-4.832-9.504V123.2c0-3.776 1.2-7.424 3.424-10.464l7.792-10.544c4.173-5.657 10.38-7.152 16.992-7.152c2.496-28.48 8.4-48.8 22.512-63.68C77.331 3.165 112.567.06 127.552 0H128c14.72 0 50.4 2.88 77.28 31.36m-77.264 47.376c-3.04 0-6.544.176-10.272.544c-1.312 4.896-3.248 9.312-6.08 12.128c-11.2 11.2-24.704 12.928-31.936 12.928c-6.802 0-13.927-1.42-19.744-5.088c-5.502 1.808-10.786 4.415-11.136 10.912c-.586 12.28-.637 24.55-.688 36.824c-.026 6.16-.05 12.322-.144 18.488c.024 3.579 2.182 6.903 5.44 8.384C79.936 185.92 104.976 192 128.016 192c23.008 0 48.048-6.08 74.512-18.144c3.258-1.48 5.415-4.805 5.44-8.384c.317-18.418.062-36.912-.816-55.312h.016c-.342-6.534-5.648-9.098-11.168-10.912c-5.82 3.652-12.927 5.088-19.728 5.088c-7.232 0-20.72-1.728-31.936-12.928c-2.832-2.816-4.768-7.232-6.08-12.128a106 106 0 0 0-10.24-.544m-26.941 43.93c5.748 0 10.408 4.66 10.408 10.409v19.183c0 5.749-4.66 10.409-10.408 10.409s-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408m53.333 0c5.749 0 10.409 4.66 10.409 10.409v19.183c0 5.749-4.66 10.409-10.409 10.409c-5.748 0-10.408-4.66-10.408-10.409v-19.183c0-5.748 4.66-10.408 10.408-10.408M81.44 28.32c-11.2 1.12-20.64 4.8-25.44 9.92c-10.4 11.36-8.16 40.16-2.24 46.24c4.32 4.32 12.48 7.2 21.28 7.2c6.72 0 19.52-1.44 30.08-12.16c4.64-4.48 7.52-15.68 7.2-27.04c-.32-9.12-2.88-16.64-6.72-19.84c-4.16-3.68-13.6-5.28-24.16-4.32m68.96 4.32c-3.84 3.2-6.4 10.72-6.72 19.84c-.32 11.36 2.56 22.56 7.2 27.04c10.56 10.72 23.36 12.16 30.08 12.16c8.8 0 16.96-2.88 21.28-7.2c5.92-6.08 8.16-34.88-2.24-46.24c-4.8-5.12-14.24-8.8-25.44-9.92c-10.56-.96-20 .64-24.16 4.32M128 56c-2.56 0-5.6.16-8.96.48c.32 1.76.48 3.68.64 5.76c0 1.44 0 2.88-.16 4.48c3.2-.32 5.92-.32 8.48-.32s5.28 0 8.48.32c-.16-1.6-.16-3.04-.16-4.48c.16-2.08.32-4 .64-5.76c-3.36-.32-6.4-.48-8.96-.48" />
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IFileIconProps {}
export interface IFileIconProps { }
export const FileIcon: React.FunctionComponent<IFileIconProps> = (
props: React.PropsWithChildren<IFileIconProps>
) => {
export const FileIcon: React.FunctionComponent<IFileIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IFolderOpenedIconProps {}
export interface IFolderOpenedIconProps { }
export const FolderOpenedIcon: React.FunctionComponent<IFolderOpenedIconProps> = (
props: React.PropsWithChildren<IFolderOpenedIconProps>
) => {
export const FolderOpenedIcon: React.FunctionComponent<IFolderOpenedIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IListUnorderedIconProps {}
export interface IListUnorderedIconProps { }
export const ListUnorderedIcon: React.FunctionComponent<IListUnorderedIconProps> = (
props: React.PropsWithChildren<IListUnorderedIconProps>
) => {
export const ListUnorderedIcon: React.FunctionComponent<IListUnorderedIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IRocketIconProps {}
export interface IRocketIconProps { }
export const RocketIcon: React.FunctionComponent<IRocketIconProps> = (
props: React.PropsWithChildren<IRocketIconProps>
) => {
export const RocketIcon: React.FunctionComponent<IRocketIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface ISettingsIconProps {}
export interface ISettingsIconProps { }
export const SettingsIcon: React.FunctionComponent<ISettingsIconProps> = (
props: React.PropsWithChildren<ISettingsIconProps>
) => {
export const SettingsIcon: React.FunctionComponent<ISettingsIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface ISymbolKeywordIconProps {}
export interface ISymbolKeywordIconProps { }
export const SymbolKeywordIcon: React.FunctionComponent<ISymbolKeywordIconProps> = (
props: React.PropsWithChildren<ISymbolKeywordIconProps>
) => {
export const SymbolKeywordIcon: React.FunctionComponent<ISymbolKeywordIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface ITagIconProps {}
export interface ITagIconProps { }
export const TagIcon: React.FunctionComponent<ITagIconProps> = (
props: React.PropsWithChildren<ITagIconProps>
) => {
export const TagIcon: React.FunctionComponent<ITagIconProps> = () => {
return (
<svg
width="16"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface ITemplateIconProps {}
export interface ITemplateIconProps { }
export const TemplateIcon: React.FunctionComponent<ITemplateIconProps> = (
props: React.PropsWithChildren<ITemplateIconProps>
) => {
export const TemplateIcon: React.FunctionComponent<ITemplateIconProps> = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IToggleIconProps {}
export interface IToggleIconProps { }
export const ToggleIcon: React.FunctionComponent<IToggleIconProps> = (
props: React.PropsWithChildren<IToggleIconProps>
) => {
export const ToggleIcon: React.FunctionComponent<IToggleIconProps> = () => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -1,10 +1,8 @@
import * as React from 'react';
export interface IWritingIconProps {}
export interface IWritingIconProps { }
export const WritingIcon: React.FunctionComponent<IWritingIconProps> = (
props: React.PropsWithChildren<IWritingIconProps>
) => {
export const WritingIcon: React.FunctionComponent<IWritingIconProps> = () => {
return (
<svg
width="16"
@@ -9,6 +9,7 @@ export interface IJsonFieldSelectorProps {
dataTypes: DataType[] | undefined;
selectedDataType: string | null;
onSetDataType: (dataType: string | null) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onSchemaUpdate: (schema: any) => void;
}
+2
View File
@@ -40,6 +40,7 @@ const Metadata: React.FunctionComponent<IMetadataProps> = ({
});
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const onSendUpdate = React.useCallback((field: string | undefined, value: any, parents: string[]) => {
if (!field) {
return;
@@ -58,6 +59,7 @@ const Metadata: React.FunctionComponent<IMetadataProps> = ({
parent: IMetadata,
parentFields: string[] = [],
blockData?: BlockFieldData,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onFieldUpdate?: (field: string | undefined, value: any, parents: string[]) => void,
parentBlock?: string | null
): (JSX.Element | null)[] | undefined => {
@@ -26,10 +26,6 @@ const OtherActions: React.FunctionComponent<IOtherActionsProps> = ({
settings,
isBase
}: React.PropsWithChildren<IOtherActionsProps>) => {
const openSettings = () => {
Messenger.send(CommandToCode.openSettings);
};
const openFile = () => {
Messenger.send(CommandToCode.openFile);
};
+1 -1
View File
@@ -7,7 +7,7 @@ import { LocalizationKey } from '../../localization';
export interface IPreviewProps { }
const Preview: React.FunctionComponent<IPreviewProps> = (_: React.PropsWithChildren<IPreviewProps>) => {
const Preview: React.FunctionComponent<IPreviewProps> = () => {
const open = () => {
Messenger.send(CommandToCode.openPreview);
};

Some files were not shown because too many files have changed in this diff Show More