Socket
Socket
Sign inDemoInstall

remark-lint-no-shortcut-reference-image

Package Overview
Dependencies
16
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 3.0.0

index.d.ts

42

index.js

@@ -15,3 +15,4 @@ /**

*
* @example {"name": "ok.md"}
* @example
* {"name": "ok.md"}
*

@@ -22,3 +23,4 @@ * ![foo][]

*
* @example {"name": "not-ok.md", "label": "input"}
* @example
* {"name": "not-ok.md", "label": "input"}
*

@@ -29,3 +31,4 @@ * ![foo]

*
* @example {"name": "not-ok.md", "label": "output"}
* @example
* {"name": "not-ok.md", "label": "output"}
*

@@ -35,23 +38,22 @@ * 1:1-1:7: Use the trailing [] on reference images

'use strict'
/**
* @typedef {import('mdast').Root} Root
*/
var rule = require('unified-lint-rule')
var visit = require('unist-util-visit')
var generated = require('unist-util-generated')
import {lintRule} from 'unified-lint-rule'
import {visit} from 'unist-util-visit'
import {generated} from 'unist-util-generated'
module.exports = rule(
const remarkLintNoShortcutReferenceImage = lintRule(
'remark-lint:no-shortcut-reference-image',
noShortcutReferenceImage
/** @type {import('unified-lint-rule').Rule<Root, void>} */
(tree, file) => {
visit(tree, 'imageReference', (node) => {
if (!generated(node) && node.referenceType === 'shortcut') {
file.message('Use the trailing [] on reference images', node)
}
})
}
)
var reason = 'Use the trailing [] on reference images'
function noShortcutReferenceImage(tree, file) {
visit(tree, 'imageReference', visitor)
function visitor(node) {
if (!generated(node) && node.referenceType === 'shortcut') {
file.message(reason, node)
}
}
}
export default remarkLintNoShortcutReferenceImage
{
"name": "remark-lint-no-shortcut-reference-image",
"version": "2.0.1",
"version": "3.0.0",
"description": "remark-lint rule to warn when shortcut reference images are used",

@@ -25,11 +25,27 @@ "license": "MIT",

],
"sideEffects": false,
"type": "module",
"main": "index.js",
"types": "index.d.ts",
"files": [
"index.d.ts",
"index.js"
],
"dependencies": {
"unified-lint-rule": "^1.0.0",
"unist-util-generated": "^1.1.0",
"unist-util-visit": "^2.0.0"
"@types/mdast": "^3.0.0",
"unified": "^10.0.0",
"unified-lint-rule": "^2.0.0",
"unist-util-generated": "^2.0.0",
"unist-util-visit": "^4.0.0"
},
"xo": false
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage"
},
"xo": false,
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

@@ -64,2 +64,5 @@ <!--This file is generated-->

This package is [ESM only][esm]:
Node 12+ is needed to use it and it must be `imported`ed instead of `required`d.
[npm][]:

@@ -71,2 +74,5 @@

This package exports no identifiers.
The default export is `remarkLintNoShortcutReferenceImage`.
## Use

@@ -98,10 +104,13 @@

```diff
var remark = require('remark')
var report = require('vfile-reporter')
import {remark} from 'remark'
import {reporter} from 'vfile-reporter'
import remarkLint from 'remark-lint'
import remarkLintNoShortcutReferenceImage from 'remark-lint-no-shortcut-reference-image'
remark()
.use(require('remark-lint'))
+ .use(require('remark-lint-no-shortcut-reference-image'))
.process('_Emphasis_ and **importance**', function (err, file) {
console.error(report(err || file))
.use(remarkLint)
+ .use(remarkLintNoShortcutReferenceImage)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})

@@ -124,5 +133,5 @@ ```

[build-badge]: https://img.shields.io/travis/remarkjs/remark-lint/main.svg
[build-badge]: https://github.com/remarkjs/remark-lint/workflows/main/badge.svg
[build]: https://travis-ci.org/remarkjs/remark-lint
[build]: https://github.com/remarkjs/remark-lint/actions

@@ -147,6 +156,8 @@ [coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg

[chat-badge]: https://img.shields.io/badge/chat-spectrum.svg
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[chat]: https://spectrum.chat/unified/remark
[chat]: https://github.com/remarkjs/remark/discussions
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[npm]: https://docs.npmjs.com/cli/install

@@ -153,0 +164,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc