Skip to content

Error with no-manual-cleanup in files with "require" imports #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
C-Higgins opened this issue Apr 16, 2020 · 2 comments
Closed

Error with no-manual-cleanup in files with "require" imports #111

C-Higgins opened this issue Apr 16, 2020 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@C-Higgins
Copy link

C-Higgins commented Apr 16, 2020

TypeError: Cannot read property 'match' of undefined at VariableDeclarator (node_modules/eslint-plugin-testing-library/lib/rules/no-manual-cleanup.js:62:66)

This is the only rule that fails in any file. It seems to fail in every file which uses require imports.

This is the value of node.init.arguments[0] when it has no value

Node {
  type: 'CallExpression',
  start: 3230,
  end: 3302,
  loc: SourceLocation {
    start: Position { line: 116, column: 23 },
    end: Position { line: 118, column: 6 }
  },
  range: [ 3230, 3302 ],
  callee: Node {
    type: 'MemberExpression',
    start: 3230,
    end: 3242,
    loc: SourceLocation { start: [Position], end: [Position] },
    range: [ 3230, 3242 ],
    object: Node {
      type: 'Identifier',
      start: 3230,
      end: 3237,
      loc: [SourceLocation],
      range: [Array],
      name: 'resolve',
      _babelType: 'Identifier',
      parent: [Circular]
    },
    property: Node {
      type: 'Identifier',
      start: 3238,
      end: 3242,
      loc: [SourceLocation],
      range: [Array],
      name: 'sync',
      _babelType: 'Identifier',
      parent: [Circular]
    },
    computed: false,
    _babelType: 'MemberExpression',
    parent: [Circular]
  },
  arguments: [
    Node {
      type: 'Literal',
      start: 3243,
      end: 3255,
      loc: [SourceLocation],
      range: [Array],
      value: 'typescript',
      raw: '"typescript"',
      _babelType: 'Literal',
      parent: [Circular]
    },
    Node {
      type: 'ObjectExpression',
      start: 3257,
      end: 3301,
      loc: [SourceLocation],
      range: [Array],
      properties: [Array],
      extra: [Object],
      _babelType: 'ObjectExpression',
      parent: [Circular]
    }
  ],
  _babelType: 'CallExpression',
  parent: Node {
    type: 'CallExpression',
    start: 3222,
    end: 3303,
    loc: SourceLocation { start: [Position], end: [Position] },
    range: [ 3222, 3303 ],
    callee: Node {
      type: 'Identifier',
      start: 3222,
      end: 3229,
      loc: [SourceLocation],
      range: [Array],
      name: 'require',
      _babelType: 'Identifier',
      parent: [Circular]
    },
    arguments: [ [Circular] ],
    _babelType: 'CallExpression',
    parent: Node {
      type: 'VariableDeclarator',
      start: 3217,
      end: 3303,
      loc: [SourceLocation],
      range: [Array],
      id: [Node],
      init: [Circular],
      _babelType: 'VariableDeclarator',
      parent: [Node]
    }
  }
}
@Belco90 Belco90 added the bug Something isn't working label Apr 17, 2020
@Belco90
Copy link
Member

Belco90 commented Apr 17, 2020

Hey Chris, thanks for reporting! I think I had to solve a similar issue in another rule, I'll take a look at it this weekend.

@Belco90
Copy link
Member

Belco90 commented Jun 4, 2020

Fixed in #128

@Belco90 Belco90 closed this as completed Jun 4, 2020
@Belco90 Belco90 added the duplicate This issue or pull request already exists label Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants