.stylelintrc.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. module.exports = {
  2. extends: '@wagtail/stylelint-config-wagtail',
  3. rules: {
  4. 'scss/at-rule-no-unknown': [
  5. true,
  6. {
  7. ignoreAtRules: [
  8. 'tailwind',
  9. 'apply',
  10. 'variants',
  11. 'responsive',
  12. 'screen',
  13. 'layer',
  14. ],
  15. },
  16. ],
  17. 'no-invalid-position-at-import-rule': [
  18. true,
  19. {
  20. ignoreAtRules: ['tailwind', 'use'],
  21. },
  22. ],
  23. // Would be valuable for strict BEM components but is too hard to enforce with legacy code.
  24. 'no-descending-specificity': null,
  25. // Refined ordering to align with media mixin usage - see https://github.com/wagtail/stylelint-config-wagtail/issues/37
  26. 'order/order': ['dollar-variables', 'custom-properties', 'declarations'],
  27. // Some parts of declaration-strict-value commented out until we are in a position to enforce them.
  28. 'scale-unlimited/declaration-strict-value': [
  29. [
  30. // Colors should always be defined from variables or functions.
  31. '/color/',
  32. 'fill',
  33. 'stroke',
  34. // Font tokens should come from our design tokens.
  35. 'font-family',
  36. // 'font-size',
  37. // 'font-weight',
  38. // Spacing should use a consistent scale rather than hard-coded values.
  39. // '/margin/',
  40. // '/padding/',
  41. // 'gap',
  42. // Consistently using variables for z-index allows us to define the order of the values globally.
  43. // 'z-index',
  44. ],
  45. {
  46. disableFix: true,
  47. ignoreValues: [
  48. 'currentColor',
  49. 'inherit',
  50. 'initial',
  51. 'none',
  52. 'unset',
  53. 'transparent',
  54. 'normal',
  55. // System colors for forced-colors styling.
  56. // See https://drafts.csswg.org/css-color-4/#css-system-colors.
  57. 'Canvas',
  58. 'CanvasText',
  59. 'LinkText',
  60. 'VisitedText',
  61. 'ActiveText',
  62. 'ButtonFace',
  63. 'ButtonText',
  64. 'ButtonBorder',
  65. 'Field',
  66. 'FieldText',
  67. 'Highlight',
  68. 'HighlightText',
  69. 'SelectedItem',
  70. 'SelectedItemText',
  71. 'Mark',
  72. 'MarkText',
  73. 'GrayText',
  74. 'AccentColor',
  75. 'AccentColorText',
  76. ],
  77. },
  78. ],
  79. // Ignore rule until all existing selectors can be updated.
  80. 'scss/selector-no-union-class-name': null,
  81. // Ignore rule until all existing classes can be updated to use BEM.
  82. 'selector-class-pattern': null,
  83. // Allow more specificity until styles can be updated to match the more strict rules.
  84. 'selector-max-specificity': '0,6,3',
  85. // Ignore rule until we confirmed we prefer shorthand properties for positioning.
  86. 'declaration-block-no-redundant-longhand-properties': null,
  87. },
  88. };