From fd3d4544e77d6044211265acce01c6d2a9019c21 Mon Sep 17 00:00:00 2001 From: Marc G Date: Thu, 18 Aug 2022 18:46:04 +0200 Subject: [PATCH] fix: add support for flood-opacity, fill-opacity, stroke-opacity and stop-opacity to alpha-value-notation --- lib/rules/alpha-value-notation/__tests__/index.js | 9 +++++++++ lib/rules/alpha-value-notation/index.js | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/rules/alpha-value-notation/__tests__/index.js b/lib/rules/alpha-value-notation/__tests__/index.js index 3bafc95128..176c8fe9ee 100644 --- a/lib/rules/alpha-value-notation/__tests__/index.js +++ b/lib/rules/alpha-value-notation/__tests__/index.js @@ -79,6 +79,15 @@ testRule({ endLine: 1, endColumn: 31, }, + { + code: 'feDropShadow { flood-opacity: 50% }', + fixed: 'feDropShadow { flood-opacity: 0.5 }', + message: messages.expected('50%', '0.5'), + line: 1, + column: 31, + endLine: 1, + endColumn: 34, + }, { code: 'a { color: rgba(0, 0, 0, 50%) }', fixed: 'a { color: rgba(0, 0, 0, 0.5) }', diff --git a/lib/rules/alpha-value-notation/index.js b/lib/rules/alpha-value-notation/index.js index f0f4561eec..70ab607b8e 100644 --- a/lib/rules/alpha-value-notation/index.js +++ b/lib/rules/alpha-value-notation/index.js @@ -23,7 +23,15 @@ const meta = { fixable: true, }; -const ALPHA_PROPS = new Set(['opacity', 'shape-image-threshold']); +const ALPHA_PROPS = new Set([ + 'opacity', + 'shape-image-threshold', + // SVG properties + 'fill-opacity', + 'flood-opacity', + 'stop-opacity', + 'stroke-opacity', +]); const ALPHA_FUNCS = new Set(['hsl', 'hsla', 'hwb', 'lab', 'lch', 'rgb', 'rgba']); /** @type {import('stylelint').Rule} */