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

remark-lint-no-empty-sections

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-no-empty-sections - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

.travis.yml

6

dist/no-empty-section.js

@@ -18,2 +18,8 @@ 'use strict';

}
if (parent.children.length - 1 === index) {
file.warn('Remove empty section: "' + label + '"', {
start: node.position.start,
end: node.position.end
});
}
});

@@ -20,0 +26,0 @@ }

@@ -16,2 +16,8 @@ const rule = require('unified-lint-rule');

}
if (parent.children.length - 1 === index) {
file.warn(`Remove empty section: "${label}"`, {
start: node.position.start,
end: node.position.end
});
}
});

@@ -18,0 +24,0 @@ }

8

package.json
{
"name": "remark-lint-no-empty-sections",
"version": "2.0.0",
"version": "3.0.0",
"description": "Checks that all markdown titles have a content",

@@ -20,3 +20,3 @@ "author": "Victor Felder <victorfelder@gmail.com>",

"babel-eslint": "^7.1.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-env": "^1.7.0",
"eslint": "^3.16.1",

@@ -27,4 +27,4 @@ "eslint-config-airbnb": "^14.1.0",

"eslint-plugin-react": "^6.10.0",
"remark": "^7.0.0",
"remark-cli": "^3.0.0",
"remark": "^9.0.0",
"remark-cli": "^5.0.0",
"remark-lint": "^6.0.0",

@@ -31,0 +31,0 @@ "tape": "^4.6.3"

@@ -1,8 +0,11 @@

# remark-lint-no-empty-sections
# remark-lint-no-empty-sections [![Build Status](https://travis-ci.org/vhf/remark-lint-no-empty-sections.svg?branch=master)](https://travis-ci.org/vhf/remark-lint-no-empty-sections)
This [remark-lint](https://github.com/wooorm/remark-lint) rule was created for [free-programming-books-lint](https://github.com/vhf/free-programming-books-lint) to enforce [free-programming-books](https://github.com/vhf/free-programming-books) [formatting guidelines](https://github.com/vhf/free-programming-books/blob/master/CONTRIBUTING.md#formatting).
This rule checks that every `([#]+)title` has some content. This content can be anything: a lower-level title, a higher-level title, text, list, etc. It will only complain if you have an n-level title without content followed by another n-level title.
This rule checks that every `([#]+)heading` has some content. This content can be anything: a lower-level heading, a higher-level heading, text, list, etc. It will warn when it detects an `n`-level heading without content followed by another `n`-level heading.
```Text
## Examples
```markdown
<!-- Invalid -->

@@ -13,5 +16,17 @@

## B (this section is empty!)
```
```markdown
<!-- Invalid -->
# A
## B (this section is empty!)
## C
Some content.
```
```markdown
<!-- Valid -->

@@ -22,2 +37,4 @@

## C
Some content.
```

@@ -24,0 +41,0 @@

@@ -13,4 +13,22 @@ const test = require('tape');

## C
This one is not.
`;
const emptySectionAsLastNode = `# A
## B
It should warn when the last section is empty!
## C (this section is empty!)
`;
const twoEmptySections = `# A
## B (empty!)
## C (empty and last!)
`;
const higher = `# A

@@ -21,2 +39,4 @@

# C
This one is not.
`;

@@ -29,2 +49,4 @@

### C
Not empty.
`;

@@ -35,2 +57,4 @@

## C
Not empty.
`;

@@ -46,2 +70,17 @@

t.deepEqual(
processor.processSync(emptySectionAsLastNode).messages.map(String),
['7:1-7:30: Remove empty section: "C (this section is empty!)"'],
'should warn on empty section when it is the last section'
);
t.deepEqual(
processor.processSync(twoEmptySections).messages.map(String),
[
'3:14-5:1: Remove empty section: "B (empty!)"',
'5:1-5:23: Remove empty section: "C (empty and last!)"'
],
'should warn on all empty sections, including last'
);
t.deepEqual(
processor.processSync(lower).messages.map(String),

@@ -48,0 +87,0 @@ [],

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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