Skip to content

Commit

Permalink
Docs: switch incorrect example with correct one (#11107)
Browse files Browse the repository at this point in the history
It looks like we always show the incorrect example first, so the fact that in this example we want to show the correct code first might be on purpose, but it does not look like it is
  • Loading branch information
Romain Le Quellec authored and not-an-aardvark committed Nov 21, 2018
1 parent d2d500c commit cf296bd
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/rules/id-match.md
Expand Up @@ -23,20 +23,6 @@ For example, to enforce a camelcase naming convention:
}
```

Examples of **correct** code for this rule with the `"^[a-z]+([A-Z][a-z]+)*$"` option:

```js
/*eslint id-match: ["error", "^[a-z]+([A-Z][a-z]+)*$"]*/

var myFavoriteColor = "#112C85";
var foo = bar.baz_boom;
var foo = { qux: bar.baz_boom };
do_something();
var obj = {
my_pref: 1
};
```

Examples of **incorrect** code for this rule with the `"^[a-z]+([A-Z][a-z]+)*$"` option:

```js
Expand All @@ -54,6 +40,20 @@ obj.do_something = function() {
};
```

Examples of **correct** code for this rule with the `"^[a-z]+([A-Z][a-z]+)*$"` option:

```js
/*eslint id-match: ["error", "^[a-z]+([A-Z][a-z]+)*$"]*/

var myFavoriteColor = "#112C85";
var foo = bar.baz_boom;
var foo = { qux: bar.baz_boom };
do_something();
var obj = {
my_pref: 1
};
```

This rule has an object option:

* `"properties": true` requires object properties to match the specified regular expression
Expand Down

0 comments on commit cf296bd

Please sign in to comment.