Giter Club home page Giter Club logo

typedoc-plugin-rename-defaults's Introduction

typedoc-plugin-rename-defaults

A TypeDoc plugin that renames the default exports to their original name.

Why?

Since TypeDoc 0.20, the default exports fields do not get documented with their original names, but with the name "default". This plugin restores the behavior of TypeDoc 0.19 by keeping the original field name in the documentation. See typedoc#1521 for more context.

Usage

Install the plugin:

npm install --save-dev typedoc-plugin-rename-defaults

Then, add --plugin typedoc-plugin-rename-defaults (required since TypeDoc 0.24) and --entrypointStrategy expand (required since TypeDoc 0.22) to the typedoc command. Example:

// package.json

{
  "scripts": {
    "build-docs": "typedoc --plugin typedoc-plugin-rename-defaults --entryPointStrategy expand src/"
  }
}

Credits

The initial implementation of this plugin was proposed by @Gerrit0 at typedoc#1521.

typedoc-plugin-rename-defaults's People

Contributors

axeemhaider avatar felipecrs avatar hiimjustin000 avatar izelnakri avatar jcbhmr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

typedoc-plugin-rename-defaults's Issues

Does not work with unnamed defaults

This is a great plugin. I had many default exports which were listed in my typedoc as 'default'. After installing your plugin, it fixed all of them but one. One 'default' made it into the docs.

Rather than the usual:
const myFunc = () => {}
export default myFunc

I had a function with the following pattern:
export default () => {}

I solved this by giving the function a name, but it might be nice if code formatted like this get the default function name from the filename, which would be the regular convention for this type of default export.

Thanks

Can't support typedoc version 0.21.X

Console output these when I installing this package

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: ***@1.0.0
npm ERR! Found: [email protected]
npm ERR! node_modules/typedoc
npm ERR!   dev typedoc@"^0.21.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typedoc@"0.20.x" from [email protected]
npm ERR! node_modules/typedoc-plugin-rename-defaults
npm ERR!   dev typedoc-plugin-rename-defaults@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\***\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\***\AppData\Local\npm-cache\_logs\2021-08-07T10_27_27_319Z-debug.log

whats the best name for the default export?

this is to get a feel for what others thing the default name should be so i dont get stuck in my opinion bubble

which of these is best?
the project that I'm using as a demo https://isaacs.github.io/rimraf/functions/path_arg.default.html

"default" or "export="
image

name of symbol (may be raw expr; need 2nd opt)
image

same name as module
image

camelCase module .default suffix
image

camelCased module name
image

and here's another real-ish-world example this time with dots in the module names

"default" or "export="
image

name of symbol (may be raw expr; need 2nd opt)
image

same name as module
image

camelCased module name
image

which ones do you think are the best? lmk if there's other ways that i haven't thought of idk

yes, this is a bit silly amount of talk/detail/work/effort/whatever just to talk about some inconsequential code naming conventions lol ๐Ÿคฃ

ESM breaks `docusaurus-plugin-typedoc`

I have no idea if this is something you can fix or even care about, but here goes.

I'm using Docusaurus for a documentation site.
This site uses docusaurus-plugin-typedoc to generate API docs, which uses typedoc-plugin-markdown.
I configured Typedoc to use this plugin.

Recently, I migrated from Docusaurus v2 to v3, but this change had this weird side effect where the API docs would still get generated but Docusaurus wouldn't detect them until a rebuild is triggered by changing some file.
When I removed this plugin, the issue disappeared.
I tried using other plugins (and disabling all plugins) and the issue seems to be related to this plugin specifically.

Oh and before I forget: thanks a lot for making this plugin!

Add a "default" badge to renamed symbols

ideally it'd be nice to have something like this where the (default) is there and informing you that, yes, this is the default export and not a named export BUT also being out of the way enough to not clutter it? idk the technical feasibility of this tho

you can sorta do this now with the @exports default or some other @summary THIS IS THE DEFAULT EXPORT in your jsdoc comment but it's not quite the same lol

/**
 * @exports default
 * @name default
 * @summary THIS IS THE DEFAULT EXPORT
 * @defaultExport
 */
export default function assign<T extends object, U extends object>(o1: T, o2: U): T & U {
  return Object.assign(o1, o2)
}

Originally posted by @jcbhmr in #14 (comment)

`<internal>.default` replacement stopped working after upgrading from 0.4.0 to 0.6.1

The name of <internal>.default classes discovered using the https://github.com/Gerrit0/typedoc-plugin-missing-exports plugin used to be replaced correctly at 0.4.0 but after upgrading to 0.6.1, <internal>.default would be replaced by <internal>.<internal>

I am confident the behaviour is due to this plugin because when the documentation was produced without this plugin, the results from the previous version of typedoc & typedoc-plugin-missing-exports are same as the latest version.

0.4.0:
https://algorand.github.io/js-algorand-sdk/classes/Algodv2.html#accountApplicationInformation

0.6.1:
https://upgrade-typedoc-and-plugins--js-algosdk.netlify.app/classes/algodv2#accountApplicationInformation

Version changes:
fionnachan/js-algorand-sdk@205d878

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.