@studiohyperdrive/stylelint-config
Version:
Studio Hyperdrive StyleLint linting rules/guidelines.
271 lines (239 loc) • 20.5 kB
JavaScript
module.exports = {
// https://stylelint.io/user-guide/rules/
rules: {
// Color
"color-hex-case": ["lower", { // Specify lowercase or uppercase for hex colors.
severity: "warning"
}],
"color-hex-length": "short", // Specify short or long notation for hex colors.
"color-named": null, // Require (where possible) or disallow named colors.
"color-no-hex": null, // Disallow hex colors.
"color-no-invalid-hex": true, // Disallow invalid hex colors.
// Font family
"font-family-name-quotes": "always-unless-keyword", // Specify whether or not quotation marks should be used around font family names.
"font-family-no-duplicate-names": true, // Disallow duplicate font family names.
// Font weight
"font-weight-notation": "numeric", // Require numeric or named (where possible) font-weight values.
// Function
"function-blacklist": null, // Specify a blacklist of disallowed functions.
"function-calc-no-unspaced-operator": true, // Disallow an unspaced operator within calc functions.
"function-comma-newline-after": null, // Require a newline or disallow whitespace after the commas of functions.
"function-comma-newline-before": null, // Require a newline or disallow whitespace before the commas of functions.
"function-comma-space-after": "always", // Require a single space or disallow whitespace after the commas of functions.
"function-comma-space-before": "never", // Require a single space or disallow whitespace before the commas of functions.
"function-linear-gradient-no-nonstandard-direction": true, // Disallow direction values in linear-gradient() calls that are not valid according to the standard syntax.
"function-max-empty-lines": 0, // Limit the number of adjacent empty lines within functions.
"function-name-case": "lower", // Specify lowercase or uppercase for function names.
"function-parentheses-newline-inside": "always-multi-line", // Require a newline or disallow whitespace on the inside of the parentheses of functions.
"function-parentheses-space-inside": "never-single-line", // Require a single space or disallow whitespace on the inside of the parentheses of functions.
"function-url-no-scheme-relative": null, // Disallow scheme-relative urls.
"function-url-quotes": "always", // Require or disallow quotes for urls.
"function-url-scheme-whitelist": null, // Specify a whitelist of allowed url schemes.
"function-url-scheme-blacklist": null, // Specify a blacklist of allowed url schemes.
"function-whitelist": null, // Specify a whitelist of allowed functions.
"function-whitespace-after": "always", // Require or disallow whitespace after functions.
// Number
"number-leading-zero": "always", // Require or disallow a leading zero for fractional numbers less than 1.
// TODO: Check the precision difference that is visible in the browser
"number-max-precision": [2, { // Limit the number of decimal places allowed in numbers.
severity: "warning"
}],
"number-no-trailing-zeros": true, // Disallow trailing zeros in numbers.
// String
"string-no-newline": null, // Disallow (unescaped) newlines in strings.
"string-quotes": "double", // Specify single or double quotes around strings.
// Length
"length-zero-no-unit": true, // Disallow units for zero lengths.
// Time
"time-min-milliseconds": 100, // Specify the minimum number of milliseconds for time values.
// Unit
"unit-blacklist": null, // Specify a blacklist of disallowed units.
"unit-case": "lower", // Specify lowercase or uppercase for units.
"unit-no-unknown": true, // Disallow unknown units.
"unit-whitelist": null, // Specify a whitelist of allowed units.
// Value
"value-keyword-case": "lower", // Specify lowercase or uppercase for keywords values.
"value-no-vendor-prefix": true, // Disallow vendor prefixes for values.
// Value list
"value-list-comma-newline-after": null, // Require a newline or disallow whitespace after the commas of value lists.
"value-list-comma-newline-before": null, // Require a newline or disallow whitespace before the commas of value lists.
"value-list-comma-space-after": "always", // Require a single space or disallow whitespace after the commas of value lists.
"value-list-comma-space-before": "never", // Require a single space or disallow whitespace before the commas of value lists.
"value-list-max-empty-lines": 0, // Limit the number of adjacent empty lines within value lists.
// Custom property
"custom-property-empty-line-before": null, // Require or disallow an empty line before custom properties.
// "custom-property-no-outside-root": null, // Disallow custom properties outside of :root rules (deprecated).
"custom-property-pattern": null, // Specify a pattern for custom properties.
// Shorthand property
"shorthand-property-no-redundant-values": true, // Disallow redundant values in shorthand properties.
// Property
"property-blacklist": null, // Specify a blacklist of disallowed properties.
"property-case": "lower", // Specify lowercase or uppercase for properties.
"property-no-unknown": true, // Disallow unknown properties.
"property-no-vendor-prefix": true, // Disallow vendor prefixes for properties.
"property-whitelist": null, // Specify a whitelist of allowed properties.
// Keyframe declaration
"keyframe-declaration-no-important": null, // Disallow !important within keyframe declarations.
// Declaration
"declaration-bang-space-after": "never", // Require a single space or disallow whitespace after the bang of declarations.
"declaration-bang-space-before": "always", // Require a single space or disallow whitespace before the bang of declarations.
"declaration-colon-newline-after": null, // Require a newline or disallow whitespace after the colon of declarations.
"declaration-colon-space-after": "always", // Require a single space or disallow whitespace after the colon of declarations.
"declaration-colon-space-before": "never", // Require a single space or disallow whitespace before the colon of declarations.
"declaration-empty-line-before": null, // Require or disallow an empty line before declarations.
"declaration-no-important": null, // Disallow !important within declarations.
"declaration-property-unit-blacklist": null, // Specify a blacklist of disallowed property and unit pairs within declarations.
"declaration-property-unit-whitelist": null, // Specify a whitelist of allowed property and unit pairs within declarations.
"declaration-property-value-blacklist": null, // Specify a blacklist of disallowed property and value pairs within declarations.
"declaration-property-value-whitelist": null, // Specify a whitelist of allowed property and value pairs within declarations.
// Declaration block
"declaration-block-no-duplicate-properties": true, // Disallow duplicate properties within declaration blocks.
"declaration-block-no-redundant-longhand-properties": null, // Disallow longhand properties that can be combined into one shorthand property.
"declaration-block-no-shorthand-property-overrides": true, // Disallow shorthand properties that override related longhand properties within declaration blocks.
// "declaration-block-properties-order": null, // Specify the order of properties within declaration blocks (deprecated).
"declaration-block-semicolon-newline-after": "always-multi-line", // Require a newline or disallow whitespace after the semicolons of declaration blocks.
"declaration-block-semicolon-newline-before": null, // Require a newline or disallow whitespace before the semicolons of declaration blocks.
"declaration-block-semicolon-space-after": "always-single-line", // Require a single space or disallow whitespace after the semicolons of declaration blocks.
"declaration-block-semicolon-space-before": "never", // Require a single space or disallow whitespace before the semicolons of declaration blocks.
"declaration-block-single-line-max-declarations": null, // Limit the number of declaration within single line declaration blocks.
"declaration-block-trailing-semicolon": "always", // Require or disallow a trailing semicolon within declaration blocks.
// Block
"block-closing-brace-empty-line-before": "never", // Require or disallow an empty line before the closing brace of blocks.
"block-closing-brace-newline-after": "always", // Require a newline or disallow whitespace after the closing brace of blocks.
"block-closing-brace-newline-before": null, // Require a newline or disallow whitespace before the closing brace of blocks.
"block-closing-brace-space-after": "always-single-line", // Require a single space or disallow whitespace after the closing brace of blocks.
"block-closing-brace-space-before": "always-single-line", // Require a single space or disallow whitespace before the closing brace of blocks.
"block-no-empty": true, // Disallow empty blocks.
// "block-no-single-line": null, // Disallow single-line blocks (deprecated).
"block-opening-brace-newline-after": "always-multi-line", // Require a newline after the opening brace of blocks.
"block-opening-brace-newline-before": null, // Require a newline or disallow whitespace before the opening brace of blocks.
"block-opening-brace-space-after": "always-single-line", // Require a single space or disallow whitespace after the opening brace of blocks.
"block-opening-brace-space-before": "always", // Require a single space or disallow whitespace before the opening brace of blocks.
// Selector
"selector-attribute-brackets-space-inside": "never", // Require a single space or disallow whitespace on the inside of the brackets within attribute selectors.
"selector-attribute-operator-blacklist": null, // Specify a blacklist of disallowed attribute operators.
"selector-attribute-operator-space-after": "never", // Require a single space or disallow whitespace after operators within attribute selectors.
"selector-attribute-operator-space-before": "never", // Require a single space or disallow whitespace before operators within attribute selectors.
"selector-attribute-operator-whitelist": null, // Specify a whitelist of allowed attribute operators.
"selector-attribute-quotes": "always", // Require or disallow quotes for attribute values.
"selector-class-pattern": "^(a|m|o|p|q|u|is|has|icon)-([a-z_-])+", // Specify a pattern for class selectors.
"selector-combinator-space-after": "always", // Require a single space or disallow whitespace after the combinators of selectors.
"selector-combinator-space-before": "always", // Require a single space or disallow whitespace before the combinators of selectors.
"selector-descendant-combinator-no-non-space": true, // Disallow non-space characters for descendant combinators of selectors.
"selector-id-pattern": null, // Specify a pattern for id selectors.
// To discuss
"selector-max-compound-selectors": null, // Limit the number of compound selectors in a selector.
"selector-max-specificity": null, // Limit the specificity of selectors.
"selector-nested-pattern": null, // Specify a pattern for the selectors of rules nested within rules.
"selector-max-attribute": null, // Disallow attribute selectors.
"selector-max-combinators": null, // Disallow combinators in selectors.
// "selector-no-empty": "", // Disallow empty selectors (deprecated).
// To discuss
"selector-max-id": 0, // Limit the number of id selectors in a selector.
"selector-no-qualifying-type": [ // Disallow qualifying a selector by type.
false, {
ignore: ['attribute', 'class']
}
],
"selector-max-type": null, // Disallow type selectors.
"selector-max-universal": null, // Disallow the universal selector.
"selector-no-vendor-prefix": null, // Disallow vendor prefixes for selectors.
"selector-pseudo-class-blacklist": null, // Specify a blacklist of disallowed pseudo-class selectors.
"selector-pseudo-class-case": "lower", // Specify lowercase or uppercase for pseudo-class selectors.
"selector-pseudo-class-no-unknown": true, // Disallow unknown pseudo-class selectors.
"selector-pseudo-class-parentheses-space-inside": "never", // Require a single space or disallow whitespace on the inside of the parentheses within pseudo-class selectors.
"selector-pseudo-class-whitelist": null, // Specify a whitelist of allowed pseudo-class selectors.
"selector-pseudo-element-case": "lower", // Specify lowercase or uppercase for pseudo-element selectors.
"selector-pseudo-element-colon-notation": "double", // Specify single or double colon notation for applicable pseudo-elements.
"selector-pseudo-element-no-unknown": true, // Disallow unknown pseudo-element selectors.
// "selector-root-no-composition": "", // Disallow the composition of :root in selectors (deprecated).
"selector-type-case": "lower", // Specify lowercase or uppercase for type selector.
"selector-type-no-unknown": null, // Disallow unknown type selectors.
"selector-max-empty-lines": 0, // Limit the number of adjacent empty lines within selectors.
// Selector list
"selector-list-comma-newline-after": "always-multi-line", // Require a newline or disallow whitespace after the commas of selector lists.
"selector-list-comma-newline-before": "never-multi-line", // Require a newline or disallow whitespace before the commas of selector lists.
"selector-list-comma-space-after": "always-single-line", // Require a single space or disallow whitespace after the commas of selector lists.
"selector-list-comma-space-before": "never", // Require a single space or disallow whitespace before the commas of selector lists.
// Root rule
// "root-no-standard-properties": null, // Disallow standard properties inside :root rules (deprecated).
// Rule
"rule-empty-line-before": ["always-multi-line", { // Require or disallow an empty line before rules.
// except: [ "first-nested" ],
ignore: ["after-comment"]
}],
// "rule-nested-empty-line-before": null, // Require or disallow an empty line before nested rules (deprecated).
// "rule-non-nested-empty-line-before": null, // Require or disallow an empty line before non-nested rules (deprecated).
// Media feature
"media-feature-colon-space-after": "always", // Require a single space or disallow whitespace after the colon in media features.
"media-feature-colon-space-before": "never", // Require a single space or disallow whitespace before the colon in media features.
"media-feature-name-blacklist": null, // Specify a blacklist of disallowed media feature names.
"media-feature-name-case": "lower", // Specify lowercase or uppercase for media feature names.
"media-feature-name-no-unknown": true, // Disallow unknown media feature names.
"media-feature-name-no-vendor-prefix": true, // Disallow vendor prefixes for media feature names.
"media-feature-name-whitelist": null, // Specify a whitelist of allowed media feature names.
// "media-feature-no-missing-punctuation": null, // Disallow missing punctuation for non-boolean media features (deprecated).
"media-feature-parentheses-space-inside": "never", // Require a single space or disallow whitespace on the inside of the parentheses within media features.
"media-feature-range-operator-space-after": "always", // Require a single space or disallow whitespace after the range operator in media features.
"media-feature-range-operator-space-before": "always", // Require a single space or disallow whitespace before the range operator in media features.
// Custom media
"custom-media-pattern": null, // Specify a pattern for custom media query names.
// Media query list
"media-query-list-comma-newline-after": "always-multi-line", // Require a newline or disallow whitespace after the commas of media query lists.
"media-query-list-comma-newline-before": null, // Require a newline or disallow whitespace before the commas of media query lists.
"media-query-list-comma-space-after": "always-single-line", // Require a single space or disallow whitespace after the commas of media query lists.
"media-query-list-comma-space-before": "never", // Require a single space or disallow whitespace before the commas of media query lists.
// At-rule
"at-rule-blacklist": null, // Specify a blacklist of disallowed at-rules.
"at-rule-empty-line-before": [ // Require or disallow an empty line before at-rules.
"always", {
except: [
"after-same-name",
],
ignore: [
"after-comment",
"blockless-after-same-name-blockless",
"inside-block",
],
ignoreAtRules: ["mixin", "content"],
},
],
"at-rule-name-case": "lower", // Specify lowercase or uppercase for at-rules names.
"at-rule-name-newline-after": null, // Require a newline after at-rule names.
"at-rule-name-space-after": "always-single-line", // Require a single space after at-rule names.
"at-rule-no-unknown": true, // Disallow unknown at-rules.
"at-rule-no-vendor-prefix": true, // Disallow vendor prefixes for at-rules.
"at-rule-semicolon-newline-after": "always", // Require a newline after the semicolon of at-rules.
"at-rule-semicolon-space-before": "never", // Require a single space or disallow whitespace before the semicolons of at rules.
"at-rule-whitelist": null, // Specify a whitelist of allowed at-rules.
// Stylelint-disable comment
// "stylelint-disable-reason": null, // Require a reason comment before or after stylelint-disable comments (deprecated).
// Comment
"comment-empty-line-before": [ // Require or disallow an empty line before comments.
"always",
{
except: ["first-nested"],
ignore: ["after-comment", "stylelint-commands"]
}
],
"comment-no-empty": true, // Disallow empty comments.
"comment-whitespace-inside": null, // Require or disallow whitespace on the inside of comment markers.
"comment-word-blacklist": null, // Specify a blacklist of disallowed words within comments.
// General / Sheet
"indentation": "tab", // Specify indentation.
"max-empty-lines": 3, // Limit the number of adjacent empty lines.
"max-line-length": null, // Limit the length of a line.
"max-nesting-depth": 4, // Limit the depth of nesting.
// "no-browser-hacks": null, // Disallow browser hacks that are irrelevant to the browsers you are targeting (deprecated).
"no-descending-specificity": true, // Disallow selectors of lower specificity from coming after overriding selectors of higher specificity.
"no-duplicate-selectors": true, // Disallow duplicate selectors.
"no-empty-source": true, // Disallow empty sources.
"no-eol-whitespace": true, // Disallow end-of-line whitespace.
"no-extra-semicolons": true, // Disallow extra semicolons.
// "no-indistinguishable-colors": null, // Disallow colors that are suspiciously close to being identical (deprecated).
"no-invalid-double-slash-comments": true, // Disallow double-slash comments (//...) which are not supported by CSS.
"no-missing-end-of-source-newline": null, // Disallow missing end-of-source newlines.
"no-unknown-animations": null, // Disallow unknown animations.
// "no-unsupported-browser-features": null, // Disallow features that are unsupported by the browsers that you are targeting (deprecated).
},
};