diff --git a/change/@fluentui-contrib-stylelint-plugin-07a48668-e1bc-4b9b-905e-994574b8380a.json b/change/@fluentui-contrib-stylelint-plugin-07a48668-e1bc-4b9b-905e-994574b8380a.json new file mode 100644 index 00000000..04d9b013 --- /dev/null +++ b/change/@fluentui-contrib-stylelint-plugin-07a48668-e1bc-4b9b-905e-994574b8380a.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix: allow more pseudo classes", + "packageName": "@fluentui-contrib/stylelint-plugin", + "email": "olfedias@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/stylelint-plugin/src/rules/combinator-depth/combinator-depth.ts b/packages/stylelint-plugin/src/rules/combinator-depth/combinator-depth.ts index 7347464b..77fce8d0 100644 --- a/packages/stylelint-plugin/src/rules/combinator-depth/combinator-depth.ts +++ b/packages/stylelint-plugin/src/rules/combinator-depth/combinator-depth.ts @@ -4,6 +4,8 @@ import { extractAllSelectors } from '../../postcss-utils'; import { createRule } from '../../create-rule'; import { normalizeRuleName } from '../../normalize-rule-name'; +const ALLOWED_PSEUDO_CLASSES = [':hover', ':active', ':focus', ':focus-within']; + export const ruleName = normalizeRuleName('combinator-depth'); const messages = stylelint.utils.ruleMessages(ruleName, { @@ -55,7 +57,7 @@ export default createRule({ if ( tokenizedSelector.length > 1 && tokenizedSelector[1].type === 'pseudo-class' && - [':hover', ':active'].includes(tokenizedSelector[1].content) && + ALLOWED_PSEUDO_CLASSES.includes(tokenizedSelector[1].content) && combinatorCount <= allowedDepth + 1 ) { continue;