From f800d37f8e016a7f5f036a0386a40b738d9477f2 Mon Sep 17 00:00:00 2001 From: moki Date: Thu, 26 Oct 2023 02:32:47 +0400 Subject: [PATCH] fix: linting errors --- src/cmd/publish/index.ts | 2 +- src/cmd/publish/upload.ts | 4 ++-- src/cmd/translate/index.ts | 10 +++++----- src/cmd/xliff/compose.ts | 2 +- src/cmd/xliff/extract.ts | 4 ++-- src/index.ts | 2 +- src/models.ts | 2 +- src/resolvers/lintPage.ts | 2 +- src/resolvers/md2html.ts | 10 +++++----- src/resolvers/md2md.ts | 4 ++-- src/services/includers/batteries/generic.ts | 4 ++-- src/services/includers/batteries/unarchive.ts | 6 +++--- src/services/includers/index.ts | 2 +- src/services/leading.ts | 4 ++-- src/services/metadata.ts | 4 ++-- src/services/plugins.ts | 4 ++-- src/services/tocs.ts | 10 +++++----- src/steps/processExcludedFiles.ts | 2 +- src/steps/processLinter.ts | 6 +++--- src/steps/processPages.ts | 14 +++++++------- src/steps/processServiceFiles.ts | 2 +- src/steps/publishFilesToS3.ts | 2 +- src/utils/markup.ts | 4 ++-- src/utils/singlePage.ts | 2 +- src/utils/toc.ts | 2 +- src/validator.ts | 2 +- src/vcs-connector/client/github.ts | 4 ++-- src/vcs-connector/index.ts | 2 +- 28 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/cmd/publish/index.ts b/src/cmd/publish/index.ts index 227d3697b..eb3d40e0b 100644 --- a/src/cmd/publish/index.ts +++ b/src/cmd/publish/index.ts @@ -2,7 +2,7 @@ import {join} from 'path'; import {ArgvService} from '../../services'; import {logger} from '../../utils'; -import {Argv, Arguments} from 'yargs'; +import {Arguments, Argv} from 'yargs'; import {upload} from './upload'; diff --git a/src/cmd/publish/upload.ts b/src/cmd/publish/upload.ts index bf006491f..b0ac70ead 100644 --- a/src/cmd/publish/upload.ts +++ b/src/cmd/publish/upload.ts @@ -1,7 +1,7 @@ import {createReadStream} from 'fs'; import walkSync from 'walk-sync'; -import {resolve, join} from 'path'; -import {S3Client, PutObjectCommand} from '@aws-sdk/client-s3'; +import {join, resolve} from 'path'; +import {PutObjectCommand, S3Client} from '@aws-sdk/client-s3'; import mime from 'mime-types'; import {convertBackSlashToSlash, logger} from '../../utils'; diff --git a/src/cmd/translate/index.ts b/src/cmd/translate/index.ts index 65f976a07..137ec7d1e 100644 --- a/src/cmd/translate/index.ts +++ b/src/cmd/translate/index.ts @@ -1,14 +1,14 @@ -import {eachLimit, retry, asyncify} from 'async'; +import {asyncify, eachLimit, retry} from 'async'; -import {dirname, resolve, join} from 'path'; -import {readFile, writeFile, mkdir} from 'fs/promises'; +import {dirname, join, resolve} from 'path'; +import {mkdir, readFile, writeFile} from 'fs/promises'; import {XMLParser} from 'fast-xml-parser'; import {Session} from '@yandex-cloud/nodejs-sdk/dist/session'; import {TranslationServiceClient} from '@yandex-cloud/nodejs-sdk/dist/generated/yandex/cloud/service_clients'; import { - TranslateRequest, TranslateRequest_Format as Format, + TranslateRequest, } from '@yandex-cloud/nodejs-sdk/dist/generated/yandex/cloud/ai/translate/v2/translation_service'; import markdownTranslation from '@diplodoc/markdown-translation'; @@ -17,7 +17,7 @@ import {ArgvService} from '../../services'; import {getYandexOAuthToken} from '../../packages/credentials'; import {glob, logger} from '../../utils'; -import {Argv, Arguments} from 'yargs'; +import {Arguments, Argv} from 'yargs'; import {YandexCloudTranslateGlossaryPair} from '../../models'; diff --git a/src/cmd/xliff/compose.ts b/src/cmd/xliff/compose.ts index 17156ad1e..6598cdb1a 100644 --- a/src/cmd/xliff/compose.ts +++ b/src/cmd/xliff/compose.ts @@ -1,7 +1,7 @@ const { promises: {readFile, writeFile, mkdir}, } = require('fs'); -import {join, extname, dirname} from 'path'; +import {dirname, extname, join} from 'path'; import markdownTranslation, {ComposeParameters} from '@diplodoc/markdown-translation'; import {Arguments, Argv} from 'yargs'; diff --git a/src/cmd/xliff/extract.ts b/src/cmd/xliff/extract.ts index 3d0101c15..54f4d680d 100644 --- a/src/cmd/xliff/extract.ts +++ b/src/cmd/xliff/extract.ts @@ -1,11 +1,11 @@ const { promises: {readFile, writeFile, mkdir}, } = require('fs'); -import {join, dirname, extname} from 'path'; +import {dirname, extname, join} from 'path'; import markdownTranslation, {ExtractParameters} from '@diplodoc/markdown-translation'; import {Arguments, Argv} from 'yargs'; -import {eachLimit, asyncify} from 'async'; +import {asyncify, eachLimit} from 'async'; import {ArgvService} from '../../services'; import {glob, logger} from '../../utils'; diff --git a/src/index.ts b/src/index.ts index 4ae3c5fea..944a6bc91 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ import 'threads/register'; import {MAIN_TIMER_ID} from './constants'; -import {build, xliff, translate, publish} from './cmd'; +import {build, publish, translate, xliff} from './cmd'; console.time(MAIN_TIMER_ID); diff --git a/src/models.ts b/src/models.ts index 669da947a..4f8877da2 100644 --- a/src/models.ts +++ b/src/models.ts @@ -2,7 +2,7 @@ import {Logger} from '@diplodoc/transform/lib/log'; import {LintConfig} from '@diplodoc/transform/lib/yfmlint'; import {FileContributors, VCSConnector, VCSConnectorConfig} from './vcs-connector/connector-models'; -import {Lang, Stage, IncludeMode, ResourceType} from './constants'; +import {IncludeMode, Lang, ResourceType, Stage} from './constants'; import {ChangelogItem} from '@diplodoc/transform/lib/plugins/changelog/types'; export type VarsPreset = 'internal' | 'external'; diff --git a/src/resolvers/lintPage.ts b/src/resolvers/lintPage.ts index 287c891eb..f795bb2e7 100644 --- a/src/resolvers/lintPage.ts +++ b/src/resolvers/lintPage.ts @@ -1,9 +1,9 @@ import {dirname, relative, resolve} from 'path'; import log from '@diplodoc/transform/lib/log'; import { - default as yfmlint, LintMarkdownFunctionOptions, PluginOptions, + default as yfmlint, } from '@diplodoc/transform/lib/yfmlint'; import {readFileSync} from 'fs'; import {bold} from 'chalk'; diff --git a/src/resolvers/md2html.ts b/src/resolvers/md2html.ts index 5716ecc49..0918de385 100644 --- a/src/resolvers/md2html.ts +++ b/src/resolvers/md2html.ts @@ -6,16 +6,16 @@ import transform, {Output} from '@diplodoc/transform'; import log from '@diplodoc/transform/lib/log'; import liquid from '@diplodoc/transform/lib/liquid'; -import {ResolverOptions, YfmToc, ResolveMd2HTMLResult, LeadingPage} from '../models'; -import {ArgvService, TocService, PluginService} from '../services'; +import {LeadingPage, ResolveMd2HTMLResult, ResolverOptions, YfmToc} from '../models'; +import {ArgvService, PluginService, TocService} from '../services'; import { generateStaticMarkup, - logger, - transformToc, getVarsPerFile, getVarsPerRelativeFile, + logger, + transformToc, } from '../utils'; -import {PROCESSING_FINISHED, Lang} from '../constants'; +import {Lang, PROCESSING_FINISHED} from '../constants'; import {getAssetsPublicPath, getUpdatedMetadata} from '../services/metadata'; import {MarkdownItPluginCb} from '@diplodoc/transform/lib/plugins/typings'; diff --git a/src/resolvers/md2md.ts b/src/resolvers/md2md.ts index e684a7754..d08d3cdc2 100644 --- a/src/resolvers/md2md.ts +++ b/src/resolvers/md2md.ts @@ -1,11 +1,11 @@ import {existsSync, readFileSync, writeFileSync} from 'fs'; -import {dirname, resolve, join, basename, extname} from 'path'; +import {basename, dirname, extname, join, resolve} from 'path'; import shell from 'shelljs'; import log from '@diplodoc/transform/lib/log'; import liquid from '@diplodoc/transform/lib/liquid'; import {ArgvService, PluginService} from '../services'; -import {logger, getVarsPerFile} from '../utils'; +import {getVarsPerFile, logger} from '../utils'; import {PluginOptions, ResolveMd2MdOptions} from '../models'; import {PROCESSING_FINISHED} from '../constants'; import {getContentWithUpdatedMetadata} from '../services/metadata'; diff --git a/src/services/includers/batteries/generic.ts b/src/services/includers/batteries/generic.ts index 5fe5c40b5..de3ee5e2b 100644 --- a/src/services/includers/batteries/generic.ts +++ b/src/services/includers/batteries/generic.ts @@ -1,5 +1,5 @@ -import {readFile, writeFile, mkdir} from 'fs/promises'; -import {parse, join, dirname} from 'path'; +import {mkdir, readFile, writeFile} from 'fs/promises'; +import {dirname, join, parse} from 'path'; import {updateWith} from 'lodash'; import {dump} from 'js-yaml'; diff --git a/src/services/includers/batteries/unarchive.ts b/src/services/includers/batteries/unarchive.ts index 99a741a32..9de15a254 100644 --- a/src/services/includers/batteries/unarchive.ts +++ b/src/services/includers/batteries/unarchive.ts @@ -1,6 +1,6 @@ -import {mkdirSync, createReadStream, createWriteStream} from 'fs'; -import {join, dirname} from 'path'; -import {extract, Headers} from 'tar-stream'; +import {createReadStream, createWriteStream, mkdirSync} from 'fs'; +import {dirname, join} from 'path'; +import {Headers, extract} from 'tar-stream'; import type {PassThrough} from 'stream'; diff --git a/src/services/includers/index.ts b/src/services/includers/index.ts index de103322b..402c3f22f 100644 --- a/src/services/includers/index.ts +++ b/src/services/includers/index.ts @@ -7,8 +7,8 @@ import {IncludeMode} from '../../constants'; import {generic, sourcedocs, unarchive} from './batteries'; import type { - YfmPreset, Includer, + YfmPreset, YfmToc, YfmTocInclude, YfmTocIncluder, diff --git a/src/services/leading.ts b/src/services/leading.ts index 85dd36a89..d785a9967 100644 --- a/src/services/leading.ts +++ b/src/services/leading.ts @@ -6,11 +6,11 @@ import log from '@diplodoc/transform/lib/log'; import {ArgvService, PresetService} from './index'; import {LeadingPage} from '../models'; import { - filterTextItems, filterFiles, + filterTextItems, firstFilterTextItems, - liquidFields, liquidField, + liquidFields, } from './utils'; function filterFile(path: string) { diff --git a/src/services/metadata.ts b/src/services/metadata.ts index b9a09231b..56a5dcc51 100644 --- a/src/services/metadata.ts +++ b/src/services/metadata.ts @@ -1,7 +1,7 @@ import {dump} from 'js-yaml'; import {VCSConnector} from '../vcs-connector/connector-models'; -import {Metadata, MetaDataOptions, Resources} from '../models'; +import {MetaDataOptions, Metadata, Resources} from '../models'; import { getAuthorDetails, updateAuthorMetadataStringByAuthorLogin, @@ -10,7 +10,7 @@ import { import {getFileContributorsMetadata, getFileContributorsString} from './contributors'; import {isObject} from './utils'; import {сarriage} from '../utils'; -import {metadataBorder, REGEXP_AUTHOR} from '../constants'; +import {REGEXP_AUTHOR, metadataBorder} from '../constants'; import {dirname, relative, resolve} from 'path'; import {ArgvService} from './index'; diff --git a/src/services/plugins.ts b/src/services/plugins.ts index fadb9a0b9..b941a0ab5 100644 --- a/src/services/plugins.ts +++ b/src/services/plugins.ts @@ -1,6 +1,6 @@ -import {LintRule, LintConfig} from '@diplodoc/transform/lib/yfmlint'; +import {LintConfig, LintRule} from '@diplodoc/transform/lib/yfmlint'; -import {PluginOptions, Plugin, CollectionOfPluginsFunction} from '../models'; +import {CollectionOfPluginsFunction, Plugin, PluginOptions} from '../models'; import {YFM_PLUGINS} from '../constants'; let plugins: Function[] | Plugin[]; diff --git a/src/services/tocs.ts b/src/services/tocs.ts index a3ec8f303..2f02156bc 100644 --- a/src/services/tocs.ts +++ b/src/services/tocs.ts @@ -1,6 +1,6 @@ -import {dirname, extname, join, parse, resolve, relative, normalize, sep} from 'path'; -import {copyFileSync, readFileSync, writeFileSync, existsSync} from 'fs'; -import {load, dump} from 'js-yaml'; +import {dirname, extname, join, normalize, parse, relative, resolve, sep} from 'path'; +import {copyFileSync, existsSync, readFileSync, writeFileSync} from 'fs'; +import {dump, load} from 'js-yaml'; import shell from 'shelljs'; import walkSync from 'walk-sync'; import liquid from '@diplodoc/transform/lib/liquid'; @@ -10,10 +10,10 @@ import {bold} from 'chalk'; import {ArgvService, PresetService} from './index'; import {getContentWithUpdatedStaticMetadata} from './metadata'; import {YfmToc} from '../models'; -import {Stage, IncludeMode} from '../constants'; +import {IncludeMode, Stage} from '../constants'; import {isExternalHref, logger} from '../utils'; import {filterFiles, firstFilterTextItems, liquidField} from './utils'; -import {applyIncluders, IncludersError} from './includers'; +import {IncludersError, applyIncluders} from './includers'; export interface TocServiceData { storage: Map; diff --git a/src/steps/processExcludedFiles.ts b/src/steps/processExcludedFiles.ts index 4c7715fb0..7dfbc6835 100644 --- a/src/steps/processExcludedFiles.ts +++ b/src/steps/processExcludedFiles.ts @@ -1,4 +1,4 @@ -import {resolve, relative} from 'path'; +import {relative, resolve} from 'path'; import walkSync from 'walk-sync'; import shell from 'shelljs'; diff --git a/src/steps/processLinter.ts b/src/steps/processLinter.ts index 8d0e15c86..13c3c0501 100644 --- a/src/steps/processLinter.ts +++ b/src/steps/processLinter.ts @@ -1,11 +1,11 @@ import log from '@diplodoc/transform/lib/log'; -import {spawn, Worker, Thread} from 'threads'; +import {Thread, Worker, spawn} from 'threads'; import {extname} from 'path'; -import {ArgvService, TocService, PresetService, PluginService} from '../services'; +import {ArgvService, PluginService, PresetService, TocService} from '../services'; import {ProcessLinterWorker} from '../workers/linter'; import {logger} from '../utils'; -import {LINTING_FINISHED, WORKERS_COUNT, MIN_CHUNK_SIZE} from '../constants'; +import {LINTING_FINISHED, MIN_CHUNK_SIZE, WORKERS_COUNT} from '../constants'; import {lintPage} from '../resolvers'; import {splitOnChunks} from '../utils/worker'; diff --git a/src/steps/processPages.ts b/src/steps/processPages.ts index 99834a674..f80c1df7c 100644 --- a/src/steps/processPages.ts +++ b/src/steps/processPages.ts @@ -1,14 +1,14 @@ import type {DocInnerProps} from '@diplodoc/client'; -import {basename, dirname, extname, resolve, join, relative} from 'path'; +import {basename, dirname, extname, join, relative, resolve} from 'path'; import shell from 'shelljs'; import {copyFileSync, readFileSync, writeFileSync} from 'fs'; import {bold} from 'chalk'; import {dump, load} from 'js-yaml'; -import {mapLimit, asyncify} from 'async'; +import {asyncify, mapLimit} from 'async'; import log from '@diplodoc/transform/lib/log'; -import {ArgvService, LeadingService, TocService, PluginService} from '../services'; +import {ArgvService, LeadingService, PluginService, TocService} from '../services'; import {resolveMd2HTML, resolveMd2Md} from '../resolvers'; import { generateStaticMarkup, @@ -17,16 +17,16 @@ import { transformTocForSinglePage, } from '../utils'; import { + LeadingPage, MetaDataOptions, - SinglePageResult, PathData, - YfmToc, Resources, - LeadingPage, + SinglePageResult, + YfmToc, } from '../models'; import {VCSConnector} from '../vcs-connector/connector-models'; import {getVCSConnector} from '../vcs-connector'; -import {SINGLE_PAGE_FILENAME, SINGLE_PAGE_DATA_FILENAME, Lang, ResourceType} from '../constants'; +import {Lang, ResourceType, SINGLE_PAGE_DATA_FILENAME, SINGLE_PAGE_FILENAME} from '../constants'; const singlePageResults: Record = {}; const singlePagePaths: Record> = {}; diff --git a/src/steps/processServiceFiles.ts b/src/steps/processServiceFiles.ts index 7ae63f13d..d5bc321a7 100644 --- a/src/steps/processServiceFiles.ts +++ b/src/steps/processServiceFiles.ts @@ -1,7 +1,7 @@ import {dirname, resolve} from 'path'; import walkSync from 'walk-sync'; import {readFileSync, writeFileSync} from 'fs'; -import {load, dump} from 'js-yaml'; +import {dump, load} from 'js-yaml'; import log from '@diplodoc/transform/lib/log'; import {ArgvService, PresetService, TocService} from '../services'; diff --git a/src/steps/publishFilesToS3.ts b/src/steps/publishFilesToS3.ts index 87aa0eb49..70c05a32c 100644 --- a/src/steps/publishFilesToS3.ts +++ b/src/steps/publishFilesToS3.ts @@ -1,6 +1,6 @@ import {readFileSync} from 'fs'; import walkSync from 'walk-sync'; -import {resolve, join} from 'path'; +import {join, resolve} from 'path'; import S3 from 'aws-sdk/clients/s3'; import mime from 'mime-types'; diff --git a/src/utils/markup.ts b/src/utils/markup.ts index 988e60735..e395f9e12 100644 --- a/src/utils/markup.ts +++ b/src/utils/markup.ts @@ -1,10 +1,10 @@ import {platform} from 'process'; import {CUSTOM_STYLE, Platforms, ResourceType} from '../constants'; -import {SinglePageResult, Resources} from '../models'; +import {Resources, SinglePageResult} from '../models'; import {ArgvService, PluginService} from '../services'; import {preprocessPageHtmlForSinglePage} from './singlePage'; -import {render, DocInnerProps, DocPageData} from '@diplodoc/client'; +import {DocInnerProps, DocPageData, render} from '@diplodoc/client'; import client from '../../scripts/client'; export interface TitleMeta { diff --git a/src/utils/singlePage.ts b/src/utils/singlePage.ts index 46672872f..f3799e999 100644 --- a/src/utils/singlePage.ts +++ b/src/utils/singlePage.ts @@ -1,6 +1,6 @@ import HTMLElement from 'node-html-parser/dist/nodes/html'; import {parse} from 'node-html-parser'; -import {resolve, sep, relative} from 'path'; +import {relative, resolve, sep} from 'path'; import {resolveRelativePath} from '@diplodoc/transform/lib/utilsFS'; import url from 'url'; import _ from 'lodash'; diff --git a/src/utils/toc.ts b/src/utils/toc.ts index fa7bfae8d..65ef1a0fe 100644 --- a/src/utils/toc.ts +++ b/src/utils/toc.ts @@ -1,4 +1,4 @@ -import {relative, dirname, basename, extname, format, join} from 'path'; +import {basename, dirname, extname, format, join, relative} from 'path'; import {YfmToc} from '../models'; import {filterFiles} from '../services/utils'; diff --git a/src/validator.ts b/src/validator.ts index 6f7ef6860..f02892444 100644 --- a/src/validator.ts +++ b/src/validator.ts @@ -4,7 +4,7 @@ import {readFileSync} from 'fs'; import {load} from 'js-yaml'; import merge from 'lodash/merge'; import log from '@diplodoc/transform/lib/log'; -import {REDIRECTS_FILENAME, LINT_CONFIG_FILENAME, YFM_CONFIG_FILENAME} from './constants'; +import {LINT_CONFIG_FILENAME, REDIRECTS_FILENAME, YFM_CONFIG_FILENAME} from './constants'; import {ConnectorValidatorProps} from './vcs-connector/connector-models'; function notEmptyStringValidator(value: unknown): Boolean { diff --git a/src/vcs-connector/client/github.ts b/src/vcs-connector/client/github.ts index 9fcf25e57..b3dd5ad10 100644 --- a/src/vcs-connector/client/github.ts +++ b/src/vcs-connector/client/github.ts @@ -2,10 +2,10 @@ import log from '@diplodoc/transform/lib/log'; import {Octokit} from '@octokit/core'; import {ArgvService} from '../../services'; import { - GithubCommitDTO, GitHubConnectorFields, - SourceType, + GithubCommitDTO, GithubUserDTO, + SourceType, } from '../connector-models'; import {validateConnectorFields} from '../connector-validator'; diff --git a/src/vcs-connector/index.ts b/src/vcs-connector/index.ts index cfef71737..a3cfd8d35 100644 --- a/src/vcs-connector/index.ts +++ b/src/vcs-connector/index.ts @@ -1,6 +1,6 @@ import {ArgvService} from '../services'; import getGitHubVCSConnector from './github'; -import {VCSConnector, SourceType} from './connector-models'; +import {SourceType, VCSConnector} from './connector-models'; export async function getVCSConnector(): Promise { const {connector} = ArgvService.getConfig();