From 49013fcee1786dadf495ad4b43dc1630b34a81a9 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 6 Feb 2021 05:37:36 -0800 Subject: [PATCH] =?UTF-8?q?tools:=20make=20comma-dangle=20ESLint=20rule=20?= =?UTF-8?q?more=20stringent=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We've been having a lot of nits lately asking people to add trailing commas, so it's probably time to incrementally make the comma-dangle rule more stringent. PR-URL: https://github.com/nodejs/node/pull/37088 Reviewed-By: Michaƫl Zasso Reviewed-By: Antoine du Hamel --- .eslintrc.js | 8 +++++++- test/.eslintrc.yaml | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index ca0e40e4b6ceee..a9a1761e6abcdf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -95,7 +95,13 @@ module.exports = { ignorePattern: '.*', }, }], - 'comma-dangle': ['error', 'only-multiline'], + 'comma-dangle': ['error', { + arrays: 'always-multiline', + exports: 'only-multiline', + functions: 'only-multiline', + imports: 'only-multiline', + objects: 'only-multiline', + }], 'comma-spacing': 'error', 'comma-style': 'error', 'computed-property-spacing': 'error', diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 6a0104f7ce17ca..146633bf850f83 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -5,6 +5,8 @@ env: es6: true rules: + # For now, comma-dangle is more lenient in the test directory than elsewhere. + comma-dangle: ["error", "only-multiline"] no-var: error prefer-const: error symbol-description: off