linters icon indicating copy to clipboard operation
linters copied to clipboard

[bug] TypeError: Cannot read property 'type' of undefined

Open SuperOleg39 opened this issue 4 years ago • 0 comments

Reproduce

install dependencies:

npm i @tinkoff/eslint-config @tinkoff/eslint-config-react @tinkoff/eslint-plugin-tramvai

modyfy .eslintrc:

module.exports = {
    extends: [
        '@tinkoff/eslint-config/app',
        '@tinkoff/eslint-config/jest',
        '@tinkoff/eslint-config-react',
        'plugin:@tinkoff/tramvai/recommended',
    ],
    rules: {
        '@typescript-eslint/naming-convention': 1,
    },
};

add destructurisation in js file:

const x = ({ ...y }) => {}

Error

TypeError: Cannot read property 'type' of undefined
Occurred while linting /Users/b.ponomarenko/Desktop/es-app/index.js:1
    at getIdentifiersFromPattern (/Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:532:21)
    at /Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:553:21
    at Array.forEach (<anonymous>)
    at getIdentifiersFromPattern (/Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:544:32)
    at /Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:397:21
    at Array.forEach (<anonymous>)
    at FunctionDeclaration, TSDeclareFunction, FunctionExpression, ArrowFunctionExpression (/Users/b.ponomarenko/Desktop/es-app/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js:392:29)
    at /Users/b.ponomarenko/Desktop/es-app/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/b.ponomarenko/Desktop/es-app/node_modules/eslint/lib/linter/safe-emitter.js:45:38)

Problem

Error only with enabled @typescript-eslint/naming-convention rule

SuperOleg39 avatar Aug 12 '21 09:08 SuperOleg39