Fix remaining eslint errors

h/t @paescuj
This commit is contained in:
rijkvanzanten
2021-04-29 15:55:12 -04:00
parent 5b7bd55d68
commit 801e868554
308 changed files with 1031 additions and 1221 deletions

View File

@@ -1,13 +1,12 @@
import { knex, Knex } from 'knex';
import dotenv from 'dotenv';
import path from 'path';
import logger from '../logger';
import env from '../env';
import { validateEnv } from '../utils/validate-env';
import { performance } from 'perf_hooks';
import SchemaInspector from '@directus/schema';
import dotenv from 'dotenv';
import { knex, Knex } from 'knex';
import path from 'path';
import { performance } from 'perf_hooks';
import env from '../env';
import logger from '../logger';
import { getConfigFromEnv } from '../utils/get-config-from-env';
import { validateEnv } from '../utils/validate-env';
dotenv.config({ path: path.resolve(__dirname, '../../', '.env') });

View File

@@ -1,5 +1,5 @@
import { Knex } from 'knex';
import { uniq, merge } from 'lodash';
import { merge, uniq } from 'lodash';
const defaults = {
collection: null,

View File

@@ -1,7 +1,7 @@
import formatTitle from '@directus/format-title';
import fse from 'fs-extra';
import { Knex } from 'knex';
import path from 'path';
import formatTitle from '@directus/format-title';
import env from '../../env';
type Migration = {
@@ -29,7 +29,7 @@ export default async function run(database: Knex, direction: 'up' | 'down' | 'la
...customMigrationFiles.map((path) => parseFilePath(path, true)),
];
function parseFilePath(filePath: string, custom: boolean = false) {
function parseFilePath(filePath: string, custom = false) {
const version = filePath.split('-')[0];
const name = formatTitle(filePath.split('-').slice(1).join('_').split('.')[0]);
const completed = !!completedMigrations.find((migration) => migration.version === version);

View File

@@ -1,11 +1,11 @@
import { AST, NestedCollectionNode, FieldNode } from '../types/ast';
import { clone, cloneDeep, uniq, pick } from 'lodash';
import database from './index';
import { Query, Item, SchemaOverview } from '../types';
import { PayloadService } from '../services/payload';
import applyQuery from '../utils/apply-query';
import { Knex } from 'knex';
import { clone, cloneDeep, pick, uniq } from 'lodash';
import { PayloadService } from '../services/payload';
import { Item, Query, SchemaOverview } from '../types';
import { AST, FieldNode, NestedCollectionNode } from '../types/ast';
import applyQuery from '../utils/apply-query';
import { toArray } from '../utils/to-array';
import database from './index';
type RunASTOptions = {
/**
@@ -86,7 +86,7 @@ export default async function runAST(
const nestedNodes = applyParentFilters(nestedCollectionNodes, items);
for (const nestedNode of nestedNodes) {
let nestedItems = await runAST(nestedNode, schema, { knex, nested: true });
const nestedItems = await runAST(nestedNode, schema, { knex, nested: true });
if (nestedItems) {
// Merge all fetched nested records with the parent items
@@ -160,7 +160,7 @@ function getDBQuery(
schema: SchemaOverview,
nested?: boolean
): Knex.QueryBuilder {
let dbQuery = knex.select(columns.map((column) => `${table}.${column}`)).from(table);
const dbQuery = knex.select(columns.map((column) => `${table}.${column}`)).from(table);
const queryCopy = clone(query);

View File

@@ -1,9 +1,9 @@
import { Knex } from 'knex';
import fse from 'fs-extra';
import path from 'path';
import yaml from 'js-yaml';
import { Knex } from 'knex';
import { isObject } from 'lodash';
import path from 'path';
import { types } from '../../types';
import { isObject, merge } from 'lodash';
type TableSeed = {
table: string;

View File

@@ -1,6 +1,6 @@
import { requireYAML } from '../../../utils/require-yaml';
import { Permission } from '../../../types';
import { merge } from 'lodash';
import { Permission } from '../../../types';
import { requireYAML } from '../../../utils/require-yaml';
const defaults: Partial<Permission> = {
role: null,

View File

@@ -1,6 +1,6 @@
import { requireYAML } from '../../../utils/require-yaml';
import { merge } from 'lodash';
import { CollectionMeta } from '../../../types';
import { requireYAML } from '../../../utils/require-yaml';
const systemData = requireYAML(require.resolve('./collections.yaml'));

View File

@@ -1,13 +1,13 @@
import { requireYAML } from '../../../utils/require-yaml';
import { merge } from 'lodash';
import { FieldMeta } from '../../../types';
import fse from 'fs-extra';
import { merge } from 'lodash';
import path from 'path';
import { FieldMeta } from '../../../types';
import { requireYAML } from '../../../utils/require-yaml';
const defaults = requireYAML(require.resolve('./_defaults.yaml'));
const fieldData = fse.readdirSync(path.resolve(__dirname));
export let systemFieldRows: FieldMeta[] = [];
export const systemFieldRows: FieldMeta[] = [];
for (const filepath of fieldData) {
if (filepath.includes('_defaults') || filepath.includes('index')) continue;

View File

@@ -1,6 +1,6 @@
import { requireYAML } from '../../../utils/require-yaml';
import { merge } from 'lodash';
import { Relation } from '../../../types';
import { requireYAML } from '../../../utils/require-yaml';
const systemData = requireYAML(require.resolve('./relations.yaml'));