mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix eslint warnings and cleanup unused disable-directives (#8718)
* Fix eslint warnings * Remove unused eslint disable-directives
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-empty-function */
|
||||
|
||||
import { Knex } from 'knex';
|
||||
import { User, SessionData } from '../types';
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import getDatabase, { getSchemaInspector } from '../database';
|
||||
import { systemCollectionRows } from '../database/system-data/collections';
|
||||
import env from '../env';
|
||||
import { ForbiddenException, InvalidPayloadException } from '../exceptions';
|
||||
import logger from '../logger';
|
||||
import { FieldsService } from '../services/fields';
|
||||
import { ItemsService, MutationOptions } from '../services/items';
|
||||
import Keyv from 'keyv';
|
||||
|
||||
@@ -6,13 +6,11 @@ import getDatabase from '../database';
|
||||
import runAST from '../database/run-ast';
|
||||
import emitter, { emitAsyncSafe } from '../emitter';
|
||||
import env from '../env';
|
||||
import { ForbiddenException, InvalidPayloadException } from '../exceptions';
|
||||
import { ForbiddenException } from '../exceptions';
|
||||
import { translateDatabaseError } from '../exceptions/database/translate';
|
||||
import logger from '../logger';
|
||||
import { Accountability, Query, PermissionsAction } from '@directus/shared/types';
|
||||
import { AbstractService, AbstractServiceOptions, Action, Item as AnyItem, PrimaryKey, SchemaOverview } from '../types';
|
||||
import getASTFromQuery from '../utils/get-ast-from-query';
|
||||
import { toArray } from '@directus/shared/utils';
|
||||
import { AuthorizationService } from './authorization';
|
||||
import { PayloadService } from './payload';
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export class MetaService {
|
||||
this.schema = options.schema;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
async getMetaForQuery(collection: string, query: any): Promise<Record<string, any> | undefined> {
|
||||
if (!query || !query.meta) return;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { appAccessMinimalPermissions } from '../database/system-data/app-access-permissions';
|
||||
import logger from '../logger';
|
||||
import { ItemsService, QueryOptions } from '../services/items';
|
||||
import { AbstractServiceOptions, Item, PrimaryKey } from '../types';
|
||||
import { Query, PermissionsAction } from '@directus/shared/types';
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { Knex } from 'knex';
|
||||
import { clone, cloneDeep } from 'lodash';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import getDatabase from '../database';
|
||||
import env from '../env';
|
||||
import { FailedValidationException } from '@directus/shared/exceptions';
|
||||
import { ForbiddenException, InvalidPayloadException, UnprocessableEntityException } from '../exceptions';
|
||||
import { RecordNotUniqueException } from '../exceptions/database/record-not-unique';
|
||||
import logger from '../logger';
|
||||
import { AbstractServiceOptions, Item, PrimaryKey, SchemaOverview } from '../types';
|
||||
import { Query } from '@directus/shared/types';
|
||||
import { Accountability } from '@directus/shared/types';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Knex } from 'knex';
|
||||
import { SchemaOverview } from '../types';
|
||||
import { Accountability } from '@directus/shared/types';
|
||||
import { Item, PrimaryKey } from './items';
|
||||
import { Query, PermissionsAction } from '@directus/shared/types';
|
||||
import { Query } from '@directus/shared/types';
|
||||
|
||||
export type AbstractServiceOptions = {
|
||||
knex?: Knex;
|
||||
|
||||
@@ -67,7 +67,10 @@ export default defineComponent({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
depth: Number,
|
||||
depth: {
|
||||
type: Number,
|
||||
default: undefined,
|
||||
},
|
||||
inject: {
|
||||
type: Object as PropType<{ fields: Field[]; collections: Collection[]; relations: Relation[] } | null>,
|
||||
default: () => ({ fields: [], collections: [], relations: [] }),
|
||||
|
||||
@@ -31,7 +31,10 @@ export default defineComponent({
|
||||
type: Object as PropType<FieldTree>,
|
||||
required: true,
|
||||
},
|
||||
depth: Number,
|
||||
depth: {
|
||||
type: Number,
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
emits: ['add'],
|
||||
setup() {
|
||||
|
||||
@@ -54,7 +54,10 @@ export default defineComponent({
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
depth: Number,
|
||||
depth: {
|
||||
type: Number,
|
||||
default: undefined,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: null,
|
||||
|
||||
@@ -46,14 +46,12 @@ export function usePopper(
|
||||
|
||||
function start() {
|
||||
return new Promise((resolve) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
popperInstance.value = createPopper(reference.value!, popper.value!, {
|
||||
placement: options.value.attached ? 'bottom-start' : options.value.placement,
|
||||
modifiers: getModifiers(resolve),
|
||||
strategy: 'fixed',
|
||||
});
|
||||
popperInstance.value.forceUpdate();
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
observer.observe(popper.value!, {
|
||||
attributes: false,
|
||||
childList: true,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import { FormField } from '@/components/v-form/types';
|
||||
import { getInterfaces } from '@/interfaces';
|
||||
import { Field, InterfaceConfig } from '@directus/shared/types';
|
||||
|
||||
@@ -16,6 +16,7 @@ export function getComparator(node: Record<string, any>): string {
|
||||
return getNodeName(get(node, getField(node)));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
export function fieldToFilter(field: string, operator: string, value: any): Record<string, any> {
|
||||
return fieldToFilterR(field.split('.'));
|
||||
|
||||
|
||||
@@ -249,7 +249,6 @@ export default defineComponent({
|
||||
const newDefaults: any = {};
|
||||
|
||||
props.fields.forEach((field) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
newDefaults[field.field!] = field.schema?.default_value;
|
||||
});
|
||||
|
||||
|
||||
@@ -191,7 +191,6 @@ export default defineComponent({
|
||||
// of the item and fetch it from the API to render the preview
|
||||
if (
|
||||
newValue !== null &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
newValue !== currentItem.value?.[relatedPrimaryKeyField.value!.field] &&
|
||||
(typeof newValue === 'string' || typeof newValue === 'number')
|
||||
) {
|
||||
|
||||
@@ -444,7 +444,6 @@ export default defineComponent({
|
||||
revisionsDrawerDetail.value?.refresh?.();
|
||||
|
||||
if (props.primaryKey === '+') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const newPrimaryKey = savedItem[primaryKeyField.value!.field];
|
||||
router.replace(`/collections/${props.collection}/${encodeURIComponent(newPrimaryKey)}`);
|
||||
}
|
||||
|
||||
@@ -349,7 +349,6 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const value: FormattedPreset = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
id: preset.value.id!,
|
||||
collection: preset.value.collection,
|
||||
layout: preset.value.layout,
|
||||
|
||||
@@ -393,7 +393,6 @@ export default defineComponent({
|
||||
revisionsDrawerDetail.value?.refresh?.();
|
||||
|
||||
if (props.primaryKey === '+') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const newPrimaryKey = savedItem.id;
|
||||
router.replace(`/users/${newPrimaryKey}`);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,6 @@ export const useFieldsStore = defineStore({
|
||||
},
|
||||
getPrimaryKeyFieldForCollection(collection: string): Field {
|
||||
/** @NOTE it's safe to assume every collection has a primary key */
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const primaryKeyField = this.fields.find(
|
||||
(field) => field.collection === collection && field.schema?.is_primary_key === true
|
||||
)!;
|
||||
|
||||
@@ -4,7 +4,6 @@ import { InvalidConfig, DriverNotSupported } from './exceptions';
|
||||
import { StorageManagerConfig, StorageManagerDiskConfig, StorageManagerSingleDiskConfig } from './types';
|
||||
|
||||
interface StorageConstructor<T extends Storage = Storage> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
new (...args: any[]): T;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user