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

Cannot read property 'push' of undefined #11929

babramczyk opened this issue Jul 1, 2019 · 3 comments


Copy link

commented Jul 1, 2019

Tell us about your environment

  • macOS 10.14.4

  • ESLint Version: 6.0.1

  • Node Version: 8.16.0

  • npm Version: 6.4.1

What parser (default, Babel-ESLint, etc.) are you using? Default

Please show your full configuration:

module.exports = {
  env: {
    es6: true,
  parserOptions: {
    ecmaVersion: 6,

  rules: {
     * Possible Errors
    'no-compare-neg-zero': 2,
    'no-cond-assign': 2,
    'no-console': 2,
    'no-constant-condition': 2,
    'no-debugger': 2,
    'no-dupe-args': 2,
    'no-dupe-keys': 2,
    'no-duplicate-case': 2,
    'no-empty': 2,
    'no-empty-character-class': 2,
    'no-ex-assign': 2,
    'no-extra-boolean-cast': 2,
    'no-extra-semi': 2,
    'no-func-assign': 2,
    'no-inner-declarations': 2,
    'no-invalid-regexp': 2,
    'no-irregular-whitespace': 2,
    'no-obj-calls': 2,
    'no-regex-spaces': 2,
    'no-sparse-arrays': 0,
    'no-template-curly-in-string': 2,
    'no-unexpected-multiline': 2,
    'no-unreachable': 2,
    'no-unsafe-finally': 2,
    'use-isnan': 2,
    'valid-typeof': 2,
    eqeqeq: ['error', 'always'],

     * Best Practices
    'no-caller': 2,
    'no-case-declarations': 2,
    'no-empty-pattern': 2,
    'no-extend-native': 2,
    'no-new-wrappers': 2,
    'no-octal': 2,
    'no-redeclare': 2,
    'no-self-assign': 2,
    'no-unused-labels': 2,
    'no-var': 2,

     * ESLint's "Variables" rules
    'no-delete-var': 2,
    'no-undef': 2,
    'no-unused-vars': [
        args: 'none',
        ignoreRestSiblings: true,
    'no-use-before-define': [
        functions: false,

     * ECMAScript 6
    'constructor-super': 2,

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

Can't tell which source code, if any, is triggering this.

./node_modules/.bin/eslint .

This does not happen if I run something like ./node_modules/.bin/eslint js where js is a directory.

What did you expect to happen?
ESLint runs as usual

What actually happened? Please include the actual, raw output from ESLint.

TypeError: Cannot read property 'push' of undefined
    at ast.comments.filter.forEach.comment (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/linter/linter.js:316:57)
    at Array.forEach (<anonymous>)
    at getDirectiveComments (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/linter/linter.js:270:60)
    at Linter._verifyWithoutProcessors (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/linter/linter.js:1065:15)
    at Linter._verifyWithConfigArray (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/linter/linter.js:1177:21)
    at Linter.verify (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/linter/linter.js:1132:25)
    at Linter.verifyAndFix (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/linter/linter.js:1322:29)
    at verifyText (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/cli-engine/cli-engine.js:231:48)
    at CLIEngine.executeOnFiles (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/cli-engine/cli-engine.js:781:28)
    at Object.execute (/Users/abr1402/nml/nm-innovation-hub-gen/node_modules/eslint/lib/cli.js:209:111)

Are you willing to submit a pull request to fix this bug?
Depends on how complex the fix is 🤷‍♀


This comment has been minimized.

Copy link

commented Jul 1, 2019

Hi @babramczyk, could you please run ESLint with the --debug flag? It should hopefully show the last file being linted before the error. Then, could you please post the contents of that file (if there are no confidentiality issues)? It will help us try to reproduce the issue. Thanks!

@platinumazure platinumazure added core evaluating and removed triage labels Jul 1, 2019


This comment has been minimized.

Copy link

commented Jul 1, 2019

So here is one (it seems of many) files that it chokes on. It's a build file from Vue, I believe (I've since ignored it in .eslintrc.js.


This comment has been minimized.

Copy link

commented Jul 3, 2019

Marking as accepted based on the linked PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.