From 2b4da1a2c8878c8817a2ed8b327969d95aaade96 Mon Sep 17 00:00:00 2001 From: Zack Baldwin Date: Sat, 30 Dec 2023 21:00:53 +0000 Subject: [PATCH 1/4] fix(lint): fix node 18 zwave lint --- .../src/rules/consistent-device-config-property-order.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts index 34d30146ad1d..1ace0f740e95 100644 --- a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts +++ b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts @@ -80,8 +80,8 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { 0, withRanges[0].property.loc.start.column, ); - - const desiredOrder = propsWithComments.toSorted((a, b) => + // TODO: Change to .toSorted() once on node 20. + const desiredOrder = [...propsWithComments].sort((a, b) => a.index - b.index ).map((prop) => { const start = Math.min( From d7408530eca0f36571ee5204bc7535b87523e060 Mon Sep 17 00:00:00 2001 From: Zack Baldwin Date: Sat, 30 Dec 2023 21:50:09 +0000 Subject: [PATCH 2/4] fix(lint): ran lint:fix on file --- .../src/rules/consistent-device-config-property-order.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts index 1ace0f740e95..c99e3fe7d154 100644 --- a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts +++ b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts @@ -48,7 +48,7 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { .filter( (c) => c.loc?.start.line - === prev.property.loc.end.line, + === prev.property.loc.end.line, ); prev.comments.trailing.push( ...wronglyAttributedComments, @@ -80,8 +80,8 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { 0, withRanges[0].property.loc.start.column, ); - // TODO: Change to .toSorted() once on node 20. - const desiredOrder = [...propsWithComments].sort((a, b) => + // TODO: Change to .toSorted() once on node 20. + const desiredOrder = [...propsWithComments].sort((a, b) => a.index - b.index ).map((prop) => { const start = Math.min( @@ -161,8 +161,7 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { schema: [], messages: { "parameter-ordering": - `For consistency, config param properties should follow the order ${ - paramInfoPropertyOrder.map((p) => `"${p}"`).join(", ") + `For consistency, config param properties should follow the order ${paramInfoPropertyOrder.map((p) => `"${p}"`).join(", ") }.`, }, type: "problem", From 0f0fb2ef17b729c17949ce7fc11cd7936000f1f2 Mon Sep 17 00:00:00 2001 From: Zack Baldwin Date: Sat, 30 Dec 2023 21:57:34 +0000 Subject: [PATCH 3/4] Revert "fix(lint): ran lint:fix on file" This reverts commit d7408530eca0f36571ee5204bc7535b87523e060. --- .../src/rules/consistent-device-config-property-order.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts index c99e3fe7d154..1ace0f740e95 100644 --- a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts +++ b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts @@ -48,7 +48,7 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { .filter( (c) => c.loc?.start.line - === prev.property.loc.end.line, + === prev.property.loc.end.line, ); prev.comments.trailing.push( ...wronglyAttributedComments, @@ -80,8 +80,8 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { 0, withRanges[0].property.loc.start.column, ); - // TODO: Change to .toSorted() once on node 20. - const desiredOrder = [...propsWithComments].sort((a, b) => + // TODO: Change to .toSorted() once on node 20. + const desiredOrder = [...propsWithComments].sort((a, b) => a.index - b.index ).map((prop) => { const start = Math.min( @@ -161,7 +161,8 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { schema: [], messages: { "parameter-ordering": - `For consistency, config param properties should follow the order ${paramInfoPropertyOrder.map((p) => `"${p}"`).join(", ") + `For consistency, config param properties should follow the order ${ + paramInfoPropertyOrder.map((p) => `"${p}"`).join(", ") }.`, }, type: "problem", From 3bca8e8e3f8b5aa6cabcfaf2cd577260d684d6ce Mon Sep 17 00:00:00 2001 From: Zack Baldwin Date: Sun, 31 Dec 2023 19:38:03 +0000 Subject: [PATCH 4/4] chore(lint): fix linespace --- .../src/rules/consistent-device-config-property-order.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts index 1ace0f740e95..28d530ffa930 100644 --- a/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts +++ b/packages/eslint-plugin/src/rules/consistent-device-config-property-order.ts @@ -80,8 +80,8 @@ export const consistentDeviceConfigPropertyOrder: JSONCRule.RuleModule = { 0, withRanges[0].property.loc.start.column, ); - // TODO: Change to .toSorted() once on node 20. - const desiredOrder = [...propsWithComments].sort((a, b) => + // TODO: Change to .toSorted() once on node 20. + const desiredOrder = [...propsWithComments].sort((a, b) => a.index - b.index ).map((prop) => { const start = Math.min(