Socket
Socket
Sign inDemoInstall

remark-lint-final-newline

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-lint-final-newline - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

22

index.js

@@ -11,2 +11,10 @@ /**

*
* ## Fix
*
* [`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify)
* always adds a final newline to files.
*
* See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
* on how to automatically fix warnings for this rule.
*
* ## Example

@@ -45,15 +53,15 @@ *

'use strict';
'use strict'
var rule = require('unified-lint-rule');
var rule = require('unified-lint-rule')
module.exports = rule('remark-lint:final-newline', finalNewline);
module.exports = rule('remark-lint:final-newline', finalNewline)
function finalNewline(ast, file) {
var contents = file.toString();
var last = contents.length - 1;
function finalNewline(tree, file) {
var contents = String(file)
var last = contents.length - 1
if (last > -1 && contents.charAt(last) !== '\n') {
file.message('Missing newline character at end of file');
file.message('Missing newline character at end of file')
}
}
{
"name": "remark-lint-final-newline",
"version": "1.0.1",
"version": "1.0.2",
"description": "remark-lint rule to warn when a newline at the end of a file is missing",

@@ -14,4 +14,4 @@ "license": "MIT",

],
"repository": "https://github.com/wooorm/remark-lint/tree/master/packages/remark-lint-final-newline",
"bugs": "https://github.com/wooorm/remark-lint/issues",
"repository": "https://github.com/remarkjs/remark-lint/tree/master/packages/remark-lint-final-newline",
"bugs": "https://github.com/remarkjs/remark-lint/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",

@@ -18,0 +18,0 @@ "contributors": [

@@ -9,2 +9,10 @@ <!--This file is generated-->

## Fix
[`remark-stringify`](https://github.com/remarkjs/remark/tree/master/packages/remark-stringify)
always adds a final newline to files.
See [Using remark to fix your markdown](https://github.com/remarkjs/remark-lint#using-remark-to-fix-your-markdown)
on how to automatically fix warnings for this rule.
## Example

@@ -48,3 +56,3 @@

| ------ | ------- |
| [`remark-preset-lint-recommended`](https://github.com/wooorm/remark-lint/tree/master/packages/remark-preset-lint-recommended) | |
| [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/master/packages/remark-preset-lint-recommended) | |

@@ -96,2 +104,2 @@ ## Install

[MIT](https://github.com/wooorm/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com)
[MIT](https://github.com/remarkjs/remark-lint/blob/master/LICENSE) © [Titus Wormer](http://wooorm.com)
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