Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@double-great/remark-lint-alt-text

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@double-great/remark-lint-alt-text - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

LICENSE

23

index.js
const rule = require("unified-lint-rule");
const visit = require("unist-util-visit");
const visit = require("unist-util-visit-parents");
const altText = require("@double-great/alt-text");

@@ -7,5 +7,16 @@

const textToNodes = {};
const aggregate = node => {
let imageIsLink = false;
let hasAltText = false;
const aggregate = (node, ancestors) => {
imageIsLink = ancestors.filter(a => a.type === "link").length > 0;
const alt = node.alt || undefined;
if (!alt) return;
if (alt) hasAltText = true;
if (!alt && !imageIsLink) return;
if (!alt && imageIsLink) {
file.message(
"No alt text found: Images inside a link tag require alt text that describes the purpose of the link.",
node
);
}
if (!textToNodes[alt]) {

@@ -26,2 +37,8 @@ textToNodes[alt] = [];

}
if (imageIsLink && hasAltText) {
file.message(
"Images inside a link tag require alt text that describes the purpose of the link.",
node
);
}
});

@@ -28,0 +45,0 @@ });

11

package.json
{
"name": "@double-great/remark-lint-alt-text",
"version": "0.1.0",
"description": "A remark-lint plugin to warn against inaccessible alt text.",
"version": "0.2.0",
"description": "A remark-lint plugin that finds unhelpful or missing image alt text",
"main": "index.js",

@@ -15,5 +15,5 @@ "scripts": {

"dependencies": {
"@double-great/alt-text": "^0.1.0",
"@double-great/alt-text": "^0.2.0",
"unified-lint-rule": "^1.0.4",
"unist-util-visit": "^2.0.1"
"unist-util-visit-parents": "^3.0.1"
},

@@ -28,3 +28,3 @@ "devDependencies": {

"remark": "^11.0.2",
"tape": "^4.12.1"
"tape": "^4.13.0"
},

@@ -40,2 +40,3 @@ "husky": {

"keywords": [
"accessibility",
"remark",

@@ -42,0 +43,0 @@ "remark-plugin",

# remark-lint-alt-text [![Build Status](https://travis-ci.com/double-great/remark-lint-alt-text.svg?branch=master)](https://travis-ci.com/double-great/remark-lint-alt-text)
A [remark-lint](https://github.com/remarkjs/remark-lint) plugin to warn against inaccessible alt text.
A [remark-lint](https://github.com/remarkjs/remark-lint) plugin that finds unhelpful or missing image alt text.

@@ -5,0 +5,0 @@ ## Install

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc