Skip to content

function-no-unknown

Disallow unknown functions.

a { transform: unknown(1); }
/** ↑
* Functions like this */

Use this rule to avoid mistyped functions, e.g. rgbaa(). Browsers ignore the whole declaration.

This rule considers functions defined in the CSS Specifications, up to and including Editor’s Drafts, to be known.

You can filter the CSSTree Syntax Reference to find out what functions are known, and use the languageOptions configuration property to extend it.

This rule ignores:

  • double-dashed custom functions, e.g., --custom-function()
  • vendor-prefixed functions, e.g., -webkit-calc()

This rule supports 1 message argument: the unknown function.

{
"function-no-unknown": true
}

The following patterns are considered problems:

a { transform: unknown(1); }

The following patterns are not considered problems:

a { transform: scale(1); }
a { transform: --custom-function(1); }
{ "ignoreFunctions": ["array", "of", "functions", "/regex/"] }

Ignore the specified functions.

Given:

{
"function-no-unknown": [true, { "ignoreFunctions": ["theme", "/^foo-/"] }]
}

The following patterns are not considered problems:

a { transform: theme(1); }
a { transform: foo-func(1); }