Skip to main 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()
note

We recommend only using this rule for CSS-like languages, such as SCSS and Less. For CSS, we recommend using these more capable and overlapping rules instead:

This rule supports 1 message argument: the unknown function.

Options​

true​

{
"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); }

Optional secondary options​

ignoreFunctions​

{ "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); }