Skip to content

Cannot read property 'push' of undefined #11929

@bowernite

Description

@bowernite

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:

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

  rules: {
    /**
     * Possible Errors
     *
     * https://eslint.org/docs/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
     *
     * https://eslint.org/docs/rules/#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
     *
     * https://eslint.org/docs/rules/#variables
     */
    'no-delete-var': 2,
    'no-undef': 2,
    'no-unused-vars': [
      2,
      {
        args: 'none',
        ignoreRestSiblings: true,
      },
    ],
    'no-use-before-define': [
      2,
      {
        functions: false,
      },
    ],

    /**
     * ECMAScript 6
     *
     * https://eslint.org/docs/rules/#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 🤷‍♀

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlycoreRelates to ESLint's core APIs and features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions