Skip to content

Commit

Permalink
fix: linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
moki committed Oct 25, 2023
1 parent 63a934e commit f800d37
Show file tree
Hide file tree
Showing 28 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/cmd/publish/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/publish/upload.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
10 changes: 5 additions & 5 deletions src/cmd/translate/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/xliff/compose.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/xliff/extract.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 10 in src/index.ts

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement

Expand Down
2 changes: 1 addition & 1 deletion src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/lintPage.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
10 changes: 5 additions & 5 deletions src/resolvers/md2html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/resolvers/md2md.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
4 changes: 2 additions & 2 deletions src/services/includers/batteries/generic.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
6 changes: 3 additions & 3 deletions src/services/includers/batteries/unarchive.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/services/includers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {IncludeMode} from '../../constants';
import {generic, sourcedocs, unarchive} from './batteries';

import type {
YfmPreset,
Includer,
YfmPreset,
YfmToc,
YfmTocInclude,
YfmTocIncluder,
Expand Down
4 changes: 2 additions & 2 deletions src/services/leading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/metadata.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/services/plugins.ts
Original file line number Diff line number Diff line change
@@ -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[];
Expand Down
10 changes: 5 additions & 5 deletions src/services/tocs.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<string, YfmToc>;
Expand Down
2 changes: 1 addition & 1 deletion src/steps/processExcludedFiles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {resolve, relative} from 'path';
import {relative, resolve} from 'path';
import walkSync from 'walk-sync';
import shell from 'shelljs';

Expand Down
6 changes: 3 additions & 3 deletions src/steps/processLinter.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
14 changes: 7 additions & 7 deletions src/steps/processPages.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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<string, SinglePageResult[]> = {};
const singlePagePaths: Record<string, Set<string>> = {};
Expand Down
2 changes: 1 addition & 1 deletion src/steps/processServiceFiles.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/steps/publishFilesToS3.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/utils/markup.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/singlePage.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/toc.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/vcs-connector/client/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion src/vcs-connector/index.ts
Original file line number Diff line number Diff line change
@@ -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<VCSConnector | undefined> {
const {connector} = ArgvService.getConfig();
Expand Down

0 comments on commit f800d37

Please sign in to comment.