-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
correctly write doclets at es6 class constructors #74
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple stylistic nit-picks.
Can you also add a test for this please?
src/Emitter.ts
Outdated
import { assertNever } from './assert_never'; | ||
import {Dictionary} from './Dictionary'; | ||
import {warn} from './logger'; | ||
import {assertNever} from './assert_never'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix these whitespace changes please.
src/Emitter.ts
Outdated
} from './create_helpers'; | ||
import {createFunctionParams} from "./type_resolve_helpers"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: spaces between braces
src/create_helpers.ts
Outdated
@@ -279,6 +273,29 @@ export function createClassMember(doclet: IMemberDoclet): ts.PropertyDeclaration | |||
)); | |||
} | |||
|
|||
function getAccessModifiers(doclet: IMemberDoclet | IClassDoclet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Newline before braces, don't use K&R style braces.
I just realized that this approach only works if the class is exported using By the way, how do you debug the tests? Are you using Webstorm? Somehow the debugger cannot attach to the sources of the template. |
I don't use Webstorm I use Code and haven't had an issue debugging it before. Generally I setup a minimal test file and launch a parse process from Code against that one file to debug the specific issue I'm hitting. |
From [PR#74](englercj#74) with fix.
@englercj, @HackbrettXXX, I think I managed to fix the things around this topic. Please see the PR#98. Key changes:
|
* Very first 'export default' generation. Still buggy: module declaration is generated twice. * Removal of the IExportDefaultDoclet hack. * Code moved from _createTreeNodes() to _buildTree() for 'export default' doclets. => fixed: generation of 'export default' at the end of the module (and not at the beginning) => fixed: duplicate module declaration * 'module.exports =' pattern management. module2 test addition. * module3 test addition. * Removal of K&R style braces. `debug()` controled by a specific `debug` option. * Addition of debug traces. * opts.generationStrategy option addition. 'documented' => by default 'exported' => not fully implemented, just prevents non documented doclets to be removed for the moment * correctly write doclets at es6 class constructors cherry-pick & merge from @HackbrettXXX's commit 312578e * add a test case for constructors (fails currently) * Constructor generation with documentation. From [PR#74](#74) with fix. * Emitter._buildTree() strengthening with full jsdoc doclets. * First 'exported' generation strategy implementation. Still needs to be tested. * Test additions for testing the 'exported' generation strategy. Lots of them are not enabled yet and need to be fixed. * (Re)named exports. * Warning addition while waiting for [tsd-jsdoc#104](#104 resolution. * 'export <named type>' pattern support. Fix for 'module.exports = {name: }' pattern. * Named exports with reference to a type of the same name. * 'export default <named type>' pattern support (works like a lambda class would actually). * 'export default <lambda class>' pattern support. * 'export default <lambda function>' and 'export default <named function>' patterns support. * 'module.exports=<lambda type>' and 'module.exports=<named type>' patterns support. * 'module.exports.name=<lambda type>' and 'module.exports.name=<named type>' patterns support. * 'exports.name=<lambda type>' and 'exports.name=<named type>' patterns support. * 'module.exports={name=<lambda type>} and 'module.exports={name=<named type>}' patterns support. Workaround needed for classes as long as issue [jsdoc#1699](jsdoc/jsdoc#1699) is not fixed. * cyclic dependencies with 'exported' generation strategy. Addition of 'export default {name: ...}' tests (not supported yet). * Test class_all.js working with 'exported' generation strategy. * Test constructors.js & enum_all.js working with 'exported' generation strategy. * Tests function_all.js and interface_all.js working with 'exported' generation strategy. Warn&debug improvements. * Test namespace_all.js working with 'exported' generation strategy. * Tests property_all.js and typedef_all.js working with 'exported' generation strategy. * 'documented' & 'exported' test cases. Instrumentation for jsdoc 3.5.5 vs 3.6.3 investigations. * jsdoc@3.6.3 installation. * jsdoc@3.6.3 fixes. * `walk-back.d.ts` typescript declaration. * `walk-back.d.ts`: application of "tsd-default-export" recommendations. See: https://github.com/Alexis-ROYER/tsd-default-export/blob/master/README.md * Corrections to @englercj’s remarks. * Fix merge tag 'v2.5.0' into export-default 'exported' tests were not executed due to a false trailing 'r' after `generationStrategy` in `test/lib/index.ts`. * Corrections to @englercj’s remarks. Co-authored-by: Lukas Hollaender <lukas.hollaender@yworks.com>
A pull request to correctly write doc comments at es6 class constructors like described here.