diff --git a/.prettierrc b/.prettierrc
index 544138be4..b0a179d48 100644
--- a/.prettierrc
+++ b/.prettierrc
@@ -1,3 +1,5 @@
{
- "singleQuote": true
+ "singleQuote": true,
+ "trailingComma": "none",
+ "arrowParens": "avoid"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d64f7cec2..3c6df0160 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,15 @@
-# Change Log
+# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+### [13.0.1](https://github.com/documentationjs/documentation/compare/v13.0.0...v13.0.1) (2020-06-04)
+
+
+### Bug Fixes
+
+* 🐛 Error with flow opaque type and readme command ([78db9a4](https://github.com/documentationjs/documentation/commit/78db9a443a65bbe8ff202083351655e0cfa60004)), closes [#1322](https://github.com/documentationjs/documentation/issues/1322)
+* 🐛 Fixes an issue when using object spread and $Exact ([106945c](https://github.com/documentationjs/documentation/commit/106945c6354f0b70335adf737c7b7fa296952cc3)), closes [#1324](https://github.com/documentationjs/documentation/issues/1324)
+
# [13.0.0](https://github.com/documentationjs/documentation/compare/v12.3.0...v13.0.0) (2020-05-09)
diff --git a/__tests__/__snapshots__/test.js.snap b/__tests__/__snapshots__/test.js.snap
index 0ad23c1b9..90f3d41d0 100644
--- a/__tests__/__snapshots__/test.js.snap
+++ b/__tests__/__snapshots__/test.js.snap
@@ -18930,6 +18930,185 @@ Object {
}
`;
+exports[`outputs flow-exported-opaque-type.input.js JSON 1`] = `
+Array [
+ Object {
+ "augments": Array [],
+ "context": Object {
+ "loc": Object {
+ "end": Object {
+ "column": 48,
+ "line": 4,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 4,
+ },
+ },
+ },
+ "description": Object {
+ "children": Array [
+ Object {
+ "children": Array [
+ Object {
+ "position": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "indent": Array [],
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "type": "text",
+ "value": "MyOpaqueType Description Here",
+ },
+ ],
+ "position": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "indent": Array [],
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "type": "paragraph",
+ },
+ ],
+ "position": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "type": "root",
+ },
+ "errors": Array [],
+ "examples": Array [],
+ "implements": Array [],
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 3,
+ },
+ "start": Object {
+ "column": 0,
+ "line": 3,
+ },
+ },
+ "members": Object {
+ "events": Array [],
+ "global": Array [],
+ "inner": Array [],
+ "instance": Array [],
+ "static": Array [],
+ },
+ "name": "MyOpaqueType",
+ "namespace": "MyOpaqueType",
+ "params": Array [],
+ "path": Array [
+ Object {
+ "name": "MyOpaqueType",
+ },
+ ],
+ "properties": Array [],
+ "returns": Array [],
+ "sees": Array [],
+ "tags": Array [],
+ "throws": Array [],
+ "todos": Array [],
+ "yields": Array [],
+ },
+]
+`;
+
+exports[`outputs flow-exported-opaque-type.input.js markdown 1`] = `
+"
+
+### Table of Contents
+
+- [MyOpaqueType][1]
+
+## MyOpaqueType
+
+MyOpaqueType Description Here
+
+[1]: #myopaquetype
+"
+`;
+
+exports[`outputs flow-exported-opaque-type.input.js markdown AST 1`] = `
+Object {
+ "children": Array [
+ Object {
+ "type": "html",
+ "value": "",
+ },
+ Object {
+ "children": Array [
+ Object {
+ "type": "text",
+ "value": "MyOpaqueType",
+ },
+ ],
+ "depth": 2,
+ "type": "heading",
+ },
+ Object {
+ "children": Array [
+ Object {
+ "position": Position {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "indent": Array [],
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "type": "text",
+ "value": "MyOpaqueType Description Here",
+ },
+ ],
+ "position": Position {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "indent": Array [],
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "type": "paragraph",
+ },
+ ],
+ "type": "root",
+}
+`;
+
exports[`outputs flow-optional-chaining.input.js JSON 1`] = `
Array [
Object {
@@ -31972,30 +32151,6 @@ Array [
"tags": Array [],
"throws": Array [],
"todos": Array [],
- "type": Object {
- "fields": Array [
- Object {
- "key": "opt",
- "type": "FieldType",
- "value": Object {
- "expression": Object {
- "name": "number",
- "type": "NameExpression",
- },
- "type": "OptionalType",
- },
- },
- Object {
- "key": "req",
- "type": "FieldType",
- "value": Object {
- "name": "string",
- "type": "NameExpression",
- },
- },
- ],
- "type": "RecordType",
- },
"yields": Array [],
},
]
@@ -32011,8 +32166,6 @@ exports[`outputs optional-record-field-type.input.js markdown 1`] = `
## Record
-Type: {opt: [number][3]?, req: [string][4]}
-
### Properties
- \`opt\` **[number][3]?**
@@ -32045,61 +32198,6 @@ Object {
"depth": 2,
"type": "heading",
},
- Object {
- "children": Array [
- Object {
- "type": "text",
- "value": "Type: ",
- },
- Object {
- "type": "text",
- "value": "{",
- },
- Object {
- "type": "text",
- "value": "opt: ",
- },
- Object {
- "children": Array [
- Object {
- "type": "text",
- "value": "number",
- },
- ],
- "identifier": "1",
- "referenceType": "full",
- "type": "linkReference",
- },
- Object {
- "type": "text",
- "value": "?",
- },
- Object {
- "type": "text",
- "value": ", ",
- },
- Object {
- "type": "text",
- "value": "req: ",
- },
- Object {
- "children": Array [
- Object {
- "type": "text",
- "value": "string",
- },
- ],
- "identifier": "2",
- "referenceType": "full",
- "type": "linkReference",
- },
- Object {
- "type": "text",
- "value": "}",
- },
- ],
- "type": "paragraph",
- },
Object {
"children": Array [
Object {
diff --git a/__tests__/bin-readme.js b/__tests__/bin-readme.js
index 51f6441d0..e147ff579 100644
--- a/__tests__/bin-readme.js
+++ b/__tests__/bin-readme.js
@@ -22,7 +22,7 @@ function documentation(args, options, parseJSON) {
});
}
-describe('readme autodetection of different filenames', function() {
+describe('readme autodetection of different filenames', function () {
const fixtures = path.join(__dirname, 'fixture/readme');
const sourceFile = path.join(fixtures, 'index.js');
let d;
@@ -38,14 +38,14 @@ describe('readme autodetection of different filenames', function() {
fs.copySync(path.join(fixtures, 'index.js'), path.join(d, 'index.js'));
});
- test('updates readme.markdown', async function() {
+ test('updates readme.markdown', async function () {
await documentation(['readme index.js -s API'], { cwd: d });
const outputPath = path.join(d, 'readme.markdown');
expect(fs.readFileSync(outputPath, 'utf-8')).toMatchSnapshot();
});
});
-describe('readme command', function() {
+describe('readme command', function () {
const fixtures = path.join(__dirname, 'fixture/readme');
const sourceFile = path.join(fixtures, 'index.js');
let d;
@@ -63,7 +63,7 @@ describe('readme command', function() {
// run tests after setting up temp dir
- test('--diff-only: changes needed', async function() {
+ test('--diff-only: changes needed', async function () {
const before = fs.readFileSync(path.join(d, 'README.md'), 'utf-8');
try {
await documentation(['readme index.js --diff-only -s API'], {
@@ -77,13 +77,13 @@ describe('readme command', function() {
}
});
- test('updates README.md', async function() {
+ test('updates README.md', async function () {
await documentation(['readme index.js -s API'], { cwd: d });
const outputPath = path.join(d, 'README.md');
expect(fs.readFileSync(outputPath, 'utf-8')).toMatchSnapshot();
});
- test('--readme-file', async function() {
+ test('--readme-file', async function () {
fs.copySync(
path.join(fixtures, 'README.input.md'),
path.join(d, 'other.md')
@@ -95,7 +95,7 @@ describe('readme command', function() {
expect(actual).toMatchSnapshot();
});
- test('--diff-only: changes NOT needed', function() {
+ test('--diff-only: changes NOT needed', function () {
fs.copySync(
path.join(fixtures, 'README.output.md'),
path.join(d, 'uptodate.md')
@@ -108,7 +108,7 @@ describe('readme command', function() {
});
});
- test('-s: not found', async function() {
+ test('-s: not found', async function () {
fs.copySync(
path.join(fixtures, 'README.output.md'),
path.join(d, 'uptodate.md')
@@ -123,7 +123,7 @@ describe('readme command', function() {
}
});
- test('requires -s option', async function() {
+ test('requires -s option', async function () {
try {
await documentation(['readme index.js'], { cwd: d });
} catch (err) {
@@ -134,7 +134,7 @@ describe('readme command', function() {
});
const badFixturePath = path.join(__dirname, 'fixture/bad/syntax.input');
- test('errors on invalid syntax', async function() {
+ test('errors on invalid syntax', async function () {
try {
await documentation(
['readme ' + badFixturePath + ' -s API --parseExtension input'],
diff --git a/__tests__/bin-watch-serve.js b/__tests__/bin-watch-serve.js
index 538ed03e6..57e071a32 100644
--- a/__tests__/bin-watch-serve.js
+++ b/__tests__/bin-watch-serve.js
@@ -20,7 +20,7 @@ function documentation(args, options) {
}
function normalize(result) {
- result.forEach(function(item) {
+ result.forEach(function (item) {
item.context.file = '[path]';
});
return result;
@@ -28,7 +28,7 @@ function normalize(result) {
const timeout = 20000;
-test.skip('harness', function() {
+test.skip('harness', function () {
const docProcess = documentation(['serve', 'fixture/simple.input.js']);
expect(docProcess).toBeTruthy();
docProcess.kill();
@@ -36,14 +36,14 @@ test.skip('harness', function() {
test.skip(
'provides index.html',
- function() {
+ function () {
const docProcess = documentation(['serve', 'fixture/simple.input.js']);
- return pEvent(docProcess.stdout, 'data').then(function(data) {
+ return pEvent(docProcess.stdout, 'data').then(function (data) {
const portNumber = data
.toString()
.match(/documentation.js serving on port (\d+)/);
expect(portNumber).toBeTruthy();
- return get(`http://localhost:${portNumber[1]}/`).then(function(text) {
+ return get(`http://localhost:${portNumber[1]}/`).then(function (text) {
expect(text.match(//)).toBeTruthy();
docProcess.kill();
});
@@ -54,18 +54,18 @@ test.skip(
test.skip(
'accepts port argument',
- function() {
+ function () {
const docProcess = documentation([
'serve',
'fixture/simple.input.js',
'--port=4004'
]);
- return pEvent(docProcess.stdout, 'data').then(function(data) {
+ return pEvent(docProcess.stdout, 'data').then(function (data) {
const portNumber = data
.toString()
.match(/documentation.js serving on port 4004/);
expect(portNumber).toBeTruthy();
- return get(`http://localhost:4004/`).then(function(text) {
+ return get(`http://localhost:4004/`).then(function (text) {
expect(text.match(//)).toBeTruthy();
docProcess.kill();
});
@@ -76,20 +76,20 @@ test.skip(
test.skip(
'--watch',
- function(done) {
+ function (done) {
const tmpFile = path.join(os.tmpdir(), '/simple.js');
fs.writeFileSync(tmpFile, '/** a function */function apples() {}');
const docProcess = documentation(['serve', tmpFile, '--watch']);
- pEvent(docProcess.stdout, 'data').then(function(data) {
+ pEvent(docProcess.stdout, 'data').then(function (data) {
const portNumber = data
.toString()
.match(/documentation.js serving on port (\d+)/);
expect(portNumber).toBeTruthy();
- return get(`http://localhost:${portNumber[1]}/`).then(function(text) {
+ return get(`http://localhost:${portNumber[1]}/`).then(function (text) {
expect(text.match(/apples/)).toBeTruthy();
fs.writeFileSync(tmpFile, '/** a function */function bananas() {}');
function doGet() {
- get(`http://localhost:${portNumber[1]}/`).then(function(text) {
+ get(`http://localhost:${portNumber[1]}/`).then(function (text) {
if (text.match(/bananas/)) {
docProcess.kill();
done();
@@ -107,23 +107,23 @@ test.skip(
test.skip(
'--watch',
- function(done) {
+ function (done) {
const tmpDir = os.tmpdir();
const a = path.join(tmpDir, '/simple.js');
const b = path.join(tmpDir, '/required.js');
fs.writeFileSync(a, 'require("./required")');
fs.writeFileSync(b, '/** soup */function soup() {}');
const docProcess = documentation(['serve', a, '--watch']);
- docProcess.stdout.once('data', function(data) {
+ docProcess.stdout.once('data', function (data) {
const portNumber = data
.toString()
.match(/documentation.js serving on port (\d+)/);
expect(portNumber).toBeTruthy();
- get(`http://localhost:${portNumber[1]}/`).then(function(text) {
+ get(`http://localhost:${portNumber[1]}/`).then(function (text) {
expect(text.match(/soup/)).toBeTruthy();
fs.writeFileSync(b, '/** nuts */function nuts() {}');
function doGet() {
- get(`http://localhost:${portNumber[1]}/`).then(function(text) {
+ get(`http://localhost:${portNumber[1]}/`).then(function (text) {
if (text.match(/nuts/)) {
docProcess.kill();
done();
@@ -141,17 +141,17 @@ test.skip(
test.skip(
'error page',
- function() {
+ function () {
const tmpDir = os.tmpdir();
const a = path.join(tmpDir, '/simple.js');
fs.writeFileSync(a, '**');
const docProcess = documentation(['serve', a, '--watch']);
- return pEvent(docProcess.stdout, 'data').then(function(data) {
+ return pEvent(docProcess.stdout, 'data').then(function (data) {
const portNumber = data
.toString()
.match(/documentation.js serving on port (\d+)/);
expect(portNumber).toBeTruthy();
- return get(`http://localhost:${portNumber[1]}/`).then(function(text) {
+ return get(`http://localhost:${portNumber[1]}/`).then(function (text) {
expect(text.match(/Unexpected token/)).toBeTruthy();
docProcess.kill();
});
diff --git a/__tests__/bin.js b/__tests__/bin.js
index e893c644d..399553875 100644
--- a/__tests__/bin.js
+++ b/__tests__/bin.js
@@ -21,7 +21,7 @@ function documentation(args, options, parseJSON) {
args.unshift('node ' + path.join(__dirname, '..', 'bin', 'documentation.js'));
return new Promise((resolve, reject) => {
- exec(args.join(' '), options, function(err, stdout, stderr) {
+ exec(args.join(' '), options, function (err, stdout, stderr) {
if (err) {
err.stderr = stderr;
return reject(err);
@@ -40,32 +40,32 @@ function documentation(args, options, parseJSON) {
}
function normalize(result) {
- result.forEach(function(item) {
+ result.forEach(function (item) {
item.context.file = '[path]';
});
return result;
}
-test.skip('documentation binary', async function() {
+test.skip('documentation binary', async function () {
const data = await documentation(['build fixture/simple.input.js'], {});
expect(data.length).toBe(1);
});
-test.skip('defaults to parsing package.json main', async function() {
+test.skip('defaults to parsing package.json main', async function () {
const data = await documentation(['build'], {
cwd: path.join(__dirname, '..')
});
expect(data.length).toBeTruthy();
});
-test.skip('accepts config file', async function() {
+test.skip('accepts config file', async function () {
const data = await documentation([
'build fixture/sorting/input.js -c fixture/config.json'
]);
expect(normalize(data)).toMatchSnapshot();
});
-test.skip('accepts config file - reports failures', async function() {
+test.skip('accepts config file - reports failures', async function () {
try {
await documentation(
['build fixture/sorting/input.js -c fixture/config-bad.yml'],
@@ -77,7 +77,7 @@ test.skip('accepts config file - reports failures', async function() {
}
});
-test.skip('accepts config file - reports parse failures', async function() {
+test.skip('accepts config file - reports parse failures', async function () {
try {
await documentation(
['build fixture/sorting/input.js -c fixture/config-malformed.json'],
@@ -89,14 +89,14 @@ test.skip('accepts config file - reports parse failures', async function() {
}
});
-test.skip('--shallow option', async function() {
+test.skip('--shallow option', async function () {
const data = await documentation([
'build --shallow fixture/internal.input.js'
]);
expect(data.length).toBe(0);
});
-test.skip('external modules option', async function() {
+test.skip('external modules option', async function () {
const data = await documentation([
'build fixture/external.input.js ' +
'--external=external --external=external/node_modules'
@@ -104,14 +104,14 @@ test.skip('external modules option', async function() {
expect(data.length).toBe(2);
});
-test.skip('when a file is specified both in a glob and explicitly, it is only documented once', async function() {
+test.skip('when a file is specified both in a glob and explicitly, it is only documented once', async function () {
const data = await documentation([
'build fixture/simple.input.js fixture/simple.input.*'
]);
expect(data.length).toBe(1);
});
-test.skip('extension option', async function() {
+test.skip('extension option', async function () {
const data = await documentation([
'build fixture/extension/index.otherextension ' +
'--requireExtension=otherextension --parseExtension=otherextension'
@@ -119,12 +119,12 @@ test.skip('extension option', async function() {
expect(data.length).toBe(1);
});
-test.skip('extension option', function() {
+test.skip('extension option', function () {
return documentation(['build fixture/extension.jsx']);
});
-describe('invalid arguments', function() {
- test.skip('bad -f option', async function() {
+describe('invalid arguments', function () {
+ test.skip('bad -f option', async function () {
try {
await documentation(
['build -f DOES-NOT-EXIST fixture/internal.input.js'],
@@ -136,7 +136,7 @@ describe('invalid arguments', function() {
}
});
- test.skip('html with no destination', async function() {
+ test.skip('html with no destination', async function () {
try {
await documentation(['build -f html fixture/internal.input.js']);
} catch (err) {
@@ -150,7 +150,7 @@ describe('invalid arguments', function() {
}
});
- test.skip('bad command', async function() {
+ test.skip('bad command', async function () {
try {
await documentation(['-f html fixture/internal.input.js'], {}, false);
} catch (err) {
@@ -160,7 +160,7 @@ describe('invalid arguments', function() {
});
const semver = /\bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?\b/gi;
-test.skip('--config', async function() {
+test.skip('--config', async function () {
const dst = path.join(os.tmpdir(), (Date.now() + Math.random()).toString());
fs.mkdirSync(dst);
const outputIndex = path.join(dst, 'index.html');
@@ -178,26 +178,22 @@ test.skip('--config', async function() {
expect(output).toMatchSnapshot();
});
-test.skip('--version', async function() {
+test.skip('--version', async function () {
const output = await documentation(['--version'], {}, false);
expect(output).toBeTruthy();
});
-describe('lint command', function() {
- test.skip('generates lint output', async function() {
+describe('lint command', function () {
+ test.skip('generates lint output', async function () {
try {
await documentation(['lint fixture/lint/lint.input.js'], {}, false);
} catch (err) {
- const data = err.stderr
- .toString()
- .split('\n')
- .slice(2)
- .join('\n');
+ const data = err.stderr.toString().split('\n').slice(2).join('\n');
expect(data).toMatchSnapshot();
}
});
- test.skip('generates no output on a good file', async function() {
+ test.skip('generates no output on a good file', async function () {
const data = await documentation(
['lint fixture/simple.input.js'],
{},
@@ -206,7 +202,7 @@ describe('lint command', function() {
expect(data).toBe('');
});
- test.skip('exposes syntax error on a bad file', async function() {
+ test.skip('exposes syntax error on a bad file', async function () {
try {
await documentation(
['lint fixture/bad/syntax.input', '--parseExtension input'],
@@ -218,7 +214,7 @@ describe('lint command', function() {
}
});
- test.skip('lint with no inputs', async function() {
+ test.skip('lint with no inputs', async function () {
try {
await documentation(
['lint'],
@@ -232,7 +228,7 @@ describe('lint command', function() {
}
});
- test.skip('generates lint output with shallow', async function() {
+ test.skip('generates lint output with shallow', async function () {
const data = await documentation(
['lint fixture/lint/lint.input.shallow.js --shallow'],
{},
@@ -242,7 +238,7 @@ describe('lint command', function() {
});
});
-test.skip('given no files', async function() {
+test.skip('given no files', async function () {
try {
await documentation(['build']);
} catch (err) {
@@ -256,7 +252,7 @@ test.skip('given no files', async function() {
}
});
-test.skip('with an invalid command', async function() {
+test.skip('with an invalid command', async function () {
try {
await documentation(['invalid'], {}, false);
} catch (err) {
@@ -264,7 +260,7 @@ test.skip('with an invalid command', async function() {
}
});
-test.skip('--access flag', async function() {
+test.skip('--access flag', async function () {
const data = await documentation(
['build --shallow fixture/internal.input.js -a public'],
{},
@@ -273,7 +269,7 @@ test.skip('--access flag', async function() {
expect(data).toBe('[]');
});
-test.skip('--private flag', async function() {
+test.skip('--private flag', async function () {
const data = await documentation(
['build fixture/internal.input.js --private'],
{},
@@ -282,14 +278,14 @@ test.skip('--private flag', async function() {
expect(data.length > 2).toBeTruthy();
});
-test.skip('--infer-private flag', async function() {
+test.skip('--infer-private flag', async function () {
const data = await documentation(
['build fixture/infer-private.input.js --infer-private ^_'],
{},
false
);
// This uses JSON.parse with a reviver used as a visitor.
- JSON.parse(data, function(n, v) {
+ JSON.parse(data, function (n, v) {
// Make sure we do not see any names that match `^_`.
if (n === 'name') {
expect(typeof v).toBe('string');
@@ -299,7 +295,7 @@ test.skip('--infer-private flag', async function() {
});
});
-test.skip('write to file', async function() {
+test.skip('write to file', async function () {
const dst = path.join(os.tmpdir(), (Date.now() + Math.random()).toString());
const data = await documentation(
@@ -311,7 +307,7 @@ test.skip('write to file', async function() {
expect(fs.existsSync(dst)).toBeTruthy();
});
-test.skip('write to html', async function() {
+test.skip('write to html', async function () {
const dstDir = path.join(
os.tmpdir(),
(Date.now() + Math.random()).toString()
@@ -327,7 +323,7 @@ test.skip('write to html', async function() {
expect(fs.existsSync(path.join(dstDir, 'index.html'))).toBeTruthy();
});
-test.skip('write to html with custom theme', async function() {
+test.skip('write to html with custom theme', async function () {
const dstDir = path.join(
os.tmpdir(),
(Date.now() + Math.random()).toString()
@@ -346,7 +342,7 @@ test.skip('write to html with custom theme', async function() {
expect(fs.readFileSync(path.join(dstDir, 'index.html'), 'utf8')).toBeTruthy();
});
-test.skip('write to html, highlightAuto', function() {
+test.skip('write to html, highlightAuto', function () {
const fixture = 'fixture/auto_lang_hljs/multilanguage.input.js';
const config = 'fixture/auto_lang_hljs/config.yml';
const dstDir = path.join(
@@ -374,7 +370,7 @@ test.skip('write to html, highlightAuto', function() {
});
});
-test.skip('fatal error', async function() {
+test.skip('fatal error', async function () {
try {
await documentation(
['build --shallow fixture/bad/syntax.input --parseExtension input'],
@@ -386,7 +382,7 @@ test.skip('fatal error', async function() {
}
});
-test.skip('build --document-exported', async function() {
+test.skip('build --document-exported', async function () {
const data = await documentation(
['build fixture/document-exported.input.js --document-exported -f md'],
{},
@@ -395,7 +391,7 @@ test.skip('build --document-exported', async function() {
expect(data).toMatchSnapshot();
});
-test.skip('build large file without error (no deoptimized styling error)', function() {
+test.skip('build large file without error (no deoptimized styling error)', function () {
const dstFile =
path.join(os.tmpdir(), (Date.now() + Math.random()).toString()) + '.js';
let contents = '';
@@ -409,12 +405,12 @@ test.skip('build large file without error (no deoptimized styling error)', funct
});
});
-test.skip('should use browser resolve', async function() {
+test.skip('should use browser resolve', async function () {
const data = await documentation(['build fixture/resolve/index.js']);
expect(normalize(data)).toMatchSnapshot();
});
-test.skip('should use node resolve', async function() {
+test.skip('should use node resolve', async function () {
const data = await documentation([
'build fixture/resolve/index.js --resolve node'
]);
diff --git a/__tests__/fixture/flow-exported-opaque-type.input.js b/__tests__/fixture/flow-exported-opaque-type.input.js
new file mode 100644
index 000000000..9bcf2e647
--- /dev/null
+++ b/__tests__/fixture/flow-exported-opaque-type.input.js
@@ -0,0 +1,4 @@
+// @flow
+
+/** MyOpaqueType Description Here */
+export opaque type MyOpaqueType: string = string
\ No newline at end of file
diff --git a/__tests__/format_type.js b/__tests__/format_type.js
index 0f09b69ec..3b3abdf4e 100644
--- a/__tests__/format_type.js
+++ b/__tests__/format_type.js
@@ -12,7 +12,7 @@ function stringify(children) {
});
}
-test('formatType', function() {
+test('formatType', function () {
const linkerStack = new LinkerStack({});
const formatType = _formatType.bind(undefined, linkerStack.link);
[
@@ -81,7 +81,7 @@ test('formatType', function() {
'undefined',
'[undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined)'
]
- ].forEach(function(example) {
+ ].forEach(function (example) {
expect(
stringify(
formatType(
@@ -102,7 +102,7 @@ test('formatType', function() {
expect(
stringify(
_formatType(
- function(str) {
+ function (str) {
return str.toUpperCase();
},
parse('@param {Foo} a', {
@@ -114,7 +114,7 @@ test('formatType', function() {
expect(stringify(formatType())).toEqual('any');
- expect(function() {
+ expect(function () {
formatType({});
}).toThrow();
});
diff --git a/__tests__/index.js b/__tests__/index.js
index ed945e56e..6b40a6617 100644
--- a/__tests__/index.js
+++ b/__tests__/index.js
@@ -21,7 +21,7 @@ function cleanup(comments) {
});
}
-test('lint', async function() {
+test('lint', async function () {
const { paths } = inputs({
'index.js': '/** hi */var name = 1;'
});
@@ -30,7 +30,7 @@ test('lint', async function() {
expect(data).toEqual('');
});
-test('build', async function() {
+test('build', async function () {
const { paths } = inputs({
'index.js': '/** hi */var name = 1;'
});
@@ -46,7 +46,7 @@ test('build', async function() {
expect(json).toMatchSnapshot();
});
-test('expandInputs', async function() {
+test('expandInputs', async function () {
const { paths } = inputs({
'index.js': '/** hi */var name = 1;'
});
diff --git a/__tests__/lib/infer/type.js b/__tests__/lib/infer/type.js
index 19ea0dc18..beab3d0ee 100644
--- a/__tests__/lib/infer/type.js
+++ b/__tests__/lib/infer/type.js
@@ -41,28 +41,6 @@ test('inferType (flow)', function() {
type: 'TypeApplication'
});
- expect(evaluate('/** */' + "type V = {a:number,'b':string}").type).toEqual({
- fields: [
- {
- key: 'a',
- type: 'FieldType',
- value: {
- name: 'number',
- type: 'NameExpression'
- }
- },
- {
- key: 'b',
- type: 'FieldType',
- value: {
- name: 'string',
- type: 'NameExpression'
- }
- }
- ],
- type: 'RecordType'
- });
-
expect(evaluate('/** */' + 'type V = Array').type).toEqual({
applications: [
{
@@ -127,16 +105,12 @@ test('inferType (flow)', function() {
type: 'NameExpression'
});
- expect(
- evaluate('interface Foo { /** */ bar: string; }').type
- ).toEqual({
+ expect(evaluate('interface Foo { /** */ bar: string; }').type).toEqual({
name: 'string',
type: 'NameExpression'
});
- expect(
- evaluate('type Foo = { /** */ bar: string; }').type
- ).toEqual({
+ expect(evaluate('type Foo = { /** */ bar: string; }').type).toEqual({
name: 'string',
type: 'NameExpression'
});
@@ -167,28 +141,6 @@ test('inferType (typescript)', function() {
type: 'TypeApplication'
});
- expect(evaluate('/** */' + "type V = {a:number,'b':string}", 'test.ts').type).toEqual({
- fields: [
- {
- key: 'a',
- type: 'FieldType',
- value: {
- name: 'number',
- type: 'NameExpression'
- }
- },
- {
- key: 'b',
- type: 'FieldType',
- value: {
- name: 'string',
- type: 'NameExpression'
- }
- }
- ],
- type: 'RecordType'
- });
-
expect(evaluate('/** */' + 'type V = Array', 'test.ts').type).toEqual({
applications: [
{
@@ -223,27 +175,43 @@ test('inferType (typescript)', function() {
type: 'NameExpression'
});
- expect(evaluate('class C {' + '/** */' + 'x: number;' + '}', 'test.ts').type).toEqual({
+ expect(
+ evaluate('class C {' + '/** */' + 'x: number;' + '}', 'test.ts').type
+ ).toEqual({
name: 'number',
type: 'NameExpression'
});
- expect(evaluate('class Foo { /** */ get b(): string { } }', 'test.ts').type).toEqual({
+ expect(
+ evaluate('class Foo { /** */ get b(): string { } }', 'test.ts').type
+ ).toEqual({
name: 'string',
type: 'NameExpression'
});
- expect(evaluate('class Foo { /** */ set b(s: string) { } }', 'test.ts').type).toEqual({
+ expect(
+ evaluate('class Foo { /** */ set b(s: string) { } }', 'test.ts').type
+ ).toEqual({
name: 'string',
type: 'NameExpression'
});
- expect(evaluate('abstract class Foo { /** */ abstract get b(): string; }', 'test.ts').type).toEqual({
+ expect(
+ evaluate(
+ 'abstract class Foo { /** */ abstract get b(): string; }',
+ 'test.ts'
+ ).type
+ ).toEqual({
name: 'string',
type: 'NameExpression'
});
- expect(evaluate('abstract class Foo { /** */ abstract set b(s: string); }', 'test.ts').type).toEqual({
+ expect(
+ evaluate(
+ 'abstract class Foo { /** */ abstract set b(s: string); }',
+ 'test.ts'
+ ).type
+ ).toEqual({
name: 'string',
type: 'NameExpression'
});
@@ -277,28 +245,22 @@ test('inferType (typescript)', function() {
type: 'NameExpression'
});
- expect(
- evaluate('enum Foo { /** */ A }', 'test.ts').type
- ).toEqual({
+ expect(evaluate('enum Foo { /** */ A }', 'test.ts').type).toEqual({
name: 'number',
type: 'NameExpression'
});
- expect(
- evaluate('enum Foo { /** */ A = 2 }', 'test.ts').type
- ).toEqual({
+ expect(evaluate('enum Foo { /** */ A = 2 }', 'test.ts').type).toEqual({
name: 'number',
type: 'NameExpression'
});
- expect(
- evaluate('enum Foo { /** */ A = "test" }', 'test.ts').type
- ).toEqual({
+ expect(evaluate('enum Foo { /** */ A = "test" }', 'test.ts').type).toEqual({
name: 'string',
type: 'NameExpression'
});
- expect(
- evaluate('enum Foo { /** */ A = foo }', 'test.ts').type
- ).toBe(undefined);
+ expect(evaluate('enum Foo { /** */ A = foo }', 'test.ts').type).toBe(
+ undefined
+ );
});
diff --git a/__tests__/linker.js b/__tests__/linker.js
index 35cead80c..da8aefedd 100644
--- a/__tests__/linker.js
+++ b/__tests__/linker.js
@@ -1,6 +1,6 @@
const LinkerStack = require('../src/output/util/linker_stack');
-test('linkerStack', function() {
+test('linkerStack', function () {
const linkerStack = new LinkerStack({});
expect(linkerStack.link('string')).toBe(
@@ -35,7 +35,7 @@ test('linkerStack', function() {
namespace: 'Image'
}
],
- function(namespace) {
+ function (namespace) {
return '#' + namespace;
}
);
diff --git a/__tests__/test.js b/__tests__/test.js
index 63fa3361a..c3c19f010 100644
--- a/__tests__/test.js
+++ b/__tests__/test.js
@@ -31,7 +31,7 @@ function readOptionsFromFile(file) {
}
if (fs.existsSync(path.join(__dirname, '../.git'))) {
- test('git option', async function() {
+ test('git option', async function () {
jest.setTimeout(10000); // 10 second timeout. After update flow.js on 0.56 version the test is executed more time.
const file = path.join(__dirname, './fixture/simple.input.js');
const result = await documentation.build([file], { github: true });
@@ -43,7 +43,7 @@ if (fs.existsSync(path.join(__dirname, '../.git'))) {
});
}
-test('document-exported error', async function() {
+test('document-exported error', async function () {
const file = path.join(__dirname, 'fixture', 'document-exported-bad', 'x.js');
try {
await documentation.build([file], { documentExported: true });
@@ -52,7 +52,7 @@ test('document-exported error', async function() {
}
});
-test('external modules option', async function() {
+test('external modules option', async function () {
const result = await documentation.build(
[path.join(__dirname, 'fixture', 'external.input.js')],
{
@@ -68,11 +68,11 @@ test('external modules option', async function() {
expect(result).toMatchSnapshot();
});
-test('bad input', function() {
+test('bad input', function () {
glob
.sync(path.join(__dirname, 'fixture/bad', '*.input.js'))
- .forEach(function(file) {
- test(path.basename(file), function() {
+ .forEach(function (file) {
+ test(path.basename(file), function () {
return documentation
.build([file], readOptionsFromFile(file))
.then(res => {
@@ -90,11 +90,11 @@ test('bad input', function() {
});
});
-describe('html', function() {
+describe('html', function () {
glob
.sync(path.join(__dirname, 'fixture/html', '*.input.js'))
- .forEach(function(file) {
- test(path.basename(file), async function() {
+ .forEach(function (file) {
+ test(path.basename(file), async function () {
const result = await documentation.build(
[file],
readOptionsFromFile(file)
@@ -115,17 +115,17 @@ describe('html', function() {
});
});
-describe('outputs', function() {
+describe('outputs', function () {
glob
.sync(path.join(__dirname, 'fixture', '*.input.js'))
- .forEach(function(file) {
- describe(path.basename(file), async function() {
+ .forEach(function (file) {
+ describe(path.basename(file), function () {
let result = null;
- beforeEach(async function() {
+ beforeEach(async function () {
result = await documentation.build([file], readOptionsFromFile(file));
});
- test('markdown', async function() {
+ test('markdown', async function () {
const md = await outputMarkdown(_.cloneDeep(result), {
markdownToc: true
});
@@ -133,7 +133,7 @@ describe('outputs', function() {
});
if (file.match(/es6.input.js/)) {
- test('no markdown TOC', async function() {
+ test('no markdown TOC', async function () {
const txt = await outputMarkdown(_.cloneDeep(result), {
markdownToc: false
});
@@ -141,16 +141,16 @@ describe('outputs', function() {
});
}
- test('markdown AST', async function() {
+ test('markdown AST', async function () {
const ast = await outputMarkdownAST(_.cloneDeep(result), {});
expect(ast).toMatchSnapshot();
});
- test('JSON', function() {
+ test('JSON', function () {
normalize(result);
- result.forEach(function(comment) {
+ result.forEach(function (comment) {
validate(comment, documentationSchema.jsonSchema).errors.forEach(
- function(error) {
+ function (error) {
expect(error).toBeFalsy();
}
);
@@ -161,7 +161,7 @@ describe('outputs', function() {
});
});
-test('highlightAuto md output', async function() {
+test('highlightAuto md output', async function () {
const file = path.join(
__dirname,
'fixture/auto_lang_hljs/multilanguage.input.js'
@@ -175,7 +175,7 @@ test('highlightAuto md output', async function() {
expect(md.toString()).toMatchSnapshot();
});
-test('config', async function() {
+test('config', async function () {
const file = path.join(__dirname, 'fixture', 'class.input.js');
const outputfile = path.join(__dirname, 'fixture', 'class.config.output.md');
const out = await documentation.build([file], {
@@ -185,7 +185,7 @@ test('config', async function() {
expect(md).toMatchSnapshot();
});
-test('config with nested sections', async function() {
+test('config with nested sections', async function () {
const file = path.join(__dirname, 'fixture', 'sections.input.js');
const out = await documentation.build([file], {
config: path.join(__dirname, 'fixture', 'sections.config.yml')
@@ -194,7 +194,7 @@ test('config with nested sections', async function() {
expect(md).toMatchSnapshot();
});
-test('multi-file input', async function() {
+test('multi-file input', async function () {
const result = await documentation.build(
[
path.join(__dirname, 'fixture', 'simple.input.js'),
@@ -206,7 +206,7 @@ test('multi-file input', async function() {
expect(result).toMatchSnapshot();
});
-test('accepts simple relative paths', async function() {
+test('accepts simple relative paths', async function () {
await pify(chdir)(__dirname);
const data = await documentation.build(
'__tests__/fixture/simple.input.js',
@@ -215,7 +215,7 @@ test('accepts simple relative paths', async function() {
expect(data.length).toBe(1);
});
-test('.lint', async function() {
+test('.lint', async function () {
await pify(chdir)(__dirname);
const data = await documentation.lint(
'__tests__/fixture/simple.input.js',
@@ -224,7 +224,7 @@ test('.lint', async function() {
expect(data).toBe('');
});
-test('.lint with bad input', async function() {
+test('.lint with bad input', async function () {
await pify(chdir)(__dirname);
try {
await documentation.lint('__tests__/fixture/bad/syntax.input', {
@@ -235,14 +235,14 @@ test('.lint with bad input', async function() {
}
});
-test('Vue file', async function() {
+test('Vue file', async function () {
await pify(chdir)(__dirname);
const data = await documentation.build('__tests__/fixture/vue.input.vue', {});
normalize(data);
expect(data).toMatchSnapshot();
});
-test('Vue file', async function() {
+test('Vue file', async function () {
await pify(chdir)(__dirname);
const data = await documentation.build(
'__tests__/fixture/vue-no-script.input.vue',
@@ -252,7 +252,7 @@ test('Vue file', async function() {
expect(data).toMatchSnapshot();
});
-test('Use Source attribute only', async function() {
+test('Use Source attribute only', async function () {
await pify(chdir)(__dirname);
const documentationSource = `
/**
diff --git a/__tests__/utils.js b/__tests__/utils.js
index 001e3b4a7..6d67bc93c 100644
--- a/__tests__/utils.js
+++ b/__tests__/utils.js
@@ -1,12 +1,12 @@
const http = require('http');
-import { walk } from '../src/walk';
+const { walk } = require('../src/walk');
const concat = require('concat-stream');
function get(url, callback) {
return new Promise((resolve, reject) => {
- http.get(url, function(res) {
+ http.get(url, function (res) {
res.pipe(
- concat(function(text) {
+ concat(function (text) {
if (res.statusCode >= 400) {
return reject(res.statusCode);
}
@@ -18,7 +18,7 @@ function get(url, callback) {
}
function normalize(comments) {
- return walk(comments, function(comment) {
+ return walk(comments, function (comment) {
const hasGithub = !!comment.context.github;
const path = comment.context.path;
comment.context = {
diff --git a/babel.config.js b/babel.config.js
deleted file mode 100644
index 5e05b411a..000000000
--- a/babel.config.js
+++ /dev/null
@@ -1,16 +0,0 @@
-module.exports = {
- presets: [
- [
- '@babel/preset-env',
- {
- targets: {
- node: 6
- },
- include: ['transform-regenerator']
- }
- ],
- '@babel/preset-flow'
- ],
- plugins: ['@babel/plugin-transform-async-to-generator'],
- ignore: ['**/default_theme/assets/*']
-};
diff --git a/package.json b/package.json
index 46b326979..0766dbaf7 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "documentation",
"description": "a documentation generator",
- "version": "13.0.0",
+ "version": "13.0.1",
"author": "Tom MacWright",
"homepage": "https://documentation.js.org",
"bin": {
@@ -10,7 +10,7 @@
"dependencies": {
"@babel/core": "^7.9.0",
"@babel/generator": "^7.9.4",
- "@babel/parser": "7.9.4",
+ "@babel/parser": "7.10.2",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-proposal-do-expressions": "^7.8.3",
@@ -41,7 +41,7 @@
"concat-stream": "^1.6.0",
"diff": "^4.0.1",
"doctrine-temporary-fork": "2.1.0",
- "get-port": "^4.0.0",
+ "get-port": "^5.0.0",
"git-url-parse": "^11.1.2",
"github-slugger": "1.2.0",
"glob": "^7.1.2",
@@ -55,7 +55,7 @@
"mime": "^2.2.0",
"module-deps-sortable": "5.0.0",
"parse-filepath": "^1.0.2",
- "pify": "^4.0.0",
+ "pify": "^5.0.0",
"read-pkg-up": "^4.0.0",
"remark": "^9.0.0",
"remark-html": "^8.0.0",
@@ -77,23 +77,22 @@
},
"devDependencies": {
"babel-core": "^7.0.0-bridge.0",
- "babel-eslint": "^9.0.0",
- "babel-jest": "^23.4.2",
+ "babel-eslint": "^10.1.0",
"chdir": "0.0.0",
"cz-conventional-changelog": "2.1.0",
"documentation-schema": "0.0.1",
- "eslint": "^5.0.1",
- "eslint-config-prettier": "^3.0.1",
- "fs-extra": "^7.0.0",
+ "eslint": "^7.1.0",
+ "eslint-config-prettier": "^6.11.0",
+ "fs-extra": "^9.0.0",
"husky": "^1.3.1",
- "jest": "^23.0.0",
- "json-schema": "0.2.3",
+ "jest": "^26.0.0",
+ "json-schema": "^0.2.3",
"lint-staged": "^7.2.0",
"mock-fs": "^4.4.2",
- "p-event": "^2.0.0",
- "prettier": "^1.10.2",
- "standard-version": "^4.3.0",
- "tmp": "^0.0.33"
+ "p-event": "^4.1.0",
+ "prettier": "^2.0.5",
+ "standard-version": "^8.0.0",
+ "tmp": "^0.2.1"
},
"keywords": [
"documentation",
diff --git a/src/commands/lint.js b/src/commands/lint.js
index 524674578..e50b3c34e 100644
--- a/src/commands/lint.js
+++ b/src/commands/lint.js
@@ -19,7 +19,7 @@ module.exports.builder = {
* @returns {undefined} has side-effects
* @private
*/
-module.exports.handler = function(argv) {
+module.exports.handler = function (argv) {
argv._handled = true;
if (!argv.input.length) {
try {
diff --git a/src/commands/serve.js b/src/commands/serve.js
index f9c082dca..324b3f786 100644
--- a/src/commands/serve.js
+++ b/src/commands/serve.js
@@ -56,7 +56,7 @@ module.exports.handler = function serve(argv) {
const server = new Server(port);
let watcher;
- server.on('listening', function() {
+ server.on('listening', function () {
process.stdout.write(`documentation.js serving on port ${port}\n`);
});
diff --git a/src/default_theme/assets/anchor.js b/src/default_theme/assets/anchor.js
index f74c2de75..1f573dcbb 100644
--- a/src/default_theme/assets/anchor.js
+++ b/src/default_theme/assets/anchor.js
@@ -6,7 +6,7 @@
/* eslint-env amd, node */
// https://github.com/umdjs/umd/blob/master/templates/returnExports.js
-(function(root, factory) {
+(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
@@ -21,7 +21,7 @@
root.AnchorJS = factory();
root.anchors = new root.AnchorJS();
}
-})(this, function() {
+})(this, function () {
'use strict';
function AnchorJS(options) {
this.options = options || {};
@@ -51,7 +51,7 @@
* https://github.com/Modernizr/Modernizr/blob/da22eb27631fc4957f67607fe6042e85c0a84656/feature-detects/touchevents.js#L40
* @returns {Boolean} - true if the current device supports touch.
*/
- this.isTouchDevice = function() {
+ this.isTouchDevice = function () {
return !!(
'ontouchstart' in window ||
(window.DocumentTouch && document instanceof DocumentTouch)
@@ -64,7 +64,7 @@
* to. Also accepts an array or nodeList containing the relavant elements.
* @returns {this} - The AnchorJS object
*/
- this.add = function(selector) {
+ this.add = function (selector) {
var elements,
elsWithIds,
idList,
@@ -193,7 +193,7 @@
* OR a nodeList / array containing the DOM elements.
* @returns {this} - The AnchorJS object
*/
- this.remove = function(selector) {
+ this.remove = function (selector) {
var index,
domAnchor,
elements = _getElements(selector);
@@ -216,7 +216,7 @@
/**
* Removes all anchorjs links. Mostly used for tests.
*/
- this.removeAll = function() {
+ this.removeAll = function () {
this.remove(this.elements);
};
@@ -229,7 +229,7 @@
* @param {String} text - Any text. Usually pulled from the webpage element we are linking to.
* @returns {String} - hyphen-delimited text for use in IDs and URLs.
*/
- this.urlify = function(text) {
+ this.urlify = function (text) {
// Regex for finding the nonsafe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!'<>]./()*\
var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'<>\]\.\/\(\)\*\\]/g,
urlText;
@@ -260,7 +260,7 @@
* @param {HTMLElemnt} el - a DOM node
* @returns {Boolean} true/false
*/
- this.hasAnchorJSLink = function(el) {
+ this.hasAnchorJSLink = function (el) {
var hasLeftAnchor =
el.firstChild &&
(' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1,
diff --git a/src/default_theme/assets/site.js b/src/default_theme/assets/site.js
index f86584f2f..a624be7b2 100644
--- a/src/default_theme/assets/site.js
+++ b/src/default_theme/assets/site.js
@@ -7,7 +7,7 @@ anchors.add('h3');
// Filter UI
var tocElements = document.getElementById('toc').getElementsByTagName('li');
-document.getElementById('filter-input').addEventListener('keyup', function(e) {
+document.getElementById('filter-input').addEventListener('keyup', function (e) {
var i, element, children;
// enter key
@@ -22,14 +22,14 @@ document.getElementById('filter-input').addEventListener('keyup', function(e) {
}
}
- var match = function() {
+ var match = function () {
return true;
};
var value = this.value.toLowerCase();
if (!value.match(/^\s*$/)) {
- match = function(element) {
+ match = function (element) {
var html = element.firstChild.innerHTML;
return html && html.toLowerCase().indexOf(value) !== -1;
};
@@ -114,12 +114,12 @@ var cw_without_sb = split_left.clientWidth;
split_left.style.overflow = '';
Split(['#split-left', '#split-right'], {
- elementStyle: function(dimension, size, gutterSize) {
+ elementStyle: function (dimension, size, gutterSize) {
return {
'flex-basis': 'calc(' + size + '% - ' + gutterSize + 'px)'
};
},
- gutterStyle: function(dimension, gutterSize) {
+ gutterStyle: function (dimension, gutterSize) {
return {
'flex-basis': gutterSize + 'px'
};
@@ -152,9 +152,9 @@ function loadState(ev) {
}
}
-window.addEventListener('load', function() {
+window.addEventListener('load', function () {
// Restore after Firefox scrolls to hash.
- setTimeout(function() {
+ setTimeout(function () {
loadState();
// Update with initial scroll position.
updateState();
diff --git a/src/default_theme/index.js b/src/default_theme/index.js
index 5134b79a3..0ca504edf 100644
--- a/src/default_theme/index.js
+++ b/src/default_theme/index.js
@@ -18,10 +18,10 @@ function isFunction(section) {
);
}
-module.exports = function(comments, config) {
+module.exports = function (comments, config) {
var linkerStack = new LinkerStack(config).namespaceResolver(
comments,
- function(namespace) {
+ function (namespace) {
var slugger = new GithubSlugger();
return '#' + slugger.slug(namespace);
}
@@ -109,7 +109,7 @@ module.exports = function(comments, config) {
// push assets into the pipeline as well.
return new Promise(resolve => {
vfs.src([__dirname + '/assets/**'], { base: __dirname }).pipe(
- concat(function(files) {
+ concat(function (files) {
resolve(
files.concat(
new File({
diff --git a/src/extractors/exported.js b/src/extractors/exported.js
index 9a11323af..720fa280d 100644
--- a/src/extractors/exported.js
+++ b/src/extractors/exported.js
@@ -45,7 +45,7 @@ function walkExported(ast, data /*: {
}
return comments
- .map(function(comment) {
+ .map(function (comment) {
return addComment(
data,
comment.value,
@@ -61,7 +61,7 @@ function walkExported(ast, data /*: {
function addComments(data, path, overrideName) {
const comments = getComments(data, path);
if (overrideName) {
- comments.forEach(function(comment) {
+ comments.forEach(function (comment) {
comment.name = overrideName;
});
}
@@ -224,7 +224,8 @@ function findExportDeclaration(
if (
declaration.isFunctionDeclaration() ||
declaration.isClassDeclaration() ||
- declaration.isTypeAlias()
+ declaration.isTypeAlias() ||
+ declaration.isOpaqueType()
) {
bindingName = declaration.node.id.name;
} else if (declaration.isVariableDeclaration()) {
diff --git a/src/get-readme-file.js b/src/get-readme-file.js
index 7be8b7068..796b5690d 100644
--- a/src/get-readme-file.js
+++ b/src/get-readme-file.js
@@ -10,7 +10,7 @@ module.exports = function findReadme(dir) {
'readme.md'
];
- const readmeFile = fs.readdirSync(dir).find(function(filename) {
+ const readmeFile = fs.readdirSync(dir).find(function (filename) {
return readmeFilenames.indexOf(filename) >= 0;
});
diff --git a/src/github.js b/src/github.js
index 3edb435ad..6867be0f6 100644
--- a/src/github.js
+++ b/src/github.js
@@ -9,7 +9,7 @@ const getGithubURLPrefix = require('./git/url_prefix');
* @param {Object} comment parsed comment
* @returns {Object} comment with github inferred
*/
-module.exports = function(comment) {
+module.exports = function (comment) {
const paths = findGit(comment.context.file);
const urlPrefix = paths && getGithubURLPrefix(paths);
diff --git a/src/hierarchy.js b/src/hierarchy.js
index ab94adf8e..1eddff936 100644
--- a/src/hierarchy.js
+++ b/src/hierarchy.js
@@ -49,7 +49,7 @@ function pick(comment) {
* @returns {Array