From 445fd67472a97876efeac7043e33815e9b568278 Mon Sep 17 00:00:00 2001 From: Ezra Brooks Date: Tue, 20 Feb 2024 08:47:25 -0700 Subject: [PATCH] Consolidate key-spacing style This is inconsistent across the project. Add a lint rule to enforce the more common one. --- eslint.config.js | 3 ++- examples/node_simple.js | 24 +++++++++---------- .../component_examples/example_functions.jsx | 6 ++--- src/core/Action.js | 10 ++++---- test/examples/tf_service.example.js | 2 +- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index bc7319569..1a1401ba4 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -32,7 +32,8 @@ module.exports = [ strict: 0, quotes: [2, 'single'], 'no-proto': 2, - 'linebreak-style': 2 + 'linebreak-style': 2, + 'key-spacing': [2, {afterColon: true}] }, files: ['**/*.{js,jsx,cjs}'] } diff --git a/examples/node_simple.js b/examples/node_simple.js index 340216dc6..422aa5523 100644 --- a/examples/node_simple.js +++ b/examples/node_simple.js @@ -4,7 +4,7 @@ var ROSLIB = require('roslib'); var ros = new ROSLIB.Ros({ - url : 'ws://localhost:9090' + url: 'ws://localhost:9090' }); ros.on('connection', function() { @@ -23,21 +23,21 @@ console.log('Connection to websocket server closed.'); // ------------------ var cmdVel = new ROSLIB.Topic({ - ros : ros, - name : '/cmd_vel', - messageType : 'geometry_msgs/Twist' + ros: ros, + name: '/cmd_vel', + messageType: 'geometry_msgs/Twist' }); var twist = new ROSLIB.Message({ -linear : { - x : 0.1, - y : 0.2, - z : 0.3 +linear: { + x: 0.1, + y: 0.2, + z: 0.3 }, -angular : { - x : -0.1, - y : -0.2, - z : -0.3 +angular: { + x: -0.1, + y: -0.2, + z: -0.3 } }); diff --git a/examples/react-example/src/component_examples/example_functions.jsx b/examples/react-example/src/component_examples/example_functions.jsx index 99576b5cc..f1ecab793 100644 --- a/examples/react-example/src/component_examples/example_functions.jsx +++ b/examples/react-example/src/component_examples/example_functions.jsx @@ -47,9 +47,9 @@ function SendMessage() { }) const data = new ROSLIB.Message({ - x : linear.x, - y : linear.y, - theta : angular.z + x: linear.x, + y: linear.y, + theta: angular.z }) // publishes to the queue diff --git a/src/core/Action.js b/src/core/Action.js index 597142649..b4cbc9b08 100644 --- a/src/core/Action.js +++ b/src/core/Action.js @@ -72,12 +72,12 @@ class Action extends EventEmitter { } var call = { - op : 'send_action_goal', - id : actionGoalId, - action : this.name, + op: 'send_action_goal', + id: actionGoalId, + action: this.name, action_type: this.actionType, - args : goal, - feedback : true, + args: goal, + feedback: true, }; this.ros.callOnConnection(call); diff --git a/test/examples/tf_service.example.js b/test/examples/tf_service.example.js index 98cd04410..2d7db501e 100644 --- a/test/examples/tf_service.example.js +++ b/test/examples/tf_service.example.js @@ -5,7 +5,7 @@ describe('TF2 Republisher Service Example', function() { it('tf republisher', () => new Promise((done) => { var ros = new ROSLIB.Ros({ // Use the service interface to tf2_web_republisher - groovyCompatibility : false + groovyCompatibility: false }); ros.connect('ws://localhost:9090');