Skip to content

Commit 05e9641

Browse files
acwhite211github-actions[bot]
authored andcommitted
Lint code with ESLint and Prettier
Triggered by df0d024 on branch refs/heads/issue-7436
1 parent df0d024 commit 05e9641

File tree

12 files changed

+192
-182
lines changed

12 files changed

+192
-182
lines changed

specifyweb/frontend/js_src/lib/components/AppResources/Filters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Input, Label } from '../Atoms/Form';
1515
import { icons } from '../Atoms/Icons';
1616
import { Link } from '../Atoms/Link';
1717
import { Dialog } from '../Molecules/Dialog';
18+
import { hasPermission } from '../Permissions/helpers';
1819
import {
1920
allAppResources,
2021
countAppResources,
@@ -23,7 +24,6 @@ import {
2324
} from './filtersHelpers';
2425
import type { AppResources } from './hooks';
2526
import { appResourceSubTypes, appResourceTypes } from './types';
26-
import { hasPermission } from '../Permissions/helpers';
2727

2828
export function AppResourcesFilters({
2929
initialResources,

specifyweb/frontend/js_src/lib/components/Attachments/Plugin.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import { loadingBar } from '../Molecules';
2323
import { Dialog } from '../Molecules/Dialog';
2424
import { FilePicker } from '../Molecules/FilePicker';
2525
import { ProtectedTable } from '../Permissions/PermissionDenied';
26+
import { collectionPreferences } from '../Preferences/collectionPreferences';
2627
import { userPreferences } from '../Preferences/userPreferences';
2728
import { AttachmentPluginSkeleton } from '../SkeletonLoaders/AttachmentPlugin';
2829
import { attachmentSettingsPromise, uploadFile } from './attachments';
2930
import { AttachmentViewer } from './Viewer';
30-
import { collectionPreferences } from '../Preferences/collectionPreferences';
3131

3232
export function AttachmentsPlugin(
3333
props: Parameters<typeof ProtectedAttachmentsPlugin>[0]

specifyweb/frontend/js_src/lib/components/AttachmentsBulkImport/Upload.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { strictGetTable } from '../DataModel/tables';
2323
import type { Attachment, Tables } from '../DataModel/types';
2424
import { Dialog } from '../Molecules/Dialog';
2525
import { hasPermission } from '../Permissions/helpers';
26+
import { collectionPreferences } from '../Preferences/collectionPreferences';
2627
import { ActionState } from './ActionState';
2728
import type { AttachmentUploadSpec, EagerDataSet } from './Import';
2829
import { PerformAttachmentTask } from './PerformAttachmentTask';
@@ -39,7 +40,6 @@ import {
3940
saveForAttachmentUpload,
4041
validateAttachmentFiles,
4142
} from './utils';
42-
import { collectionPreferences } from '../Preferences/collectionPreferences';
4343

4444
async function prepareForUpload(
4545
dataSet: EagerDataSet,

specifyweb/frontend/js_src/lib/components/DataModel/businessRules.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ export class BusinessRuleManager<SCHEMA extends AnySchema> {
7171
fieldName: string &
7272
(keyof SCHEMA['fields'] | keyof SCHEMA['toOneIndependent'])
7373
): Promise<RA<BusinessRuleResult<SCHEMA>>> {
74-
// REFACTOR: When checkField is called directly, the promises are not
75-
// added to the public pendingPromise
74+
/*
75+
* REFACTOR: When checkField is called directly, the promises are not
76+
* added to the public pendingPromise
77+
*/
7678

7779
const field = this.resource.specifyTable.getField(fieldName);
7880
if (field === undefined) return [];

specifyweb/frontend/js_src/lib/components/FormPlugins/__tests__/dateUtils.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ describe('getDateParser', () => {
1717
new Date()
1818
)
1919
).toMatchInlineSnapshot(`
20-
{
21-
"formatters": [
22-
[Function],
23-
[Function],
24-
],
25-
"max": "9999-12-31",
26-
"minLength": 10,
27-
"parser": [Function],
28-
"required": false,
29-
"title": "Required Format: MM/DD/YYYY.",
30-
"type": "date",
31-
"validators": [
32-
[Function],
33-
],
34-
"value": "2022-08-31",
35-
"whiteSpaceSensitive": false,
36-
}
37-
`));
20+
{
21+
"formatters": [
22+
[Function],
23+
[Function],
24+
],
25+
"max": "9999-12-31",
26+
"minLength": 10,
27+
"parser": [Function],
28+
"required": false,
29+
"title": "Required Format: MM/DD/YYYY.",
30+
"type": "date",
31+
"validators": [
32+
[Function],
33+
],
34+
"value": "2022-08-31",
35+
"whiteSpaceSensitive": false,
36+
}
37+
`));
3838

3939
test('month-year', () =>
4040
expect(getDateParser(undefined, 'month-year', undefined))

specifyweb/frontend/js_src/lib/components/Preferences/Aside.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import type { GetSet, WritableArray } from '../../utils/types';
77
import { Link } from '../Atoms/Link';
88
import { pathIsOverlay } from '../Router/UnloadProtect';
99
import { scrollIntoView } from '../TreeView/helpers';
10-
import { PreferenceType, usePrefDefinitions } from './index';
10+
import type { PreferenceType } from './index';
11+
import { usePrefDefinitions } from './index';
1112

1213
export function PreferencesAside({
1314
activeCategory,

specifyweb/frontend/js_src/lib/components/Preferences/CollectionDefinitions.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { LocalizedString } from 'typesafe-i18n';
1+
import type { LocalizedString } from 'typesafe-i18n';
2+
23
import { attachmentsText } from '../../localization/attachments';
34
import { preferencesText } from '../../localization/preferences';
45
import { queryText } from '../../localization/query';
@@ -8,13 +9,13 @@ import { treeText } from '../../localization/tree';
89
import { f } from '../../utils/functools';
910
import type { RA } from '../../utils/types';
1011
import { ensure } from '../../utils/types';
12+
import { camelToHuman } from '../../utils/utils';
1113
import { genericTables } from '../DataModel/tables';
12-
import { Tables } from '../DataModel/types';
14+
import type { Tables } from '../DataModel/types';
15+
import type { QueryView } from '../QueryBuilder/Header';
1316
import type { StatLayout } from '../Statistics/types';
1417
import type { GenericPreferences } from './types';
1518
import { definePref } from './types';
16-
import { camelToHuman } from '../../utils/utils';
17-
import { QueryView } from '../QueryBuilder/Header';
1819

1920
const tableLabel = (tableName: keyof Tables): LocalizedString =>
2021
genericTables[tableName]?.label ?? camelToHuman(tableName);

specifyweb/frontend/js_src/lib/components/Preferences/index.tsx

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import type { LocalizedString } from 'typesafe-i18n';
99
import { usePromise } from '../../hooks/useAsyncState';
1010
import { useBooleanState } from '../../hooks/useBooleanState';
1111
import { commonText } from '../../localization/common';
12+
import { headerText } from '../../localization/header';
1213
import { preferencesText } from '../../localization/preferences';
1314
import { StringToJsx } from '../../localization/utils';
1415
import { f } from '../../utils/functools';
16+
import type { IR } from '../../utils/types';
1517
import { Container, H2, Key } from '../Atoms';
1618
import { Button } from '../Atoms/Button';
1719
import { className } from '../Atoms/className';
@@ -21,22 +23,20 @@ import { Submit } from '../Atoms/Submit';
2123
import { LoadingContext, ReadOnlyContext } from '../Core/Contexts';
2224
import { ErrorBoundary } from '../Errors/ErrorBoundary';
2325
import { hasPermission } from '../Permissions/helpers';
26+
import {
27+
ProtectedAction,
28+
ProtectedTool,
29+
} from '../Permissions/PermissionDenied';
2430
import { PreferencesAside } from './Aside';
31+
import type { BasePreferences } from './BasePreferences';
32+
import { collectionPreferenceDefinitions } from './CollectionDefinitions';
2533
import { collectionPreferences } from './collectionPreferences';
2634
import { useDarkMode } from './Hooks';
2735
import { DefaultPreferenceItemRender } from './Renderers';
2836
import type { GenericPreferences, PreferenceItem } from './types';
2937
import { userPreferenceDefinitions } from './UserDefinitions';
3038
import { userPreferences } from './userPreferences';
3139
import { useTopChild } from './useTopChild';
32-
import { IR } from '../../utils/types';
33-
import { headerText } from '../../localization/header';
34-
import { BasePreferences } from './BasePreferences';
35-
import {
36-
ProtectedAction,
37-
ProtectedTool,
38-
} from '../Permissions/PermissionDenied';
39-
import { collectionPreferenceDefinitions } from './CollectionDefinitions';
4040

4141
export type PreferenceType = keyof typeof preferenceInstances;
4242

@@ -142,9 +142,9 @@ function Preferences({
142142
>
143143
<PreferencesAside
144144
activeCategory={visibleChild}
145+
prefType={prefType}
145146
references={references}
146147
setActiveCategory={setVisibleChild}
147-
prefType={prefType}
148148
/>
149149
<PreferencesContent forwardRefs={forwardRefs} prefType={prefType} />
150150
<span className="flex-1" />
@@ -323,9 +323,7 @@ export function PreferencesContent({
323323
/>
324324
</p>
325325
{item.description !== undefined && (
326-
<p
327-
className={`flex flex-1 text-gray-500 md:text-right justify-end`}
328-
>
326+
<p className="flex flex-1 text-gray-500 md:text-right justify-end">
329327
{item.description !== undefined && (
330328
<FormatString
331329
text={
@@ -383,31 +381,29 @@ export function PreferencesContent({
383381
(
384382
[category, { title, description = undefined, subCategories }],
385383
index
386-
) => {
387-
return (
388-
<ErrorBoundary dismissible key={category}>
389-
<Container.Center
390-
className="gap-8 overflow-y-visible"
391-
forwardRef={forwardRefs?.bind(undefined, index)}
392-
id={category}
393-
>
394-
<h3 className="text-2xl">
395-
{typeof title === 'function' ? title() : title}
396-
</h3>
397-
{description !== undefined && (
398-
<p>
399-
{typeof description === 'function'
400-
? description()
401-
: description}
402-
</p>
403-
)}
404-
{subCategories.map(([subcategory, data]) =>
405-
renderSubCategory(category, subcategory, data)
406-
)}
407-
</Container.Center>
408-
</ErrorBoundary>
409-
);
410-
}
384+
) => (
385+
<ErrorBoundary dismissible key={category}>
386+
<Container.Center
387+
className="gap-8 overflow-y-visible"
388+
forwardRef={forwardRefs?.bind(undefined, index)}
389+
id={category}
390+
>
391+
<h3 className="text-2xl">
392+
{typeof title === 'function' ? title() : title}
393+
</h3>
394+
{description !== undefined && (
395+
<p>
396+
{typeof description === 'function'
397+
? description()
398+
: description}
399+
</p>
400+
)}
401+
{subCategories.map(([subcategory, data]) =>
402+
renderSubCategory(category, subcategory, data)
403+
)}
404+
</Container.Center>
405+
</ErrorBoundary>
406+
)
411407
)}
412408
</div>
413409
);
@@ -484,7 +480,7 @@ function UserPrefItem<T>(props: PreferenceItemProps<T>) {
484480
props.subcategory as any,
485481
props.name as any
486482
);
487-
return <ItemBase {...props} value={value} setValue={setValue} />;
483+
return <ItemBase {...props} setValue={setValue} value={value} />;
488484
}
489485

490486
function CollectionPrefItem<T>(props: PreferenceItemProps<T>) {
@@ -493,7 +489,7 @@ function CollectionPrefItem<T>(props: PreferenceItemProps<T>) {
493489
props.subcategory as any,
494490
props.name as any
495491
);
496-
return <ItemBase {...props} value={value} setValue={setValue} />;
492+
return <ItemBase {...props} setValue={setValue} value={value} />;
497493
}
498494

499495
function CollectionPreferences(): JSX.Element {

specifyweb/frontend/js_src/lib/components/TreeView/Actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import { DeleteButton } from '../Forms/DeleteButton';
2020
import { Dialog } from '../Molecules/Dialog';
2121
import { ResourceLink } from '../Molecules/ResourceLink';
2222
import { hasPermission, hasTablePermission } from '../Permissions/helpers';
23+
import { collectionPreferences } from '../Preferences/collectionPreferences';
2324
import type { Row } from './helpers';
2425
import { checkMoveViolatesEnforced } from './helpers';
25-
import { collectionPreferences } from '../Preferences/collectionPreferences';
2626

2727
const treeActions = [
2828
'add',

specifyweb/frontend/js_src/lib/components/WbImportAttachments/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ import { loadingBar } from '../Molecules';
3636
import { Dialog } from '../Molecules/Dialog';
3737
import { FilePicker } from '../Molecules/FilePicker';
3838
import { Preview } from '../Molecules/FilePicker';
39+
import { collectionPreferences } from '../Preferences/collectionPreferences';
3940
import { uniquifyDataSetName } from '../WbImport/helpers';
4041
import { ChooseName } from '../WbImport/index';
4142
import {
4243
ATTACHMENTS_COLUMN,
4344
attachmentsToCell,
4445
BASE_TABLE_NAME,
4546
} from '../WorkBench/attachmentHelpers';
46-
import { collectionPreferences } from '../Preferences/collectionPreferences';
4747

4848
export function WbImportAttachmentsView(): JSX.Element {
4949
useMenuItem('workBench');

0 commit comments

Comments
 (0)