no-global-function-names
What it does
Section titled “What it does”Reports a call of a Sass global function that a module of the standard library replaces (map-get is map.get, mix is color.mix); calls written with their module are not reported.
Why it matters
Section titled “Why it matters”Sass deprecates the global functions in favour of modules loaded with @use, and drops them in a later major version. A call of a module function says where it comes from and is not changed by a global of the same name.
To fix, @use "sass:map" and call map.get.
Example
Section titled “Example”With this configuration:
no-global-function-names: warnat-mixin-argumentless-call-parentheses: warnat-rule-conditional-no-parentheses: warnat-extend-no-missing-placeholder: warnat-if-no-null: warnload-no-partial-leading-underscore: warndollar-variable-pattern: { level: warn, options: { pattern: "^[a-z-]+$" } }at-mixin-pattern: { level: warn, options: { pattern: "^[a-z-]+$" } }at-function-pattern: { level: warn, options: { pattern: "^[a-z-]+$" } }...@use "c.css";$fooBar: map-get($m, a) + list.length($x);...@function myFn($x) { @return mix($x, red); }a {... @include foo() using ($x) { top: 0; }...Configuration
Section titled “Configuration”css: lint: rules: no-global-function-names: level: warn # off (default), warn, error options: list: ["red=color.red","blue=color.blue","green=color.green","mix=color.mix","hue=color.hue","saturation=color.saturation","lightness=color.lightness","complement=color.complement","adjust-color=color.adjust","scale-color=color.scale","change-color=color.change","ie-hex-str=color.ie-hex-str","map-get=map.get","map-merge=map.merge","map-remove=map.remove","map-keys=map.keys","map-values=map.values","map-has-key=map.has-key","unquote=string.unquote","quote=string.quote","str-length=string.length","str-insert=string.insert","str-index=string.index","str-slice=string.slice","to-upper-case=string.to-upper-case","to-lower-case=string.to-lower-case","unique-id=string.unique-id","percentage=math.percentage","ceil=math.ceil","floor=math.floor","abs=math.abs","random=math.random","unit=math.unit","unitless=math.is-unitless","comparable=math.compatible","length=list.length","nth=list.nth","set-nth=list.set-nth","join=list.join","append=list.append","zip=list.zip","index=list.index","list-separator=list.separator","feature-exists=meta.feature-exists","variable-exists=meta.variable-exists","global-variable-exists=meta.global-variable-exists","function-exists=meta.function-exists","mixin-exists=meta.mixin-exists","inspect=meta.inspect","get-function=meta.get-function","type-of=meta.type-of","call=meta.call","content-exists=meta.content-exists","keywords=meta.keywords","selector-nest=selector.nest","selector-append=selector.append","selector-replace=selector.replace","selector-unify=selector.unify","is-superselector=selector.is-superselector","simple-selectors=selector.simple-selectors","selector-parse=selector.parse","selector-extend=selector.extend","lighten=color.adjust","adjust-hue=color.adjust","darken=color.adjust","desaturate=color.adjust","opacify=color.adjust","transparentize=color.adjust"]less: lint: rules: no-global-function-names: level: warn # off (default), warn, error options: list: ["red=color.red","blue=color.blue","green=color.green","mix=color.mix","hue=color.hue","saturation=color.saturation","lightness=color.lightness","complement=color.complement","adjust-color=color.adjust","scale-color=color.scale","change-color=color.change","ie-hex-str=color.ie-hex-str","map-get=map.get","map-merge=map.merge","map-remove=map.remove","map-keys=map.keys","map-values=map.values","map-has-key=map.has-key","unquote=string.unquote","quote=string.quote","str-length=string.length","str-insert=string.insert","str-index=string.index","str-slice=string.slice","to-upper-case=string.to-upper-case","to-lower-case=string.to-lower-case","unique-id=string.unique-id","percentage=math.percentage","ceil=math.ceil","floor=math.floor","abs=math.abs","random=math.random","unit=math.unit","unitless=math.is-unitless","comparable=math.compatible","length=list.length","nth=list.nth","set-nth=list.set-nth","join=list.join","append=list.append","zip=list.zip","index=list.index","list-separator=list.separator","feature-exists=meta.feature-exists","variable-exists=meta.variable-exists","global-variable-exists=meta.global-variable-exists","function-exists=meta.function-exists","mixin-exists=meta.mixin-exists","inspect=meta.inspect","get-function=meta.get-function","type-of=meta.type-of","call=meta.call","content-exists=meta.content-exists","keywords=meta.keywords","selector-nest=selector.nest","selector-append=selector.append","selector-replace=selector.replace","selector-unify=selector.unify","is-superselector=selector.is-superselector","simple-selectors=selector.simple-selectors","selector-parse=selector.parse","selector-extend=selector.extend","lighten=color.adjust","adjust-hue=color.adjust","darken=color.adjust","desaturate=color.adjust","opacify=color.adjust","transparentize=color.adjust"]scss: lint: rules: no-global-function-names: level: warn # off (default), warn, error options: list: ["red=color.red","blue=color.blue","green=color.green","mix=color.mix","hue=color.hue","saturation=color.saturation","lightness=color.lightness","complement=color.complement","adjust-color=color.adjust","scale-color=color.scale","change-color=color.change","ie-hex-str=color.ie-hex-str","map-get=map.get","map-merge=map.merge","map-remove=map.remove","map-keys=map.keys","map-values=map.values","map-has-key=map.has-key","unquote=string.unquote","quote=string.quote","str-length=string.length","str-insert=string.insert","str-index=string.index","str-slice=string.slice","to-upper-case=string.to-upper-case","to-lower-case=string.to-lower-case","unique-id=string.unique-id","percentage=math.percentage","ceil=math.ceil","floor=math.floor","abs=math.abs","random=math.random","unit=math.unit","unitless=math.is-unitless","comparable=math.compatible","length=list.length","nth=list.nth","set-nth=list.set-nth","join=list.join","append=list.append","zip=list.zip","index=list.index","list-separator=list.separator","feature-exists=meta.feature-exists","variable-exists=meta.variable-exists","global-variable-exists=meta.global-variable-exists","function-exists=meta.function-exists","mixin-exists=meta.mixin-exists","inspect=meta.inspect","get-function=meta.get-function","type-of=meta.type-of","call=meta.call","content-exists=meta.content-exists","keywords=meta.keywords","selector-nest=selector.nest","selector-append=selector.append","selector-replace=selector.replace","selector-unify=selector.unify","is-superselector=selector.is-superselector","simple-selectors=selector.simple-selectors","selector-parse=selector.parse","selector-extend=selector.extend","lighten=color.adjust","adjust-hue=color.adjust","darken=color.adjust","desaturate=color.adjust","opacify=color.adjust","transparentize=color.adjust"]| Option | Type | Default | Description |
|---|---|---|---|
list |
list | ["red=color.red","blue=color.blue","green=color.green","mix=color.mix","hue=color.hue","saturation=color.saturation","lightness=color.lightness","complement=color.complement","adjust-color=color.adjust","scale-color=color.scale","change-color=color.change","ie-hex-str=color.ie-hex-str","map-get=map.get","map-merge=map.merge","map-remove=map.remove","map-keys=map.keys","map-values=map.values","map-has-key=map.has-key","unquote=string.unquote","quote=string.quote","str-length=string.length","str-insert=string.insert","str-index=string.index","str-slice=string.slice","to-upper-case=string.to-upper-case","to-lower-case=string.to-lower-case","unique-id=string.unique-id","percentage=math.percentage","ceil=math.ceil","floor=math.floor","abs=math.abs","random=math.random","unit=math.unit","unitless=math.is-unitless","comparable=math.compatible","length=list.length","nth=list.nth","set-nth=list.set-nth","join=list.join","append=list.append","zip=list.zip","index=list.index","list-separator=list.separator","feature-exists=meta.feature-exists","variable-exists=meta.variable-exists","global-variable-exists=meta.global-variable-exists","function-exists=meta.function-exists","mixin-exists=meta.mixin-exists","inspect=meta.inspect","get-function=meta.get-function","type-of=meta.type-of","call=meta.call","content-exists=meta.content-exists","keywords=meta.keywords","selector-nest=selector.nest","selector-append=selector.append","selector-replace=selector.replace","selector-unify=selector.unify","is-superselector=selector.is-superselector","simple-selectors=selector.simple-selectors","selector-parse=selector.parse","selector-extend=selector.extend","lighten=color.adjust","adjust-hue=color.adjust","darken=color.adjust","desaturate=color.adjust","opacify=color.adjust","transparentize=color.adjust"] |
name=replacement entries: a global function and the module function that replaces it. |
Enabled by the presets: css/stylelint-standard.
Suppress one line with sudsy-disable-next-line no-global-function-names in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint-scss | scss/no-global-function-names |
full |