From a70d9be6157742742c565524bcda5436ce612621 Mon Sep 17 00:00:00 2001 From: literat Date: Thu, 20 Feb 2025 11:16:33 +0100 Subject: [PATCH] fixup! Feat(eslint-config): Introduce sharable ESlint preset --- configs/eslint-config-spirit/index.js | 40 +++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/configs/eslint-config-spirit/index.js b/configs/eslint-config-spirit/index.js index 9123519e07..a5d0e3ab2a 100644 --- a/configs/eslint-config-spirit/index.js +++ b/configs/eslint-config-spirit/index.js @@ -28,6 +28,11 @@ module.exports = { plugins: ['promise', 'react', '@typescript-eslint', 'prettier', 'react-refresh'], rules: { + /** + * Use prettier config for code formatting + * + * @see { @link https://github.com/prettier/eslint-plugin-prettier } + */ 'prettier/prettier': [ 'error', { @@ -35,6 +40,11 @@ module.exports = { }, ], + /** + * Set sorting of imports + * + * @see { @link https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md } + */ 'import/order': [ 'error', { @@ -59,18 +69,36 @@ module.exports = { }, ], - // 'no-param-reassign': ['warn', { props: true }], - // allow reassign in properties + + /** + * Allow reassignment of params in properties + * + * @see { @link https://eslint.org/docs/latest/rules/no-param-reassign } + */ 'no-param-reassign': ['warn', { props: false }], - // allow ++ in for loops + /** + * Allow `++`/`--` in for loops + * + * @see { @link https://eslint.org/docs/rules/no-plusplus } + */ 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], - // disable double quotes + /** + * Warn when not using single quotes + * + * @see { @link https://eslint.org/docs/latest/rules/quotes } + */ quotes: ['warn', 'single'], - // There are places where arrow body make sense and where does not - // @todo create a guideline for this + /** + * Disable arrow body style + * There are places where arrow body make sense and where does not + * + * @todo create a guideline for this + * + * @see { @link https://eslint.org/docs/latest/rules/arrow-body-style } + */ 'arrow-body-style': 'off', }, };