Skip to content

no-manual-cleanup: Cannot read property 'match' of undefined #273

Closed
@AriPerkkio

Description

@AriPerkkio

Hello, no-manual-cleanup rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. ESlint rules should not crash in any condition since this makes all valid linting problems disappear. If this is a false flag please let me know.

https://github.com/AriPerkkio/eslint-remote-tester/runs/1551964310?check_suite_focus=true

Complete list of dependencies and .eslintrc is available at CI runs logs, steps Run yarn list | grep eslint and Run yarn log --config ./plugin-configs/eslint-plugin-testing-library.config.js.

rules: {
    'testing-library/no-manual-cleanup': 'error',
}

This minimal repro doesn't exactly look like a complete case. I think this should still be considered as a bug. Users will run into this while having the rule enabled and typing new import statements above function declaration. It is not desired to have linter crashing while typing.

Minimal repro:

// Start typing new import statement above function declaration
import
function App() {}
// Start typing new import statement above function declaration
import A from
function App() {}
Crash reports from real projects

Rule: no-manual-cleanup

  • Message: Cannot read property 'match' of undefined Occurred while linting <text>:3
  • Path: wesleyclzns/Perdita/perdita-app/src/componentes/App.js
  • Link
import React from 'react';
import Pidex from './Pidex'
import
function App() {
  return (
    <div className="App">
      <header className="App-header">
       <h1>Pertida Index</h1>
TypeError: Cannot read property 'match' of undefined Occurred while linting <text>:3
    at ImportDeclaration(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-testing-library/rules/no-manual-cleanup.js:47:59)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint/lib/linter/linter.js:952:32
    at Array.forEach (<anonymous>)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions