eslint-plugin-qunit
eslint-plugin-qunit copied to clipboard
literal-compare-order complains about two literal values being in the wrong order
If I understand our code correctly, it is currently limited to literal primitives in terms of recognising "literal" values, so when both values are literals but one is using an array or object, it is (imho wrongly) expressing a warning to swap them around.
assert.equal( "foo", "foo" );
assert.equal( "foo", [ "foo" ] );
assert.equal( "foo", { toString: function() { return "foo"; } } );
assert.equal( 0, [ 0 ] );
74:16 error Expected value "foo" should be specified after actual value [ "foo" ] qunit/literal-compare-order
75:16 error Expected value "foo" should be specified after actual value { toString: function() { return "foo"; } } qunit/literal-compare-order
76:16 error Expected value 0 should be specified after actual value [ 0 ] qunit/literal-compare-order
94:25 error Expected value "foo" should be specified after actual value [ "foo" ] qunit/literal-compare-order
96:25 error Expected value "foo" should be specified after actual value { toString: function() { return "foo"; } } qunit/literal-compare-order
524:19 error Expected value "foo" should be specified after actual value [ "foo" ] qunit/literal-compare-order
525:19 error Expected value "foo" should be specified after actual value { toString: function() { return "foo"; } } qunit/literal-compare-order
526:19 error Expected value 0 should be specified after actual value [ 0 ] qunit/literal-compare-order
532:22 error Expected value "foo" should be specified after actual value [ "foo" ] qunit/literal-compare-order
534:22 error Expected value "foo" should be specified after actual value { toString: function() { return "foo"; } } qunit/literal-compare-order
From https://github.com/qunitjs/qunit/blob/86fc89b3e443ccae5dedb5782412765c85a07a5e/test/main/assert.js#L523-L534