You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,8 +22,8 @@ For more details on how to extend your configuration from one or both of these p
21
22
22
23
Each rule has emojis denoting:
23
24
24
-
- What configuration it belongs to
25
-
-:wrench: if some problems reported by the rule are automatically fixable by the `--fix`[command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
25
+
* What configuration it belongs to
26
+
*:wrench: if some problems reported by the rule are automatically fixable by the `--fix`[command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) option
26
27
27
28
<!--RULES_TABLE_START-->
28
29
@@ -101,27 +102,29 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
101
102
<!-- prettier-ignore-end -->
102
103
<!-- ALL-CONTRIBUTORS-LIST:END -->
103
104
105
+
<!-- markdownlint-disable line-length -->
106
+
104
107
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
105
108
106
109
## Semantic Versioning Policy
107
110
108
111
Like ESLint itself, this ESLint plugin follows [semantic versioning](http://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy, based on the policy used by ESLint:
109
112
110
113
* Patch release (intended not to break your lint build)
111
-
* A bug fix in a plugin rule that results in ESLint reporting fewer errors.
112
-
* Improvements to documentation.
113
-
* Non-user-facing changes such as refactoring code; adding, deleting, or modifying tests; and increasing test coverage.
114
-
* Re-releasing after a failed release (i.e., after having published a release that doesn't work for anyone).
114
+
* A bug fix in a plugin rule that results in ESLint reporting fewer errors.
115
+
* Improvements to documentation.
116
+
* Non-user-facing changes such as refactoring code; adding, deleting, or modifying tests; and increasing test coverage.
117
+
* Re-releasing after a failed release (i.e., after having published a release that doesn't work for anyone).
115
118
* Minor release (might break your lint build)
116
-
* A bug fix in a rule that results in ESLint reporting more errors.
117
-
* A new rule is created (without being added to plugin configuration).
118
-
* A new option to an existing rule is created (without any default options changing).
119
-
* A new plugin configuration is created.
120
-
* An existing rule is deprecated.
119
+
* A bug fix in a rule that results in ESLint reporting more errors.
120
+
* A new rule is created (without being added to plugin configuration).
121
+
* A new option to an existing rule is created (without any default options changing).
122
+
* A new plugin configuration is created.
123
+
* An existing rule is deprecated.
121
124
* Major release (likely to break your lint build)
122
-
* An existing plugin configuration is changed in any way, including but not limited to:
123
-
* A new rule is added to the configuration.
124
-
* A rule is removed from the configuration.
125
-
* The options used in configuration for a rule are changed
126
-
* An existing rule is removed.
127
-
* A backward-incompatible change is made to the options of a rule.
125
+
* An existing plugin configuration is changed in any way, including but not limited to:
126
+
* A new rule is added to the configuration.
127
+
* A rule is removed from the configuration.
128
+
* The options used in configuration for a rule are changed
129
+
* An existing rule is removed.
130
+
* A backward-incompatible change is made to the options of a rule.
Copy file name to clipboardExpand all lines: docs/rules/no-assert-ok.md
+3-1
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,13 @@
3
3
`assert.ok` and `assert.notOk` pass for any truthy/falsy argument. As [many expressions evaluate to true/false in JavaScript](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) the usage of `assert.ok` is potentially error prone. In general, it should be advisable to always test for exact values in tests which makes tests a lot more solid.
4
4
5
5
An example when using `assert.ok` can involuntarily go wrong:
6
-
```
6
+
7
+
```js
7
8
test('test myFunc returns a truthy value' (assert) => {
8
9
assert.ok(myFunc);
9
10
});
10
11
```
12
+
11
13
Here by mistake a developer just passed to `assert.ok` a pointer to `myFunc` instead of explicitly calling it. This test is going pass no matter how `myFunc` changes. Using `assert.strictEqual(myFunc, theReturnValue)` solves the problem as this becomes an explicit check for equality.
Copy file name to clipboardExpand all lines: docs/rules/no-loose-assertions.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -5,16 +5,19 @@ The `assert.equal`/`assert.notEqual` assertion methods in QUnit use loose equali
5
5
`assert.ok` and `assert.notOk` pass for any truthy/falsy argument. As [many expressions evaluate to true/false in JavaScript](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) the usage of `assert.ok` is potentially error prone. In general, it should be advisable to always test for exact values in tests which makes tests a lot more solid.
6
6
7
7
An example when using `assert.ok` can involuntarily go wrong:
8
-
```
8
+
9
+
```js
9
10
test('test myFunc returns a truthy value' (assert) => {
10
11
assert.ok(myFunc);
11
12
});
12
13
```
14
+
13
15
Here by mistake a developer just passed to `assert.ok` a pointer to `myFunc` instead of explicitly calling it. This test is going pass no matter how `myFunc` changes. Using `assert.strictEqual(myFunc, theReturnValue)` solves the problem as this becomes an explicit check for equality.
14
16
15
17
The assertions to lint against can be controlled with an array of assertions (default `["equal", "notEqual", "ok", "notOk"]`).
16
18
17
19
To fine tune the error message (which by default will recommend to use `strictEqual`, `notStrictEqual`, `deepEqual`, or `propEqual`) a configuration object can be passed as an option instead of a string. The configuration object has two properties:
20
+
18
21
*`disallowed`: the name of the assertion to disallow (either `equal`, `ok`, or `notOk`);
19
22
*`recommended`: an array of strings representing the recommended options to display as an error message. The strings in the array will be concatenated to build the error message: `Unexpected {{assertVar}}.{{assertion}}. Use {{assertVar}}.<recommended_1>, {{assertVar}}.<recommended_2>.` when using local assertions and `Unexpected {{assertion}}. Use <recommended_1>, <recommended_2>.` when using global assertions.
0 commit comments