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

BindExpression could not be resolved #59

Closed
thibautvs opened this issue Nov 27, 2017 · 8 comments
Closed

BindExpression could not be resolved #59

thibautvs opened this issue Nov 27, 2017 · 8 comments

Comments

@thibautvs
Copy link

thibautvs commented Nov 27, 2017

Hi,

I know this issue has been addressed before but I still get this message with the latest version of ESLint + Airbnb config, namely:

  • eslint: 4.12.0,
  • eslint-config-airbnb: 16.1.0,
  • eslint-loader: 1.9.0,
  • eslint-plugin-import: 2.8.0,
  • eslint-plugin-jsx-a11y: 6.0.2,
  • eslint-plugin-react: 7.5.1

When I run ESLint, I get the following message:

The prop value with an expression type of BindExpression could not be resolved.
Please file issue to get this fixed immediately.
Error: The prop value with an expression type of BindExpression could not be resolved.
Please file issue to get this fixed immediately.
at Object.extract [as JSXExpressionContainer] (/Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint-plugin-jsx-a11y/node_modules/jsx-ast-utils/lib/values/expressions/index.js:173:11)
at getValue (/Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint-plugin-jsx-a11y/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
at extractValue (/Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint-plugin-jsx-a11y/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
at getPropValue (/Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint-plugin-jsx-a11y/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
at /Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:76:95
at Array.some (native)
at JSXOpeningElement (/Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:75:52)
at listeners.(anonymous function).forEach.listener (/Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint/lib/util/safe-emitter.js:47:58)
at Array.forEach (native)
at Object.emit (/Users/Thibaut/Documents/Git/AFC-MartaWebClient/node_modules/eslint/lib/util/safe-emitter.js:47:38)

I can get ESLint to run by removing "parser": "babel-eslint" from .eslintrc. But it then leads to such errors:

Parsing error: Unexpected token :

Any idea on how to fix this while preserving the autobind operator (::) notations in the codebase?

Thx

@thibautvs
Copy link
Author

A workaround I found was to use the inherited config from eslint-config-airbnb without eslint-plugin-jsx-a11y:

"extends": [
    "eslint-config-airbnb-base",
    "eslint-config-airbnb-base/rules/strict",
    "eslint-config-airbnb/rules/react"
  ]

HTH

@ljharb
Copy link
Member

ljharb commented Nov 27, 2017

The airbnb guide doesn’t allow pre-stage-3 proposals like the bind operator.

Duplicate of #33; waiting on https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/327

@kgowru
Copy link

kgowru commented Mar 19, 2018

I'm seeing the exact same issue as @thibautvs, @ljharb. The issue you pointed to is closed now. Here's my dependencies:

 "dependencies": {
    "animejs": "^2.2.0",
    "antd": "^3.1.6",
    "dva": "^2.1.0",
    "dva-loading": "^1.0.4",
    "jsonwebtoken": "^8.1.1",
    "moment": "^2.21.0",
    "nprogress": "^0.2.0",
    "path-to-regexp": "^2.2.0",
    "querystring": "^0.2.0",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-helmet": "^5.2.0",
    "react-inlinesvg": "^0.7.5"
  },
  "devDependencies": {
    "babel-eslint": "^8.2.2",
    "babel-jest": "^22.4.1",
    "babel-plugin-dva-hmr": "^0.4.0",
    "babel-plugin-import": "^1.6.6",
    "babel-plugin-module-resolver": "^3.1.0",
    "babel-plugin-transform-export-extensions": "^6.22.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "enzyme": "^3.3.0",
    "enzyme-adapter-react-16": "^1.1.1",
    "eslint": "^4.14.0",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-config-umi": "^0.1.1",
    "eslint-plugin-flowtype": "^2.34.1",
    "eslint-plugin-import": "^2.6.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.1.0",
    "history": "^4.7.2",
    "husky": "^0.12.0",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^22.4.2",
    "react-test-renderer": "^16.2.0",
    "redbox-react": "^1.4.3",
    "roadhog": "^2.0.0"
  },

@ljharb
Copy link
Member

ljharb commented Mar 19, 2018

and what’s your eslint config?

@kgowru
Copy link

kgowru commented Mar 22, 2018

Here ya go:

  "extends": "airbnb",
  "rules": {
    "semi": [2, "never"],
    "no-console": 0,
    "comma-dangle": [2, "always-multiline"],
    "max-len": [1, 100, 2, {
      "ignoreUrls": true,
      "ignoreComments": false,
      "ignoreStrings": true
    }],
    "react/jsx-first-prop-new-line": 0,
    "react/jsx-filename-extension": 0,
    "space-before-function-paren": [2, "always"],
    "no-unused-expressions": [0, {
      "allowShortCircuit": true,
      "allowTernary": true
    }],
    "arrow-body-style": [0, "never"],
    "func-names": 0,
    "prefer-const": 0,
    "no-extend-native": 0,
    "no-param-reassign": 0,
    "no-restricted-syntax": 0,
    "no-eval": 0,
    "no-continue": 0,
    "react/jsx-no-bind": 0,
    "no-unused-vars": [2, { "ignoreRestSiblings": true }],
    "no-underscore-dangle": 0,
    "global-require": 0,
    "import/no-unresolved": 0,
    "import/extensions": 0,
    "jsx-a11y/href-no-hash": 0,
    "react/no-array-index-key": 0,
    "react/require-default-props": 0,
    "react/forbid-prop-types": 0,
    "react/no-string-refs": 0,
    "react/no-find-dom-node": 0,
    "react/jsx-max-props-per-line": [2, { "when": "multiline" }],
    "react/prefer-stateless-function": 0,
    "import/no-extraneous-dependencies": 0,
    "import/prefer-default-export": 0,
    "react/no-danger": 0,
    "jsx-a11y/no-static-element-interactions": 0,
    "object-curly-newline": 0,
    "no-debugger": 1
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "sourceType": "module",
    "ecmaVersion": 8,
    "ecmaFeatures": {
      "jsx": true,
      "experimentalObjectRestSpread": true
    }
  },
  "settings": {
    "import/resolver": "node"
    },
    "globals": {
    "window": true
  }

}

@ljharb
Copy link
Member

ljharb commented Mar 23, 2018

Try updating eslint-plugin-import (and all the eslint deps) to the latest.

@jessebeach
Copy link
Collaborator

@thibautvs , Fixed in version v2.2.1. This will log an error in the console, but it will no longer throw.

@ljharb ljharb reopened this Jul 1, 2019
@ljharb
Copy link
Member

ljharb commented Oct 14, 2020

This should already have been fixed by #43.

@ljharb ljharb closed this as completed Oct 14, 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

4 participants