eslint-plugin-mocha
eslint-plugin-mocha copied to clipboard
[no-setup-in-describe] Symbol() considered problem
Summary
I came against rule activation on calls on ECMAScript Symbol
class.
I think it should not happen, as it does not affect the global state.
Details
https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/docs/rules/no-setup-in-describe.md
This rule reports all function calls and use of the dot operator (due to getters and setters) directly in describe blocks.
This code is rejected
const assert = require('assert/strict');
describe('no-setup-in-describe', () => {
// ESLint: Unexpected function call in describe block.(mocha/no-setup-in-describe)
const foo = Symbol('bar');
it('foo should not be null', async () => {
assert.notStrictEqual(foo, null);
});
});
Symbol does merely instantiate a non-mutable object.
Configuration:
- node 16.5
- eslint 7.27
- eslint-plugin-mocha 9.0