chore: enable import/order rule (#7418)

This commit is contained in:
Joshua Chen 2022-05-14 23:39:50 +08:00 committed by GitHub
parent a4c54aba45
commit 0838884f67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
300 changed files with 712 additions and 727 deletions

View file

@ -5,13 +5,13 @@
* LICENSE file in the root directory of this source tree.
*/
import path from 'path';
import {
type AuthorsMap,
getAuthorsMap,
getBlogPostAuthors,
validateAuthorsMap,
} from '../authors';
import path from 'path';
describe('getBlogPostAuthors', () => {
it('can read no authors', () => {

View file

@ -6,6 +6,8 @@
*/
import {jest} from '@jest/globals';
import fs from 'fs-extra';
import path from 'path';
import {
truncate,
parseBlogFileName,
@ -14,13 +16,8 @@ import {
paginateBlogPosts,
type LinkifyParams,
} from '../blogUtils';
import fs from 'fs-extra';
import path from 'path';
import type {
BlogBrokenMarkdownLink,
BlogContentPaths,
BlogPost,
} from '../types';
import type {BlogBrokenMarkdownLink, BlogContentPaths} from '../types';
import type {BlogPost} from '@docusaurus/plugin-content-blog';
describe('truncate', () => {
it('truncates texts', () => {

View file

@ -8,11 +8,11 @@
import {jest} from '@jest/globals';
import path from 'path';
import fs from 'fs-extra';
import {DEFAULT_OPTIONS} from '../options';
import {generateBlogPosts} from '../blogUtils';
import {createBlogFeedFiles} from '../feed';
import type {LoadContext, I18n} from '@docusaurus/types';
import type {BlogContentPaths} from '../types';
import {DEFAULT_OPTIONS} from '../options';
import {generateBlogPosts} from '../blogUtils';
import type {PluginOptions} from '@docusaurus/plugin-content-blog';
const DefaultI18N: I18n = {

View file

@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {validateBlogPostFrontMatter} from '../frontMatter';
import escapeStringRegexp from 'escape-string-regexp';
import {validateBlogPostFrontMatter} from '../frontMatter';
import type {BlogPostFrontMatter} from '@docusaurus/plugin-content-blog';
// TODO this abstraction reduce verbosity but it makes it harder to debug

View file

@ -7,13 +7,13 @@
import {jest} from '@jest/globals';
import path from 'path';
import pluginContentBlog from '../index';
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
import {validateOptions} from '../options';
import type {BlogPost} from '../types';
import {normalizePluginOptions} from '@docusaurus/utils-validation';
import {posixPath, getFileCommitDate} from '@docusaurus/utils';
import pluginContentBlog from '../index';
import {validateOptions} from '../options';
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
import type {
BlogPost,
PluginOptions,
EditUrlFunction,
} from '@docusaurus/plugin-content-blog';

View file

@ -5,8 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/
import {validateOptions, DEFAULT_OPTIONS} from '../options';
import {normalizePluginOptions} from '@docusaurus/utils-validation';
import {validateOptions, DEFAULT_OPTIONS} from '../options';
import type {Options} from '@docusaurus/plugin-content-blog';
function testValidate(options: Options) {

View file

@ -5,11 +5,14 @@
* LICENSE file in the root directory of this source tree.
*/
import type {BlogPost, BlogContent} from '../types';
import {updateTranslationFileMessages} from '@docusaurus/utils';
import {getTranslationFiles, translateContent} from '../translations';
import {DEFAULT_OPTIONS} from '../options';
import {updateTranslationFileMessages} from '@docusaurus/utils';
import type {PluginOptions} from '@docusaurus/plugin-content-blog';
import type {
PluginOptions,
BlogPost,
BlogContent,
} from '@docusaurus/plugin-content-blog';
const sampleBlogOptions: PluginOptions = {
...DEFAULT_OPTIONS,

View file

@ -5,9 +5,9 @@
* LICENSE file in the root directory of this source tree.
*/
import type {BlogContentPaths} from './types';
import {getDataFileData} from '@docusaurus/utils';
import {Joi, URISchema} from '@docusaurus/utils-validation';
import type {BlogContentPaths} from './types';
import type {
Author,
BlogPostFrontMatter,

View file

@ -7,9 +7,9 @@
import fs from 'fs-extra';
import path from 'path';
import readingTime from 'reading-time';
import _ from 'lodash';
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
import logger from '@docusaurus/logger';
import readingTime from 'reading-time';
import {
parseMarkdownString,
normalizeUrl,
@ -24,10 +24,9 @@ import {
getFileCommitDate,
getContentPathList,
} from '@docusaurus/utils';
import type {LoadContext} from '@docusaurus/types';
import {validateBlogPostFrontMatter} from './frontMatter';
import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
import logger from '@docusaurus/logger';
import type {LoadContext} from '@docusaurus/types';
import type {
PluginOptions,
ReadingTimeFunction,
@ -35,6 +34,7 @@ import type {
BlogTags,
BlogPaginated,
} from '@docusaurus/plugin-content-blog';
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
export function truncate(fileString: string, truncateMarker: RegExp): string {
return fileString.split(truncateMarker, 1).shift()!;

View file

@ -5,20 +5,20 @@
* LICENSE file in the root directory of this source tree.
*/
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils';
import {load as cheerioLoad} from 'cheerio';
import type {DocusaurusConfig} from '@docusaurus/types';
import path from 'path';
import fs from 'fs-extra';
import logger from '@docusaurus/logger';
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
import {normalizeUrl, readOutputHTMLFile} from '@docusaurus/utils';
import {blogPostContainerID} from '@docusaurus/utils-common';
import {load as cheerioLoad} from 'cheerio';
import type {DocusaurusConfig} from '@docusaurus/types';
import type {
FeedType,
PluginOptions,
Author,
BlogPost,
} from '@docusaurus/plugin-content-blog';
import {blogPostContainerID} from '@docusaurus/utils-common';
import logger from '@docusaurus/logger';
async function generateBlogFeed({
blogPosts,

View file

@ -6,8 +6,6 @@
*/
import path from 'path';
import admonitions from 'remark-admonitions';
import footnoteIDFixer from './remark/footnoteIDFixer';
import {
normalizeUrl,
docuHash,
@ -23,17 +21,19 @@ import {
type TagsListItem,
type TagModule,
} from '@docusaurus/utils';
import {translateContent, getTranslationFiles} from './translations';
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
import admonitions from 'remark-admonitions';
import {
generateBlogPosts,
getSourceToPermalink,
getBlogTags,
paginateBlogPosts,
} from './blogUtils';
import footnoteIDFixer from './remark/footnoteIDFixer';
import {translateContent, getTranslationFiles} from './translations';
import {createBlogFeedFiles} from './feed';
import type {BlogContentPaths, BlogMarkdownLoaderOptions} from './types';
import type {LoadContext, Plugin, HtmlTags} from '@docusaurus/types';
import type {
PluginOptions,
BlogPostFrontMatter,

View file

@ -538,11 +538,11 @@ declare module '@theme/BlogTagsListPage' {
}
declare module '@theme/BlogTagsPostsPage' {
import type {Content} from '@theme/BlogPostPage';
import type {
BlogSidebar,
BlogPaginatedMetadata,
} from '@docusaurus/plugin-content-blog';
import type {Content} from '@theme/BlogPostPage';
import type {TagModule} from '@docusaurus/utils';
export interface Props {