Socket
Socket
Sign inDemoInstall

remark-lint-no-file-name-outer-dashes

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-no-file-name-outer-dashes - npm Package Compare versions

Comparing version 1.0.6 to 2.0.0

index.d.ts

32

index.js

@@ -9,9 +9,12 @@ /**

*
* @example {"name": "readme.md"}
* @example
* {"name": "readme.md"}
*
* @example {"name": "-readme.md", "label": "output", "config": {"positionless": true}}
* @example
* {"name": "-readme.md", "label": "output", "positionless": true}
*
* 1:1: Do not use initial or final dashes in a file name
*
* @example {"name": "readme-.md", "label": "output", "config": {"positionless": true}}
* @example
* {"name": "readme-.md", "label": "output", "positionless": true}
*

@@ -21,17 +24,18 @@ * 1:1: Do not use initial or final 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 remarkLintNofileNameOuterDashes = lintRule(
'remark-lint:no-file-name-outer-dashes',
noFileNameOuterDashes
/** @type {import('unified-lint-rule').Rule<Root, void>} */
(_, file) => {
if (file.stem && /^-|-$/.test(file.stem)) {
file.message('Do not use initial or final dashes in a file name')
}
}
)
var reason = 'Do not use initial or final dashes in a file name'
function noFileNameOuterDashes(tree, file) {
if (file.stem && /^-|-$/.test(file.stem)) {
file.message(reason)
}
}
export default remarkLintNofileNameOuterDashes
{
"name": "remark-lint-no-file-name-outer-dashes",
"version": "1.0.6",
"version": "2.0.0",
"description": "remark-lint rule to warn when file names contain initial or final dashes",

@@ -26,9 +26,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
}
}

@@ -49,2 +49,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][]:

@@ -56,2 +59,5 @@

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

@@ -83,10 +89,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 remarkLintNoFileNameOuterDashes from 'remark-lint-no-file-name-outer-dashes'
remark()
.use(require('remark-lint'))
+ .use(require('remark-lint-no-file-name-outer-dashes'))
.process('_Emphasis_ and **importance**', function (err, file) {
console.error(report(err || file))
.use(remarkLint)
+ .use(remarkLintNoFileNameOuterDashes)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})

@@ -109,5 +118,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

@@ -132,6 +141,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

@@ -138,0 +149,0 @@

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