jsx-eslint / jsx-ast-utils Goto Github PK
View Code? Open in Web Editor NEWAST utility module for statically analyzing JSX
License: MIT License
AST utility module for statically analyzing JSX
License: MIT License
ESLint v7.0.0 is released 🎉
It would be awesome to have official ESLint 7 support. 👊
I'm happy to help where I can of course 🙂
Found this happening with <MyComponent role={role!}/>
Doesn't seem to happen with other props in my (limited) testing, ala #70
Error: The prop value with an expression type of TSNonNullExpression could not be resolved. Please file issue to get this fixed immediately.
Occurred while linting E:\project\src\pages\signup.tsx:189
at Array.forEach (<anonymous>)
at Array.forEach (<anonymous>
Occurs with most recent version 3.3.3.
Using @typescript-eslint/parser
.
Repros:
<input maxLength={foo()!.length} />
<input maxLength={bar()[0]!.length} />
"The prop value with an expression type of TSNonNullExpression could not be resolved" is shown when you run
$ npm run precommit
I am getting the following error
Error: The prop value with an expression type of SpreadElement could not be resolved.
Please file issue to get this fixed immediately.
at extract (C:\G2\G2\node_modules\jsx-ast-utils\lib\values\expressions\index.js:179:11)
at C:\G2\G2\node_modules\jsx-ast-utils\lib\values\expressions\ArrayExpression.js:22:32
at Array.map (<anonymous>)
at extractValueFromArrayExpression (C:\G2\G2\node_modules\jsx-ast-utils\lib\values\expressions\ArrayExpression.js:21:25)
at Object.ArrayExpression (C:\G2\G2\node_modules\jsx-ast-utils\lib\values\expressions\index.js:143:46)
at Object.extractLiteral [as JSXExpressionContainer] (C:\G2\G2\node_modules\jsx-ast-utils\lib\values\expressions\index.js:205:29)
at getLiteralValue (C:\G2\G2\node_modules\jsx-ast-utils\lib\values\index.js:61:35)
at extractValue (C:\G2\G2\node_modules\jsx-ast-utils\lib\getPropValue.js:24:12)
at getLiteralPropValue (C:\G2\G2\node_modules\jsx-ast-utils\lib\getPropValue.js:56:10)
at getTabIndex (C:\G2\G2\node_modules\eslint-plugin-jsx-a11y\lib\util\getTabIndex.js:17:59)
It seems to related to the following line
tabIndex={[...this.props.tabIndex, intIndex]}
The team I work on is migrating a Flow project to Typescript, and we are trying to keep our ESLint setup by using typescript-eslint, but things were not working out as expected.
After some debugging, we found out that the issue was within jsx-ast-utils
, which didn't correctly handle JSX attributes in the form of atribute={value!}
(where !
is a Typescript non-null assertion, i.e. it tells Typescript to assume that value
is neither null
or undefined
). It crashed here, more specifically. The issue is that @typescript-eslint/typescript-estree
exposes it as a TSNonNullExpression
node with value
's AST as node.expression
.
For our codebase, simply adding
if (type === "TSNonNullExpression") {
expression = expression.expression;
type = expression.type;
}
before that check made everything work. It's a fairly large React codebase, so I guess it's fair to assume there would be little additional work.
I would be happy to come up with a PR if the project sees this as desirable. Thanks!
I use @babel/plugin-proposal-optional-chaining
like this:
<div href={data?.href} />
I found only href
will throw error. Other props will not throw error, like this:
<div test={data?.test} />
Migrated from babel/babel-eslint#472
I'm using this syntax:
::this.foo()
However, eslint crashes in this case:
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/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/values/expressions/index.js:173:11)
at getValue (/Users/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
at extractValue (/Users/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
at getPropValue (/Users/tsheaff/Code/private/calm/www/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
at /Users/tsheaff/Code/private/calm/www/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:76:95
at Array.some (native)
at EventEmitter.JSXOpeningElement (/Users/tsheaff/Code/private/calm/www/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:75:52)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:191:7)
at NodeEventGenerator.applySelector (/Users/tsheaff/Code/private/calm/www/node_modules/eslint/lib/util/node-event-generator.js:265:26)
at NodeEventGenerator.applySelectors (/Users/tsheaff/Code/private/calm/www/node_modules/eslint/lib/util/node-event-generator.js:294:22)
Here is my .eslintrc
:
module.exports = {
'env': {
'browser': true,
'node': true,
},
'plugins': [ 'react' ],
'parser': 'babel-eslint',
'extends': 'airbnb', /* see https://github.com/airbnb/javascript */
'rules': {
/* override a few airbnb rules */
'strict': 0,
'space-before-function-paren': ['error', 'never'],
'func-names': 'off',
'no-console': 'error',
'max-len': 'off',
'global-require': 'error',
'consistent-return': 'off',
'class-methods-use-this': 'off',
'object-shorthand': ['error', 'never'],
'no-param-reassign': ['error', {
'props': false
}],
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
'arrow-parens': ['error', 'always'],
'arrow-body-style': 'off',
'import/prefer-default-export': 'off',
'import/extensions': ['error', {
'js': 'never',
'json': 'always'
}],
},
}
Here are my dependencies:
"babel-eslint": "^7.2.3",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.1",
When I remove the 'parser': 'babel-eslint',
line from the config, this crash goes away. However in that case native eslint doesn't recognize the ::
and says Parsing error: Unexpected token : (Fatal)
It also goes away if the file I'm linting does not use the ::
syntax
This mini-repo recreates the error: https://gist.github.com/tsheaff/003685ca6a163fb467a29fb7c70fbf10
The ::
operator on line this line is the offending one. If I remove that or switch to .bind(this)
syntax I don't get the error. I also don't get the error if the ::
is not in JSX
Began seeing The prop value with an expression type of ChainExpression could not be resolved. Please file issue to get this fixed immediately.
in eslint output after upgrading.
ECMAscript Optional Chaining shipped, resulting in various changes to parsers and javascript/typescript tools to support it. Initially there were different, non-standard names for the AST nodes to represent it. Over this year, consensus has settled out, including in the parser that eslint uses, estree (see estree/estree#204 ).
jsx-ast-utils should be updated to support the new AST nodes.
[email protected]
[email protected] (via [email protected], [email protected])
Component.jsx
import React from 'react';
export function Component() {
const x = {};
return (
<div role="button" key={x.y?.z}>
hi
</div>
);
}
.eslintrc
module.exports = {
extends: [
'plugin:react/recommended',
'plugin:jsx-a11y/recommended'
],
plugins: ['react', 'jsx-a11y'],
}
run
eslint ./Component.jsx
Example AST (via console.log):
{
type: 'JSXExpressionContainer',
expression: {
type: 'ChainExpression',
expression: {
type: 'MemberExpression',
object: [Object],
property: [Object],
computed: false,
optional: true,
range: [Array],
loc: [Object],
parent: [Circular]
},
range: [ 6299, 6313 ],
loc: { start: [Object], end: [Object] },
parent: [Circular]
},
range: [ 6298, 6314 ],
loc: { start: { line: 205, column: 29 }, end: { line: 205, column: 45 } },
parent: {
type: 'JSXAttribute',
name: {
type: 'JSXIdentifier',
name: 'href',
range: [Array],
loc: [Object],
parent: [Circular]
},
value: [Circular],
range: [ 6293, 6314 ],
loc: { start: [Object], end: [Object] },
parent: {
type: 'JSXOpeningElement',
typeParameters: undefined,
selfClosing: false,
name: [Object],
attributes: [Array],
range: [Array],
loc: [Object],
parent: [Object]
}
}
}
Hi, during build we've got this message and fatal error after:
The prop value with an expression type of TSNonNullExpression could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-config-airbnb-base |
Current Version | 11.1.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-config-airbnb-base is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
in getLiteralPropValue, the strings "True"
and "False"
should be normalized and resolve to booleans.
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-plugin-import |
Current Version | 2.6.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-plugin-import is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
The new version differs by 4 commits.
d9b712a
bump to v2.6.1 to bump dep on node resolver to latest 😳
4d561e3
Merge pull request #881 from futpib/named-flow-import-interface
56e60e4
Update no-extraneous-dependencies.md (#878)
9a06426
Fix flow interface imports giving false-negative with named
rule
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
When running eslint over our source, the following error occurs: eslint/eslint#7341
seems as if JSX UpdateExpression
is unknown by jsx-ast-utils.
CLI warning: The prop value with an expression type of TSNonNullExpression could not be resolved. Please file issue to get this fixed immediately.
Was tracking some of the expressions til I found the cause which looks like this:
<div data-test={someNullishObject![0]} />
From evcohen/eslint-plugin-jsx-a11y, I got an error when running eslint-plugin-jsx-a11y plugin which uses jsx-ast-utils.
Here is my configuration:
OS: macOS 10.12.4
Running ESLint: v3.19.0
Launched with: eslint command line
Stacktrace:
> ./node_modules/.bin/eslint ./src
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 extract (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/index.js:173:11)
at Object.extractValueFromCallExpression [as CallExpression] (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/CallExpression.js:24:30)
at extract (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/index.js:176:21)
at Object.extractValueFromLogicalExpression [as LogicalExpression] (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/LogicalExpression.js:27:37)
at Object.extract [as JSXExpressionContainer] (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/expressions/index.js:176:21)
at getValue (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
at extractValue (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
at getPropValue (/Users/vivaxy/Developer/react-ui/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
at /Users/vivaxy/Developer/react-ui/node_modules/eslint-plugin-jsx-a11y/lib/rules/href-no-hash.js:47:48
at Array.map (native)
Error trace:
The prop value with an expression type of AssignmentExpression could not be resolved.
Please file issue to get this fixed immediately.
Error: The prop value with an expression type of AssignmentExpression could not be resolved.
Please file issue to get this fixed immediately.
at extract (jsx-ast-utils\lib\values\expressions\index.js:175:11)
at Object.extractValueFromLogicalExpression [as LogicalExpression] (jsx-ast-utils\lib\values\expressions\LogicalExpression.js:28:38)
at Object.extract [as JSXExpressionContainer] (jsx-ast-utils\lib\values\expressions\index.js:178:21)
at getValue (jsx-ast-utils\lib\values\index.js:48:27)
at extractValue (jsx-ast-utils\lib\getPropValue.js:24:12)
at getPropValue (jsx-ast-utils\lib\getPropValue.js:41:10)
at eslint-plugin-jsx-a11y\lib\rules\no-static-element-interactions.js:79:95
at Array.some (native)
at EventEmitter.JSXOpeningElement (eslint-plugin-jsx-a11y\lib\rules\no-static-element-interactions.js:75:52)
After stepping through I've found the culprit in the onClick
assignment here:
this._options.map((config, key) => <DropdownBox.Item key={key}
onClick={this._cachedOnClickItemHandlers[key] ||
(this._cachedOnClickItemHandlers[key] = this._onClickItem.bind(null, config))}>
{config.label}
</DropdownBox.Item>)
Yeah, not the nicest code, but I guess this shouldn't break eslint
What code were you trying to parse?
I use @typescript-eslint/parser
parser for TypeScript files.
When I try to lint the code below, It cannot parse functional type.
<MyButton
// ... some codes
onClick={handleSubmit as ((e: any) => void)}
/>
What did you expect to happen?
Parse ((e: any)=> void)
as usual type.
What actually happened?
Error: The prop value with an expression type of TSAsExpression could not be resolved.
Please file issue to get this fixed immediately.
Occurred while linting /Users/MyProject/src/MyComponent.tsx:151
at Object.extract [as JSXExpressionContainer] (/Users/MyProject/node_modules/jsx-ast-utils/lib/values/expressions/index.js:179:11)
at getValue (/Users/MyProject/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
at extractValue (/Users/MyProject/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
at getPropValue (/Users/MyProject/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
at /Users/MyProject/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-noninteractive-element-interactions.js:90:95
at Array.some (<anonymous>)
at JSXOpeningElement (/Users/MyProject/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-noninteractive-element-interactions.js:89:52)
at listeners.(anonymous function).forEach.listener (/Users/MyProject/node_modules/eslint/lib/util/safe-emitter.js:45:58)
at Array.forEach (<anonymous>)
at Object.emit (/Users/MyProject/node_modules/eslint/lib/util/safe-emitter.js:45:38)
Versions
package | version |
---|---|
@typescript-eslint/parser |
2.1.0 |
TypeScript |
3.4.5 |
ESLint |
5.12.0 |
node |
8.14.1 |
npm |
6.11.3 |
( Came from typescript-eslint/typescript-eslint#966 )
So I've tried to figure it out,
https://github.com/evcohen/jsx-ast-utils/blob/master/src/values/expressions/index.js#L63-L91
but I don't know why TSAsExpression escape from while
loop.
Hey Ethan,
Thanks for this great tool!
I'm building an ESLint rule for a project to warn our team when we use <this.ComponentName /> in JSX. (Because JSX tag names should always start with a capital and it sometimes compiles to "(void 0).ComponentName" which obviously won't run.)
However, elementType(node) returns "undefined.ComponentName" in a few cases:
<Component.Child.RenderThisGuy /> becomes "undefined.RenderThisGuy"
<this.props.Component> becomes "undefined.Component"
I can't check for names that start with "undefined" because, as you can see above, the first would be a false positive. And if I check only names that start with "this", I'm missing some instances.
Do you have any idea what could be causing this? And do you need any further info about the code I'm testing?
Thanks for any assistance!
Julien
Hi,
I was just upgrading eslint and all its plugins and now getting this error when trying to lint with the following setup:
Full Error Message:
Error: The prop value with an expression type of TypeCastExpression could not be resolved.
Please file issue to get this fixed immediately.
at Object.extract [as JSXExpressionContainer] (/Users/mil/Development/wizard/node_modules/jsx-ast-utils/lib/values/expressions/index.js:179:11)
at getValue (/Users/mil/Development/wizard/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
at extractValue (/Users/mil/Development/wizard/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
at getPropValue (/Users/mil/Development/wizard/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
at /Users/mil/Development/wizard/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:78:95
at Array.some (<anonymous>)
at JSXOpeningElement (/Users/mil/Development/wizard/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:77:52)
at listeners.(anonymous function).forEach.listener (/Users/mil/Development/wizard/node_modules/eslint/lib/util/safe-emitter.js:47:58)
at Array.forEach (<anonymous>)
at Object.emit (/Users/mil/Development/wizard/node_modules/eslint/lib/util/safe-emitter.js:47:38)
Any idea?
The prop value with an expression type of JSXEmptyExpression could not be resolved.
ESLint stack trace:
TypeError: LITERAL_TYPES[value.type] is not a function
Occurred while linting /**/*.tsx:*
Rule: "react/button-has-type"
at getLiteralValue (/**/node_modules/jsx-ast-utils/lib/values/index.js:69:35)
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These branches will be created by Renovate only once you click their checkbox below.
flow-parser
to ^0.235.0babel-jest
to v29babel-plugin-transform-replace-object-assign
to v2eslint
to v9jest-cli
to v29jest
to v29rimraf
to v5.github/workflows/node-aught.yml
.github/workflows/node-pretest.yml
.github/workflows/node-tens.yml
.github/workflows/rebase.yml
actions/checkout v2
.github/workflows/require-allow-edits.yml
package.json
array-includes ^3.1.6
array.prototype.flat ^1.3.1
object.assign ^4.1.4
object.values ^1.1.6
@babel/core ^7.22.9
@babel/eslint-parser ^7.22.9
@babel/parser ^7.22.7
aud ^2.0.3
auto-changelog ^2.4.0
babel-cli ^6.26.0
babel-core ^6.26.3
babel-jest ^20.0.3
babel-plugin-transform-object-rest-spread ^6.26.0
babel-plugin-transform-replace-object-assign ^1.0.0
babel-polyfill ^6.26.0
babel-preset-env ^1.7.0
babylon ^6.18.0
eslint ^8.45.0
eslint-config-airbnb-base ^15.0.0
eslint-plugin-import ^2.27.5
flow-parser ^0.126.1
in-publish ^2.0.1
jest ^20.0.4
jest-cli ^20.0.4
npmignore ^0.3.0
object.entries ^1.1.6
object.fromentries ^2.0.6
rimraf ^2.7.1
safe-publish-latest ^2.0.0
node >=4.0
Hello,
I'm raising an issue as instructed by the error message.
// ...
"@typescript-eslint/eslint-plugin": "5.37.0",
"@typescript-eslint/parser": "5.37.0",
"ts-loader": "9.3.1",
"typescript": "4.8.3",
// ...
"eslint": "8.23.1",
"eslint-config-prettier": "8.5.0",
"eslint-formatter-friendly": "7.0.0",
"eslint-plugin-jsdoc": "39.3.6",
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-promise": "6.0.1",
"eslint-plugin-react": "7.31.8",
"eslint-plugin-sonarjs": "0.15.0",
"eslint-plugin-sort": "2.4.0",
"eslint-plugin-unicorn": "43.0.2",
"eslint-webpack-plugin": "3.2.0",
"webpack": "5.74.0",
// ...
node -v
v16.16.0
npm why jsx-ast-utils
[email protected] dev
node_modules/jsx-ast-utils
jsx-ast-utils@"^3.3.2" from [email protected]
node_modules/eslint-plugin-jsx-a11y
dev eslint-plugin-jsx-a11y@"6.6.1" from the root project
jsx-ast-utils@"^2.4.1 || ^3.0.0" from [email protected]
node_modules/eslint-plugin-react
dev eslint-plugin-react@"7.31.8" from the root project
What info do you need ?
Can I help ?
Thank you for your time
Given the following:
<a href={`${undefined}`} />
In an actual component, this is rendered as:
<a href="undefined" />
This is the default behaviour for such a template literal in JavaScript.
However in getPropValue
this is returned as an empty string.
It seems to be intended behaviour as there is also a test for this:
it('should drop variables in template literals that are literally undefined', () => {
const prop = extractProp('<div foo={`bar ${undefined}`} />');
const expected = 'bar ';
const actual = getPropValue(prop);
assert.equal(expected, actual);
});
However, the difference between the actual JSX / JavaScript behaviour and the result calculated here can lead to confusion when used in linters and tests.
Hello, I'm seeing these errors while testing eslint-plugin-jsx-a11y
. I believe these warnings are coming from this project.
The prop value with an expression type of TSNonNullExpression could not be resolved. Please file issue to get this fixed immediately.
The prop value with an expression type of JSXFragment could not be resolved. Please file issue to get this fixed immediately.
https://github.com/AriPerkkio/eslint-remote-tester/runs/1542824521?check_suite_focus=true
I'm not exactly sure which code block or project is causing these. Is this info helpful enough to reproduce this or should I try to debug this closer?
Also it would be great if this error message could contain stack trace. Any ideas why it's not currently included?
jsx-ast-utils/src/values/expressions/index.js
Lines 99 to 102 in 4576cde
Receiving the error:
The prop value with an expression type of TSSatisfiesExpression could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
During local builds of NextJS application.
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-plugin-import |
Current Version | 2.3.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-plugin-import is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
The new version differs by 27 commits.
c41ed06
bump to v2.5.0
94187a3
bump debug
version everywhere
54687d1
resolvers/webpack: v0.8.2
dac23a1
eslint-module-utils: v2.1.1 (bumping to re-publish to npm)
d92ef43
Merge pull request #696 from eelyafi/new_line_fixer
3f9e4bf
[Tests] comment out failing (and probably invalid) test
4067495
Only apps should have lockfiles.
ebaa8e3
Merge pull request #873 from lukeapage/patch-3
3268cb1
Fix documentation of newline-after-import example
3c46d30
rollback utils dependency to 2.0.0
e3a32ad
add yank note to utils change log
089f7f1
add yanking note to root change log
dfbe0e7
Upgrade debug version of eslint-module-utils (#844)
3d9c642
Merge branch 'release'
b8e9a0b
Merge pull request #861 from benmosher/release-2.4.0
There are 27 commits in total.
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
Looks similar to #3
Error: The prop value with an expression type of ArrayExpression could not be resolved.
Please file issue to get this fixed immediately.
at Object.extractLiteral as JSXExpressionContainer
at getLiteralValue (C:\ProjectDirectory\app\app.v4\node_modules\jsx-ast-utils\lib\values\index.js:65:35)
at extractValue (C:\ProjectDirectory\app\app.v4\node_modules\jsx-ast-utils\lib\getPropValue.js:24:12)
at getLiteralPropValue (C:\ProjectDirectory\app\app.v4\node_modules\jsx-ast-utils\lib\getPropValue.js:56:10)
at EventEmitter.JSXOpeningElement (C:\ProjectDirectory\app\app.v4\node_modules\eslint-plugin-jsx-a11y\lib\rules\role-supports-aria-props.js:50:69)
at emitOne (events.js:95:20)
at EventEmitter.emit (events.js:182:7)
at NodeEventGenerator.enterNode (C:\ProjectDirectory\app\app.v4\node_modules\eslint\lib\util\node-event-generator.js:40:22)
at CodePathAnalyzer.enterNode (C:\ProjectDirectory\app\app.v4\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:608:23)
at CommentEventGenerator.enterNode (C:\ProjectDirectory\app\app.v4\node_modules\eslint\lib\util\comment-event-generator.js:97:23)
Hi there,
Looks like there is missing type regarding SequenceExpression, resulting in a error output.
could you please add it to fix the error? TKS!
var TYPES = {
Identifier: _Identifier2.default,
Literal: _Literal2.default,
JSXElement: _JSXElement2.default,
TaggedTemplateExpression: _TaggedTemplateExpression2.default,
TemplateLiteral: _TemplateLiteral2.default,
ArrowFunctionExpression: _FunctionExpression2.default,
FunctionExpression: _FunctionExpression2.default,
LogicalExpression: _LogicalExpression2.default,
MemberExpression: _MemberExpression2.default,
OptionalMemberExpression: _OptionalMemberExpression2.default,
CallExpression: _CallExpression2.default,
UnaryExpression: _UnaryExpression2.default,
ThisExpression: _ThisExpression2.default,
ConditionalExpression: _ConditionalExpression2.default,
BinaryExpression: _BinaryExpression2.default,
ObjectExpression: _ObjectExpression2.default,
NewExpression: _NewExpression2.default,
UpdateExpression: _UpdateExpression2.default,
ArrayExpression: _ArrayExpression2.default,
BindExpression: _BindExpression2.default,
SpreadElement: _SpreadElement2.default,
TypeCastExpression: _TypeCastExpression2.default
};
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-config-airbnb-base |
Current Version | 11.0.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-config-airbnb-base is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
at extract (/path/node_modules/jsx-ast-utils/lib/values/expressions/index.js:170:20)
at /path/node_modules/jsx-ast-utils/lib/values/expressions/ObjectExpression.js:38:32
at Array.reduce (<anonymous>)
at Object.extractValueFromObjectExpression [as ObjectExpression] (/path/node_modules/jsx-ast-utils/lib/values/expressions/ObjectExpression.js:36:27)
at extract (/path/node_modules/jsx-ast-utils/lib/values/expressions/index.js:183:21)
at /path/node_modules/jsx-ast-utils/lib/values/expressions/ObjectExpression.js:38:70
at Array.reduce (<anonymous>)
at Object.extractValueFromObjectExpression [as ObjectExpression] (/path/node_modules/jsx-ast-utils/lib/values/expressions/ObjectExpression.js:36:27)
at Object.extract [as JSXExpressionContainer] (/path/node_modules/jsx-ast-utils/lib/values/expressions/index.js:183:21)
at getValue (/path/node_modules/jsx-ast-utils/lib/values/index.js:48:27)
Hi, I have this github repository https://github.com/wasim-ullah/blog which I am trying to deploy through vercel or netlify, it gives me the error that says: "The prop value with an expression type of AwaitExpression could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately."
Hi,
I know this issue has been addressed before but I still get this message with the latest version of ESLint + Airbnb config, namely:
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
Reproduced example using v3.3.4
Error output (value.type here is JSXFragment):
Oops! Something went wrong! :(
ESLint: 8.44.0
TypeError: TYPES[value.type] is not a function
Occurred while linting /Users/xxx/repos/jsx-fragment-issue-repo/src/index.tsx:2
Rule: "jsx-a11y/role-supports-aria-props"
at getValue (/Users/xxx/repos/jsx-fragment-issue-repo/node_modules/jsx-ast-utils/lib/values/index.js:56:27)
at /Users/xxx/repos/jsx-fragment-issue-repo/node_modules/jsx-ast-utils/lib/values/JSXFragment.js:20:12
at Array.map (<anonymous>)
at Object.extractValueFromJSXFragment [as JSXFragment] (/Users/xxx/repos/jsx-fragment-issue-repo/node_modules/jsx-ast-utils/lib/values/JSXFragment.js:19:43)
at Object.extract [as JSXExpressionContainer] (/Users/xxx/repos/jsx-fragment-issue-repo/node_modules/jsx-ast-utils/lib/values/expressions/index.js:211:21)
at getValue (/Users/xxx/repos/jsx-fragment-issue-repo/node_modules/jsx-ast-utils/lib/values/index.js:56:27)
at extractValue (/Users/xxx/repos/jsx-fragment-issue-repo/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12)
at getPropValue (/Users/xxx/repos/jsx-fragment-issue-repo/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10)
at /Users/xxx/repos/jsx-fragment-issue-repo/node_modules/eslint-plugin-jsx-a11y/lib/rules/role-supports-aria-props.js:63:48
at Array.filter (<anonymous>)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-plugin-import |
Current Version | 2.3.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-plugin-import is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
The new version differs by 10 commits.
44ca158
update utils changelog
a3728d7
bump eslint-module-utils to v2.1.0
3e29169
bump v2.4.0
ea9c92c
Merge pull request #737 from kevin940726/master
8f9b403
fix typos, enforce type of array of strings in allow option
95315e0
update CHANGELOG.md
28e1623
eslint-module-utils: filePath in parserOptions (#840)
2f690b4
update CI to build on Node 6+7 (#846)
7d41745
write doc, add two more tests
dedfb11
add allow glob for rule no-unassigned-import, fix #671
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
Seems similar to this.
The prop value with an expression type of AssignmentExpression could not be resolved. Please file issue to get this fixed immediately. Error: The prop value with an expression type of AssignmentExpression could not be resolved. Please file issue to get this fixed immediately. at Object.extract [as JSXExpressionContainer] (/Users/simple/Documents/web-preorder/node_modules/jsx-ast-utils/lib/values/expressions/index.js:179:11) at getValue (/Users/simple/Documents/web-preorder/node_modules/jsx-ast-utils/lib/values/index.js:48:27) at extractValue (/Users/simple/Documents/web-preorder/node_modules/jsx-ast-utils/lib/getPropValue.js:24:12) at getPropValue (/Users/simple/Documents/web-preorder/node_modules/jsx-ast-utils/lib/getPropValue.js:41:10) at /Users/simple/Documents/web-preorder/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:78:95 at Array.some (<anonymous>) at JSXOpeningElement (/Users/simple/Documents/web-preorder/node_modules/eslint-plugin-jsx-a11y/lib/rules/no-static-element-interactions.js:77:52) at listeners.(anonymous function).forEach.listener (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/util/safe-emitter.js:47:58) at Array.forEach (<anonymous>) at Object.emit (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/util/safe-emitter.js:47:38) at NodeEventGenerator.applySelector (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/util/node-event-generator.js:251:26) at NodeEventGenerator.applySelectors (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/util/node-event-generator.js:280:22) at NodeEventGenerator.enterNode (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/util/node-event-generator.js:294:14) at CodePathAnalyzer.enterNode (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23) at Traverser.enter [as _enter] (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/linter.js:997:32) at Traverser._traverse (/Users/simple/Documents/web-preorder/node_modules/eslint/lib/util/traverser.js:132:14) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Branch | Build failing 🚨 |
---|---|
Dependency | babel-core |
Current Version | 6.24.1 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As babel-core is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
➜ yarn lint
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
The prop value with an expression type of MetaProperty could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately.
{
"extends": ["react-app", "react-app/jest", "prettier"]
}
"jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.2":
version: 3.3.2
resolution: "jsx-ast-utils@npm:3.3.2"
dependencies:
array-includes: ^3.1.5
object.assign: ^4.1.2
checksum: 61d4596d44480afc03ae0a7ebb272aa6603dc4c3645805dea0fc8d9f0693542cd0959f3ba7c0c9b16c13dd5a900c7c4310108bada273132a8355efe3fed22064
languageName: node
linkType: hard
"eslint-plugin-react@npm:^7.27.1, eslint-plugin-react@npm:^7.29.4":
version: 7.30.1
resolution: "eslint-plugin-react@npm:7.30.1"
dependencies:
array-includes: ^3.1.5
array.prototype.flatmap: ^1.3.0
doctrine: ^2.1.0
estraverse: ^5.3.0
jsx-ast-utils: ^2.4.1 || ^3.0.0
minimatch: ^3.1.2
object.entries: ^1.1.5
object.fromentries: ^2.0.5
object.hasown: ^1.1.1
object.values: ^1.1.5
prop-types: ^15.8.1
resolve: ^2.0.0-next.3
semver: ^6.3.0
string.prototype.matchall: ^4.0.7
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
checksum: 553fb9ece6beb7c14cf6f84670c786c8ac978c2918421994dcc4edd2385302022e5d5ac4a39fafdb35954e29cecddefed61758040c3c530cafcf651f674a9d51
languageName: node
linkType: hard
"eslint-plugin-jsx-a11y@npm:^6.5.1":
version: 6.6.1
resolution: "eslint-plugin-jsx-a11y@npm:6.6.1"
dependencies:
"@babel/runtime": ^7.18.9
aria-query: ^4.2.2
array-includes: ^3.1.5
ast-types-flow: ^0.0.7
axe-core: ^4.4.3
axobject-query: ^2.2.0
damerau-levenshtein: ^1.0.8
emoji-regex: ^9.2.2
has: ^1.0.3
jsx-ast-utils: ^3.3.2
language-tags: ^1.0.5
minimatch: ^3.1.2
semver: ^6.3.0
peerDependencies:
eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8
checksum: baae7377f0e25a0cc9b34dc333a3dc6ead9ee8365e445451eff554c3ca267a0a6cb88127fe90395c578ab1b92cfed246aef7dc8d2b48b603389e10181799e144
languageName: node
linkType: hard
Hi,
I got this error while running ESLint on our code-base. Not sure where it is coming from though.
The prop value with an expression type of JSXFragment could not be resolved. Please file an issue to get this fixed immediately.
@typescript-eslint/eslint-plugin: 5.18.0
@typescript-eslint/parser: 5.18.0
eslint: 8.12.0
jsx-ast-utils: 3.2.1
node: v16.8.0
Hope this helps to fix the issue.
I am facing an issue while I building my react project.
The prop value with an expression type of JSXEmptyExpression could not be resolved. Please file an issue ( https://github.com/jsx-eslint/jsx-ast-utils/issues/new ) to get this fixed immediately
It's up to you —@ljharb—, but if you'd like, you're welcome to transfer this repository to the official @eslint-community
organization on GitHub.
As you can read in the '@eslint-community
GitHub organization' RFC, the goal of this new org is to have a place where community members can help ensure widely depended upon ESLint related packages stay up to date with newer ESLint releases and doesn't hold the wider community back without depending on one person's GitHub/npm
account.
Again, totally up to you. I just want you to know we appreciate all you've done and you're welcome to join the organization if you like.
run "eslint --ext .js,.jsx,.tsx,.ts ./src --cache --fix"
versions:
[email protected]
[email protected]
[email protected]
[email protected]
I'm seeing some logging related to TSPrivateIdentifier
while testing eslint-plugin-jsx-a11y
.
https://github.com/AriPerkkio/eslint-remote-tester/actions/workflows/lint-eslint-plugin-jsx-a11y.yml
2021-09-09T05:45:12.5777054Z The prop value with an expression type of TSPrivateIdentifier could not be resolved. Please file issue to get this fixed immediately.
2021-09-09T05:45:13.4113986Z The prop value with an expression type of TSPrivateIdentifier could not be resolved. Please file issue to get this fixed immediately.
import React from "react";
export class MyLink extends React.Component {
#urls = { submit: "/submit" };
render() {
return <a href={this.#urls.submit}>Submit</a>;
}
}
{
"root": true,
"env": {
"es6": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "16.13.1"
}
},
"extends": ["plugin:jsx-a11y/recommended"]
}
{
"scripts": {
"lint": "eslint index.tsx"
},
"devDependencies": {
"@typescript-eslint/parser": "^4.31.1",
"eslint": "7.32.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "7.21.5",
"react": "16",
"typescript": "^4.4.3"
}
}
From evcohen/eslint-plugin-jsx-a11y#178, I got an error when running eslint-plugin-jsx-a11y
plugin which uses jsx-ast-utils
.
Here is my configuration:
v3.8.1
[email protected]
C:\Users\Clément\Documents\Work\phoenix\www\node_modules\jsx-ast-utils\lib\values\expressions\index.js:170
throw new Error(errorMessage(type));
^
Error: The prop value with an expression type of undefined could not be resolved.
Please file issue to get this fixed immediately.
at extract (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\jsx-ast-utils\lib\values\expressions\index.js:170:11)
at Object.extractValueFromConditionalExpression [as ConditionalExpression] (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\jsx-ast-utils\lib\values\expressions\ConditionalExpression.js:26:59)
at Object.extract [as JSXExpressionContainer] (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\jsx-ast-utils\lib\values\expressions\index.js:173:21)
at getValue (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\jsx-ast-utils\lib\values\index.js:52:27)
at extractValue (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\jsx-ast-utils\lib\getPropValue.js:24:12)
at getPropValue (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\jsx-ast-utils\lib\getPropValue.js:41:10)
at EventEmitter.JSXOpeningElement (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint-plugin-jsx-a11y\lib\rules\mouse-events-have-key-events.js:35:62)
at emitOne (events.js:95:20)
at EventEmitter.emit (events.js:182:7)
at NodeEventGenerator.enterNode (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\util\node-event-generator.js:40:22)
at CodePathAnalyzer.enterNode (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\code-path-analysis\code-path-analyzer.js:608:23)
at CommentEventGenerator.enterNode (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\util\comment-event-generator.js:97:23)
at Controller.enter (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\eslint.js:898:36)
at Controller.__execute (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\node_modules\estraverse\estraverse.js:397:31)
at Controller.traverse (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\node_modules\estraverse\estraverse.js:501:28)
at Controller.Traverser.controller.traverse (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\util\traverser.js:36:33)
at EventEmitter.module.exports.api.verify (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\eslint.js:895:23)
at processText (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\cli-engine.js:264:31)
at CLIEngine.executeOnText (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\eslint\lib\cli-engine.js:756:26)
at verify (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\gulp-eslint\index.js:20:25)
at Transform._transform (C:\Users\Clément\Documents\Work\phoenix\www\node_modules\gulp-eslint\index.js:70:17)
at Transform._read (_stream_transform.js:167:10)
at Transform._write (_stream_transform.js:155:12)
at doWrite (_stream_writable.js:301:12)
(1.4.1 is just #30)
On node v0.10.33 (the version in Ubuntu trusty/14.04), 1.4.0 works but 1.4.1 gives
> require('jsx-ast-utils')
TypeError: undefined is not a function
at Object.<anonymous> (/tmp/node_modules/jsx-ast-utils/lib/values/expressions/index.js:106:28)
This gets surfaced by eslint-plugin-react as
ESLint couldn't find the plugin "eslint-plugin-react". This can happen for a couple different reasons:
1. If ESLint is installed globally, [...some misleading stuff]
The prop value with an expression type of JSXEmptyExpression could not be resolved. Please file issue to get this fixed immediately.
Until run eslint --fix in my project, I receive this message
Looking at ESLINT github issues, it looks like an error on jsx-ast-utils
The prop value with an expression type of OptionalCallExpression could not be resolved. Please file issue to get this fixed immediately.
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^6.9.0",
"eslint-import-resolver-babel-plugin-root-import": "^1.1.1",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-import-helpers": "^1.0.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.0",
"eslint-plugin-react-hooks": "^1.7.0",
Object.assign
should be native in for the required version range.
src
is compiled away and __tests__
obviously aren't much use so I recommend ignoring them when publishing. I just saw a diff fly by me where we check in node_modules so figured I'd reach out and see it would be possible to ignore them in the future.
I just did a dry run and it takes ~12kb off the .tgz. Looking at the last month of downloads on npm that saves ~17.5gb of bandwidth 😯
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.