From 4351bffd537eab927226bf6f9b66cd385a049a43 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 22 Sep 2021 16:20:44 -0400 Subject: [PATCH] doc: fixup to meet lint rules Signed-off-by: Michael Dawson PR-URL: https://github.com/nodejs/node-addon-api/pull/1077 Reviewed-By: Nicola Del Gobbo --- test/addon.js | 2 +- test/addon_data.js | 6 +++--- tools/clang-format.js | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/addon.js b/test/addon.js index b9fca2f15..78abaf6f7 100644 --- a/test/addon.js +++ b/test/addon.js @@ -4,7 +4,7 @@ const assert = require('assert'); module.exports = require('./common').runTest(test); -function test(binding) { +function test (binding) { assert.strictEqual(binding.addon.increment(), 43); assert.strictEqual(binding.addon.increment(), 44); assert.strictEqual(binding.addon.subObject.decrement(), 43); diff --git a/test/addon_data.js b/test/addon_data.js index 1762d9663..6fdbdd977 100644 --- a/test/addon_data.js +++ b/test/addon_data.js @@ -8,7 +8,7 @@ module.exports = require('./common').runTestWithBindingPath(test); // Make sure the instance data finalizer is called at process exit. If the hint // is non-zero, it will be printed out by the child process. -function testFinalizer(bindingName, hint, expected) { +function testFinalizer (bindingName, hint, expected) { return new Promise((resolve) => { bindingName = bindingName.split('\\').join('\\\\'); const child = spawn(process.execPath, [ @@ -30,7 +30,7 @@ function testFinalizer(bindingName, hint, expected) { }); } -async function test(bindingName) { +async function test (bindingName) { const binding = require(bindingName).addon_data(0); // Make sure it is possible to get/set instance data. @@ -42,5 +42,5 @@ async function test(bindingName) { await testFinalizer(bindingName, 0, ['addon_data: Addon::~Addon']); await testFinalizer(bindingName, 42, - ['addon_data: Addon::~Addon', 'hint: 42']); + ['addon_data: Addon::~Addon', 'hint: 42']); } diff --git a/tools/clang-format.js b/tools/clang-format.js index e97098336..997733e5d 100644 --- a/tools/clang-format.js +++ b/tools/clang-format.js @@ -6,19 +6,20 @@ const path = require('path'); const filesToCheck = ['*.h', '*.cc']; const CLANG_FORMAT_START = process.env.CLANG_FORMAT_START || 'main'; -function main(args) { +function main (args) { let fix = false; while (args.length > 0) { switch (args[0]) { case '-f': case '--fix': fix = true; + break; default: } args.shift(); } - let clangFormatPath = path.dirname(require.resolve('clang-format')); + const clangFormatPath = path.dirname(require.resolve('clang-format')); const options = ['--binary=node_modules/.bin/clang-format', '--style=file']; if (fix) { options.push(CLANG_FORMAT_START);