Skip to content

v9.0.0 (October 29, 2019)

Compare
Choose a tag to compare
@shawnbot shawnbot released this 30 Oct 00:04
6e88bbf

πŸ’₯ Breaking Change

  • primer/variables is no longer supported; please use the primer/colors, primer/borders, primer/box-shadow, primer/spacing, and primer/typography rules instead. #50

πŸš€ Enhancements

  • The new primer/colors rule enforces color variable usage in color, background-color, and fill properties
  • The new primer/borders rule enforces border variable usage in border CSS props
  • The new primer/box-shadow rule enforces $box-shadow* variables
  • The new primer/spacing rule enforces $spacer-* variables in margin and padding props
  • The new primer/typography rule enforces typography variable use in font-family, line-height, and font-weight props
  • Variable replacements for autofixing are automatically detected in variable data from Primer CSS (see: primer/css#949) #52
  • It is now possible to define variable rules using functions that take the variables, as in:
    module.exports = createVariableRule('primer/whatever', ({variables}) => {
      /* do something with variables here */
    })
  • It's also now possible to provide rule overrides in local stylelint configs as functions:
    module.exports = {
      extends: 'stylelint-config-primer',
      rules: {
        'primer/colors': [true, {
          rules: ({variables, rules}) => {
            /* do something with variables and/or rules here */
            return rules
        }]
      }
    })
  • This release adds support for an optional singular: true flag to rule configs, which skips the parsing of individual values in the matched properties. We use this in primer/box-shadow to prevent multiple warnings for a single value like box-shadow: inset 0 1px $blue (before there would be 4 separate ones!).

πŸ› Bug fixes

  • Use requirePrimerFile() when loading dist/variables.json so that we can access the right file when running within the @primer/css repo.
  • Walk only declarations (prop: value) in rules (blocks with selectors, not @rules), and skip linting for declarations nested in @each, @for, @function, and @mixin blocks, since those can define their own variables and we can't reliably assert their values.
  • Allow $*-shadow variable patterns in primer/box-shadow to match $btn-active-shadow and $form-control-shadow
  • Allow color: inherit in primer/colors
  • Allow $em-spacer-* in padding and margin properties
  • Allow (and auto-fix!) negative spacer variables in margin properties
  • Make primer/colors smarter re: background property shorthand values (allowing positions and image url(*) values)
  • Remove 100% from allowed values for border-radius, and suggest 50% instead
  • Prohibit negative spacer values in padding properties
  • Allow $h000-size for marketing