Skip to content

[no-setup-in-describe] Symbol() considered problem #295

@GradedJestRisk

Description

@GradedJestRisk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions