refactor: enforce type import specifiers (#6230)

* refactor: enforce type import specifiers

* fix

* Upgrade esbuild

* Fix (haha)
This commit is contained in:
Joshua Chen 2021-12-31 21:17:09 +08:00 committed by GitHub
parent 24d65d9bdd
commit cb1aa30286
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
192 changed files with 484 additions and 337 deletions

View file

@ -6,7 +6,7 @@
*/
import {
BlogPostFrontMatter,
type BlogPostFrontMatter,
validateBlogPostFrontMatter,
} from '../blogFrontMatter';
import escapeStringRegexp from 'escape-string-regexp';

View file

@ -7,11 +7,11 @@
import path from 'path';
import {generateBlogFeed} from '../feed';
import {LoadContext, I18n} from '@docusaurus/types';
import {PluginOptions, BlogContentPaths} from '../types';
import type {LoadContext, I18n} from '@docusaurus/types';
import type {PluginOptions, BlogContentPaths} from '../types';
import {DEFAULT_OPTIONS} from '../pluginOptionSchema';
import {generateBlogPosts} from '../blogUtils';
import {Feed} from 'feed';
import type {Feed} from 'feed';
const DefaultI18N: I18n = {
currentLocale: 'en',

View file

@ -8,10 +8,10 @@
import fs from 'fs-extra';
import path from 'path';
import pluginContentBlog from '../index';
import {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
import type {DocusaurusConfig, LoadContext, I18n} from '@docusaurus/types';
import {PluginOptionSchema} from '../pluginOptionSchema';
import {PluginOptions, EditUrlFunction, BlogPost} from '../types';
import {Joi} from '@docusaurus/utils-validation';
import type {PluginOptions, EditUrlFunction, BlogPost} from '../types';
import type {Joi} from '@docusaurus/utils-validation';
import {posixPath} from '@docusaurus/utils';
function findByTitle(

View file

@ -7,8 +7,12 @@
import fs from 'fs-extra';
import path from 'path';
import {linkify, LinkifyParams, getSourceToPermalink} from '../blogUtils';
import {BlogBrokenMarkdownLink, BlogContentPaths, BlogPost} from '../types';
import {linkify, type LinkifyParams, getSourceToPermalink} from '../blogUtils';
import type {
BlogBrokenMarkdownLink,
BlogContentPaths,
BlogPost,
} from '../types';
const siteDir = path.join(__dirname, '__fixtures__', 'website');
const contentPaths: BlogContentPaths = {

View file

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
import {BlogPost, BlogContent, PluginOptions} from '../types';
import type {BlogPost, BlogContent, PluginOptions} from '../types';
import {getTranslationFiles, translateContent} from '../translations';
import {DEFAULT_OPTIONS} from '../pluginOptionSchema';
import {updateTranslationFileMessages} from '@docusaurus/utils';

View file

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

View file

@ -9,7 +9,7 @@ import fs from 'fs-extra';
import path from 'path';
import readingTime from 'reading-time';
import {keyBy, mapValues} from 'lodash';
import {
import type {
PluginOptions,
BlogPost,
BlogContentPaths,
@ -30,9 +30,9 @@ import {
groupTaggedItems,
getContentPathList,
} from '@docusaurus/utils';
import {LoadContext} from '@docusaurus/types';
import type {LoadContext} from '@docusaurus/types';
import {validateBlogPostFrontMatter} from './blogFrontMatter';
import {AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
import {type AuthorsMap, getAuthorsMap, getBlogPostAuthors} from './authors';
import logger from '@docusaurus/logger';
export function truncate(fileString: string, truncateMarker: RegExp): string {

View file

@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
import {Feed, Author as FeedAuthor, Item as FeedItem} from 'feed';
import {PluginOptions, Author, BlogPost, FeedType} from './types';
import {Feed, type Author as FeedAuthor, type Item as FeedItem} from 'feed';
import type {PluginOptions, Author, BlogPost, FeedType} from './types';
import {normalizeUrl, mdxToHtml} from '@docusaurus/utils';
import {DocusaurusConfig} from '@docusaurus/types';
import type {DocusaurusConfig} from '@docusaurus/types';
import path from 'path';
import fs from 'fs-extra';

View file

@ -22,7 +22,7 @@ import {
} from '@docusaurus/utils';
import {translateContent, getTranslationFiles} from './translations';
import {
import type {
PluginOptions,
BlogTags,
BlogContent,
@ -35,7 +35,7 @@ import {
Assets,
} from './types';
import {PluginOptionSchema} from './pluginOptionSchema';
import {
import type {
LoadContext,
ConfigureWebpackUtils,
Props,
@ -44,13 +44,13 @@ import {
OptionValidationContext,
ValidationResult,
} from '@docusaurus/types';
import {Configuration} from 'webpack';
import type {Configuration} from 'webpack';
import {
generateBlogPosts,
getSourceToPermalink,
getBlogTags,
} from './blogUtils';
import {BlogPostFrontMatter} from './blogFrontMatter';
import type {BlogPostFrontMatter} from './blogFrontMatter';
import {createBlogFeedFiles} from './feed';
export default async function pluginContentBlog(

View file

@ -7,7 +7,7 @@
import {truncate, linkify} from './blogUtils';
import {parseQuery} from 'loader-utils';
import {BlogMarkdownLoaderOptions} from './types';
import type {BlogMarkdownLoaderOptions} from './types';
import type {LoaderContext} from 'webpack';
export default function markdownLoader(

View file

@ -13,7 +13,7 @@ import {
URISchema,
} from '@docusaurus/utils-validation';
import {GlobExcludeDefault} from '@docusaurus/utils';
import {PluginOptions} from './types';
import type {PluginOptions} from './types';
export const DEFAULT_OPTIONS: PluginOptions = {
feedOptions: {type: ['rss', 'atom'], copyright: ''},

View file

@ -11,8 +11,8 @@ import type {
BrokenMarkdownLink,
ContentPaths,
} from '@docusaurus/utils/lib/markdownLinks';
import {Overwrite} from 'utility-types';
import {BlogPostFrontMatter} from './blogFrontMatter';
import type {Overwrite} from 'utility-types';
import type {BlogPostFrontMatter} from './blogFrontMatter';
export type BlogContentPaths = ContentPaths;