fix(docs): order class members in order of declaration
Previously, class members were ordered alphabetically. This change leaves it up to the class author to determine the order in which they would like properties and methods to appear in class documentation, without having to create methods like `zUnimportantMethod`. Fixes #2569
This commit is contained in:
parent
35589a6b3c
commit
ea27704ea9
|
@ -24,8 +24,8 @@ module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, mo
|
||||||
basePath: '.',
|
basePath: '.',
|
||||||
// We can ignore members of classes that are private
|
// We can ignore members of classes that are private
|
||||||
hidePrivateMembers: true,
|
hidePrivateMembers: true,
|
||||||
// We can sort class members alphabetically
|
// We leave class members sorted in order of declaration
|
||||||
sortClassMembers: true,
|
sortClassMembers: false,
|
||||||
// We can provide a collection of strings or regexes to ignore exports whose export names match
|
// We can provide a collection of strings or regexes to ignore exports whose export names match
|
||||||
ignoreExportsMatching: ['___esModule'],
|
ignoreExportsMatching: ['___esModule'],
|
||||||
|
|
||||||
|
|
|
@ -46,16 +46,16 @@ describe('readTypeScriptModules', function() {
|
||||||
|
|
||||||
|
|
||||||
describe('ordering of members', function() {
|
describe('ordering of members', function() {
|
||||||
it('should order class members alphabetically (by default)', function() {
|
it('should order class members in order of appearance (by default)', function() {
|
||||||
processor.sourceFiles = ['orderingOfMembers.ts'];
|
processor.sourceFiles = ['orderingOfMembers.ts'];
|
||||||
var docs = [];
|
var docs = [];
|
||||||
processor.$process(docs);
|
processor.$process(docs);
|
||||||
var classDoc = _.find(docs, { docType: 'class' });
|
var classDoc = _.find(docs, { docType: 'class' });
|
||||||
expect(classDoc.docType).toEqual('class');
|
expect(classDoc.docType).toEqual('class');
|
||||||
expect(getNames(classDoc.members)).toEqual([
|
expect(getNames(classDoc.members)).toEqual([
|
||||||
'doStuff',
|
|
||||||
'firstItem',
|
'firstItem',
|
||||||
'otherMethod'
|
'otherMethod',
|
||||||
|
'doStuff',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue