mirror of
https://github.com/electron/node-gyp.git
synced 2025-08-15 12:58:19 +02:00
src: implement standard.js linting
In addition: * moved module.exports to the bottom * no single-line if statements * no if statements without a { * const for requires * array declarations get spaces inside [ ] * 'use strict' in all .js files PR-URL: https://github.com/nodejs/node-gyp/pull/1794 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: João Reis <reis@janeasystems.com>
This commit is contained in:
parent
7e8127068f
commit
e40c99e283
28 changed files with 739 additions and 661 deletions
|
@ -1,8 +1,4 @@
|
|||
module.exports = exports = findVisualStudio
|
||||
module.exports.test = {
|
||||
VisualStudioFinder: VisualStudioFinder,
|
||||
findVisualStudio: findVisualStudio
|
||||
}
|
||||
'use strict'
|
||||
|
||||
const log = require('npmlog')
|
||||
const execFile = require('child_process').execFile
|
||||
|
@ -132,9 +128,13 @@ VisualStudioFinder.prototype = {
|
|||
var ps = path.join(process.env.SystemRoot, 'System32',
|
||||
'WindowsPowerShell', 'v1.0', 'powershell.exe')
|
||||
var csFile = path.join(__dirname, 'Find-VisualStudio.cs')
|
||||
var psArgs = ['-ExecutionPolicy', 'Unrestricted', '-NoProfile',
|
||||
'-Command', '&{Add-Type -Path \'' + csFile + '\';' +
|
||||
'[VisualStudioConfiguration.Main]::PrintJson()}']
|
||||
var psArgs = [
|
||||
'-ExecutionPolicy',
|
||||
'Unrestricted',
|
||||
'-NoProfile',
|
||||
'-Command',
|
||||
'&{Add-Type -Path \'' + csFile + '\';' + '[VisualStudioConfiguration.Main]::PrintJson()}'
|
||||
]
|
||||
|
||||
this.log.silly('Running', ps, psArgs)
|
||||
var child = execFile(ps, psArgs, { encoding: 'utf8' },
|
||||
|
@ -188,7 +188,9 @@ VisualStudioFinder.prototype = {
|
|||
|
||||
// Remove future versions or errors parsing version number
|
||||
vsInfo = vsInfo.filter((info) => {
|
||||
if (info.versionYear) { return true }
|
||||
if (info.versionYear) {
|
||||
return true
|
||||
}
|
||||
this.addLog(`unknown version "${info.version}" found at "${info.path}"`)
|
||||
return false
|
||||
})
|
||||
|
@ -415,3 +417,9 @@ VisualStudioFinder.prototype = {
|
|||
return true
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = findVisualStudio
|
||||
module.exports.test = {
|
||||
VisualStudioFinder: VisualStudioFinder,
|
||||
findVisualStudio: findVisualStudio
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue