sonarjs/inverted-assertion-arguments
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/inverted-assertion-arguments": "error",
},
},
];Assertion arguments should be passed in the correct order
const assert = require('chai').assert;
const expect = require('chai').expect;
const should = require('chai').should();
it("inverts arguments", function() {
assert.equal(42, aNumber); // Noncompliant
expect(42).to.equal(aNumber); // Noncompliant
should.fail(42, aNumber); // Noncompliant
});const assert = require('chai').assert;
const expect = require('chai').expect;
const should = require('chai').should();
it("inverts arguments", function() {
assert.equal(aNumber, 42);
expect(aNumber).to.equal(42);
should.fail(aNumber, 42);
});Examples from the ESLint documentation.
sonarjs/inverted-assertion-arguments
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/inverted-assertion-arguments": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
JWT should be signed and verified with strong cipher algorithms
React components should not render non-boolean condition values
Only "while", "do", "for" and "switch" statements should be labelled
"indexOf" checks should not be for positive numbers
Opened windows should not have access to the originating page