chore: fix typos across the codebase (#402)

This commit is contained in:
a-kriya 2023-01-22 08:47:27 +05:30 committed by GitHub
parent 14db8da270
commit 6d9478f8f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 66 additions and 66 deletions

View File

@ -27,7 +27,7 @@
_faqs: {
'what-is-static-cms.md': {
content:
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git comitters.\n\n',
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git committers.\n\n',
},
'what-is-jam-stack.md': {
content:

View File

@ -35,7 +35,7 @@ import {
selectFieldsComments,
selectFileEntryLabel,
selectFolderEntryExtension,
selectInferedField,
selectInferredField,
selectMediaFolders,
} from './lib/util/collection.util';
import { selectMediaFilePath, selectMediaFilePublicPath } from './lib/util/media.util';
@ -526,12 +526,12 @@ export class Backend<BC extends BackendClass = BackendClass> {
});
} else {
searchFields = [
selectInferedField(collection, 'title'),
selectInferedField(collection, 'shortTitle'),
selectInferedField(collection, 'author'),
selectInferredField(collection, 'title'),
selectInferredField(collection, 'shortTitle'),
selectInferredField(collection, 'author'),
...summaryFields.map(elem => {
if (dateParsers[elem]) {
return selectInferedField(collection, 'date');
return selectInferredField(collection, 'date');
}
return elem;
}),
@ -555,7 +555,7 @@ export class Backend<BC extends BackendClass = BackendClass> {
if (errors.length > 0) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
throw new Error({ message: 'Errors ocurred while searching entries locally!', errors });
throw new Error({ message: 'Errors occurred while searching entries locally!', errors });
}
const hits = entries

View File

@ -86,7 +86,7 @@ const Header = ({
createNewEntry(collectionName);
}, []);
const createableCollections = useMemo(
const creatableCollections = useMemo(
() =>
Object.values(collections).filter(collection =>
'folder' in collection ? collection.create ?? false : false,
@ -123,7 +123,7 @@ const Header = ({
) : null}
<StyledSpacer />
<StyledAppHeaderActions>
{createableCollections.length > 0 && (
{creatableCollections.length > 0 && (
<div key="quick-create">
<Button
id="quick-create-button"
@ -145,7 +145,7 @@ const Header = ({
'aria-labelledby': 'quick-create-button',
}}
>
{createableCollections.map(collection => (
{creatableCollections.map(collection => (
<MenuItem
key={collection.name}
onClick={() => handleCreatePostClick(collection.name)}

View File

@ -54,7 +54,7 @@ const EntryCard = ({
interface EntryCardOwnProps {
entry: Entry;
inferedFields: {
inferredFields: {
titleField?: string | null | undefined;
descriptionField?: string | null | undefined;
imageField?: string | null | undefined;
@ -67,11 +67,11 @@ interface EntryCardOwnProps {
}
function mapStateToProps(state: RootState, ownProps: EntryCardOwnProps) {
const { entry, inferedFields, collection } = ownProps;
const { entry, inferredFields, collection } = ownProps;
const entryData = entry.data;
let image = inferedFields.imageField
? (entryData?.[inferedFields.imageField] as string | undefined)
let image = inferredFields.imageField
? (entryData?.[inferredFields.imageField] as string | undefined)
: undefined;
if (image) {
@ -86,7 +86,7 @@ function mapStateToProps(state: RootState, ownProps: EntryCardOwnProps) {
image,
imageField:
'fields' in collection
? collection.fields?.find(f => f.name === inferedFields.imageField && f.widget === 'image')
? collection.fields?.find(f => f.name === inferredFields.imageField && f.widget === 'image')
: undefined,
isLoadingAsset,
};

View File

@ -4,7 +4,7 @@ import { Waypoint } from 'react-waypoint';
import { VIEW_STYLE_LIST } from '@staticcms/core/constants/collectionViews';
import { transientOptions } from '@staticcms/core/lib';
import { selectFields, selectInferedField } from '@staticcms/core/lib/util/collection.util';
import { selectFields, selectInferredField } from '@staticcms/core/lib/util/collection.util';
import EntryCard from './EntryCard';
import type { CollectionViewStyle } from '@staticcms/core/constants/collectionViews';
@ -86,12 +86,12 @@ const EntryListing = ({
return {};
}
const titleField = selectInferedField(collection, 'title');
const descriptionField = selectInferedField(collection, 'description');
const imageField = selectInferedField(collection, 'image');
const titleField = selectInferredField(collection, 'title');
const descriptionField = selectInferredField(collection, 'description');
const imageField = selectInferredField(collection, 'image');
const fields = selectFields(collection);
const inferedFields = [titleField, descriptionField, imageField];
const remainingFields = fields && fields.filter(f => inferedFields.indexOf(f.name) === -1);
const inferredFields = [titleField, descriptionField, imageField];
const remainingFields = fields && fields.filter(f => inferredFields.indexOf(f.name) === -1);
return { titleField, descriptionField, imageField, remainingFields };
},
[],
@ -99,11 +99,11 @@ const EntryListing = ({
const renderedCards = useMemo(() => {
if ('collection' in otherProps) {
const inferedFields = inferFields(otherProps.collection);
const inferredFields = inferFields(otherProps.collection);
return entries.map((entry, idx) => (
<EntryCard
collection={otherProps.collection}
inferedFields={inferedFields}
inferredFields={inferredFields}
viewStyle={viewStyle}
entry={entry}
key={idx}
@ -118,12 +118,12 @@ const EntryListing = ({
coll => coll.name === collectionName,
);
const collectionLabel = !isSingleCollectionInList ? collection?.label : undefined;
const inferedFields = inferFields(collection);
const inferredFields = inferFields(collection);
return collection ? (
<EntryCard
collection={collection}
entry={entry}
inferedFields={inferedFields}
inferredFields={inferredFields}
collectionLabel={collectionLabel}
key={idx}
/>

View File

@ -46,7 +46,7 @@ const LocaleRowWrapper = styled('div')`
gap: 8px;
`;
const DefaultLocaleWrittingIn = styled('div')`
const DefaultLocaleWritingIn = styled('div')`
display: flex;
align-items: center;
height: 36.5px;
@ -89,7 +89,7 @@ const LocaleDropdown = ({
);
if (!canChangeLocale) {
return <DefaultLocaleWrittingIn>{dropdownText}</DefaultLocaleWrittingIn>;
return <DefaultLocaleWritingIn>{dropdownText}</DefaultLocaleWritingIn>;
}
return (

View File

@ -10,7 +10,7 @@ import { getAsset as getAssetAction } from '@staticcms/core/actions/media';
import { ErrorBoundary } from '@staticcms/core/components/UI';
import { lengths } from '@staticcms/core/components/UI/styles';
import { getPreviewStyles, getPreviewTemplate, resolveWidget } from '@staticcms/core/lib/registry';
import { selectTemplateName, useInferedFields } from '@staticcms/core/lib/util/collection.util';
import { selectTemplateName, useInferredFields } from '@staticcms/core/lib/util/collection.util';
import { selectField } from '@staticcms/core/lib/util/field.util';
import { selectIsLoadingAsset } from '@staticcms/core/reducers/selectors/medias';
import { getTypedFieldForValue } from '@staticcms/list/typedListHelpers';
@ -92,7 +92,7 @@ function getWidgetFor(
name: string,
fields: Field[],
entry: Entry,
inferedFields: Record<string, InferredField>,
inferredFields: Record<string, InferredField>,
getAsset: GetAssetFunction,
widgetFields: Field[] = fields,
values: EntryData = entry.data,
@ -116,7 +116,7 @@ function getWidgetFor(
collection,
fields,
entry,
inferedFields,
inferredFields,
getAsset,
field.fields,
value as EntryData | EntryData[],
@ -130,7 +130,7 @@ function getWidgetFor(
collection,
field,
entry,
inferedFields,
inferredFields,
getAsset,
value as EntryData[],
),
@ -138,7 +138,7 @@ function getWidgetFor(
}
const labelledWidgets = ['string', 'text', 'number'];
const inferedField = Object.entries(inferedFields)
const inferredField = Object.entries(inferredFields)
.filter(([key]) => {
const fieldToMatch = selectField(collection, key);
return fieldToMatch === fieldWithWidgets;
@ -146,8 +146,8 @@ function getWidgetFor(
.map(([, value]) => value)[0];
let renderedValue: ValueOrNestedValue | ReactNode = value;
if (inferedField) {
renderedValue = inferedField.defaultPreview(String(value));
if (inferredField) {
renderedValue = inferredField.defaultPreview(String(value));
} else if (
value &&
fieldWithWidgets.widget &&
@ -235,7 +235,7 @@ function widgetsForNestedFields(
collection: Collection,
fields: Field[],
entry: Entry,
inferedFields: Record<string, InferredField>,
inferredFields: Record<string, InferredField>,
getAsset: GetAssetFunction,
widgetFields: Field[],
values: EntryData,
@ -249,7 +249,7 @@ function widgetsForNestedFields(
field.name,
fields,
entry,
inferedFields,
inferredFields,
getAsset,
widgetFields,
values,
@ -267,7 +267,7 @@ function getTypedNestedWidgets(
collection: Collection,
field: ListField,
entry: Entry,
inferedFields: Record<string, InferredField>,
inferredFields: Record<string, InferredField>,
getAsset: GetAssetFunction,
values: EntryData[],
) {
@ -283,7 +283,7 @@ function getTypedNestedWidgets(
collection,
itemType.fields,
entry,
inferedFields,
inferredFields,
getAsset,
itemType.fields,
value,
@ -301,7 +301,7 @@ function getNestedWidgets(
collection: Collection,
fields: Field[],
entry: Entry,
inferedFields: Record<string, InferredField>,
inferredFields: Record<string, InferredField>,
getAsset: GetAssetFunction,
widgetFields: Field[],
values: EntryData | EntryData[],
@ -314,7 +314,7 @@ function getNestedWidgets(
collection,
fields,
entry,
inferedFields,
inferredFields,
getAsset,
widgetFields,
value,
@ -328,7 +328,7 @@ function getNestedWidgets(
collection,
fields,
entry,
inferedFields,
inferredFields,
getAsset,
widgetFields,
values,
@ -338,7 +338,7 @@ function getNestedWidgets(
const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
const { entry, collection, config, fields, previewInFrame, getAsset, t } = props;
const inferedFields = useInferedFields(collection);
const inferredFields = useInferredFields(collection);
const handleGetAsset = useCallback(
(path: string, field?: Field) => {
@ -359,11 +359,11 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
name,
fields,
entry,
inferedFields,
inferredFields,
handleGetAsset,
);
},
[collection, config, entry, fields, handleGetAsset, inferedFields],
[collection, config, entry, fields, handleGetAsset, inferredFields],
);
/**
@ -413,7 +413,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
field.name,
fields,
entry,
inferedFields,
inferredFields,
handleGetAsset,
nestedFields,
val,
@ -445,7 +445,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
field.name,
fields,
entry,
inferedFields,
inferredFields,
handleGetAsset,
nestedFields,
value,
@ -457,7 +457,7 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
}, {} as Record<string, ReactNode>),
};
},
[collection, config.config, entry, fields, handleGetAsset, inferedFields],
[collection, config.config, entry, fields, handleGetAsset, inferredFields],
);
const previewStyles = useMemo(

View File

@ -2097,7 +2097,7 @@ const equalStaticArray = function * ( table , finalKey ,
}
else {
if ( lineRest[0]===']' ) { break; }
throw throws(SyntaxError$1(`Unexpect character in static array item value` + where(', which is found at ')));
throw throws(SyntaxError$1(`Unexpected character in static array item value` + where(', which is found at ')));
}
}
inline===null || beInline(staticArray, inline);
@ -2231,7 +2231,7 @@ const Root = () => {
const { leadingKeys, finalKey, asArrayItem, tag, lineRest } = TABLE_DEFINITION_exec_groups(line, parseKeys);
const table = prepareTable(rootTable, leadingKeys);
if ( lineRest ) {
lineRest[0]==='#' || throws(SyntaxError$1(`Unexpect charachtor after table header` + where(' at ')));
lineRest[0]==='#' || throws(SyntaxError$1(`Unexpected charachtor after table header` + where(' at ')));
}
lastSectionTable = appendTable(table, finalKey, asArrayItem, tag);
preserveComment && lineRest && ( lastSectionTable[commentForThis] = asArrayItem ? lineRest.slice(1) : table[commentFor(finalKey)] = lineRest.slice(1) );
@ -2244,7 +2244,7 @@ const Root = () => {
let rest = assign(forComment);
typeof rest==='string' || ( rest = x (rest) );
if ( rest ) {
rest[0]==='#' || throws(SyntaxError$1(`Unexpect charachtor after key/value pair` + where(' at ')));
rest[0]==='#' || throws(SyntaxError$1(`Unexpected charachtor after key/value pair` + where(' at ')));
if ( preserveComment ) { forComment.table[commentFor(forComment.finalKey)] = rest.slice(1); }
}
}

View File

@ -16,7 +16,7 @@ async function sha256(text: string) {
// based on https://github.com/auth0/auth0-spa-js/blob/9a83f698127eae7da72691b0d4b1b847567687e3/src/utils.ts#L147
function generateVerifierCode() {
// characters that can be used for codeVerifer
// characters that can be used for codeVerifier
// excludes _~ as if included would cause an uneven distribution as char.length would no longer be a factor of 256
const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.';
const randomValues = Array.from(window.crypto.getRandomValues(new Uint8Array(128)));

View File

@ -4,7 +4,7 @@ import partialRight from 'lodash/partialRight';
import { COMMIT_AUTHOR, COMMIT_DATE } from '../constants/commitProps';
import { sanitizeSlug } from './urlHelper';
import { selectIdentifier, selectInferedField } from './util/collection.util';
import { selectIdentifier, selectInferredField } from './util/collection.util';
import { selectField } from './util/field.util';
import { set } from './util/object.util';
import {
@ -108,7 +108,7 @@ export function slugFormatter(collection: Collection, entryData: EntryData, slug
export function summaryFormatter(summaryTemplate: string, entry: Entry, collection: Collection) {
let entryData = entry.data;
const date = parseDateFromEntry(entry, selectInferedField(collection, 'date')) || null;
const date = parseDateFromEntry(entry, selectInferredField(collection, 'date')) || null;
const identifier = get(entryData, keyToPathArray(selectIdentifier(collection)));
entryData =
@ -144,7 +144,7 @@ export function folderFormatter(
'folder' in collection ? collection.folder : '',
);
const date = parseDateFromEntry(entry, selectInferedField(collection, 'date')) || null;
const date = parseDateFromEntry(entry, selectInferredField(collection, 'date')) || null;
const identifier = get(fields, keyToPathArray(selectIdentifier(collection)));
const processSegment = getProcessSegment(slugConfig, [defaultFolder, fields?.dirname as string]);

View File

@ -125,7 +125,7 @@ export function selectEntryCollectionTitle(collection: Collection, entry: Entry)
// try to infer a title field from the entry data
const entryData = entry.data;
const titleField = selectInferedField(collection, 'title');
const titleField = selectInferredField(collection, 'title');
const result = titleField && get(entryData, keyToPathArray(titleField));
// if the custom field does not yield a result, fallback to 'title'
@ -138,7 +138,7 @@ export function selectEntryCollectionTitle(collection: Collection, entry: Entry)
export function selectDefaultSortableFields(collection: Collection, backend: Backend) {
let defaultSortable = SORTABLE_FIELDS.map((type: string) => {
const field = selectInferedField(collection, type);
const field = selectInferredField(collection, type);
if (backend.isGitBackend() && type === 'author' && !field) {
// default to commit author if not author field is found
return COMMIT_AUTHOR;
@ -336,7 +336,7 @@ export function selectIdentifier(collection: Collection) {
);
}
export function selectInferedField(collection: Collection, fieldName: string) {
export function selectInferredField(collection: Collection, fieldName: string) {
if (fieldName === 'title' && collection.identifier_field) {
return selectIdentifier(collection);
}
@ -393,11 +393,11 @@ export function selectInferedField(collection: Collection, fieldName: string) {
return null;
}
export function useInferedFields(collection: Collection) {
export function useInferredFields(collection: Collection) {
return useMemo(() => {
const titleField = selectInferedField(collection, 'title');
const shortTitleField = selectInferedField(collection, 'shortTitle');
const authorField = selectInferedField(collection, 'author');
const titleField = selectInferredField(collection, 'title');
const shortTitleField = selectInferredField(collection, 'shortTitle');
const authorField = selectInferredField(collection, 'author');
const iFields: Record<string, InferredField> = {};
if (titleField) {

View File

@ -48,7 +48,7 @@ declare global {
cloudinary: {
createMediaLibrary: (
config: Record<string, unknown>,
hadlers: { insertHandler: (data: { assets: CloudinaryAsset[] }) => void },
handlers: { insertHandler: (data: { assets: CloudinaryAsset[] }) => void },
) => {
show: (config: Record<string, unknown>) => void;
hide: () => void;

View File

@ -381,7 +381,7 @@ const withFileControl = ({ forImage = false }: WithFileControlProps = {}) => {
if (isMultiple(internalValue)) {
return (
<FileLinks key="mulitple-file-links">
<FileLinks key="multiple-file-links">
<FileLinkList key="file-links-list">
{internalValue.map(val => (
<li key={val}>{renderFileLink(val)}</li>

View File

@ -36,7 +36,7 @@ const StyledMapControlContent = styled(
)<StyledMapControlContentProps>(
({ $collapsed, $height }) => `
display: flex;
postion: relative;
position: relative;
height: ${$height}
${
$collapsed

View File

@ -30,7 +30,7 @@
_faqs: {
'what-is-static-cms.md': {
content:
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git comitters.\n\n',
'---\ntitle: What is Static CMS?\ndate: 2015-11-02T00:00.000Z\n---\n\n# Static CMS is Content Manager for Static Site Generators\n\nStatic sites are many times faster, cheaper and safer and traditional dynamic websites.\n\nModern static site generators like Jekyll, Middleman, Roots or Hugo are powerful publishing and development systems, but when we build sites for non-technical users, we need a layer on top of them.\n\nStatic CMS is there to let your marketing team push new content to your public site, or to let technical writers work on your documentation.\n\nStatic CMS integrates with Git and turns normal content editors into git committers.\n\n',
},
'what-is-jam-stack.md': {
content:

View File

@ -24,7 +24,7 @@ Then create a new route for your project (for instance at `/admin`), and import
import CMS from '@staticcms/core';
```
The default export is a _CMS_ object, which has an `init` method that takes an object with a `config` attribute. The `config` attribute is an object representing the [configuration options](docs/configuration-options). You can use destructuring assigment syntax as shorthand:
The default export is a _CMS_ object, which has an `init` method that takes an object with a `config` attribute. The `config` attribute is an object representing the [configuration options](docs/configuration-options). You can use destructuring assignment syntax as shorthand:
```js
import CMS from '@staticcms/core';