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

prefer-default-export: Cannot read property 'type' of null #1965

Closed
AriPerkkio opened this issue Dec 13, 2020 · 0 comments
Closed

prefer-default-export: Cannot read property 'type' of null #1965

AriPerkkio opened this issue Dec 13, 2020 · 0 comments

Comments

@AriPerkkio
Copy link

Hello, prefer-default-export rule seems to crash in certain cases. This issue was spotted by automated CI run - it is not blocking my development or anything. https://github.com/AriPerkkio/eslint-remote-tester/actions/runs/417578540

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-config-airbnb.config.js.

eslint-config-airbnb@18.2.1
eslint-plugin-import@2.22.1
extends: ['airbnb', 'airbnb/hooks', 'airbnb/whitespace']

Minimal repro:

const items = ['A', 'B', 'C'];

export const [First,, Third] = items;
Crash reports from real-world examples

Rule: prefer-default-export

  • Message: Cannot read property 'type' of null Occurred while linting <text>:5
  • Path: houfio/dakpan/examples/counter-hoc/src/states/counter.ts
  • Link
import { createDakpan } from 'dakpan';

import { sleep } from '../utils/sleep';

export const [CounterProvider,, withCounter] = createDakpan({
  count: 0
})({
  increment: () => ({ count }) => ({
    count: count + 1
  }),
TypeError: Cannot read property 'type' of null
Occurred while linting <text>:5
    at captureDeclaration (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js:22:31)
    at Array.forEach (<anonymous>)
    at captureDeclaration(/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js:30:9)
    at /home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js:70:13
    at Array.forEach (<anonymous>)
    at ExportNamedDeclaration (/home/runner/work/eslint-remote-tester/eslint-remote-tester/ci/node_modules/eslint-plugin-import/lib/rules/prefer-default-export.js:69:41)
    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)
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

1 participant