Skip to content

Commit 5e15ab0

Browse files
committed
Merge pull request #259 from SassDoc/revert-258-unify-annotation-names-2.0
Revert "Unify annotation names 2.0"
2 parents d238ec7 + d1ce417 commit 5e15ab0

31 files changed

+84
-84
lines changed

src/annotation/annotations/parameter.js renamed to src/annotation/annotations/parameters.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525

2626
return obj;
2727
},
28-
alias: ['arg', 'arguments', 'param', 'parameters'],
28+
alias: ['arg', 'arguments', 'param'],
2929

3030
allowedOn : ['function', 'mixin']
3131
};

src/annotation/annotations/property.js renamed to src/annotation/annotations/prop.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
return obj;
2727
},
2828

29-
alias: ['prop'],
29+
alias: ['property'],
3030

3131
allowedOn: ['variable']
3232
};

src/annotation/annotations/require.js renamed to src/annotation/annotations/requires.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ module.exports = {
106106
all = all.concat(variables);
107107

108108
// Merge in user supplyed requires if there are any
109-
if (item.require && item.require.length > 0){
110-
all = all.concat(item.require);
109+
if (item.requires && item.requires.length > 0){
110+
all = all.concat(item.requires);
111111
}
112112

113113
if (all.length > 0){
@@ -118,8 +118,8 @@ module.exports = {
118118

119119
resolve: function (byTypeAndName) {
120120
utils.eachItem(byTypeAndName, function (item) {
121-
if (utils.isset(item.require)) {
122-
item.require = item.require.map(function (req) {
121+
if (utils.isset(item.requires)) {
122+
item.requires = item.requires.map(function (req) {
123123
if (req.external === true) {
124124
return req;
125125
}
@@ -153,7 +153,7 @@ module.exports = {
153153
return req;
154154
});
155155

156-
item.require.toJSON = utils.mapArray.bind(null, item.require,
156+
item.requires.toJSON = utils.mapArray.bind(null, item.requires,
157157
function (item) {
158158
var obj = {
159159
type: item.type,
@@ -175,5 +175,5 @@ module.exports = {
175175

176176
},
177177

178-
alias: ['requires']
178+
alias: ['require']
179179
};

src/annotation/annotations/return.js renamed to src/annotation/annotations/returns.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
return obj;
2727
},
2828

29-
alias: ['returns'],
29+
alias: ['return'],
3030

3131
allowedOn : ['function']
3232
};

src/annotation/annotations/throw.js renamed to src/annotation/annotations/throws.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ module.exports = {
1616
return throwing;
1717
}
1818
},
19-
alias: ['throws', 'exception'],
19+
alias: ['throw', 'exception'],
2020
allowedOn: ['function', 'mixin', 'placeholder']
2121
};

src/annotation/annotations/todo.js renamed to src/annotation/annotations/todos.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = {
44
parse: function (text) {
55
return text.trim();
66
},
7-
alias: ['todos']
7+
alias: ['todo']
88
};

test/annotations/parameter.test.js renamed to test/annotations/parameters.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
var assert = require('assert');
55

6-
describe('#parameter', function () {
7-
var param = (new (require('../../src/annotation'))()).list.parameter;
6+
describe('#parameters', function () {
7+
var param = (new (require('../../src/annotation'))()).list.parameters;
88

99
it('should return an object', function () {
1010
assert.deepEqual(param.parse('{type} $hyphenated-name (default) - description'), { type: 'type', name: 'hyphenated-name', default: 'default', description: 'description' });

test/annotations/property.test.js renamed to test/annotations/prop.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
var assert = require('assert');
55

6-
describe('#property', function () {
7-
var prop = (new (require('../../src/annotation'))()).list.property;
6+
describe('#prop', function () {
7+
var prop = (new (require('../../src/annotation'))()).list.prop;
88

99
it('should parse the prop annotation', function () {
1010
assert.deepEqual(prop.parse('base'), {

test/annotations/require.test.js renamed to test/annotations/requires.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
var assert = require('assert');
55

6-
describe('#require', function () {
7-
var requires = (new (require('../../src/annotation'))()).list.require;
6+
describe('#requires', function () {
7+
var requires = (new (require('../../src/annotation'))()).list.requires;
88

99
it('should default to function', function () {
1010
assert.deepEqual(requires.parse('name - description'), { type: 'function', name: 'name', description: 'description', 'external': false });

test/annotations/return.test.js renamed to test/annotations/returns.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
var assert = require('assert');
55

6-
describe('#return', function () {
7-
var returns = (new (require('../../src/annotation'))()).list.return;
6+
describe('#parameters', function () {
7+
var returns = (new (require('../../src/annotation'))()).list.returns;
88

99
it('should return an object', function () {
1010
assert.deepEqual(returns.parse('{type} $hyphenated-name (default) - description'), { type: 'type', name: 'hyphenated-name', default: 'default', description: 'description' });

test/annotations/throw.test.js

-15
This file was deleted.

test/annotations/throws.test.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* global describe, it */
2+
'use strict';
3+
4+
var assert = require('assert');
5+
6+
describe('#throws', function () {
7+
var _throws = (new (require('../../src/annotation'))()).list.throws;
8+
9+
it('should return the trimmed string', function () {
10+
assert.equal(_throws.parse(' '), '');
11+
assert.equal(_throws.parse(' '), '');
12+
assert.equal(_throws.parse('\ntest\t'), 'test');
13+
assert.equal(_throws.parse('\nte\nst\t'), 'te\nst');
14+
});
15+
});

test/annotations/todo.test.js

-15
This file was deleted.

test/annotations/todos.test.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* global describe, it */
2+
'use strict';
3+
4+
var assert = require('assert');
5+
6+
describe('#throws', function () {
7+
var todos = (new (require('../../src/annotation'))()).list.todos;
8+
9+
it('should return the trimmed string', function () {
10+
assert.equal(todos.parse(' '), '');
11+
assert.equal(todos.parse(' '), '');
12+
assert.equal(todos.parse('\ntest\t'), 'test');
13+
assert.equal(todos.parse('\nte\nst\t'), 'te\nst');
14+
});
15+
});

test/data/fixture/parameter/expected.json renamed to test/data/fixture/param/expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"end": 6
1212
}
1313
},
14-
"parameter": [
14+
"parameters": [
1515
{
1616
"type": "String",
1717
"name": "foo",
@@ -37,4 +37,4 @@
3737
}
3838
}
3939
}
40-
}
40+
}

test/data/fixture/param/input.scss

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
/**
3+
* @param {String} $foo - the foo parameter
4+
* @param {Map | Arglist} $bar - the bar parameter
5+
*/
6+
@function test-function-param($foo, $bar) {}

test/data/fixture/parameter/input.scss

-6
This file was deleted.

test/data/fixture/property/expected.json renamed to test/data/fixture/prop/expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": [
1616
"Map"
1717
],
18-
"property": [
18+
"prop": [
1919
{
2020
"type": "String",
2121
"name": "foo",
@@ -43,4 +43,4 @@
4343
}
4444
}
4545
}
46-
}
46+
}

test/data/fixture/require/expected.json renamed to test/data/fixture/requires/expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"end": 5
1212
}
1313
},
14-
"require": [
14+
"requires": [
1515
{
1616
"type": "function",
1717
"name": "test-function-required",
@@ -70,4 +70,4 @@
7070
]
7171
}
7272
}
73-
}
73+
}

test/data/fixture/require/input.scss renamed to test/data/fixture/requires/input.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/**
3-
* @require test-function-required
3+
* @requires test-function-required
44
*/
55
@function test-function-requires() {}
66

test/data/fixture/return/expected.json renamed to test/data/fixture/returns/expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"end": 5
1212
}
1313
},
14-
"return": [
14+
"returns": [
1515
{
1616
"type": "String",
1717
"description": "A description fo returns"
@@ -31,4 +31,4 @@
3131
}
3232
}
3333
}
34-
}
34+
}

test/data/fixture/throw/expected.json renamed to test/data/fixture/throws/expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"end": 5
1212
}
1313
},
14-
"throw": [
14+
"throws": [
1515
"Error warn you on wrong argument type"
1616
],
1717
"access": [
@@ -28,4 +28,4 @@
2828
}
2929
}
3030
}
31-
}
31+
}

test/data/fixture/todo/expected.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"end": 5
1212
}
1313
},
14-
"todo": [
14+
"todos": [
1515
"Improve that function"
1616
],
1717
"access": [
@@ -28,4 +28,4 @@
2828
}
2929
}
3030
}
31-
}
31+
}

test/data/parameter.test.js renamed to test/data/param.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
var assert = require('assert');
55

6-
describe('#parameter', function () {
6+
describe('#param', function () {
77
var getData = require('../../src/file').getData;
88

9-
var expected = require('./fixture/parameter/expected');
10-
var input = 'test/data/fixture/parameter';
9+
var expected = require('./fixture/param/expected');
10+
var input = 'test/data/fixture/param';
1111
var data;
1212

1313
before(function (done) {

test/data/property.test.js renamed to test/data/prop.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33

44
var assert = require('assert');
55

6-
describe('#property', function () {
6+
describe('#prop', function () {
77
var getData = require('../../src/file').getData;
88

9-
var expected = require('./fixture/property/expected');
10-
var input = 'test/data/fixture/property';
9+
var expected = require('./fixture/prop/expected');
10+
var input = 'test/data/fixture/prop';
1111
var data;
1212

1313
before(function (done) {

test/data/require.test.js renamed to test/data/requires.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
var assert = require('assert');
55
var _ = require('lodash');
66

7-
describe('#require', function () {
7+
describe('#requires', function () {
88
var getData = require('../../src/file').getData;
99

10-
var expected = require('./fixture/require/expected');
11-
var input = 'test/data/fixture/require';
10+
var expected = require('./fixture/requires/expected');
11+
var input = 'test/data/fixture/requires';
1212
var data;
1313

1414
before(function (done) {
@@ -30,12 +30,12 @@ describe('#require', function () {
3030
var requires = dataClone['function']['test-function-requires'];
3131
var required = dataClone['function']['test-function-required'];
3232

33-
assert.equal(requires.require[0].item, required);
33+
assert.equal(requires.requires[0].item, required);
3434
assert.equal(required.usedBy[0], requires);
3535

3636
// Remove circular structure from the clone
37-
delete requires.require.toJSON;
38-
delete requires.require[0].item;
37+
delete requires.requires.toJSON;
38+
delete requires.requires[0].item;
3939
delete required.usedBy.toJSON;
4040

4141
// Include the reference

test/data/return.test.js renamed to test/data/returns.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var assert = require('assert');
66
describe('#returns', function () {
77
var getData = require('../../src/file').getData;
88

9-
var expected = require('./fixture/return/expected');
10-
var input = 'test/data/fixture/return';
9+
var expected = require('./fixture/returns/expected');
10+
var input = 'test/data/fixture/returns';
1111
var data;
1212

1313
before(function (done) {

test/data/throw.test.js renamed to test/data/throws.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var assert = require('assert');
66
describe('#throws', function () {
77
var getData = require('../../src/file').getData;
88

9-
var expected = require('./fixture/throw/expected');
10-
var input = 'test/data/fixture/throw';
9+
var expected = require('./fixture/throws/expected');
10+
var input = 'test/data/fixture/throws';
1111
var data;
1212

1313
before(function (done) {

0 commit comments

Comments
 (0)