remark-lint-final-newline
Advanced tools
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) |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
3943
60
103