diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index 2a2f672c..00000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,25 +0,0 @@ -env: - node: true - es6: true -globals: - every: true - after: true - constantly: true -ignorePatterns: ['generated/', 'types/interfaces.d.ts'] -parser: 'babel-eslint' -rules: - prettier/prettier: 'error' -extends: ['prettier'] -plugins: ['prettier'] -parserOptions: - ecmaVersion: 2018 -overrides: - - files: ['*.ts'] - parser: '@typescript-eslint/parser' - plugins: ['@typescript-eslint'] - parserOptions: { - sourceType: 'module' - } - rules: { - strict: [0, 'global'] - } diff --git a/.github/workflows/linux-build-and-test.yml b/.github/workflows/linux-build-and-test.yml index 8a3ae654..06a43149 100644 --- a/.github/workflows/linux-build-and-test.yml +++ b/.github/workflows/linux-build-and-test.yml @@ -50,4 +50,5 @@ jobs: run: | source /opt/ros/${{ needs.identify-ros-distro.outputs.distro }}/setup.bash npm i + npm run lint npm test diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..26fcbea3 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,55 @@ +import prettier from "eslint-plugin-prettier"; +import globals from "globals"; +import typescriptEslint from "@typescript-eslint/eslint-plugin"; +import tsParser from "@typescript-eslint/parser"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); + +export default [{ + ignores: ["generated/", "eslint.config.mjs", "lib/", "types/", "scripts/", "benchmark/", "docs/", "electron_demo/"], +}, ...compat.extends("prettier"), { + plugins: { + prettier, + }, + + languageOptions: { + globals: { + ...globals.node, + every: true, + after: true, + constantly: true, + }, + + ecmaVersion: "latest", + sourceType: "commonjs", + }, + + rules: { + "prettier/prettier": "error", + }, +}, { + files: ["types/*.d.ts"], + + plugins: { + "@typescript-eslint": typescriptEslint, + }, + + languageOptions: { + parser: tsParser, + sourceType: "module", + }, + + rules: { + strict: [0, "global"], + }, +}]; diff --git a/example/publisher-content-filter-example.js b/example/publisher-content-filter-example.js index 8cae8a18..8c75608c 100644 --- a/example/publisher-content-filter-example.js +++ b/example/publisher-content-filter-example.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); async function main() { diff --git a/example/publisher-message-example.js b/example/publisher-message-example.js index ae595e45..e81147ca 100644 --- a/example/publisher-message-example.js +++ b/example/publisher-message-example.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); rclnodejs diff --git a/example/publisher-multiarray-example.js b/example/publisher-multiarray-example.js index 9db6aef7..65c738e9 100644 --- a/example/publisher-multiarray-example.js +++ b/example/publisher-multiarray-example.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); rclnodejs diff --git a/example/publisher-raw-message.js b/example/publisher-raw-message.js index c4850455..3b53d133 100644 --- a/example/publisher-raw-message.js +++ b/example/publisher-raw-message.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); rclnodejs diff --git a/example/subscription-multiarray-example.js b/example/subscription-multiarray-example.js index 73011b6c..596bb59c 100644 --- a/example/subscription-multiarray-example.js +++ b/example/subscription-multiarray-example.js @@ -36,7 +36,7 @@ rclnodejs const weightStride = dim[1].stride; const channel = dim[2].size; const channelStride = dim[2].stride; - // eslint-disable-next-line + const offset = multiArray.layout.data_offset; for (let i = 0; i < height; i++) { diff --git a/example/subscription-raw-message.js b/example/subscription-raw-message.js index 3c3c9773..4f6c3468 100644 --- a/example/subscription-raw-message.js +++ b/example/subscription-raw-message.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); rclnodejs.init().then(() => { diff --git a/lib/action/client.js b/lib/action/client.js index 28099230..0a7180e3 100644 --- a/lib/action/client.js +++ b/lib/action/client.js @@ -172,7 +172,7 @@ class ActionClient extends Entity { goalHandle.status = status; // Remove done handles from the list - // eslint-disable-next-line max-depth + if ( status === ActionInterfaces.GoalStatus.STATUS_SUCCEEDED || status === ActionInterfaces.GoalStatus.STATUS_CANCELED || diff --git a/lib/clock_type.js b/lib/clock_type.js index 65d7faeb..ad21b71b 100644 --- a/lib/clock_type.js +++ b/lib/clock_type.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - /** * Enum for ClockType * @readonly diff --git a/lib/interface_loader.js b/lib/interface_loader.js index 97ea76d4..e7d195ff 100644 --- a/lib/interface_loader.js +++ b/lib/interface_loader.js @@ -59,7 +59,6 @@ let interfaceLoader = { // Suppose the name is a package, and traverse the path to collect the IDL files. let packagePath = path.join(generator.generatedRoot, name); - // eslint-disable-next-line let interfaces = fs.readdirSync(packagePath); if (interfaces.length > 0) { return this.loadInterfaceByPath(packagePath, interfaces); @@ -108,7 +107,7 @@ let interfaceLoader = { packageName, packageName + '__' + type + '__' + messageName + '.js' ); - // eslint-disable-next-line + if (fs.existsSync(filePath)) { return require(filePath); } diff --git a/lib/lifecycle.js b/lib/lifecycle.js index 07d88808..79964101 100644 --- a/lib/lifecycle.js +++ b/lib/lifecycle.js @@ -603,7 +603,6 @@ class LifecycleNode extends Node { _onGetState(request, response) { let result = response.template; - // eslint-disable-next-line camelcase result.current_state = this.currentState; response.send(result); @@ -619,7 +618,6 @@ class LifecycleNode extends Node { _onGetAvailableStates(request, response) { let result = response.template; - // eslint-disable-next-line camelcase result.available_states = this.availableStates; response.send(result); @@ -634,7 +632,6 @@ class LifecycleNode extends Node { _onGetAvailableTransitions(request, response) { let result = response.template; - // eslint-disable-next-line camelcase result.available_transitions = this.availableTransitions; response.send(result); diff --git a/lib/parameter.js b/lib/parameter.js index 9d267c4e..17b7deab 100644 --- a/lib/parameter.js +++ b/lib/parameter.js @@ -19,8 +19,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const IsClose = require('is-close'); /** diff --git a/lib/parameter_service.js b/lib/parameter_service.js index 772c04d4..eb653cd4 100644 --- a/lib/parameter_service.js +++ b/lib/parameter_service.js @@ -1,4 +1,3 @@ -/* eslint-disable max-depth */ // Copyright (c) 2020 Wayne Parrott. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/lib/qos.js b/lib/qos.js index b9bb0f4d..d6e0412b 100644 --- a/lib/qos.js +++ b/lib/qos.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable */ - /** * Enum for HistoryPolicy * @readonly diff --git a/package.json b/package.json index f0f9374c..367348f8 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "postinstall": "npm run generate-messages", "docs": "cd docs && make", "test": "node --expose-gc ./scripts/run_test.js && npx tsd", - "lint": "eslint --max-warnings=0 --ext js,ts index.js types scripts lib example rosidl_gen rosidl_parser test benchmark/rclnodejs && node ./scripts/cpplint.js", + "lint": "eslint && node ./scripts/cpplint.js", "format": "clang-format -i -style=file ./src/*.cpp ./src/*.hpp && prettier --write \"{lib,rosidl_gen,rostsd_gen,rosidl_parser,types,example,test,scripts,benchmark}/**/*.{js,md,ts}\" ./*.{js,md,ts}", "prepare": "husky" }, @@ -44,6 +44,8 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.25.9", + "@eslint/eslintrc": "^3.3.0", + "@eslint/js": "^9.21.0", "@types/node": "^22.13.5", "@typescript-eslint/eslint-plugin": "^8.18.0", "@typescript-eslint/parser": "^8.18.0", @@ -54,6 +56,7 @@ "eslint": "^9.16.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-prettier": "^5.2.1", + "globals": "^16.0.0", "husky": "^9.1.7", "jsdoc": "^4.0.4", "lint-staged": "^15.2.10", diff --git a/rosidl_gen/action_msgs.js b/rosidl_gen/action_msgs.js index 8305cf63..f6ab5f05 100644 --- a/rosidl_gen/action_msgs.js +++ b/rosidl_gen/action_msgs.js @@ -12,7 +12,6 @@ 'use strict'; -/* eslint-disable camelcase */ const GOAL_ID_FIELD = { name: 'goal_id', type: { diff --git a/rosidl_gen/filter.js b/rosidl_gen/filter.js index 03273bc1..d28e88ad 100644 --- a/rosidl_gen/filter.js +++ b/rosidl_gen/filter.js @@ -87,7 +87,6 @@ const RosPackageFilters = { if (!fs.existsSync(blocklistPath)) return; - // eslint-disable-next-line let blocklistData = JSON.parse(fs.readFileSync(blocklistPath, 'utf8')); let filters = blocklistData.map((pkgFilterData) => { diff --git a/rosidl_gen/index.js b/rosidl_gen/index.js index 2e428160..cc1a48d3 100644 --- a/rosidl_gen/index.js +++ b/rosidl_gen/index.js @@ -64,7 +64,6 @@ async function generateAll(forcedGenerating) { const generator = { version() { - // eslint-disable-next-line return fse.readJsonSync(path.join(__dirname, 'generator.json')).version; }, diff --git a/rosidl_gen/message_translator.js b/rosidl_gen/message_translator.js index 94e4da49..9b2ff311 100644 --- a/rosidl_gen/message_translator.js +++ b/rosidl_gen/message_translator.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable max-depth */ - function isTypedArray(value) { return ArrayBuffer.isView(value) && !(value instanceof DataView); } @@ -133,7 +131,6 @@ function toPlainObject(message, enableTypedArray = true) { array.push(toPlainObject(e, enableTypedArray)); // Translate every elements }); return array; - // eslint-disable-next-line no-else-return } else { // It's a ROS message const def = message.constructor.ROSMessageDef; diff --git a/rosidl_gen/primitive_types.js b/rosidl_gen/primitive_types.js index a2d60998..7099fc6d 100644 --- a/rosidl_gen/primitive_types.js +++ b/rosidl_gen/primitive_types.js @@ -18,8 +18,6 @@ const ref = require('@rclnodejs/ref-napi'); const StructType = require('@rclnodejs/ref-struct-di')(ref); const rclnodejs = require('bindings')('rclnodejs'); -/* eslint-disable camelcase */ - const StringRefStruct = StructType({ data: ref.types.CString, size: ref.types.size_t, @@ -65,5 +63,3 @@ module.exports = { wstring: StringRefStruct, initString: initString, }; - -/* eslint-enable camelcase */ diff --git a/rostsd_gen/index.js b/rostsd_gen/index.js index 4c9f6b68..176517a4 100644 --- a/rostsd_gen/index.js +++ b/rostsd_gen/index.js @@ -23,10 +23,6 @@ declare module "rclnodejs" { } */ -/* eslint-disable max-depth */ -/* eslint-disable no-sync */ -/* eslint-disable camelcase */ - 'use strict'; const path = require('path'); diff --git a/scripts/cpplint.js b/scripts/cpplint.js index 793f6488..1f25fcb7 100644 --- a/scripts/cpplint.js +++ b/scripts/cpplint.js @@ -18,10 +18,9 @@ const exec = require('child_process').exec; const cmd = 'wget -nc '; const cpplintUrl = - 'https://raw.githubusercontent.com/google/styleguide' + - '/gh-pages/cpplint/cpplint.py'; + 'https://raw.githubusercontent.com/cpplint/cpplint/refs/heads/develop/cpplint.py'; const root = `${__dirname}/../src`; -const args = `--extensions=cpp,h,hpp,cc ${root}/*`; +const args = `--filter=-build/include_subdir,-whitespace/indent_namespace --extensions=cpp,h,hpp,cc ${root}/*`; console.log('Downloading the cpplint...'); exec(cmd + cpplintUrl, (err, stdout, stderr) => { @@ -29,7 +28,7 @@ exec(cmd + cpplintUrl, (err, stdout, stderr) => { console.log(`Downloading failed: ${stderr}`); } else { console.log('Running the cpplint...'); - exec('python cpplint.py ' + args, (err, stdout, stderr) => { + exec('python3 cpplint.py ' + args, (err, stdout, stderr) => { console.log(stdout); if (err) { console.log(stderr); diff --git a/src/executor.hpp b/src/executor.hpp index 0469e6e8..5d16bf56 100644 --- a/src/executor.hpp +++ b/src/executor.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_EXECUTOR_HPP_ -#define RCLNODEJS_EXECUTOR_HPP_ +#ifndef SRC_EXECUTOR_HPP_ +#define SRC_EXECUTOR_HPP_ #include #include @@ -74,4 +74,4 @@ class Executor { } // namespace rclnodejs -#endif +#endif // SRC_EXECUTOR_HPP_ diff --git a/src/handle_manager.hpp b/src/handle_manager.hpp index d17f05f2..9605c8a8 100644 --- a/src/handle_manager.hpp +++ b/src/handle_manager.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_HANDLE_MANAGER_HPP_ -#define RCLNODEJS_HANDLE_MANAGER_HPP_ +#ifndef SRC_HANDLE_MANAGER_HPP_ +#define SRC_HANDLE_MANAGER_HPP_ #include #include @@ -132,4 +132,4 @@ class HandleManager { } // namespace rclnodejs -#endif +#endif // SRC_HANDLE_MANAGER_HPP_ diff --git a/src/macros.hpp b/src/macros.hpp index 9cf374dd..399d0fc5 100644 --- a/src/macros.hpp +++ b/src/macros.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_MARCOS_HPP_ -#define RCLNODEJS_MARCOS_HPP_ +#ifndef SRC_MACROS_HPP_ +#define SRC_MACROS_HPP_ #include "rcutils/logging_macros.h" @@ -43,4 +43,4 @@ #define RCLNODEJS_DEBUG(...) #endif -#endif +#endif // SRC_MACROS_HPP_ diff --git a/src/rcl_action_bindings.hpp b/src/rcl_action_bindings.hpp index 898ae6e0..115816fc 100644 --- a/src/rcl_action_bindings.hpp +++ b/src/rcl_action_bindings.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_RCL_ACTION_BINDINGS_HPP_ -#define RCLNODEJS_RCL_ACTION_BINDINGS_HPP_ +#ifndef SRC_RCL_ACTION_BINDINGS_HPP_ +#define SRC_RCL_ACTION_BINDINGS_HPP_ #include #include @@ -28,4 +28,4 @@ extern std::vector action_binding_methods; } // namespace rclnodejs -#endif +#endif // SRC_RCL_ACTION_BINDINGS_HPP_ diff --git a/src/rcl_bindings.cpp b/src/rcl_bindings.cpp index c5a7f4f2..4514d09e 100644 --- a/src/rcl_bindings.cpp +++ b/src/rcl_bindings.cpp @@ -40,6 +40,7 @@ #include #endif +#include #include #include #include @@ -963,7 +964,7 @@ NAN_METHOD(SendRequest) { THROW_ERROR_IF_NOT_EQUAL(rcl_send_request(client, buffer, &sequence_number), RCL_RET_OK, rcl_get_error_string().str); - info.GetReturnValue().Set(Nan::New((uint32_t)sequence_number)); + info.GetReturnValue().Set(Nan::New(static_cast(sequence_number))); } NAN_METHOD(RclTakeResponse) { @@ -980,7 +981,7 @@ NAN_METHOD(RclTakeResponse) { int64_t sequence_number = header.request_id.sequence_number; if (ret == RCL_RET_OK) { - info.GetReturnValue().Set(Nan::New((uint32_t)sequence_number)); + info.GetReturnValue().Set(Nan::New(static_cast(sequence_number))); return; } @@ -1161,7 +1162,7 @@ NAN_METHOD(ValidateFullTopicName) { Nan::Set( result_list, 0, Nan::New(std::string(validation_message)).ToLocalChecked()); - Nan::Set(result_list, 1, Nan::New((int32_t)invalid_index)); + Nan::Set(result_list, 1, Nan::New(static_cast(invalid_index))); info.GetReturnValue().Set(result_list); } @@ -1196,7 +1197,7 @@ NAN_METHOD(ValidateNodeName) { Nan::Set( result_list, 0, Nan::New(std::string(validation_message)).ToLocalChecked()); - Nan::Set(result_list, 1, Nan::New((int32_t)invalid_index)); + Nan::Set(result_list, 1, Nan::New(static_cast(invalid_index))); info.GetReturnValue().Set(result_list); } @@ -1231,7 +1232,7 @@ NAN_METHOD(ValidateTopicName) { Nan::Set( result_list, 0, Nan::New(std::string(validation_message)).ToLocalChecked()); - Nan::Set(result_list, 1, Nan::New((int32_t)invalid_index)); + Nan::Set(result_list, 1, Nan::New(static_cast(invalid_index))); info.GetReturnValue().Set(result_list); } @@ -1266,7 +1267,7 @@ NAN_METHOD(ValidateNamespace) { Nan::Set( result_list, 0, Nan::New(std::string(validation_message)).ToLocalChecked()); - Nan::Set(result_list, 1, Nan::New((int32_t)invalid_index)); + Nan::Set(result_list, 1, Nan::New(static_cast(invalid_index))); info.GetReturnValue().Set(result_list); } diff --git a/src/rcl_bindings.hpp b/src/rcl_bindings.hpp index 998d5676..8c8476f0 100644 --- a/src/rcl_bindings.hpp +++ b/src/rcl_bindings.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_RCL_BINDINGS_HPP_ -#define RCLNODEJS_RCL_BINDINGS_HPP_ +#ifndef SRC_RCL_BINDINGS_HPP_ +#define SRC_RCL_BINDINGS_HPP_ #include #include @@ -43,4 +43,4 @@ extern std::vector binding_methods; } // namespace rclnodejs -#endif +#endif // SRC_RCL_BINDINGS_HPP_ diff --git a/src/rcl_handle.hpp b/src/rcl_handle.hpp index aff9b186..143009e0 100644 --- a/src/rcl_handle.hpp +++ b/src/rcl_handle.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_RCL_HANDLE_HPP_ -#define RCLNODEJS_RCL_HANDLE_HPP_ +#ifndef SRC_RCL_HANDLE_HPP_ +#define SRC_RCL_HANDLE_HPP_ #include @@ -68,4 +68,4 @@ class RclHandle : public Nan::ObjectWrap { } // namespace rclnodejs -#endif +#endif // SRC_RCL_HANDLE_HPP_ diff --git a/src/rcl_lifecycle_bindings.hpp b/src/rcl_lifecycle_bindings.hpp index 2f84cb19..a7c75155 100644 --- a/src/rcl_lifecycle_bindings.hpp +++ b/src/rcl_lifecycle_bindings.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_RCL_LIFECYCLE_BINDINGS_HPP_ -#define RCLNODEJS_RCL_LIFECYCLE_BINDINGS_HPP_ +#ifndef SRC_RCL_LIFECYCLE_BINDINGS_HPP_ +#define SRC_RCL_LIFECYCLE_BINDINGS_HPP_ #include @@ -25,4 +25,4 @@ extern std::vector lifecycle_binding_methods; } // namespace rclnodejs -#endif +#endif // SRC_RCL_LIFECYCLE_BINDINGS_HPP_ diff --git a/src/rcl_utilities.hpp b/src/rcl_utilities.hpp index 30ec30f2..300b6ae0 100644 --- a/src/rcl_utilities.hpp +++ b/src/rcl_utilities.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_RCL_UTILITIES_HPP_ -#define RCLNODEJS_RCL_UTILITIES_HPP_ +#ifndef SRC_RCL_UTILITIES_HPP_ +#define SRC_RCL_UTILITIES_HPP_ #include @@ -37,4 +37,4 @@ std::string GetErrorMessageAndClear(); } // namespace rclnodejs -#endif +#endif // SRC_RCL_UTILITIES_HPP_ diff --git a/src/shadow_node.hpp b/src/shadow_node.hpp index 359cd8a6..e1b7f456 100644 --- a/src/shadow_node.hpp +++ b/src/shadow_node.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RCLNODEJS_SHADOW_NODE_HPP_ -#define RCLNODEJS_SHADOW_NODE_HPP_ +#ifndef SRC_SHADOW_NODE_HPP_ +#define SRC_SHADOW_NODE_HPP_ #include @@ -60,4 +60,4 @@ class ShadowNode : public Nan::ObjectWrap, public Executor::Delegate { } // namespace rclnodejs -#endif +#endif // SRC_SHADOW_NODE_HPP_ diff --git a/test/publisher_array_setup.js b/test/publisher_array_setup.js index 56315b60..e1d1b8b2 100644 --- a/test/publisher_array_setup.js +++ b/test/publisher_array_setup.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); rclnodejs diff --git a/test/publisher_msg_header.js b/test/publisher_msg_header.js index 64ee73dd..8e9fde43 100644 --- a/test/publisher_msg_header.js +++ b/test/publisher_msg_header.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); rclnodejs diff --git a/test/publisher_msg_jointstate.js b/test/publisher_msg_jointstate.js index b244d29d..32d15d59 100644 --- a/test/publisher_msg_jointstate.js +++ b/test/publisher_msg_jointstate.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const rclnodejs = require('../index.js'); rclnodejs diff --git a/test/test-array-data.js b/test/test-array-data.js index eac2742c..dfc2b58c 100644 --- a/test/test-array-data.js +++ b/test/test-array-data.js @@ -32,10 +32,6 @@ describe('rclnodejs message communication', function () { rclnodejs.shutdown(); }); - /* eslint-disable camelcase */ - /* eslint-disable key-spacing */ - /* eslint-disable comma-spacing */ - const layout = { dim: [ { label: 'height', size: 10, stride: 600 }, @@ -143,9 +139,6 @@ describe('rclnodejs message communication', function () { }, // Provide data via TypedArray ], }, - /* eslint-enable camelcase */ - /* eslint-enable key-spacing */ - /* eslint-enable comma-spacing */ ].forEach((testData) => { const topic = testData.topic || 'topic' + testData.type; testData.values.forEach((v, i) => { @@ -222,9 +215,6 @@ describe('rclnodejs message communication', function () { ); [ - /* eslint-disable camelcase */ - /* eslint-disable key-spacing */ - /* eslint-disable comma-spacing */ { pkg: 'sensor_msgs', type: 'PointCloud2', @@ -353,9 +343,6 @@ describe('rclnodejs message communication', function () { }, ], }, - /* eslint-enable camelcase */ - /* eslint-enable key-spacing */ - /* eslint-enable comma-spacing */ ].forEach((testData) => { const topic = testData.topic || 'topic' + testData.type; testData.values.forEach((v, i) => { @@ -383,7 +370,6 @@ describe('rclnodejs message communication', function () { const arrayLength = 1024; [ - /* eslint-disable max-len */ { type: 'ByteMultiArray', arrayType: Uint8Array, @@ -583,7 +569,6 @@ describe('rclnodejs message communication', function () { Math.floor ), }, - /* eslint-enable max-len */ ].forEach((testData) => { const topic = testData.topic || 'topic' + testData.type; it('Make sure ' + testData.type + ' use TypedArray', function () { @@ -591,7 +576,7 @@ describe('rclnodejs message communication', function () { const msg = translator.toROSMessage(MessageType, { layout: { dim: [{ label: 'length', size: 0, stride: 0 }], - // eslint-disable-next-line + data_offset: 0, }, data: testData.values, diff --git a/test/test-bounded-sequences.js b/test/test-bounded-sequences.js index d4ddf146..1cc47dda 100644 --- a/test/test-bounded-sequences.js +++ b/test/test-bounded-sequences.js @@ -17,9 +17,6 @@ const assert = require('assert'); const rclnodejs = require('../index.js'); -/* eslint-disable camelcase */ -/* eslint-disable key-spacing */ -/* eslint-disable comma-spacing */ describe('Test bounded sequeces', function () { this.timeout(60 * 1000); diff --git a/test/test-disable-typedarray.js b/test/test-disable-typedarray.js index 11c959b9..2e4688cb 100644 --- a/test/test-disable-typedarray.js +++ b/test/test-disable-typedarray.js @@ -17,9 +17,6 @@ const assert = require('assert'); const rclnodejs = require('../index.js'); -/* eslint-disable camelcase */ -/* eslint-disable key-spacing */ -/* eslint-disable comma-spacing */ describe('rclnodejs message communication', function () { this.timeout(60 * 1000); diff --git a/test/test-fixed-array.js b/test/test-fixed-array.js index 647260bd..91c5c6d5 100644 --- a/test/test-fixed-array.js +++ b/test/test-fixed-array.js @@ -17,10 +17,6 @@ const assert = require('assert'); const rclnodejs = require('../index.js'); -/* eslint-disable camelcase */ -/* eslint-disable key-spacing */ -/* eslint-disable comma-spacing */ - describe('Test message which has a fixed array of 36', function () { this.timeout(60 * 1000); diff --git a/test/test-message-properties-validation.js b/test/test-message-properties-validation.js index e2c22376..f38d72de 100644 --- a/test/test-message-properties-validation.js +++ b/test/test-message-properties-validation.js @@ -29,9 +29,6 @@ describe('Rclnodejs message properities validation', function () { rclnodejs.shutdown(); }); - /* eslint-disable camelcase */ - /* eslint-disable key-spacing */ - /* eslint-disable comma-spacing */ [ { pkg: 'std_msgs', diff --git a/test/test-message-translator-complex.js b/test/test-message-translator-complex.js index b7365bc6..355b8005 100644 --- a/test/test-message-translator-complex.js +++ b/test/test-message-translator-complex.js @@ -28,10 +28,6 @@ describe('Rclnodejs message translation: complex types', function () { rclnodejs.shutdown(); }); - /* eslint-disable camelcase */ - /* eslint-disable key-spacing */ - /* eslint-disable comma-spacing */ - [ { pkg: 'std_msgs', @@ -205,9 +201,6 @@ describe('Rclnodejs message translation: complex types', function () { }, ], }, - /* eslint-enable camelcase */ - /* eslint-enable key-spacing */ - /* eslint-enable comma-spacing */ ].forEach((testData) => { const topic = testData.topic || 'topic' + testData.type; testData.values.forEach((v, i) => { diff --git a/test/test-message-translator-primitive.js b/test/test-message-translator-primitive.js index 5bcefb71..8d5b3d91 100644 --- a/test/test-message-translator-primitive.js +++ b/test/test-message-translator-primitive.js @@ -19,9 +19,6 @@ const deepEqual = require('deep-equal'); const arrayGen = require('./array_generator.js'); const { isTypedArray } = require('./utils.js'); -/* eslint-disable camelcase */ -/* eslint-disable indent */ - describe('Rclnodejs message translation: primitive types', function () { this.timeout(60 * 1000); @@ -259,7 +256,6 @@ describe('Rclnodejs message translation: TypedArray large data', function () { const arrayLength = 100 * 1000; [ - /* eslint-disable max-len */ { type: 'ByteMultiArray', values: arrayGen.generateValues( @@ -464,7 +460,6 @@ describe('Rclnodejs message translation: TypedArray large data', function () { Math.floor ), }, - /* eslint-enable max-len */ ].forEach((testData) => { const topic = testData.topic || 'topic' + testData.type; it( diff --git a/test/test-msg-type-cpp-node.js b/test/test-msg-type-cpp-node.js index 38315682..6ea2d346 100644 --- a/test/test-msg-type-cpp-node.js +++ b/test/test-msg-type-cpp-node.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const assert = require('assert'); const path = require('path'); const childProcess = require('child_process'); diff --git a/test/test-msg-type-py-node.js b/test/test-msg-type-py-node.js index 26ab5044..6e9c9c32 100644 --- a/test/test-msg-type-py-node.js +++ b/test/test-msg-type-py-node.js @@ -14,8 +14,6 @@ 'use strict'; -/* eslint-disable camelcase */ - const assert = require('assert'); const childProcess = require('child_process'); const deepEqual = require('deep-equal'); diff --git a/test/test-non-primitive-array.js b/test/test-non-primitive-array.js index 2b3535c8..228fd713 100644 --- a/test/test-non-primitive-array.js +++ b/test/test-non-primitive-array.js @@ -17,10 +17,6 @@ const assert = require('assert'); const rclnodejs = require('../index.js'); -/* eslint-disable camelcase */ -/* eslint-disable key-spacing */ -/* eslint-disable comma-spacing */ - describe('Test message which has a non-primitive array', function () { this.timeout(60 * 1000); diff --git a/test/test-non-primitive-msg-type-check.js b/test/test-non-primitive-msg-type-check.js index f459b214..02e45817 100644 --- a/test/test-non-primitive-msg-type-check.js +++ b/test/test-non-primitive-msg-type-check.js @@ -17,7 +17,6 @@ const assert = require('assert'); const rclnodejs = require('../index.js'); -/* eslint-disable camelcase */ describe('Rclnodejs non primitive message type testing', function () { this.timeout(60 * 1000); diff --git a/test/test-parameter-service.js b/test/test-parameter-service.js index 047a99e8..ffe236be 100644 --- a/test/test-parameter-service.js +++ b/test/test-parameter-service.js @@ -1,4 +1,3 @@ -/* eslint-disable camelcase */ // Copyright (c) Wayne Parrott All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/test/test-parameters.js b/test/test-parameters.js index eaf4892c..14039206 100644 --- a/test/test-parameters.js +++ b/test/test-parameters.js @@ -645,12 +645,10 @@ describe('rclnodejs parameters test suite', function () { let node; this.timeout(60 * 1000); - /* eslint-disable-next-line space-before-function-paren */ before(async () => { await rclnodejs.init(); }); - /* eslint-disable-next-line space-before-function-paren */ this.beforeEach(async () => { node = rclnodejs.createNode(NODE_NAME); PARAMETER = new Parameter(PARAM_NAME, PARAM_TYPE, PARAM_VALUE); diff --git a/test/test-promise-gc.js b/test/test-promise-gc.js index 99dc0b1e..1495b4c3 100644 --- a/test/test-promise-gc.js +++ b/test/test-promise-gc.js @@ -15,7 +15,6 @@ * */ -/* eslint-disable camelcase */ 'use strict'; const assert = require('assert'); diff --git a/test/test-security-related.js b/test/test-security-related.js index 4fe29395..539dcde9 100644 --- a/test/test-security-related.js +++ b/test/test-security-related.js @@ -292,7 +292,7 @@ describe('Fuzzing API calls testing', function () { for (let i = 0; i < dataLength; i++) { uint8Data[i] = i % 255; } - /* eslint-disable camelcase */ + const value = { header: { stamp: { sec: 11223, nanosec: 44556 }, frame_id: 'f001' }, height: 240, diff --git a/test/utils.js b/test/utils.js index f20d4105..d7d9ca28 100644 --- a/test/utils.js +++ b/test/utils.js @@ -66,7 +66,6 @@ function getAvailablePath(amentPrefixPath, otherDirs) { appendedPath = path.join(appendedPath, dir); }); - // eslint-disable-next-line if (fs.existsSync(appendedPath) || fs.existsSync(appendedPath + '.exe')) { availablePath = appendedPath; } diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index da883ca9..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "moduleResolution": "node", - "target": "es6", - /* Strict Type-Checking Options */ - "strict": true, - /* Additional Checks */ - /* next line commented out because we need unused vars for type tests */ - // "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "lib": ["es2017"] - }, - "include": [ - "types/**/*" - ] -} \ No newline at end of file diff --git a/types/publisher.d.ts b/types/publisher.d.ts index bf9edf38..89fe12f7 100644 --- a/types/publisher.d.ts +++ b/types/publisher.d.ts @@ -8,7 +8,6 @@ declare module 'rclnodejs' { * Topic on which messages are published. */ readonly topic: string; - /** * Publish a message *