Skip to content

Commit

Permalink
Update stylelint-config to support stylelint^15 (#364)
Browse files Browse the repository at this point in the history
* Update stylelint to version ^15

Remove deprecated stylelint rules.

* Update stylelint-order to version ^6.0.0

* Update stylelint-scss to version ^4.4.0

* Update postcss to version ^8.4.21

* Dropping CI of version node^12

* Updating stylelint-prettier to ^3.0.0
  • Loading branch information
alexandcote committed Feb 23, 2023
1 parent 0581e66 commit 2283dfe
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 314 deletions.
9 changes: 9 additions & 0 deletions .changeset/clever-tables-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@shopify/stylelint-plugin': major
---

Updating our stylelint rules to support stylelint@^15

- Removing [76 rules](https://stylelint.io/user-guide/rules#deprecated) deprecated rules.
- Enable a new [`declaration-property-value-no-unknown`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-property-value-no-unknown/README.md) rule.
- Only support `stylelint` >= 15
5 changes: 5 additions & 0 deletions .changeset/gold-penguins-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/stylelint-plugin': patch
---

Update `postcss` to version ^8.4.21
13 changes: 13 additions & 0 deletions .changeset/shaggy-pugs-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@shopify/stylelint-plugin': minor
---

Updating `stylelint-scss` to version `^4.4.0`.

This version support new rules:

- [`scss/dollar-variable-no-namespaced-assignment`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/dollar-variable-no-namespaced-assignment/README.md)
- [`scss/at-use-no-unnamespaced`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-use-no-unnamespaced/README.md)
- [`scss/function-no-unknown`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/function-no-unknown/README.md)
- [`scss/at-import-partial-extension`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-import-partial-extension/README.md)
- [`scss/at-rule-no-unknown`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/at-rule-no-unknown/README.md)
5 changes: 5 additions & 0 deletions .changeset/shiny-badgers-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/stylelint-plugin': patch
---

Updating stylelint-prettier to `^3.0.0`
5 changes: 5 additions & 0 deletions .changeset/thick-rockets-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/stylelint-plugin': patch
---

Update `stylelint-order` to version `^6.0.0`
184 changes: 6 additions & 178 deletions packages/stylelint-plugin/config/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,76 +14,24 @@ module.exports = {
ignoreAtRules: ['else'],
},
],
// Specify lowercase or uppercase for at-rules names.
'at-rule-name-case': 'lower',
// Require a newline after at-rule names.
'at-rule-name-newline-after': 'always-multi-line',
// Require a single space after at-rule names.
'at-rule-name-space-after': 'always-single-line',
// Disallow unknown at-rules.
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'at-root',
'content',
'debug',
'each',
'else',
'error',
'extend',
'for',
'forward',
'function',
'if',
'include',
'mixin',
'return',
'use',
'warn',
'while',
],
},
],
'at-rule-no-unknown': true,
// Disallow vendor prefixes for @rules.
'at-rule-no-vendor-prefix': true,
// Require a newline after the semicolon of at-rules.
'at-rule-semicolon-newline-after': 'always',
// Specify a allowed-list of allowed at-rules.
'at-rule-allowed-list': null,
// Require a single space or disallow whitespace before the semicolons of at-rules.
'at-rule-semicolon-space-before': 'never',

//
// Block
//

'block-closing-brace-empty-line-before': 'never',
// Require a newline or disallow whitespace after the closing brace of blocks.
'block-closing-brace-newline-after': 'always-single-line',
// Require a newline or disallow whitespace before the closing brace of blocks.
'block-closing-brace-newline-before': 'always-multi-line',
// Require a single space or disallow whitespace after the closing brace of blocks.
'block-closing-brace-space-after': null,
// Require a single space or disallow whitespace before the closing brace of blocks.
'block-closing-brace-space-before': 'always-single-line',
// Disallow empty blocks.
'block-no-empty': true,
// Require a newline after the opening brace of blocks.
'block-opening-brace-newline-after': 'always-multi-line',
// Require a newline or disallow whitespace before the opening brace of blocks.
'block-opening-brace-newline-before': null,
// Require a single space or disallow whitespace after the opening brace of blocks.
'block-opening-brace-space-after': 'always-single-line',
// Require a single space or disallow whitespace before the opening brace of blocks.
'block-opening-brace-space-before': 'always',

//
// Color
//

// Specify lowercase or uppercase for hex colors.
'color-hex-case': 'lower',
// Specify short or long notation for hex colors.
'color-hex-length': 'long',
// Require (where possible) or disallow named colors.
Expand Down Expand Up @@ -134,28 +82,8 @@ module.exports = {
],
// Disallow shorthand properties that override related longhand properties within declaration blocks.
'declaration-block-no-shorthand-property-overrides': true,
// Require a newline or disallow whitespace after the semicolons of declaration blocks.
'declaration-block-semicolon-newline-after': 'always-multi-line',
// Require a newline or disallow whitespace before the semicolons of declaration blocks.
'declaration-block-semicolon-newline-before': 'never-multi-line',
// Require a single space or disallow whitespace after the semicolons of declaration blocks.
'declaration-block-semicolon-space-after': 'always-single-line',
// Require a single space or disallow whitespace before the semicolons of declaration blocks.
'declaration-block-semicolon-space-before': 'never',
// Limit the number of declaration within single line declaration blocks.
'declaration-block-single-line-max-declarations': 2,
// Require or disallow a trailing semicolon within declaration blocks.
'declaration-block-trailing-semicolon': 'always',
// Require a single space or disallow whitespace after the bang of declarations.
'declaration-bang-space-after': 'never',
// Require a single space or disallow whitespace before the bang of declarations.
'declaration-bang-space-before': 'always',
// Require a newline or disallow whitespace after the colon of declarations.
'declaration-colon-newline-after': 'always-multi-line',
// Require a single space or disallow whitespace after the colon of declarations.
'declaration-colon-space-after': 'always-single-line',
// Require a single space or disallow whitespace before the colon of declarations.
'declaration-colon-space-before': 'never',
// Require or disallow an empty line before declarations.
'declaration-empty-line-before': [
'never',
Expand Down Expand Up @@ -194,28 +122,16 @@ module.exports = {
// Function
//

// Disallow unknown functions.
'function-no-unknown': true,
// Specify a disallowed list of disallowed functions.
'function-disallowed-list': null,
// Disallow an unspaced operator within calc functions.
'function-calc-no-unspaced-operator': true,
// Require a newline or disallow whitespace after the commas of functions.
'function-comma-newline-after': 'never-multi-line',
// Require a newline or disallow whitespace before the commas of functions.
'function-comma-newline-before': null,
// Require a single space or disallow whitespace after the commas of functions.
'function-comma-space-after': 'always-single-line',
// Require a single space or disallow whitespace before the commas of functions.
'function-comma-space-before': 'never',
// Disallow direction values in linear-gradient() calls that are not valid according to the standard syntax.
'function-linear-gradient-no-nonstandard-direction': true,
// Limit the number of adjacent empty lines within functions.
'function-max-empty-lines': 0,
// Specify lowercase or uppercase for function names.
'function-name-case': 'lower',
// Require a newline or disallow whitespace on the inside of the parentheses of functions.
'function-parentheses-newline-inside': 'always-multi-line',
// Require a single space or disallow whitespace on the inside of the parentheses of functions.
'function-parentheses-space-inside': 'never-single-line',
// Disallow scheme-relative urls.
'function-url-no-scheme-relative': true,
// Require or disallow quotes for urls.
Expand All @@ -226,21 +142,11 @@ module.exports = {
'function-url-scheme-allowed-list': ['http', 'https'],
// Specify a allowed-list of only allowed functions.
'function-allowed-list': null,
// Require a single space or disallow whitespace after functions.
'function-whitespace-after': 'always',

//
// General
//

// Specify indentation.
indentation: 2,
// Specify unix or windows linebreaks
linebreaks: 'unix',
// Disallow more than a specified number of adjacent empty lines.
'max-empty-lines': 3,
// Limit the length of a line.
'max-line-length': null,
// Limit the depth of nesting.
'max-nesting-depth': 3,
// Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
Expand All @@ -249,14 +155,10 @@ module.exports = {
'no-duplicate-selectors': true,
// Disallow empty sources.
'no-empty-source': true,
// Disallow end-of-line whitespace.
'no-eol-whitespace': true,
// Disallow extra semicolons.
'no-extra-semicolons': true,
// Disallow missing end-of-file newline.
'no-missing-end-of-source-newline': true,
// Disallow animation names that do not correspond to a @keyframes declaration.
'no-unknown-animations': true,
// Disallow unknown values for properties within declarations.
'declaration-property-value-no-unknown': true,

//
// Length
Expand All @@ -271,14 +173,8 @@ module.exports = {

// Specify pattern of custom media query names.
'custom-media-pattern': null,
// Require a single space or disallow whitespace after the colon in media features.
'media-feature-colon-space-after': 'always',
// Require a single space or disallow whitespace before the colon in media features.
'media-feature-colon-space-before': 'never',
// Specify a disallowed-list of disallowed media feature names.
'media-feature-name-disallowed-list': null,
// Specify lowercase or uppercase for media feature names.
'media-feature-name-case': 'lower',
// Disallow unknown media feature names.
'media-feature-name-no-unknown': [
true,
Expand All @@ -290,31 +186,13 @@ module.exports = {
'media-feature-name-no-vendor-prefix': true,
// Specify a allowed-list of allowed media feature names
'media-feature-name-allowed-list': null,
// Require a single space or disallow whitespace on the inside of the parentheses within media features.
'media-feature-parentheses-space-inside': 'never',
// Require a single space or disallow whitespace after the range operator in media features.
'media-feature-range-operator-space-after': 'always',
// Require a single space or disallow whitespace before the range operator in media features.
'media-feature-range-operator-space-before': 'always',
// Require a newline or disallow whitespace after the commas of media query lists.
'media-query-list-comma-newline-after': 'always-multi-line',
// Require a newline or disallow whitespace before the commas of media query lists.
'media-query-list-comma-newline-before': 'never-multi-line',
// Require a single space or disallow whitespace after the commas of media query lists.
'media-query-list-comma-space-after': 'always-single-line',
// Require a single space or disallow whitespace before the commas of media query lists.
'media-query-list-comma-space-before': 'never',

//
// Number
//

// Require or disallow a leading zero for fractional numbers less than 1.
'number-leading-zero': 'always',
// Limit the number of decimal places allowed in numbers.
'number-max-precision': null,
// Disallow trailing zeros within numbers.
'number-no-trailing-zeros': true,

//
// Property
Expand All @@ -332,8 +210,6 @@ module.exports = {
'custom-property-pattern': null,
// Specify a disallowed listed of disallowed properties.
'property-disallowed-list': [],
// Specify lowercase or uppercase for properties.
'property-case': 'lower',
// Disallow unknown properties.
'property-no-unknown': true,
// Disallow vendor prefixes for properties.
Expand Down Expand Up @@ -362,26 +238,14 @@ module.exports = {
// Selector
//

// Require a single space or disallow whitespace on the inside of the brackets within attribute selectors.
'selector-attribute-brackets-space-inside': 'never',
// Specify a disallowed-list of disallowed attribute operators.
'selector-attribute-operator-disallowed-list': null,
// Require a single space or disallow whitespace after operators within attribute selectors.
'selector-attribute-operator-space-after': 'never',
// Require a single space or disallow whitespace before operators within attribute selectors.
'selector-attribute-operator-space-before': 'never',
// Specify a allowed-list of allowed attribute operators.
'selector-attribute-operator-allowed-list': null,
// Require or disallow quotes for attribute values.
'selector-attribute-quotes': 'always',
// Specify a pattern for class selectors.
'selector-class-pattern': /^[a-zA-Z][a-zA-Z0-9-]+$/,
// Require a single space or disallow whitespace after the combinators of selectors.
'selector-combinator-space-after': 'always',
// Require a single space or disallow whitespace before the combinators of selectors.
'selector-combinator-space-before': 'always',
// Disallow non-space characters for descendant combinators of selectors.
'selector-descendant-combinator-no-non-space': true,
// Specify a pattern for id selectors.
'selector-id-pattern': /^[A-Z][a-zA-Z0-9]+$/,
// Limit the number of attribute selectors in a selector.
Expand All @@ -396,14 +260,6 @@ module.exports = {
'selector-max-type': 1,
// Limit the number of universal selectors in a selector.
'selector-max-universal': 2,
// Require a newline or disallow whitespace after the commas of selector lists.
'selector-list-comma-newline-after': 'always',
// Require a newline or disallow whitespace before the commas of selector lists.
'selector-list-comma-newline-before': null,
// Require a single space or disallow whitespace after the commas of selector lists.
'selector-list-comma-space-after': 'never-single-line',
// Require a single space or disallow whitespace before the commas of selector lists.
'selector-list-comma-space-before': 'never',
// Limit the number of compound selectors in a selector.
'selector-max-compound-selectors': 3,
// Limit the specificity of selectors.
Expand All @@ -416,16 +272,10 @@ module.exports = {
'selector-no-vendor-prefix': true,
// Specify a disallowed-list of disallowed pseudo-class selectors.
'selector-pseudo-class-disallowed-list': null,
// Specify lowercase or uppercase for pseudo-class selectors.
'selector-pseudo-class-case': 'lower',
// Disallow unknown pseudo-class selectors.
'selector-pseudo-class-no-unknown': true,
// Require a single space or disallow whitespace on the inside of the parentheses within pseudo-class selectors.
'selector-pseudo-class-parentheses-space-inside': 'never',
// Specify a allowed-list of allowed pseudo-class selectors.
'selector-pseudo-class-allowed-list': null,
// Specify lowercase or uppercase for pseudo-element selectors.
'selector-pseudo-element-case': 'lower',
// Specify single or double colon notation for applicable pseudo-elements.
'selector-pseudo-element-colon-notation': 'double',
// Disallow unknown pseudo-element selectors.
Expand All @@ -434,17 +284,13 @@ module.exports = {
'selector-type-case': 'lower',
// Disallow unknown type selectors.
'selector-type-no-unknown': true,
// Limit the number of adjacent empty lines within selectors.
'selector-max-empty-lines': 0,

//
// String
//

// Disallow (unescaped) newlines in strings.
'string-no-newline': true,
// Specify single or double quotes around strings.
'string-quotes': 'single',

//
// Time
Expand All @@ -458,8 +304,6 @@ module.exports = {

// Specify a disallow list of disallowed units.
'unit-disallowed-list': [],
// Specify lowercase or uppercase for units.
'unit-case': 'lower',
// Disallow unknown units.
'unit-no-unknown': true,
// Specify a allowed-list of allowed units.
Expand All @@ -473,25 +317,9 @@ module.exports = {
'value-keyword-case': [
'lower',
{
ignoreProperties: [
'font',
'font-family',
'/^--.*font/',
'/^\\$.*font/',
'/^\\$polaris/',
],
ignoreProperties: ['/^--.*font/', '/^\\$.*font/', '/^\\$polaris/'],
},
],
// Require a newline or disallow whitespace after the commas of value lists.
'value-list-comma-newline-after': 'always-multi-line',
// Require a newline or disallow whitespace before the commas of value lists.
'value-list-comma-newline-before': null,
// Require a single space or disallow whitespace after the commas of value lists.
'value-list-comma-space-after': 'always-single-line',
// Require a single space or disallow whitespace before the commas of value lists.
'value-list-comma-space-before': 'never',
// Limit the number of adjacent empty lines within value lists.
'value-list-max-empty-lines': 0,
// Disallow vendor prefixes for values.
'value-no-vendor-prefix': true,

Expand Down
Loading

0 comments on commit 2283dfe

Please sign in to comment.