@double-great/remark-lint-alt-text
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -0,3 +1,8 @@ | ||
import { Severity, Label } from "unified-lint-rule"; | ||
import { Config } from "@double-great/alt-text"; | ||
declare const checkAltText: import("unified").Plugin<void[] | [Config | import("unified-lint-rule").Label | import("unified-lint-rule").Severity] | [boolean | import("unified-lint-rule").Label | import("unified-lint-rule").Severity, Config], import("unist").Node, import("unist").Node>; | ||
import { Node } from "unist"; | ||
import { VFile } from "vfile"; | ||
import { TransformCallback } from "unified"; | ||
type Plugin = (config?: Label | Severity | Config | [level: Label | Severity, option?: Config | undefined] | undefined) => ((tree: Node, file: VFile, next: TransformCallback) => undefined) | undefined; | ||
declare const checkAltText: Plugin; | ||
export default checkAltText; |
import { lintRule } from "unified-lint-rule"; | ||
import { visitParents } from "unist-util-visit-parents"; | ||
import altText, { defaultConfig } from "@double-great/alt-text"; | ||
import imageLink from "@double-great/alt-text/dist/clues/image-link.js"; | ||
import altText, { defaultConfig, imageLink, } from "@double-great/alt-text"; | ||
const checkAltText = lintRule("remark-lint:alt-text", (tree, file, options) => { | ||
@@ -18,6 +17,6 @@ options = Object.assign(Object.assign({}, defaultConfig), options); | ||
if (suggestion) | ||
file.message(suggestion, node); | ||
file.message(suggestion); | ||
} | ||
if (!alt && imageIsLink && options["image-is-link"] !== false) { | ||
file.message(imageLink.check(), node); | ||
file.message(imageLink.check()); | ||
} | ||
@@ -39,5 +38,5 @@ if (!alt) | ||
if (suggestion) | ||
file.message(suggestion, node); | ||
file.message(suggestion); | ||
if (imageIsLink && !hasAltText && options["image-is-link"] !== false) { | ||
file.message(imageLink.check(), node); | ||
file.message(imageLink.check()); | ||
} | ||
@@ -44,0 +43,0 @@ } |
{ | ||
"name": "@double-great/remark-lint-alt-text", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A remark-lint plugin that finds unhelpful or missing image alt text", | ||
"main": "dist/index.js", | ||
"exports": "./dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"scripts": { | ||
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", | ||
"lint": "eslint .", | ||
"pretest": "npm run lint", | ||
"test": "jest", | ||
"pretty-quick": "pretty-quick", | ||
"prepare": "husky install", | ||
"prepublishOnly": "tsc" | ||
"build": "tsc", | ||
"prepublishOnly": "npm run build", | ||
"format": "prettier --write ." | ||
}, | ||
@@ -19,24 +22,23 @@ "author": "@double-great", | ||
"dependencies": { | ||
"@double-great/alt-text": "^3.0.0", | ||
"unified-lint-rule": "^2.1.1", | ||
"unist-util-visit-parents": "^5.1.0" | ||
"@double-great/alt-text": "^3.2.1", | ||
"unified-lint-rule": "^3.0.0", | ||
"unist-util-visit-parents": "^6.0.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-typescript": "^7.16.7", | ||
"@types/dedent": "^0.7.0", | ||
"@types/jest": "^27.4.1", | ||
"@types/node": "^17.0.21", | ||
"@typescript-eslint/eslint-plugin": "^5.15.0", | ||
"@typescript-eslint/parser": "^5.15.0", | ||
"dedent": "^0.7.0", | ||
"eslint": "^8.11.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-jest": "^26.1.1", | ||
"husky": "^7.0.0", | ||
"jest": "^27.5.1", | ||
"prettier": "^2.5.1", | ||
"pretty-quick": "^3.1.3", | ||
"remark": "^14.0.2", | ||
"typescript": "^4.6.2" | ||
"@babel/preset-env": "^7.26.0", | ||
"@babel/preset-typescript": "^7.26.0", | ||
"@eslint/js": "^9.18.0", | ||
"@types/dedent": "^0.7.2", | ||
"@types/jest": "^29.5.14", | ||
"@types/node": "^22.10.7", | ||
"dedent": "^1.5.3", | ||
"eslint": "^9.18.0", | ||
"eslint-plugin-jest": "^28.11.0", | ||
"jest": "^29.7.0", | ||
"prettier": "^3.4.2", | ||
"prettier-2": "npm:prettier@^2", | ||
"remark": "^15.0.1", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.7.3", | ||
"typescript-eslint": "^8.20.0" | ||
}, | ||
@@ -59,11 +61,3 @@ "directories": { | ||
}, | ||
"homepage": "https://github.com/double-great/remark-lint-alt-text#readme", | ||
"jest": { | ||
"transformIgnorePatterns": [ | ||
"!node_modules/" | ||
], | ||
"moduleNameMapper": { | ||
"^../index.js$": "<rootDir>/index.ts" | ||
} | ||
} | ||
"homepage": "https://github.com/double-great/remark-lint-alt-text#readme" | ||
} |
16
52
5489
+ Added@types/unist@3.0.3(transitive)
+ Addeddequal@2.0.3(transitive)
+ Addeddevlop@1.1.0(transitive)
+ Addedunified@11.0.5(transitive)
+ Addedunified-lint-rule@3.0.0(transitive)
+ Addedunist-util-is@6.0.0(transitive)
+ Addedunist-util-stringify-position@4.0.0(transitive)
+ Addedunist-util-visit-parents@6.0.1(transitive)
+ Addedvfile@6.0.3(transitive)
+ Addedvfile-message@4.0.2(transitive)
- Removed@types/unist@2.0.11(transitive)
- Removedis-buffer@2.0.5(transitive)
- Removedunified@10.1.2(transitive)
- Removedunified-lint-rule@2.1.2(transitive)
- Removedunist-util-is@5.2.1(transitive)
- Removedunist-util-stringify-position@3.0.3(transitive)
- Removedunist-util-visit-parents@5.1.3(transitive)
- Removedvfile@5.3.7(transitive)
- Removedvfile-message@3.1.4(transitive)
Updatedunified-lint-rule@^3.0.0