From bc42073e28225012fea743bc20afa9a16f90002a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Mon, 26 Sep 2022 14:43:52 +0200 Subject: [PATCH] ci: Use `eslint-plugin-diff` only on the CI (#4194) --- packages/@n8n_io/eslint-config/base.js | 32 ++++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/@n8n_io/eslint-config/base.js b/packages/@n8n_io/eslint-config/base.js index d81e6e136..47f0bdd3c 100644 --- a/packages/@n8n_io/eslint-config/base.js +++ b/packages/@n8n_io/eslint-config/base.js @@ -1,7 +1,7 @@ /** * @type {import('@types/eslint').ESLint.ConfigData} */ -module.exports = { +const config = module.exports = { parser: '@typescript-eslint/parser', parserOptions: { sourceType: 'module', @@ -34,13 +34,6 @@ module.exports = { */ 'eslint-plugin-prettier', - /** - * Plugin to lint only changes - * - * https://github.com/paleite/eslint-plugin-diff#plugindiffdiff-recommended - */ - 'eslint-plugin-diff', - /* * Plugin to allow specifying local ESLint rules. * https://github.com/ivov/eslint-plugin-n8n-local-rules @@ -77,13 +70,6 @@ module.exports = { * https://github.com/prettier/eslint-config-prettier */ 'eslint-config-prettier', - - /** - * Config for eslint-plugin-diff - * - * https://github.com/paleite/eslint-plugin-diff#plugindiffdiff-recommended - */ - 'plugin:diff/diff', ], rules: { @@ -385,3 +371,19 @@ module.exports = { 'import/prefer-default-export': 'off', }, }; + +if ('ESLINT_PLUGIN_DIFF_COMMIT' in process.env) { + /** + * Plugin to lint only changes + * + * https://github.com/paleite/eslint-plugin-diff#plugindiffdiff-recommended + */ + config.plugins.push('eslint-plugin-diff'); + + /** + * Config for eslint-plugin-diff + * + * https://github.com/paleite/eslint-plugin-diff#plugindiffdiff-recommended + */ + config.extends.push('plugin:diff/diff'); +}