remark-lint-no-file-name-consecutive-dashes
Advanced tools
Comparing version 1.0.5 to 2.0.0
29
index.js
@@ -9,5 +9,7 @@ /** | ||
* | ||
* @example {"name": "plug-ins.md"} | ||
* @example | ||
* {"name": "plug-ins.md"} | ||
* | ||
* @example {"name": "plug--ins.md", "label": "output", "config": {"positionless": true}} | ||
* @example | ||
* {"name": "plug--ins.md", "label": "output", "positionless": true} | ||
* | ||
@@ -17,17 +19,18 @@ * 1:1: Do not use consecutive dashes in a file name | ||
'use strict' | ||
/** | ||
* @typedef {import('mdast').Root} Root | ||
*/ | ||
var rule = require('unified-lint-rule') | ||
import {lintRule} from 'unified-lint-rule' | ||
module.exports = rule( | ||
const remarkLintNoFileNameConsecutiveDashes = lintRule( | ||
'remark-lint:no-file-name-consecutive-dashes', | ||
noFileNameConsecutiveDashes | ||
/** @type {import('unified-lint-rule').Rule<Root, void>} */ | ||
(_, file) => { | ||
if (file.stem && /-{2,}/.test(file.stem)) { | ||
file.message('Do not use consecutive dashes in a file name') | ||
} | ||
} | ||
) | ||
var reason = 'Do not use consecutive dashes in a file name' | ||
function noFileNameConsecutiveDashes(tree, file) { | ||
if (file.stem && /-{2,}/.test(file.stem)) { | ||
file.message(reason) | ||
} | ||
} | ||
export default remarkLintNoFileNameConsecutiveDashes |
{ | ||
"name": "remark-lint-no-file-name-consecutive-dashes", | ||
"version": "1.0.5", | ||
"version": "2.0.0", | ||
"description": "remark-lint rule to warn when file names contain consecutive dashes", | ||
@@ -27,9 +27,25 @@ "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" | ||
"@types/mdast": "^3.0.0", | ||
"unified": "^10.0.0", | ||
"unified-lint-rule": "^2.0.0" | ||
}, | ||
"xo": false | ||
"scripts": { | ||
"build": "rimraf \"*.d.ts\" && tsc && type-coverage" | ||
}, | ||
"xo": false, | ||
"typeCoverage": { | ||
"atLeast": 100, | ||
"detail": true, | ||
"strict": true, | ||
"ignoreCatch": true | ||
} | ||
} |
@@ -41,2 +41,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][]: | ||
@@ -48,2 +51,5 @@ | ||
This package exports no identifiers. | ||
The default export is `remarkLintNoFileNameConsecutiveDashes`. | ||
## Use | ||
@@ -75,10 +81,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 remarkLintNoFileNameConsecutiveDashes from 'remark-lint-no-file-name-consecutive-dashes' | ||
remark() | ||
.use(require('remark-lint')) | ||
+ .use(require('remark-lint-no-file-name-consecutive-dashes')) | ||
.process('_Emphasis_ and **importance**', function (err, file) { | ||
console.error(report(err || file)) | ||
.use(remarkLint) | ||
+ .use(remarkLintNoFileNameConsecutiveDashes) | ||
.process('_Emphasis_ and **importance**') | ||
.then((file) => { | ||
console.error(reporter(file)) | ||
}) | ||
@@ -101,5 +110,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 | ||
@@ -124,6 +133,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 | ||
@@ -130,0 +141,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6173
4
46
148
Yes
3
+ Added@types/mdast@^3.0.0
+ Addedunified@^10.0.0
+ Added@types/mdast@3.0.15(transitive)
+ Added@types/unist@2.0.11(transitive)
+ Addedbail@2.0.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedis-buffer@2.0.5(transitive)
+ Addedis-plain-obj@4.1.0(transitive)
+ Addedtrough@2.2.0(transitive)
+ Addedunified@10.1.2(transitive)
+ Addedunified-lint-rule@2.1.2(transitive)
+ Addedunist-util-stringify-position@3.0.3(transitive)
+ Addedvfile@5.3.7(transitive)
+ Addedvfile-message@3.1.4(transitive)
- Removedco@3.1.0(transitive)
- Removedsliced@1.0.1(transitive)
- Removedunified-lint-rule@1.0.6(transitive)
- Removedwrapped@1.0.1(transitive)
Updatedunified-lint-rule@^2.0.0