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

remark-lint-no-tabs

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-tabs - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0

index.d.ts

43

index.js

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

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

@@ -25,3 +26,4 @@ * Foo Bar

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

@@ -42,3 +44,4 @@ * »Here's one before a code block.

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

@@ -56,20 +59,24 @@ * 1:1: Use spaces instead of tabs

'use strict'
/**
* @typedef {import('mdast').Root} Root
*/
var rule = require('unified-lint-rule')
var location = require('vfile-location')
import {lintRule} from 'unified-lint-rule'
import {location} from 'vfile-location'
module.exports = rule('remark-lint:no-tabs', noTabs)
const remarkLintNoTabs = lintRule(
'remark-lint:no-tabs',
/** @type {import('unified-lint-rule').Rule<Root, void>} */
(_, file) => {
const value = String(file)
const toPoint = location(file).toPoint
let index = value.indexOf('\t')
var reason = 'Use spaces instead of tabs'
while (index !== -1) {
file.message('Use spaces instead of tabs', toPoint(index))
index = value.indexOf('\t', index + 1)
}
}
)
function noTabs(tree, file) {
var content = String(file)
var position = location(file).toPosition
var index = content.indexOf('\t')
while (index !== -1) {
file.message(reason, position(index))
index = content.indexOf('\t', index + 1)
}
}
export default remarkLintNoTabs
{
"name": "remark-lint-no-tabs",
"version": "2.0.1",
"version": "3.0.0",
"description": "remark-lint rule to warn when hard tabs are used instead of spaces",

@@ -23,10 +23,26 @@ "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",
"vfile-location": "^3.0.0"
"@types/mdast": "^3.0.0",
"unified": "^10.0.0",
"unified-lint-rule": "^2.0.0",
"vfile-location": "^4.0.0"
},
"xo": false
"scripts": {
"build": "rimraf \"*.d.ts\" && tsc && type-coverage"
},
"xo": false,
"typeCoverage": {
"atLeast": 100,
"detail": true,
"strict": true,
"ignoreCatch": true
}
}

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

@@ -91,2 +94,5 @@

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

@@ -118,10 +124,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 remarkLintNoTabs from 'remark-lint-no-tabs'
remark()
.use(require('remark-lint'))
+ .use(require('remark-lint-no-tabs'))
.process('_Emphasis_ and **importance**', function (err, file) {
console.error(report(err || file))
.use(remarkLint)
+ .use(remarkLintNoTabs)
.process('_Emphasis_ and **importance**')
.then((file) => {
console.error(reporter(file))
})

@@ -144,5 +153,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

@@ -167,6 +176,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

@@ -173,0 +184,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