Skip to content

Commit

Permalink
Docs: add class fields in func-names documentation (refs #14857)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Aug 8, 2021
1 parent ae6072b commit a3f17d2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/rules/func-names.md
Expand Up @@ -17,14 +17,14 @@ This rule can enforce or disallow the use of named function expressions.
This rule has a string option:

* `"always"` (default) requires function expressions to have a name
* `"as-needed"` requires function expressions to have a name, if the name cannot be assigned automatically in an ES6 environment
* `"as-needed"` requires function expressions to have a name, if the name isn't assigned automatically per the ECMAScript specification.
* `"never"` disallows named function expressions, except in recursive functions, where a name is needed

This rule has an object option:

* `"generators": "always" | "as-needed" | "never"`
* `"always"` require named generators
* `"as-needed"` require named generators if the name cannot be assigned automatically in an ES6 environment.
* `"as-needed"` require named generators if the name isn't assigned automatically per the ECMAScript specification.
* `"never"` disallow named generators where possible.

When a value for `generators` is not provided the behavior for generator functions falls back to the base option.
Expand Down Expand Up @@ -98,6 +98,13 @@ const cat = {
meow: function() {}
}

class C {
#bar = function() {};
baz = function() {};
}

quux ??= function() {};

(function bar() {
// ...
}())
Expand Down

0 comments on commit a3f17d2

Please sign in to comment.