Skip to content

Commit

Permalink
Merge branch 'master' into no-negated-ok-checkBooleanAssertions
Browse files Browse the repository at this point in the history
* master:
  Update: Ensure boolean assertions are not missed by several rules (platinumazure#172)
  Chore: add eslint-plugin-eslint-comments (platinumazure#178)
  Docs: enable/autofix indent rule in markdown JS code samples (platinumazure#177)
  Docs: Add eslint-plugin-markdown for JavaScript code samples in documentation (platinumazure#176)
  Upgrade: Bump y18n from 4.0.0 to 4.0.1 (platinumazure#163)
  • Loading branch information
bmish committed Apr 21, 2021
2 parents 13eed53 + 05c9738 commit ed04676
Show file tree
Hide file tree
Showing 16 changed files with 5,764 additions and 34 deletions.
31 changes: 29 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["plugin:node/recommended", "plugin:eslint-plugin/recommended"],
"extends": ["plugin:node/recommended", "plugin:eslint-comments/recommended", "plugin:eslint-plugin/recommended"],

"env": {
"node": true
Expand Down Expand Up @@ -173,5 +173,32 @@
"eslint-plugin/require-meta-type": "error",
"eslint-plugin/test-case-property-ordering": "error",
"eslint-plugin/test-case-shorthand-strings": "error"
}
},

"overrides": [
{
"files": ["**/*.md"],
"processor": "markdown/markdown"
},
{
"files": ["**/*.md/*.js", "**/*.md/*.javascript"],
"plugins": ["markdown"],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"brace-style": "off",
"eqeqeq": "off",
"guard-for-in": "off",
"no-constant-condition": "off",
"no-empty-function": "off",
"no-undef": "off",
"no-unused-expressions": "off",
"no-unused-vars": "off",
"no-var": "off",
"quotes": "off",
"space-before-function-paren": "off"
}
}
]
}
4 changes: 2 additions & 2 deletions docs/rules/no-assert-ok.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
An example when using `assert.ok` can involuntarily go wrong:

```js
test('test myFunc returns a truthy value' (assert) => {
assert.ok(myFunc);
test('test myFunc returns a truthy value', (assert) => {
assert.ok(myFunc);
});
```

Expand Down
14 changes: 7 additions & 7 deletions docs/rules/no-async-module-callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ if it was within the last `module` that QUnit processes.

```js
QUnit.module('An async module', async function () {
QUnit.test('a passing test', function (assert) {
assert.ok(true);
});
QUnit.test('a passing test', function (assert) {
assert.ok(true);
});

await Promise.resolve();
await Promise.resolve();

QUnit.test('another passing test', function (assert) {
assert.ok(true);
});
QUnit.test('another passing test', function (assert) {
assert.ok(true);
});
});

QUnit.module('Some other module');
Expand Down
7 changes: 5 additions & 2 deletions docs/rules/no-early-return.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ QUnit[shouldRunTest() ? "test" : "skip"]("a test", function (assert) {
// Nested function scopes are okay because they do not cause the test to abort
QUnit.test("a test", function (assert) {
(function () {
return;
})();
if (true) {
return;
}
assert.ok(true);
}());
});

if (shouldRunTest()) {
Expand Down
8 changes: 4 additions & 4 deletions docs/rules/no-global-assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ notDeepEqual(a, b);

notPropEqual(a, b);

raises(function (), TypeError);
raises(function () {}, TypeError);

throws(function (), TypeError);
throws(function () {}, TypeError);

```

Expand All @@ -56,9 +56,9 @@ assert.notDeepEqual(a, b);

assert.notPropEqual(a, b);

assert.raises(function (), TypeError);
assert.raises(function () {}, TypeError);

assert.throws(function (), TypeError);
assert.throws(function () {}, TypeError);

```

Expand Down
14 changes: 7 additions & 7 deletions docs/rules/no-hooks-from-ancestor-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ The following patterns are considered warnings:

```js
QUnit.module("outer module", function(hooks) {
QUnit.module("inner module", function() {
hooks.beforeEach(function() {});
});
QUnit.module("inner module", function() {
hooks.beforeEach(function() {});
});
});

QUnit.module("outer module", function(outerHooks) {
QUnit.module("inner module", function(innerHooks) {
outerHooks.beforeEach(function() {});
});
QUnit.module("inner module", function(innerHooks) {
outerHooks.beforeEach(function() {});
});
});
```

The following patterns are not warnings:

```js
QUnit.module("example module", function(hooks) {
hooks.beforeEach(function() {});
hooks.beforeEach(function() {});
});
```

Expand Down
6 changes: 3 additions & 3 deletions docs/rules/no-loose-assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ The `assert.equal`/`assert.notEqual` assertion methods in QUnit use loose equali
An example when using `assert.ok` can involuntarily go wrong:

```js
test('test myFunc returns a truthy value' (assert) => {
assert.ok(myFunc);
test('test myFunc returns a truthy value', (assert) => {
assert.ok(myFunc);
});
```

Expand Down Expand Up @@ -83,7 +83,7 @@ QUnit.test('Name', function (foo) { foo.propEqual(a, b); });

QUnit.test('Name', function () { propEqual(a, b); });

/* eslint no-loose-assertions: ["error", ["strictEqual", "ok", "notOk"]] */
/* With rule config: ["error", ["strictEqual", "ok", "notOk"]] */
QUnit.test('Name', function (assert) { assert.notEqual(a, b); });

```
Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-nested-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ QUnit.module('ParentModule', function () {
QUnit.module('ChildModule', function () {
QUnit.test('ChildTest', function () {});
});
})
});

```

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/no-qunit-stop.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The following patterns are not warnings:

```js

var done = assert.async():
var done = assert.async();

```

Expand Down
2 changes: 1 addition & 1 deletion docs/rules/require-expect.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ test('name', function(assert) {
});

test('name', function(assert) {
var callback = function() {
function callback() {
assert.ok(true);
}
callback();
Expand Down

0 comments on commit ed04676

Please sign in to comment.