.stylelintrc.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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': [
  27. 'dollar-variables',
  28. 'custom-properties',
  29. { type: 'at-rule', hasBlock: false }, // @-rules that have no nesting.
  30. 'declarations',
  31. ],
  32. // Some parts of declaration-strict-value commented out until we are in a position to enforce them.
  33. 'scale-unlimited/declaration-strict-value': [
  34. [
  35. // Colors should always be defined from variables or functions.
  36. '/color/',
  37. 'fill',
  38. 'stroke',
  39. // Font tokens should come from our design tokens.
  40. 'font-family',
  41. // 'font-size',
  42. // 'font-weight',
  43. // Spacing should use a consistent scale rather than hard-coded values.
  44. // '/margin/',
  45. // '/padding/',
  46. // 'gap',
  47. // Consistently using variables for z-index allows us to define the order of the values globally.
  48. // 'z-index',
  49. ],
  50. {
  51. disableFix: true,
  52. ignoreValues: [
  53. 'currentColor',
  54. 'inherit',
  55. 'initial',
  56. 'none',
  57. 'unset',
  58. 'transparent',
  59. // System colors for forced-colors styling.
  60. // See https://drafts.csswg.org/css-color-4/#css-system-colors.
  61. 'Canvas',
  62. 'CanvasText',
  63. 'LinkText',
  64. 'VisitedText',
  65. 'ActiveText',
  66. 'ButtonFace',
  67. 'ButtonText',
  68. 'ButtonBorder',
  69. 'Field',
  70. 'FieldText',
  71. 'Highlight',
  72. 'HighlightText',
  73. 'SelectedItem',
  74. 'SelectedItemText',
  75. 'Mark',
  76. 'MarkText',
  77. 'GrayText',
  78. 'AccentColor',
  79. 'AccentColorText',
  80. ],
  81. },
  82. ],
  83. // Ignore rule until all existing selectors can be updated.
  84. 'scss/selector-no-union-class-name': null,
  85. // Ignore rule until all existing classes can be updated to use BEM.
  86. 'selector-class-pattern': null,
  87. // Allow more specificity until styles can be updated to match the more strict rules.
  88. 'selector-max-specificity': '0,6,3',
  89. // Ignore rule until we confirmed we prefer shorthand properties for positioning.
  90. 'declaration-block-no-redundant-longhand-properties': null,
  91. },
  92. };