Skip to content

Commit ea27704

Browse files
committed
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 angular#2569
1 parent 35589a6 commit ea27704

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/dgeni-package/processors/readTypeScriptModules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ module.exports = function readTypeScriptModules(tsParser, readFilesProcessor, mo
2424
basePath: '.',
2525
// We can ignore members of classes that are private
2626
hidePrivateMembers: true,
27-
// We can sort class members alphabetically
28-
sortClassMembers: true,
27+
// We leave class members sorted in order of declaration
28+
sortClassMembers: false,
2929
// We can provide a collection of strings or regexes to ignore exports whose export names match
3030
ignoreExportsMatching: ['___esModule'],
3131

docs/dgeni-package/processors/readTypeScriptModules.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ describe('readTypeScriptModules', function() {
4646

4747

4848
describe('ordering of members', function() {
49-
it('should order class members alphabetically (by default)', function() {
49+
it('should order class members in order of appearance (by default)', function() {
5050
processor.sourceFiles = ['orderingOfMembers.ts'];
5151
var docs = [];
5252
processor.$process(docs);
5353
var classDoc = _.find(docs, { docType: 'class' });
5454
expect(classDoc.docType).toEqual('class');
5555
expect(getNames(classDoc.members)).toEqual([
56-
'doStuff',
5756
'firstItem',
58-
'otherMethod'
57+
'otherMethod',
58+
'doStuff',
5959
]);
6060
});
6161

0 commit comments

Comments
 (0)