Skip to content

Commit

Permalink
Merge branch 'main' into jsdoc-39.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
edg2s authored Nov 13, 2023
2 parents 17e3820 + 68561c5 commit cfca47e
Showing 5 changed files with 59 additions and 25 deletions.
10 changes: 10 additions & 0 deletions jsdoc.json
Original file line number Diff line number Diff line change
@@ -39,6 +39,16 @@
},
"rules": {
"jsdoc/check-param-names": [ "warn", { "allowExtraTrailingParamDocs": true } ],
"jsdoc/check-tag-names": [
"warn",
{
"definedTags": [
"ignore",
"internal",
"stable"
]
}
],
"jsdoc/check-values": "off",
"jsdoc/empty-tags": "off",
"jsdoc/no-multi-asterisks": [ "error", { "allowWhitespace": true } ],
1 change: 1 addition & 0 deletions qunit.json
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
},
"plugins": [ "qunit" ],
"rules": {
"no-shadow": [ "error", { "allow": [ "hooks" ] } ],
"qunit/no-assert-equal": "off",
"qunit/no-assert-equal-boolean": "off",
"qunit/no-assert-logical-expression": "off",
3 changes: 3 additions & 0 deletions test/fixtures/jsdoc/valid.js
Original file line number Diff line number Diff line change
@@ -156,6 +156,9 @@
* line
* @yield {number} Multi-
* line
* @ignore
* @internal
* @stable
*/
APP.JSDocTags = function ( a, b ) {
return a || b;
8 changes: 7 additions & 1 deletion test/fixtures/qunit/invalid.js
Original file line number Diff line number Diff line change
@@ -91,7 +91,13 @@ QUnit.asyncTest( 'Asynchronous test', 3, function () {
// eslint-disable-next-line qunit/no-async-module-callbacks
QUnit.module( 'An async module', async function () {
QUnit.test( 'a passing test', function ( assert ) {
assert.true( true );
// Shadowing is only allowed for the variable name "hooks" (#532)
// eslint-disable-next-line no-shadow
function checkAssert( assert ) {
return !!assert;
}

assert.true( checkAssert( assert ) );
} );

await Promise.resolve();
62 changes: 38 additions & 24 deletions test/fixtures/qunit/valid.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
QUnit.module( 'Example' );
QUnit.module( 'Module', ( hooks ) => {

// Off: qunit/no-arrow-tests
// Valid: qunit/require-expect
QUnit.test( '.foo()', () => {
} );
hooks.beforeEach( ( assert ) => {
assert.ok( true, 'beforeEach' );
} );

// Off: qunit/no-arrow-tests
// Valid: qunit/require-expect
QUnit.test( '.foo()', () => {
} );

QUnit.test( '.bar()', function ( assert ) {
const x = 'bar',
y = 'baz';

// The following rules are superseded by qunit/no-loose-assertions,
// so are turned off to avoid double errors.
// Off: qunit/no-assert-equal
// Off: qunit/no-negated-ok
// Off: qunit/no-ok-equality

QUnit.test( '.bar()', function ( assert ) {
const x = 'bar',
y = 'baz';
// Valid: qunit/no-assert-equal
assert.strictEqual( x, 'bar' );

// The following rules are superseded by qunit/no-loose-assertions,
// so are turned off to avoid double errors.
// Off: qunit/no-assert-equal
// Off: qunit/no-negated-ok
// Off: qunit/no-ok-equality
// Off: qunit/no-assert-equal-boolean
assert.strictEqual( x, true );

// Valid: qunit/no-assert-equal
assert.strictEqual( x, 'bar' );
// Valid: qunit/no-negated-ok
if ( x ) {
// Off: qunit/no-conditional-assertions
assert.true( x );
}

// Off: qunit/no-assert-equal-boolean
assert.strictEqual( x, true );
// Off: qunit/no-assert-logical-expression
assert.true( x && y );
} );

// Valid: qunit/no-negated-ok
if ( x ) {
// Off: qunit/no-conditional-assertions
assert.true( x );
}
// Valid: no-shadow
// The variable name "hooks" can be shadowed (#532)
QUnit.module( 'Nested module', ( hooks ) => {
hooks.beforeEach( ( assert ) => {
assert.ok( true, 'nested beforeEach' );
} );
} );

// Off: qunit/no-assert-logical-expression
assert.true( x && y );
} );

0 comments on commit cfca47e

Please sign in to comment.