Skip to content
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

no-typos rule crash when encounter ... #2816

Closed
Songyu-Wang opened this issue Oct 1, 2020 · 4 comments
Closed

no-typos rule crash when encounter ... #2816

Songyu-Wang opened this issue Oct 1, 2020 · 4 comments
Assignees

Comments

@Songyu-Wang
Copy link
Contributor

Reproducible example:
0001-s.txt
Error message:

  1) no-typos
       valid
         
        import createReactClass from 'create-react-class'
        function hello (extra = {}) {
          // @ts-ignore
          // eslint-disable-next-line react/prefer-es6-class
          return createReactClass({
            noteType: 'hello',
            renderItem () {
              return null
            },
            ...extra
          })
        }
    :
     TypeError: Cannot read property 'name' of undefined
Occurred while linting <input>:6
      at reportErrorIfPropertyCasingTypo (lib/rules/no-typos.js:9:6557)
      at /Users/swang/Desktop/eslint-plugin-react/lib/rules/no-typos.js:9:13772
      at Array.forEach (<anonymous>)
      at ObjectExpression (lib/rules/no-typos.js:9:13714)
      at updatedRuleInstructions.<computed> (lib/util/Components.js:9:50421)
      at /Users/swang/Desktop/eslint-plugin-react/node_modules/eslint/lib/linter/safe-emitter.js:45:58
      at Array.forEach (<anonymous>)
      at Object.emit (node_modules/eslint/lib/linter/safe-emitter.js:45:38)
      at NodeEventGenerator.applySelector (node_modules/eslint/lib/linter/node-event-generator.js:254:26)
      at NodeEventGenerator.applySelectors (node_modules/eslint/lib/linter/node-event-generator.js:283:22)
      at NodeEventGenerator.enterNode (node_modules/eslint/lib/linter/node-event-generator.js:297:14)
      at CodePathAnalyzer.enterNode (node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
      at /Users/swang/Desktop/eslint-plugin-react/node_modules/eslint/lib/linter/linter.js:952:32
      at Array.forEach (<anonymous>)
      at runRules (node_modules/eslint/lib/linter/linter.js:947:15)
      at Linter._verifyWithoutProcessors (node_modules/eslint/lib/linter/linter.js:1173:31)
      at Linter.verify (node_modules/eslint/lib/linter/linter.js:1236:21)
      at runRuleForItem (node_modules/eslint/lib/rule-tester/rule-tester.js:556:37)
      at testValidTemplate (node_modules/eslint/lib/rule-tester/rule-tester.js:605:28)
      at Context.<anonymous> (node_modules/eslint/lib/rule-tester/rule-tester.js:885:25)
      at processImmediate (internal/timers.js:456:21)

@ljharb
Copy link
Member

ljharb commented Oct 2, 2020

Duplicate of #2810. Duplicate of #2806. Duplicate of #2804.

@Songyu-Wang
Copy link
Contributor Author

@ljharb I dont think this is a duplicate. All the issues you mentioned are for tests/lib/rules/prop-types.js
The issue I raised here is for no-typos

@ljharb
Copy link
Member

ljharb commented Oct 2, 2020

ah, true enough. it'll need the same fix as prop-types.

@ljharb ljharb reopened this Oct 2, 2020
@ljharb ljharb self-assigned this Oct 2, 2020
@ljharb
Copy link
Member

ljharb commented Oct 2, 2020

aha - looks like we never anticipated someone would be using modern syntax with the deprecated createReactClass. Fix coming shortly.

@ljharb ljharb closed this as completed in 988b794 Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants