Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint fixes
  • Loading branch information
wmertens committed Jan 26, 2023
commit cfa5cd7cd77fc558fd1cb2c4a3288d59c0e16636
1 change: 1 addition & 0 deletions examples/apps/git_profanity_check.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//
// node git_profanity_check some/repo/.git
//
// eslint-disable-next-line node/shebang
var git = require("../../");

var curses = ["put", "curse", "words", "here"];
Expand Down
4 changes: 2 additions & 2 deletions examples/index-add-and-remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
var fileNames = Object.keys(fileContent);

return Promise.all(fileNames.map(function(fileName) {
fse.writeFile(
return fse.writeFile(
path.join(repo.workdir(), fileName), fileContent[fileName]);
}))

Expand Down Expand Up @@ -87,7 +87,7 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
return index.addAll(
"newFile*",
nodegit.Index.ADD_OPTION.ADD_CHECK_PATHSPEC,
function(path, matchedPattern) {
function(path, _matchedPattern) {
if (path == "newFile1") {
return 0; // add the file
}
Expand Down
1 change: 1 addition & 0 deletions generate/scripts/generateJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ module.exports = function generateJson() {
else if (enumerable.owner) {
return true;
}
return false;
});

var override = descriptor.enums[enumerable.typeName] || {};
Expand Down
2 changes: 1 addition & 1 deletion generate/scripts/generateMissingTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function generateMissingTests() {
var output = {};

function findMissingTest(idef) {
return new Promise(function(resolve, reject) {
return new Promise(function(resolve) {
var testFilePath = path.join(testFilesPath, idef.filename + ".js");
var result = {};

Expand Down
9 changes: 6 additions & 3 deletions generate/scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var callbackDefs = require("../input/callbacks.json");
var descriptor = require("../input/descriptor.json");
var libgit2 = require("../input/libgit2-docs.json");

var cTypes = libgit2.groups.map(function(group) { return group[0];});
// var cTypes = libgit2.groups.map(function(group) { return group[0];});

var cTypeMappings = {
"char": "String",
Expand Down Expand Up @@ -82,6 +82,7 @@ var Helpers = {
hasConstructor: function(type, normalizedType) {
if (normalizedType && descriptor.types[normalizedType.substr(4)]) {
var descriptorEntry = descriptor.types[normalizedType.substr(4)];
// eslint-disable-next-line no-prototype-builtins
if (descriptorEntry.hasOwnProperty('hasConstructor')) {
return descriptorEntry.hasConstructor;
}
Expand Down Expand Up @@ -116,6 +117,7 @@ var Helpers = {
libgitType = type[1];
return true;
}
return false;
});

return libgitType;
Expand Down Expand Up @@ -149,6 +151,7 @@ var Helpers = {
cbFieldName = cbField.name;
return true;
}
return false;
});

if (cbFieldName) {
Expand Down Expand Up @@ -223,7 +226,7 @@ var Helpers = {
return fnDef;
});

var typeDefOverrides = descriptor.types[typeDef.typeName] || {};
typeDefOverrides = descriptor.types[typeDef.typeName] || {};
var functionOverrides = typeDefOverrides.functions || {};
typeDef.functions.forEach(function(fnDef) {
Helpers.decorateFunction(fnDef, typeDef, functionOverrides[fnDef.cFunctionName] || {}, enums);
Expand All @@ -233,7 +236,7 @@ var Helpers = {
},

decorateField: function(field, allFields, fieldOverrides, enums) {
var normalizeType = Helpers.normalizeCtype(field.type);
// var normalizeType = Helpers.normalizeCtype(field.type);

field.cType = field.type;
field.cppFunctionName = utils.titleCase(field.name);
Expand Down
2 changes: 1 addition & 1 deletion generate/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var util = {
},

titleCase: function(str) {
return str.split(/_|\//).map(function(val, index) {
return str.split(/_|\//).map(function(val) {
if (val.length) {
return val[0].toUpperCase() + val.slice(1);
}
Expand Down
2 changes: 1 addition & 1 deletion generate/templates/filters/title_case.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = function(str) {
return str.split(/_|\//).map(function(val, index) {
return str.split(/_|\//).map(function(val) {
if (val.length) {
return val[0].toUpperCase() + val.slice(1);
}
Expand Down
8 changes: 4 additions & 4 deletions guides/repositories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var pathToRepo = require("path").resolve("../my-git-projects/my-project");
// In NodeGit we use Promises to make callbacks easier to deal with.
//
// For more information visit https://www.promisejs.org/
NodeGit.Repository.open(pathToRepo).then(function (repo) {
NodeGit.Repository.open(pathToRepo).then(function (_repo) {
// In this function we have a repo object that we can perform git operations
// on.
// NOTE: Many NodeGit objects will appear as empty objects if inspected in
Expand All @@ -21,14 +21,14 @@ NodeGit.Repository.open(pathToRepo).then(function (repo) {
// Promises will swallow errors and not report them unless you have supplied
// a second function to the `.then` or end the chain with either a `.catch` or
// a `.done`
.then(function (successfulResult) {
.then(function (_successfulResult) {
// This is the first function of the then which contains the successfully
// calculated result of the promise
}, function (reasonForFailure) {
}, function (_reasonForFailure) {
// This is the second function of the then which contains the reason the
// promise failed
})
.catch(function (reasonForFailure) {
.catch(function (_reasonForFailure) {
// You can also provide a catch function which will contain the reason why
// any above promises that weren't handled have failed
})
Expand Down
4 changes: 2 additions & 2 deletions guides/repositories/initializing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ var isBare = 0;
// In NodeGit we use Promises to make callbacks easier to deal with.
//
// For more information visit https://www.promisejs.org/
NodeGit.Repository.init(pathToRepo, isBare).then(function (repo) {
NodeGit.Repository.init(pathToRepo, isBare).then(function (_repo) {
// In this function we have a repo object that we can perform git operations
// on.

// Note that with a new repository many functions will fail until there is
// an initial commit.
})
.catch(function (reasonForFailure) {
.catch(function (_reasonForFailure) {
// If the repo cannot be created for any reason we can handle that case here.
// NodeGit won't init a repo over a pre-existing repo.
});
1 change: 1 addition & 0 deletions lib/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Remote.lookup = lookupWrapper(Remote);
* connection.
* @async
*/
// eslint-disable-next-line no-self-assign
Remote.prototype.referenceList = Remote.prototype.referenceList;

NodeGit.Remote.COMPLETION_TYPE = {};
Expand Down
16 changes: 9 additions & 7 deletions lib/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ Repository.prototype.getStatusExt = function (opts) {
*/
Repository.prototype.getSubmoduleNames = function () {
var names = [];
var submoduleCallback = function (submodule, name, payload) {
var submoduleCallback = function (_submodule, name, _payload) {
names.push(name);
};

Expand Down Expand Up @@ -1334,11 +1334,12 @@ Repository.prototype.rebaseBranches = function (
});
}

return Promise.all([
repo.getReference(branch),
upstream ? repo.getReference(upstream) : null,
onto ? repo.getReference(onto) : null,
])
return promiseChain.then(() =>
Promise.all([
repo.getReference(branch),
upstream ? repo.getReference(upstream) : null,
onto ? repo.getReference(onto) : null,
])
.then(function (refs) {
return Promise.all([
NodeGit.AnnotatedCommit.fromRef(repo, refs[0]),
Expand Down Expand Up @@ -1378,7 +1379,8 @@ Repository.prototype.rebaseBranches = function (
})
.then(function () {
return repo.getBranchCommit("HEAD");
});
})
);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Tree.prototype.getEntry = function(filePath) {
* Return the path of this tree, like `/lib/foo/bar`
* @return {String}
*/
Tree.prototype.path = function(blobsOnly) {
Tree.prototype.path = function(_blobsOnly) {
return this.entry ? this.entry.path() : "";
};

Expand Down Expand Up @@ -145,7 +145,7 @@ Tree.prototype.walk = function(blobsOnly) {
return event.emit("error", error);
}

tree.entries().forEach(function (entry, entryIndex) {
tree.entries().forEach(function (entry, _entryIndex) {
if (!blobsOnly || entry.isFile() && !entries.has(entry)) {
event.emit("entry", entry);
entries.add(entry);
Expand Down
1 change: 1 addition & 0 deletions lifecycleScripts/clean.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line node/no-unpublished-require
var cleanForPublish = require("clean-for-publish");
var path = require("path");

Expand Down
1 change: 1 addition & 0 deletions lifecycleScripts/install.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-process-exit */
var buildFlags = require("../utils/buildFlags");
var spawn = require("child_process").spawn;
var path = require("path");
Expand Down
1 change: 1 addition & 0 deletions lifecycleScripts/preinstall.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-process-exit */
var path = require("path");
var local = path.join.bind(path, __dirname);

Expand Down
1 change: 1 addition & 0 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var path = require("path");
var local = path.join.bind(path, __dirname);
var exec = require('../utils/execPromise');

// eslint-disable-next-line no-unused-vars
var NodeGit = require('..');

var workdirPath = local("repos/workdir");
Expand Down
8 changes: 4 additions & 4 deletions test/tests/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ describe("Blob", function() {
return commitFile(
test.repository,
newFileName,
"this\nis\nfun\guys",
"this\nis\nfunguys",
"added LF ending file"
);
})
Expand Down Expand Up @@ -334,7 +334,7 @@ describe("Blob", function() {
return commitFile(
test.repository,
newFileName,
"this\nis\nfun\guys",
"this\nis\nfunguys",
"added LF ending file"
);
})
Expand Down Expand Up @@ -498,7 +498,7 @@ describe("Blob", function() {
return commitFile(
test.repository,
newFileName,
"this\nis\nfun\guys",
"this\nis\nfunguys",
"added LF ending file"
);
})
Expand Down Expand Up @@ -538,7 +538,7 @@ describe("Blob", function() {
return commitFile(
test.repository,
newFileName,
"this\nis\nfun\guys",
"this\nis\nfunguys",
"added LF ending file"
);
})
Expand Down
8 changes: 4 additions & 4 deletions test/tests/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ describe("Branch", function() {

// don't force the move
return Branch.move(branch, branchName2, 0)
.then(function(branch) {
.then(function(_branch) {
return Promise.reject(new Error(
"should not be able to rename the branch"));
}, function(error) {
}, function(_error) {
return Promise.resolve()
.then(function() {
// force the move
Expand Down Expand Up @@ -150,10 +150,10 @@ describe("Branch", function() {
return Branch.createFromAnnotated(
repo, branchName, annotatedCommit, 0);
})
.then(function(branch) {
.then(function(_branch) {
return Promise.reject(new Error(
"should not be able to create the branch"));
}, function(error) {
}, function(_error) {
return Promise.resolve()
.then(function() {
// force the branch creation
Expand Down
6 changes: 3 additions & 3 deletions test/tests/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("Checkout", function() {
var test = this;

return Checkout.head(test.repository)
.then(function(blob) {
.then(function(_blob) {
var packageContent = fse.readFileSync(packageJsonPath, "utf-8");

assert.ok(~packageContent.indexOf("\"ejs\": \"~1.0.0\","));
Expand Down Expand Up @@ -175,7 +175,7 @@ describe("Checkout", function() {
.then(() => {
return test.repository.checkoutBranch(testBranchName);
})
.then((branch) => {
.then((_branch) => {
fse.writeFileSync(packageJsonPath, "\n");

return test.repository.refreshIndex()
Expand All @@ -196,7 +196,7 @@ describe("Checkout", function() {
return test.repository.createCommit("refs/heads/" + testBranchName,
signature, signature, "we made breaking changes", oid, [ourCommit]);
})
.then((commit) => {
.then((_commit) => {
return Promise.all([
test.repository.getBranchCommit(testBranchName),
test.repository.getBranchCommit("master")
Expand Down
Loading