gsoft-inc / sg-web-configs

Common configurations for building web apps at ShareGate
Apache License 2.0
2 stars 0 forks source link

💡 Validate Stylelint rules that are in Officevibe, but not in ShareGate #6

Open alexasselin008 opened 1 year ago

alexasselin008 commented 1 year ago

Idea

It would be great to compare what extra rules officevibe has, and look for opportunities to add to this repository

alexasselin008 commented 1 year ago

igloo

Extends

standard extends recommended, but also Turns on additional rules to enforce common conventions found in the specifications and in a handful of CSS styleguides,

Switching from recommended to standard would add the following rules:

        "alpha-value-notation": [
            "percentage",
            {
                exceptProperties: [
                    "opacity",
                    "fill-opacity",
                    "flood-opacity",
                    "stop-opacity",
                    "stroke-opacity"
                ]
            }
        ],
        "at-rule-empty-line-before": [
            "always",
            {
                except: ["blockless-after-same-name-blockless", "first-nested"],
                ignore: ["after-comment"]
            }
        ],
        "at-rule-name-case": "lower",
        "at-rule-no-vendor-prefix": true,
        "at-rule-semicolon-newline-after": "always",
        "color-function-notation": "modern",
        "comment-empty-line-before": [
            "always",
            {
                except: ["first-nested"],
                ignore: ["stylelint-commands"]
            }
        ],
        "comment-whitespace-inside": "always",
        "custom-property-empty-line-before": [
            "always",
            {
                except: ["after-custom-property", "first-nested"],
                ignore: ["after-comment", "inside-single-line-block"]
            }
        ],
        "custom-media-pattern": [
            "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
            {
                message: name => `Expected custom media query name "${name}" to be kebab-case`
            }
        ],
        "custom-property-pattern": [
            "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
            {
                message: name => `Expected custom property name "${name}" to be kebab-case`
            }
        ],
        "declaration-block-no-redundant-longhand-properties": true,
        "font-family-name-quotes": "always-where-recommended",
        "function-comma-newline-after": "always-multi-line",
        "function-comma-space-before": "never",
        "function-max-empty-lines": 0,
        "function-name-case": "lower",
        "function-parentheses-newline-inside": "always-multi-line",
        "function-url-quotes": "always",
        "hue-degree-notation": "angle",
        "import-notation": "url",
        "keyframe-selector-notation": "percentage-unless-within-keyword-only-block",
        "keyframes-name-pattern": [
            "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
            {
                message: name => `Expected keyframe name "${name}" to be kebab-case`
            }
        ],
        "media-feature-name-no-vendor-prefix": true,
        "media-query-list-comma-newline-after": "always-multi-line",
        "media-query-list-comma-space-after": "always-single-line",
        "media-query-list-comma-space-before": "never",
        "no-missing-end-of-source-newline": true,
        "number-leading-zero": "always",
        "number-max-precision": 4,
        "property-no-vendor-prefix": true,
        "rule-empty-line-before": [
            "always-multi-line",
            {
                except: ["first-nested"],
                ignore: ["after-comment"]
            }
        ],
        "selector-attribute-quotes": "always",
        "selector-class-pattern": [
            "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
            {
                message: selector => `Expected class selector "${selector}" to be kebab-case`
            }
        ],
        "selector-id-pattern": [
            "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
            {
                message: selector => `Expected id selector "${selector}" to be kebab-case`
            }
        ],
        "selector-list-comma-newline-after": "always",
        "selector-list-comma-space-before": "never",
        "selector-no-vendor-prefix": true,
        "selector-not-notation": "complex",
        "selector-pseudo-element-colon-notation": "double",
        "selector-type-case": "lower",
        "shorthand-property-no-redundant-values": true,
        "value-keyword-case": "lower",
        "value-list-comma-newline-after": "always-multi-line",
        "value-list-comma-space-after": "always-single-line",
        "value-list-comma-space-before": "never",
        "value-list-max-empty-lines": 0,
        "value-no-vendor-prefix": [
            true,
            {
                // `-webkit-box` is allowed as standard. See https://www.w3.org/TR/css-overflow-3/#webkit-line-clamp
                ignoreValues: ["box", "inline-box"]
            }
        ],

We have a couple of rules that we would be overwritting with different values

        "block-closing-brace-newline-before": "always-multi-line", // different in our current config
        "block-opening-brace-newline-after": "always-multi-line", // different in our current config
        "color-hex-case": "lower", // different in our current config
        "color-hex-length": "short", // different in our current config
        "max-empty-lines": 1, // different in our current config
        "max-line-length": 120,// different in our current config
        "indentation": 2, // different in our current config
        "function-parentheses-space-inside": "never-single-line", // different in our current config
        "function-comma-space-after": "always-single-line", // different in our current config
        "declaration-empty-line-before": [ // different in our current config
            "always",
            {
                except: ["after-declaration", "first-nested"],
                ignore: ["after-comment", "inside-single-line-block"]
            }
        ],

Igloo overwrites a couple of rules also:

"string-quotes": "single",
"selector-class-pattern": [
  "^[a-zA-Z][a-zA-Z0-9-_]*$",
  {
    "message": "Selector class names must be lowercase alphanumeric with dashes and underscores"
  }
]
alexasselin008 commented 1 year ago

Portal

extends

    "stylelint-config-rational-order"

rules

        "order/properties-order": [],
        "plugin/rational-order": [
            true, {
                "border-in-box-model": false,
                "empty-line-between-groups": true
            }
        ],
        "block-closing-brace-space-before": "always-single-line",
        "block-opening-brace-space-after": "always-single-line",
        "block-opening-brace-space-before": "always",
        "color-hex-case": "upper",
        "color-hex-length": "long",
        "declaration-colon-space-after": "always",
        "declaration-colon-space-before": "never",
        "font-family-no-missing-generic-family-keyword": null,
        "indentation": 4,
        "max-empty-lines": 1,
        "no-empty-first-line": true

Not sure i like stylelint-config-rational-order, might causes a lot of clashes on our side