Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Commit a5b7410

Browse files
maclover7rvagg
authored andcommitted
Add ESLint no-unused-vars rule
- Uses `.eslintrc.yaml` for configuration - `npm run lint` is part of `npm test` PR-URL: #1497 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: João Reis <reis@janeasystems.com>
1 parent 9e46872 commit a5b7410

12 files changed

Lines changed: 34 additions & 34 deletions

‎.eslintrc.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
env:
3+
node: true
4+
rules:
5+
no-unused-vars: error

‎bin/node-gyp.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if (prog.todo.length === 0) {
3434
}else{
3535
console.log('%s',prog.usage())
3636
}
37-
returnprocess.exit(0)
37+
process.exit(0)
3838
}
3939

4040
log.info('it worked if it ends with','ok')

‎lib/build.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
module.exports=exports=build
33

44
varfs=require('graceful-fs')
5-
,rm=require('rimraf')
65
,path=require('path')
76
,glob=require('glob')
87
,log=require('npmlog')
98
,which=require('which')
109
,exec=require('child_process').exec
11-
,processRelease=require('./process-release')
1210
,win=process.platform==='win32'
1311

1412
exports.usage='Invokes `'+(win ? 'msbuild' : 'make')+'` and builds the module'
@@ -25,8 +23,7 @@ function build (gyp, argv, callback) {
2523
})
2624
}
2725

28-
varrelease=processRelease(argv,gyp,process.version,process.release)
29-
,makeCommand=gyp.opts.make||process.env.MAKE||platformMake
26+
varmakeCommand=gyp.opts.make||process.env.MAKE||platformMake
3027
,command=win ? 'msbuild' : makeCommand
3128
,jobs=gyp.opts.jobs||process.env.JOBS
3229
,buildType
@@ -132,7 +129,7 @@ function build (gyp, argv, callback) {
132129
varcmd='reg query "HKLM\\Software\\Microsoft\\MSBuild\\ToolsVersions" /s'
133130
if(process.arch!=='ia32')
134131
cmd+=' /reg:32'
135-
exec(cmd,function(err,stdout,stderr){
132+
exec(cmd,function(err,stdout){
136133
if(err){
137134
returncallback(newError(err.message+'\n'+notfoundErr))
138135
}
@@ -162,7 +159,7 @@ function build (gyp, argv, callback) {
162159
;(functionverifyMsbuild(){
163160
if(!msbuilds.length)returncallback(newError(notfoundErr))
164161
msbuildPath=path.resolve(msbuilds.pop().path,'msbuild.exe')
165-
fs.stat(msbuildPath,function(err,stat){
162+
fs.stat(msbuildPath,function(err){
166163
if(err){
167164
if(err.code=='ENOENT'){
168165
if(msbuilds.length){

‎lib/configure.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function configure (gyp, argv, callback) {
6969
// into devdir. Otherwise only install if they're not already there.
7070
gyp.opts.ensure=gyp.opts.tarball ? false : true
7171

72-
gyp.commands.install([release.version],function(err,version){
72+
gyp.commands.install([release.version],function(err){
7373
if(err)returncallback(err)
7474
log.verbose('get node dir','target node version installed:',release.versionDir)
7575
nodeDir=path.resolve(gyp.devDir,release.versionDir)
@@ -188,7 +188,7 @@ function configure (gyp, argv, callback) {
188188
if(!name)returnrunGyp()
189189
varfullPath=path.resolve(name)
190190
log.verbose(name,'checking for gypi file: %s',fullPath)
191-
fs.stat(fullPath,function(err,stat){
191+
fs.stat(fullPath,function(err){
192192
if(err){
193193
if(err.code=='ENOENT'){
194194
findConfigs()// check next gypi filename
@@ -275,7 +275,7 @@ function configure (gyp, argv, callback) {
275275
vargyp_script=path.resolve(__dirname,'..','gyp','gyp_main.py')
276276
varaddon_gypi=path.resolve(__dirname,'..','addon.gypi')
277277
varcommon_gypi=path.resolve(nodeDir,'include/node/common.gypi')
278-
fs.stat(common_gypi,function(err,stat){
278+
fs.stat(common_gypi,function(err){
279279
if(err)
280280
common_gypi=path.resolve(nodeDir,'common.gypi')
281281

@@ -329,7 +329,7 @@ function configure (gyp, argv, callback) {
329329
})
330330
}
331331

332-
functiononCpExit(code,signal){
332+
functiononCpExit(code){
333333
if(code!==0){
334334
callback(newError('`gyp` failed with exit code: '+code))
335335
}else{
@@ -492,7 +492,7 @@ PythonFinder.prototype = {
492492
}
493493
varpythonPath=this.resolve(rootDir,'Python27','python.exe')
494494
this.log.verbose('ensuring that file exists:',pythonPath)
495-
this.stat(pythonPath,function(err,stat){
495+
this.stat(pythonPath,function(err){
496496
if(err){
497497
if(err.code=='ENOENT'){
498498
this.failNoPython()

‎lib/install.js‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ exports.usage = 'Install node development files for the specified node version.'
1313
varfs=require('graceful-fs')
1414
,osenv=require('osenv')
1515
,tar=require('tar')
16-
,rm=require('rimraf')
1716
,path=require('path')
1817
,crypto=require('crypto')
1918
,log=require('npmlog')
@@ -33,7 +32,7 @@ function install (fs, gyp, argv, callback) {
3332
if(err){
3433
log.warn('install','got an error, rolling back install')
3534
// roll-back the install if anything went wrong
36-
gyp.commands.remove([release.versionDir],function(err2){
35+
gyp.commands.remove([release.versionDir],function(){
3736
callback(err)
3837
})
3938
}else{
@@ -75,7 +74,7 @@ function install (fs, gyp, argv, callback) {
7574
// check if it is already installed, and only install when needed
7675
if(gyp.opts.ensure){
7776
log.verbose('install','--ensure was passed, so won\'t reinstall if already installed')
78-
fs.stat(devDir,function(err,stat){
77+
fs.stat(devDir,function(err){
7978
if(err){
8079
if(err.code=='ENOENT'){
8180
log.verbose('install','version not already installed, continuing with install',release.version)
@@ -146,7 +145,7 @@ function install (fs, gyp, argv, callback) {
146145

147146
// checks if a file to be extracted from the tarball is valid.
148147
// only .h header files and the gyp files get extracted
149-
functionisValid(path,entry){
148+
functionisValid(path){
150149
varisValid=valid(path)
151150
if(isValid){
152151
log.verbose('extracted file from tarball',path)
@@ -265,8 +264,6 @@ function install (fs, gyp, argv, callback) {
265264

266265
functiondownloadShasums(done){
267266
log.verbose('check download content checksum, need to download `SHASUMS256.txt`...')
268-
varshasumsPath=path.resolve(devDir,'SHASUMS256.txt')
269-
270267
log.verbose('checksum url',release.shasumsUrl)
271268
try{
272269
varreq=download(gyp,process.env,release.shasumsUrl)

‎lib/list.js‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ module.exports = exports = list
44
exports.usage='Prints a listing of the currently installed node development files'
55

66
varfs=require('graceful-fs')
7-
,path=require('path')
87
,log=require('npmlog')
98

109
functionlist(gyp,args,callback){

‎lib/node-gyp.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11

22
module.exports=exports=gyp
33

4-
varfs=require('graceful-fs')
5-
,path=require('path')
4+
varpath=require('path')
65
,nopt=require('nopt')
76
,log=require('npmlog')
87
,child_process=require('child_process')

‎lib/remove.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function remove (gyp, argv, callback) {
3131
log.verbose('remove','removing development files for version:',version)
3232

3333
// first check if its even installed
34-
fs.stat(versionPath,function(err,stat){
34+
fs.stat(versionPath,function(err){
3535
if(err){
3636
if(err.code=='ENOENT'){
3737
callback(null,'version was already uninstalled: '+version)

‎package.json‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838
"node": ">= 4.0.0"
3939
},
4040
"devDependencies": {
41-
"tape": "~4.2.0",
41+
"babel-eslint": "^8.2.5",
4242
"bindings": "~1.2.1",
43+
"eslint": "^5.0.1",
4344
"nan": "^2.0.0",
44-
"require-inject": "~1.3.0"
45+
"require-inject": "~1.3.0",
46+
"tape": "~4.2.0"
4547
},
4648
"scripts": {
47-
"test": "tape test/test-*"
49+
"lint": "eslint bin lib test",
50+
"test": "npm run lint && tape test/test-*"
4851
}
4952
}

‎test/test-configure-python.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ var gyp = require('../lib/node-gyp')
66
varrequireInject=require('require-inject')
77
varconfigure=requireInject('../lib/configure',{
88
'graceful-fs': {
9-
'openSync': function(file,mode){return0;},
10-
'closeSync': function(fd){},
9+
'openSync': function(){return0;},
10+
'closeSync': function(){},
1111
'writeFile': function(file,data,cb){cb()},
1212
'stat': function(file,cb){cb(null,{})}
1313
}

0 commit comments

Comments
 (0)