From 27a10089f1ba729ec2d9eba91e97b120d063f93b Mon Sep 17 00:00:00 2001 From: Jon Sun Date: Sat, 4 Nov 2023 23:02:45 +1300 Subject: [PATCH 1/6] feat: add object-curly-newline rule --- index.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index fe79b0c..350a695 100644 --- a/index.js +++ b/index.js @@ -420,8 +420,31 @@ module.exports = { 'error', 'never', ], - // Disabled because of https://github.com/xojs/eslint-config-xo/issues/27 - // 'object-property-newline': 'error', + 'object-curly-newline': [ + 'error', + { + ObjectExpression: { + multiline: true, + minProperties: 2, + consistent: true, + }, + ObjectPattern: { + multiline: true, + minProperties: 4, + consistent: true, + }, + ImportDeclaration: { + multiline: true, + minProperties: 4, + consistent: true, + }, + ExportDeclaration: { + multiline: true, + minProperties: 2, + consistent: true, + }, + }, + ], 'one-var': [ 'error', 'never', From d9abb4c96842101caa0304c36b1e8a32c86a48d7 Mon Sep 17 00:00:00 2001 From: Jon Sun Date: Thu, 9 Nov 2023 22:21:32 +1300 Subject: [PATCH 2/6] set ObjectPattern to never --- index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/index.js b/index.js index 350a695..d6d9103 100644 --- a/index.js +++ b/index.js @@ -428,11 +428,7 @@ module.exports = { minProperties: 2, consistent: true, }, - ObjectPattern: { - multiline: true, - minProperties: 4, - consistent: true, - }, + ObjectPattern: "never", ImportDeclaration: { multiline: true, minProperties: 4, From b7e73a48adc31f3f307eaa3d45c94b5d74bfb3ee Mon Sep 17 00:00:00 2001 From: Jon Sun Date: Thu, 9 Nov 2023 22:22:37 +1300 Subject: [PATCH 3/6] fix styling --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d6d9103..0bf905a 100644 --- a/index.js +++ b/index.js @@ -428,7 +428,7 @@ module.exports = { minProperties: 2, consistent: true, }, - ObjectPattern: "never", + ObjectPattern: 'never', ImportDeclaration: { multiline: true, minProperties: 4, From adfc613aab52d79b494f544adf2d1c3bf3145a67 Mon Sep 17 00:00:00 2001 From: Jon Sun Date: Sat, 11 Nov 2023 23:43:00 +1300 Subject: [PATCH 4/6] fix: consisitent import/export declaration --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 0bf905a..4b1426b 100644 --- a/index.js +++ b/index.js @@ -428,7 +428,11 @@ module.exports = { minProperties: 2, consistent: true, }, - ObjectPattern: 'never', + ObjectPattern: { + multiline: true, + minProperties: 4, + consistent: true, + }, ImportDeclaration: { multiline: true, minProperties: 4, @@ -436,7 +440,7 @@ module.exports = { }, ExportDeclaration: { multiline: true, - minProperties: 2, + minProperties: 4, consistent: true, }, }, From aa20a609efe386be4cc737a489152783d1443c4c Mon Sep 17 00:00:00 2001 From: Jon Sun Date: Sat, 11 Nov 2023 23:45:01 +1300 Subject: [PATCH 5/6] fix: allow properties on multiple line --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index 4b1426b..4142680 100644 --- a/index.js +++ b/index.js @@ -430,7 +430,6 @@ module.exports = { }, ObjectPattern: { multiline: true, - minProperties: 4, consistent: true, }, ImportDeclaration: { From 0a18a3f55ea8c6f9db110c035fcd11cecaaf0f6d Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 11 Nov 2023 19:55:59 +0700 Subject: [PATCH 6/6] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 4142680..def0046 100644 --- a/index.js +++ b/index.js @@ -425,7 +425,7 @@ module.exports = { { ObjectExpression: { multiline: true, - minProperties: 2, + minProperties: 4, consistent: true, }, ObjectPattern: {