Permalink
Browse files

Ensure that all *.js files are using LF as the line ending

Fix #1604
Closes gh-1670
  • Loading branch information...
1 parent 9e288fc commit 26833ed7630da7e087d6ee1ead40f9af4bb0a58d @ariya ariya committed Dec 14, 2016
Showing with 26 additions and 1 deletion.
  1. +1 −0 .gitattributes
  2. +2 −1 package.json
  3. +7 −0 test/line-ending-sample.js
  4. +16 −0 test/verify-line-ending.js
View
@@ -0,0 +1 @@
+*.js text eol=lf
View
@@ -80,7 +80,8 @@
"api-tests": "mocha -R dot test/api-tests.js",
"grammar-tests": "node test/grammar-tests.js",
"regression-tests": "node test/regression-tests.js",
- "all-tests": "npm run generate-fixtures && npm run unit-tests && npm run api-tests && npm run grammar-tests && npm run regression-tests && npm run hostile-env-tests",
+ "all-tests": "npm run verify-line-ending && npm run generate-fixtures && npm run unit-tests && npm run api-tests && npm run grammar-tests && npm run regression-tests && npm run hostile-env-tests",
+ "verify-line-ending": "node test/verify-line-ending.js",
"generate-fixtures": "node tools/generate-fixtures.js",
"browser-tests": "npm run compile && npm run generate-fixtures && cd test && karma start --single-run",
"saucelabs-evergreen": "cd test && karma start saucelabs-evergreen.conf.js",
@@ -0,0 +1,7 @@
+/*
+do
+not
+edit
+this
+file
+*/
@@ -0,0 +1,16 @@
+#!/usr/bin/env node
+
+'use strict';
+
+var fs = require('fs');
+
+var fname = 'test/line-ending-sample.js';
+var content = fs.readFileSync(fname, 'utf-8');
+var lines = content.split('\n');
+if (content.length !== 28 || lines.length !== 8) {
+ console.error(fname, 'uses an incorrect line ending.');
+ console.error('Please verify that the repository was checked out properly!');
+ process.exit(-1);
+} else {
+ console.log(fname, 'has the correct line endings.');
+}

0 comments on commit 26833ed

Please sign in to comment.