diff --git a/lib/find/find.js b/lib/find/find.js index 66d605e..a9b9bbc 100644 --- a/lib/find/find.js +++ b/lib/find/find.js @@ -220,10 +220,7 @@ function urlToPath(value, config) { // the `foo/bar` branch, or, `baz` in the `bar` directory on the `foo` // branch. // Currently, we’re ignoring this and just not supporting branches. - value = value - .split(slash) - .slice(1) - .join(slash) + value = value.split(slash).slice(1).join(slash) return normalize(path.resolve(config.root, value + url.hash), config) } diff --git a/lib/find/index.js b/lib/find/index.js index aacf065..a26ecf8 100644 --- a/lib/find/index.js +++ b/lib/find/index.js @@ -5,7 +5,4 @@ var findRepo = require('./find-repo') var config = require('./config') var find = require('./find') -module.exports = trough() - .use(findRepo) - .use(config) - .use(find) +module.exports = trough().use(findRepo).use(config).use(find) diff --git a/lib/index.js b/lib/index.js index 6602677..b26b052 100644 --- a/lib/index.js +++ b/lib/index.js @@ -42,7 +42,7 @@ function cliCompleter(set, next) { function checkAll(files, next) { // Check all references and landmarks. - check.run({files: files}, function(err) { + check.run({files: files}, function (err) { next(err) }) } diff --git a/package.json b/package.json index b0fc412..42ce171 100644 --- a/package.json +++ b/package.json @@ -41,9 +41,9 @@ "index.js" ], "dependencies": { - "github-slugger": "^1.2.0", + "github-slugger": "^1.0.0", "hosted-git-info": "^2.5.0", - "mdast-util-to-string": "^1.0.4", + "mdast-util-to-string": "^1.0.0", "propose": "0.0.5", "to-vfile": "^6.0.0", "trough": "^1.0.0", @@ -52,7 +52,7 @@ }, "devDependencies": { "nyc": "^15.0.0", - "prettier": "^1.0.0", + "prettier": "^2.0.0", "remark": "^11.0.0", "remark-cli": "^7.0.0", "remark-preset-wooorm": "^6.0.0", @@ -60,7 +60,7 @@ "strip-ansi": "^6.0.0", "tape": "^4.0.0", "vfile-sort": "^2.0.0", - "xo": "^0.25.0" + "xo": "^0.28.0" }, "scripts": { "format": "remark *.md -qfo && prettier --write \"**/*.js\" && xo --fix", diff --git a/test/index.js b/test/index.js index 413c9c9..33aecee 100644 --- a/test/index.js +++ b/test/index.js @@ -13,20 +13,20 @@ var links = require('..') process.chdir(path.resolve(process.cwd(), 'test', 'fixtures')) -test.onFinish(function() { +test.onFinish(function () { process.chdir(path.resolve(process.cwd(), '..', '..')) }) var bin = path.join('..', '..', 'node_modules', '.bin', 'remark') -test('remark-validate-links', function(t) { - t.test('should work on the API', function(st) { +test('remark-validate-links', function (t) { + t.test('should work on the API', function (st) { st.plan(1) remark() .use(links) .use(sort) - .process(vfile.readSync('github.md'), function(err, file) { + .process(vfile.readSync('github.md'), function (err, file) { st.deepEqual( [err].concat(file.messages.map(String)), [ @@ -42,7 +42,7 @@ test('remark-validate-links', function(t) { }) }) - t.test('should ignore invalid repositories', function(st) { + t.test('should ignore invalid repositories', function (st) { st.plan(1) childProcess.exec( @@ -77,7 +77,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should throw on Gist repositories', function(st) { + t.test('should throw on Gist repositories', function (st) { st.plan(1) childProcess.exec( @@ -112,7 +112,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should ignore unfound files (#1)', function(st) { + t.test('should ignore unfound files (#1)', function (st) { st.plan(1) childProcess.exec( @@ -147,7 +147,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should ignore unfound files (#2)', function(st) { + t.test('should ignore unfound files (#2)', function (st) { st.plan(1) childProcess.exec( @@ -186,7 +186,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work if there are no links', function(st) { + t.test('should work if there are no links', function (st) { st.plan(1) childProcess.exec( @@ -212,7 +212,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work with stdin', function(st) { + t.test('should work with stdin', function (st) { st.plan(1) var subprocess = childProcess.exec( @@ -248,7 +248,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work when not all files are given', function(st) { + t.test('should work when not all files are given', function (st) { st.plan(1) childProcess.exec( @@ -291,7 +291,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work when all files are given', function(st) { + t.test('should work when all files are given', function (st) { st.plan(1) childProcess.exec( @@ -342,7 +342,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work with definitions', function(st) { + t.test('should work with definitions', function (st) { st.plan(1) childProcess.exec( @@ -377,7 +377,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work on GitHub URLs when given a repo', function(st) { + t.test('should work on GitHub URLs when given a repo', function (st) { st.plan(1) childProcess.exec( @@ -445,7 +445,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work when with Git directory', function(st) { + t.test('should work when with Git directory', function (st) { st.plan(1) childProcess.exec('git init', oninit) @@ -538,7 +538,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should fail w/o Git repository', function(st) { + t.test('should fail w/o Git repository', function (st) { st.plan(1) fs.renameSync('../../.git', '../../.git.bak') @@ -563,7 +563,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should fail w/o Git repository w/o remote', function(st) { + t.test('should fail w/o Git repository w/o remote', function (st) { st.plan(1) childProcess.exec('git init', oninit) @@ -592,7 +592,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work w/o Git repository w/ repo', function(st) { + t.test('should work w/o Git repository w/ repo', function (st) { st.plan(1) fs.renameSync('../../.git', '../../.git.bak') @@ -630,7 +630,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work w/o Git repository w/ remote', function(st) { + t.test('should work w/o Git repository w/ remote', function (st) { st.plan(1) fs.renameSync('../../.git', '../../.git.bak') @@ -666,7 +666,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work w/o Git repository w/ remote and root', function(st) { + t.test('should work w/o Git repository w/ remote and root', function (st) { st.plan(1) fs.renameSync('../../.git', '../../.git.bak') @@ -702,7 +702,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work with `repository:false`', function(st) { + t.test('should work with `repository:false`', function (st) { st.plan(1) fs.renameSync('../../.git', '../../.git.bak') @@ -757,7 +757,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should work when finding non-hosted Git remotes', function(st) { + t.test('should work when finding non-hosted Git remotes', function (st) { st.plan(1) childProcess.exec( @@ -792,7 +792,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should support a GitLab shortcode', function(st) { + t.test('should support a GitLab shortcode', function (st) { st.plan(1) childProcess.exec( @@ -843,7 +843,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should support a Bitbucket shortcode', function(st) { + t.test('should support a Bitbucket shortcode', function (st) { st.plan(1) childProcess.exec( @@ -894,7 +894,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should suggest similar links', function(st) { + t.test('should suggest similar links', function (st) { st.plan(1) childProcess.exec( @@ -930,7 +930,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should recognise links to particular lines', function(st) { + t.test('should recognise links to particular lines', function (st) { st.plan(1) childProcess.exec( @@ -966,7 +966,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should recognise links with encoded URLs', function(st) { + t.test('should recognise links with encoded URLs', function (st) { st.plan(1) childProcess.exec( @@ -1004,7 +1004,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should support folders', function(st) { + t.test('should support folders', function (st) { st.plan(1) childProcess.exec( @@ -1043,7 +1043,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should check images', function(st) { + t.test('should check images', function (st) { st.plan(1) childProcess.exec( @@ -1082,7 +1082,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should support query parameters', function(st) { + t.test('should support query parameters', function (st) { st.plan(1) childProcess.exec( @@ -1117,7 +1117,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should support case insensitive headings', function(st) { + t.test('should support case insensitive headings', function (st) { st.plan(1) childProcess.exec( @@ -1153,7 +1153,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should ignore external links', function(st) { + t.test('should ignore external links', function (st) { st.plan(1) childProcess.exec( @@ -1179,7 +1179,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should ignore external links (without repo)', function(st) { + t.test('should ignore external links (without repo)', function (st) { st.plan(1) childProcess.exec( @@ -1205,7 +1205,7 @@ test('remark-validate-links', function(t) { } }) - t.test('should support self-hosted Git solutions', function(st) { + t.test('should support self-hosted Git solutions', function (st) { st.plan(1) childProcess.exec('git init', oninit)