-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ move to neostandard / eslint-config-express
Co-authored-by: Wes Todd <wes@wesleytodd.com>
- Loading branch information
1 parent
1c317e0
commit 8e6d24b
Showing
8 changed files
with
428 additions
and
443 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const expressLintConfig = require('eslint-config-express'); | ||
|
||
module.exports = [ | ||
...expressLintConfig, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,63 @@ | ||
'use strict' | ||
'use strict'; | ||
|
||
var fs = require('fs') | ||
var path = require('path') | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
var HISTORY_FILE_PATH = path.join(__dirname, '..', 'HISTORY.md') | ||
var MD_HEADER_REGEXP = /^====*$/ | ||
var VERSION = process.env.npm_package_version | ||
var VERSION_PLACEHOLDER_REGEXP = /^(?:unreleased|(\d+\.)+x)$/ | ||
const HISTORY_FILE_PATH = path.join(__dirname, '..', 'HISTORY.md'); | ||
const MD_HEADER_REGEXP = /^====*$/; | ||
const VERSION = process.env.npm_package_version; | ||
const VERSION_PLACEHOLDER_REGEXP = /^(?:unreleased|(\d+\.)+x)$/; | ||
|
||
var historyFileLines = fs.readFileSync(HISTORY_FILE_PATH, 'utf-8').split('\n') | ||
const historyFileLines = fs.readFileSync(HISTORY_FILE_PATH, 'utf-8').split('\n'); | ||
|
||
if (!MD_HEADER_REGEXP.test(historyFileLines[1])) { | ||
console.error('Missing header in HISTORY.md') | ||
process.exit(1) | ||
console.error('Missing header in HISTORY.md'); | ||
process.exit(1); | ||
} | ||
|
||
if (!VERSION_PLACEHOLDER_REGEXP.test(historyFileLines[0])) { | ||
console.error('Missing placegolder version in HISTORY.md') | ||
process.exit(1) | ||
console.error('Missing placegolder version in HISTORY.md'); | ||
process.exit(1); | ||
} | ||
|
||
if (historyFileLines[0].indexOf('x') !== -1) { | ||
var versionCheckRegExp = new RegExp('^' + historyFileLines[0].replace('x', '.+') + '$') | ||
const versionCheckRegExp = new RegExp('^' + historyFileLines[0].replace('x', '.+') + '$'); | ||
|
||
if (!versionCheckRegExp.test(VERSION)) { | ||
console.error('Version %s does not match placeholder %s', VERSION, historyFileLines[0]) | ||
process.exit(1) | ||
console.error('Version %s does not match placeholder %s', VERSION, historyFileLines[0]); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
historyFileLines[0] = VERSION + ' / ' + getLocaleDate() | ||
historyFileLines[1] = repeat('=', historyFileLines[0].length) | ||
historyFileLines[0] = VERSION + ' / ' + getLocaleDate(); | ||
historyFileLines[1] = repeat('=', historyFileLines[0].length); | ||
|
||
fs.writeFileSync(HISTORY_FILE_PATH, historyFileLines.join('\n')) | ||
fs.writeFileSync(HISTORY_FILE_PATH, historyFileLines.join('\n')); | ||
|
||
function getLocaleDate () { | ||
var now = new Date() | ||
const now = new Date(); | ||
|
||
return zeroPad(now.getFullYear(), 4) + '-' + | ||
zeroPad(now.getMonth() + 1, 2) + '-' + | ||
zeroPad(now.getDate(), 2) | ||
zeroPad(now.getDate(), 2); | ||
} | ||
|
||
function repeat (str, length) { | ||
var out = '' | ||
let out = ''; | ||
|
||
for (var i = 0; i < length; i++) { | ||
out += str | ||
for (let i = 0; i < length; i++) { | ||
out += str; | ||
} | ||
|
||
return out | ||
return out; | ||
} | ||
|
||
function zeroPad (number, length) { | ||
var num = number.toString() | ||
let num = number.toString(); | ||
|
||
while (num.length < length) { | ||
num = '0' + num | ||
num = '0' + num; | ||
} | ||
|
||
return num | ||
return num; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.