remark-lint-no-shortcut-reference-link
Advanced tools
Comparing version 1.0.2 to 1.0.3
27
index.js
@@ -31,22 +31,23 @@ /** | ||
'use strict'; | ||
'use strict' | ||
var rule = require('unified-lint-rule'); | ||
var visit = require('unist-util-visit'); | ||
var generated = require('unist-util-generated'); | ||
var rule = require('unified-lint-rule') | ||
var visit = require('unist-util-visit') | ||
var generated = require('unist-util-generated') | ||
module.exports = rule('remark-lint:no-shortcut-reference-link', noShortcutReferenceLink); | ||
module.exports = rule( | ||
'remark-lint:no-shortcut-reference-link', | ||
noShortcutReferenceLink | ||
) | ||
function noShortcutReferenceLink(ast, file) { | ||
visit(ast, 'linkReference', visitor); | ||
var reason = 'Use the trailing [] on reference links' | ||
function noShortcutReferenceLink(tree, file) { | ||
visit(tree, 'linkReference', visitor) | ||
function visitor(node) { | ||
if (generated(node)) { | ||
return; | ||
if (!generated(node) && node.referenceType === 'shortcut') { | ||
file.message(reason, node) | ||
} | ||
if (node.referenceType === 'shortcut') { | ||
file.message('Use the trailing [] on reference links', node); | ||
} | ||
} | ||
} |
{ | ||
"name": "remark-lint-no-shortcut-reference-link", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "remark-lint rule to warn when shortcut reference links are used", | ||
@@ -14,4 +14,4 @@ "license": "MIT", | ||
], | ||
"repository": "https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-link", | ||
"bugs": "https://github.com/wooorm/remark-lint/issues", | ||
"repository": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-no-shortcut-reference-link", | ||
"bugs": "https://github.com/remarkjs/remark-lint/issues", | ||
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
@@ -18,0 +18,0 @@ "contributors": [ |
@@ -18,4 +18,4 @@ <!--This file is generated--> | ||
| ------ | ------- | | ||
| [`remark-preset-lint-markdown-style-guide`](https://github.com/wooorm/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | | ||
| [`remark-preset-lint-recommended`](https://github.com/wooorm/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | | ||
| [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-markdown-style-guide) | | | ||
| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | | | ||
@@ -99,2 +99,2 @@ ## Example | ||
[MIT](https://github.com/wooorm/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com) | ||
[MIT](https://github.com/remarkjs/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com) |
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
3984
46