-
I declare a new module in doc plugin: declare module '@theme/DocPage' {
import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs-types';
import type {DocumentRoute} from '@theme/DocItem';
export type Props = {
readonly location: {readonly pathname: string};
readonly versionMetadata: PropVersionMetadata;
readonly route: {
readonly path: string;
readonly component: () => JSX.Element;
readonly routes: readonly DocumentRoute[];
};
};
const DocPage: (props: Props) => JSX.Element;
export default DocPage;
}
/*---------------------------------
---------------- My codes ------------------
-------------------------------
*/
declare module '@theme/DocMainContainer' {
// ----------------------------------------
// ESLint complains by WebStorm IDE: ESLint: '@docusaurus/plugin-content-docs-types' imported multiple times.(import/no-duplicates)
//----------------------------------------
// eslint-disable-next-line import/no-duplicates
import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs-types';
// eslint-disable-next-line import/no-duplicates
import type {DocumentRoute} from '@theme/DocItem';
export type Props = {
readonly location: {readonly pathname: string};
readonly versionMetadata: PropVersionMetadata;
readonly route: {
readonly path: string;
readonly component: () => JSX.Element;
readonly routes: readonly DocumentRoute[];
};
};
const DocMainContainer: (props: Props) => JSX.Element;
export default DocMainContainer;
} But 25:19 warning Don't use `object` as a type. The `object` type is currently hard to use ([see this issue](https://github.com/microsoft/TypeScript/issues/21732)).
Consider using `Record<string, unknown>` instead, as it allows you to more easily inspect and use the keys @typescript-eslint/ban-types
93:42 error '@docusaurus/plugin-content-docs-types' imported multiple times import/no-duplicates
94:36 error '@theme/DocItem' imported multiple times import/no-duplicates
✖ 3 problems (2 errors, 1 warning)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
husky - pre-commit hook exited with code 1 (error) |
Beta Was this translation helpful? Give feedback.
Answered by
slorber
Mar 4, 2021
Replies: 1 comment
-
Are you working on your own site, or trying to contribute to docusaurus? Because we are not responsible for your site eslint config or your site pre-commit hooks. However, for contributing to Docusaurus, all commits are verified through ESLint, and must respect ESLint rules. This is not a bug, this is a feature to ensure you only commit code that respects our standards |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
inix
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you working on your own site, or trying to contribute to docusaurus?
Because we are not responsible for your site eslint config or your site pre-commit hooks.
However, for contributing to Docusaurus, all commits are verified through ESLint, and must respect ESLint rules. This is not a bug, this is a feature to ensure you only commit code that respects our standards