jsx-eslint / eslint-plugin-react

React-specific linting rules for ESLint
MIT License
8.99k stars 2.77k forks source link

Results of weekly scheduled smoke test #3371

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

Something went wrong.

Click to expand ``` HttpError: Validation Failed: {"resource":"Issue","code":"custom","field":"body","message":"body is too long (maximum is 65536 characters)"} at /index.js:2869:26 at processTicksAndRejections (internal/process/task_queues.js:95:5) at async GithubClient.requestAndRetry (/index.js:5786:12) at async GithubClient.createIssue (/index.js:5819:5) at async /index.js:5977:7 ```
ljharb commented 2 years ago

cc @AriPerkkio on the "too long" error again.

I see failures like:

Repository: eManPrague/frui.ts
[535](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:536)
  Rule: react/jsx-key
[536](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:537)
  Message: Cannot read property 'type' of undefined
[537](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:538)
  Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/eManPrague/frui.ts/packages/validation/src/manualEntityValidator.ts:14
[538](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:539)
  Rule: "react/jsx-key"
[539](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:540)
  Path: eManPrague/frui.ts/packages/validation/src/manualEntityValidator.ts
[540](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:541)
  Link: https://github.com/eManPrague/frui.ts/blob/HEAD/packages/validation/src/manualEntityValidator.ts#L14
[541](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:542)

[542](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:543)
    12 |
[543](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:544)
    13 | export default class ManualEntityValidator<TEntity = any> extends EntityValidatorBase<TEntity> {
[544](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:545)
  > 14 |   protected readonly validationResults = observable.map<PropertyName<TEntity>, ValidationResult[]>();
[545](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:546)
    15 |
[546](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:547)
    16 |   constructor(isVisible = false, protected configuration: ManualEntityValidatorConfiguration = DefaultConfiguration) {
[547](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:548)
    17 |     super(isVisible);
TypeError: Cannot read property 'type' of undefined
[611](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:612)
  Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/qiekub/map/src/data/iD/modules/behavior/copy.js:50
[612](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:613)
  Rule: "react/jsx-key"
[613](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:614)
      at Object.isFunctionLikeExpression (/github/workspace/lib/util/ast.js:223:15)
[614](https://github.com/jsx-eslint/eslint-plugin-react/runs/8053911183?check_suite_focus=true#step:6:615)
      at CallExpression[callee.type="MemberExpression"][callee.property.name="map"],       CallExpression[callee.type="OptionalMemberExpression"][callee.property.name="map"],       OptionalCallExpression[callee.type="MemberExpression"][callee.property.name="map"],       OptionalCallExpression[callee.type="OptionalMemberExpression"][callee.property.name="map"] (/github/workspace/lib/rules/jsx-key.js:230:22)

I see at least 3 jsx-sort-props errors but no stack trace from those.

AriPerkkio commented 2 years ago

Something is still crashing even though I thought this was fixed in https://github.com/AriPerkkio/eslint-remote-tester-run-action/pull/27.

Here are results from logs. react/jsx-key seems related to https://github.com/jsx-eslint/eslint-plugin-react/pull/3369 (👋 @sjarva )

- Repository: stryker-mutator/stryker-js - Rule: react/jsx-key - Message: Cannot read property 'type' of undefined - Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/stryker-mutator/stryker-js/packages/instrumenter/testResources/instrumenter/optional-chains.ts:4 - Rule: "react/jsx-key" - Path: stryker-mutator/stryker-js/packages/instrumenter/testResources/instrumenter/optional-chains.ts - Link: https://github.com/stryker-mutator/stryker-js/blob/HEAD/packages/instrumenter/testResources/instrumenter/optional-chains.ts#L4 ```js 2 | const baz = foo?.bar?.()?.[1] ?? 'qux'; 3 | > 4 | qux()?.map() 5 | 6 | const directiveRanges = comments?.map(tryParseTSDirective) 7 | ``` Error: ``` TypeError: Cannot read property 'type' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/stryker-mutator/stryker-js/packages/instrumenter/testResources/instrumenter/optional-chains.ts:4 Rule: "react/jsx-key" at Object.isFunctionLikeExpression (/github/workspace/lib/util/ast.js:223:15) at CallExpression[callee.type="MemberExpression"][callee.property.name="map"], CallExpression[callee.type="OptionalMemberExpression"][callee.property.name="map"], OptionalCallExpression[callee.type="MemberExpression"][callee.property.name="map"], OptionalCallExpression[callee.type="OptionalMemberExpression"][callee.property.name="map"] (/github/workspace/lib/rules/jsx-key.js:230:22) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) at /github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach () at Object.emit (/github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (/github/workspace/node_modules/eslint/lib/linter/node-event-generator.js:297:26) at NodeEventGenerator.applySelectors (/github/workspace/node_modules/eslint/lib/linter/node-event-generator.js:326:22) at NodeEventGenerator.enterNode (/github/workspace/node_modules/eslint/lib/linter/node-event-generator.js:340:14) at CodePathAnalyzer.enterNode (/github/workspace/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23) ``` - Repository: canfie1d/complete-react-scripts - Rule: react/jsx-key - Message: Cannot read property 'type' of undefined - Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/canfie1d/complete-react-scripts/packages/react-dev-utils/evalSourceMapMiddleware.js:10 - Rule: "react/jsx-key" - Path: canfie1d/complete-react-scripts/packages/react-dev-utils/evalSourceMapMiddleware.js - Link: https://github.com/canfie1d/complete-react-scripts/blob/HEAD/packages/react-dev-utils/evalSourceMapMiddleware.js#L10 ```js 8 | 9 | function base64SourceMap(source) { > 10 | const base64 = Buffer.from(JSON.stringify(source.map()), 'utf8').toString( 11 | 'base64' 12 | ); 13 | return `data:application/json;charset=utf-8;base64,${base64}`; ``` Error: ``` TypeError: Cannot read property 'type' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/canfie1d/complete-react-scripts/packages/react-dev-utils/evalSourceMapMiddleware.js:10 Rule: "react/jsx-key" at Object.isFunctionLikeExpression (/github/workspace/lib/util/ast.js:223:15) at CallExpression[callee.type="MemberExpression"][callee.property.name="map"], CallExpression[callee.type="OptionalMemberExpression"][callee.property.name="map"], OptionalCallExpression[callee.type="MemberExpression"][callee.property.name="map"], OptionalCallExpression[callee.type="OptionalMemberExpression"][callee.property.name="map"] (/github/workspace/lib/rules/jsx-key.js:230:22) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) at /github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach () at Object.emit (/github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38) at NodeEventGenerator.applySelector (/github/workspace/node_modules/eslint/lib/linter/node-event-generator.js:297:26) at NodeEventGenerator.applySelectors (/github/workspace/node_modules/eslint/lib/linter/node-event-generator.js:326:22) at NodeEventGenerator.enterNode (/github/workspace/node_modules/eslint/lib/linter/node-event-generator.js:340:14) at CodePathAnalyzer.enterNode (/github/workspace/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23) ```
AriPerkkio commented 2 years ago

@ljharb Looks like we are still using v2 here. The fix is in v3. 😄 There should be no breaking changes between the majors for this project.

https://github.com/jsx-eslint/eslint-plugin-react/blob/2d973469f580415d5ac9768b2c609ee1eb76b909/.github/workflows/smoke-test.yml#L22

sjarva commented 2 years ago

Thanks for tagging me @AriPerkkio!

Yeah, there seems to be a problem also in the jsx-key rule, I'm taking a look at this and will (hopefully) open a fixing PR.

ljharb commented 2 years ago

I’ve got a fix ready for that one.

ljharb commented 2 years ago

0771bc1b is that fix. Rerunning the smoke test now.

github-actions[bot] commented 2 years ago

Detected 6 ESLint reports and/or crashes. Scanned 4979 repositories.

Rules:

Click to expand ## Rule: react/jsx-sort-props - Message: `Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/focusreactive/storybook-graphql-kit/addon/PanelUI/index.js:35 Rule: "react/jsx-sort-props"` - Path: `focusreactive/storybook-graphql-kit/addon/PanelUI/index.js` - [Link](https://github.com/focusreactive/storybook-graphql-kit/blob/HEAD/addon/PanelUI/index.js#L35) ```js 33 | 34 | > 35 | 36 | 37 | 38 | ); ``` ``` TypeError: Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/focusreactive/storybook-graphql-kit/addon/PanelUI/index.js:35 Rule: "react/jsx-sort-props" at getGroupsOfSortableAttributes (/github/workspace/lib/rules/jsx-sort-props.js:185:58) at generateFixerFunction (/github/workspace/lib/rules/jsx-sort-props.js:237:35) at reportNodeAttribute (/github/workspace/lib/rules/jsx-sort-props.js:332:10) at /github/workspace/lib/rules/jsx-sort-props.js:515:13 at Array.reduce () at JSXOpeningElement (/github/workspace/lib/rules/jsx-sort-props.js:410:25) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) at /github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach () at Object.emit (/github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38) ``` ## Rule: react/jsx-sort-props - Message: `Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/palmetto/palmetto-components/src/components/Spinner/Spinner.tsx:45 Rule: "react/jsx-sort-props"` - Path: `palmetto/palmetto-components/src/components/Spinner/Spinner.tsx` - [Link](https://github.com/palmetto/palmetto-components/blob/HEAD/src/components/Spinner/Spinner.tsx#L45) ```tsx 43 | circle 44 | > 45 | ``` ``` TypeError: Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/palmetto/palmetto-components/src/components/Spinner/Spinner.tsx:45 Rule: "react/jsx-sort-props" at getGroupsOfSortableAttributes (/github/workspace/lib/rules/jsx-sort-props.js:185:58) at generateFixerFunction (/github/workspace/lib/rules/jsx-sort-props.js:237:35) at reportNodeAttribute (/github/workspace/lib/rules/jsx-sort-props.js:332:10) at /github/workspace/lib/rules/jsx-sort-props.js:515:13 at Array.reduce () at JSXOpeningElement (/github/workspace/lib/rules/jsx-sort-props.js:410:25) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) at /github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach () at Object.emit (/github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38) ``` ## Rule: react/jsx-sort-props - Message: `Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/dnbexperience/eufemia/packages/dnb-eufemia/src/components/global-status/stories/GlobalStatus.stories.js:247 Rule: "react/jsx-sort-props"` - Path: `dnbexperience/eufemia/packages/dnb-eufemia/src/components/global-status/stories/GlobalStatus.stories.js` - [Link](https://github.com/dnbexperience/eufemia/blob/HEAD/packages/dnb-eufemia/src/components/global-status/stories/GlobalStatus.stories.js#L247) ```js 245 | > 246 |
> 247 | ) at JSXOpeningElement (/github/workspace/lib/rules/jsx-sort-props.js:410:25) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) ``` ## Rule: react/jsx-sort-props - Message: `Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/chariguanaCode/competitive-debugging-system/frontend/src/layout/Header/screens/HeaderBar/HeaderBar.tsx:187 Rule: "react/jsx-sort-props"` - Path: `chariguanaCode/competitive-debugging-system/frontend/src/layout/Header/screens/HeaderBar/HeaderBar.tsx` - [Link](https://github.com/chariguanaCode/competitive-debugging-system/blob/HEAD/frontend/src/layout/Header/screens/HeaderBar/HeaderBar.tsx#L187) ```tsx 185 | 186 | > 187 | ) at JSXOpeningElement (/github/workspace/lib/rules/jsx-sort-props.js:410:25) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) at /github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach () at Object.emit (/github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38) ``` ## Rule: react/jsx-sort-props - Message: `Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/domino14/liwords/liwords-ui/src/gameroom/analyzer.tsx:833 Rule: "react/jsx-sort-props"` - Path: `domino14/liwords/liwords-ui/src/gameroom/analyzer.tsx` - [Link](https://github.com/domino14/liwords/blob/HEAD/liwords-ui/src/gameroom/analyzer.tsx#L833) ```tsx 831 | if (props.includeCard) { 832 | return ( > 833 | ) at JSXOpeningElement (/github/workspace/lib/rules/jsx-sort-props.js:410:25) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) at /github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach () at Object.emit (/github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38) ``` ## Rule: react/jsx-sort-props - Message: `Cannot read property 'range' of undefined Occurred while linting /github/workspace/node_modules/eslint-remote-tester/.cache-eslint-remote-tester/domino14/liwords/liwords-ui/src/tournament/director_tools/helptip_label.tsx:13 Rule: "react/jsx-sort-props"` - Path: `domino14/liwords/liwords-ui/src/tournament/director_tools/helptip_label.tsx` - [Link](https://github.com/domino14/liwords/blob/HEAD/liwords-ui/src/tournament/director_tools/helptip_label.tsx#L13) ```tsx 11 | <> 12 | {props.labelText} > 13 | 14 | ) at JSXOpeningElement (/github/workspace/lib/rules/jsx-sort-props.js:410:25) at ruleErrorHandler (/github/workspace/node_modules/eslint/lib/linter/linter.js:1114:28) at /github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:58 at Array.forEach () at Object.emit (/github/workspace/node_modules/eslint/lib/linter/safe-emitter.js:45:38) ```
ljharb commented 2 years ago

On this one, avoiding the crash is easy, but making the test case have correct output seems to have unveiled a larger bug (cc @ROSSROSALES)

ROSSROSALES commented 2 years ago

@ljharb Thanks for tagging me. I will take a look at this as soon as I can to find a fix. It seems like the rule is finding >1 line comments in between two props of a multi-lined component and block comments allocated at the end of the last prop of a multi-lined component. Currently, I believe it should be able to sort the last prop of a multi-lined component if it is a line comment // and block comments are sorted if on the same line.

Nokel81 commented 2 years ago

https://github.com/jsx-eslint/eslint-plugin-react/commit/0771bc1b5b7e75216543e5ca93c1d99a5152c759 seems to have fixed https://github.com/jsx-eslint/eslint-plugin-react/issues/3373 which I just reported since it seems that observable.map is being thought of as something like Array.prototype.map.

ljharb commented 2 years ago

@ROSSROSALES the issue i'm seeing is that it's autofixing to <ReactJson collapseStringsAfterLength={60} collapsed collapseStringsAfterLength={60} onEdit={onEdit} /* onDelete={onEdit} */ /> instead of <ReactJson collapseStringsAfterLength={60} collapsed={4} src={rowResult} name="data" onEdit={onEdit} /* onDelete={onEdit} */ /> (note the change of collapsed to a boolean)

ROSSROSALES commented 2 years ago

@ROSSROSALES the issue i'm seeing is that it's autofixing to <ReactJson collapseStringsAfterLength={60} collapsed collapseStringsAfterLength={60} onEdit={onEdit} /* onDelete={onEdit} */ /> instead of <ReactJson collapseStringsAfterLength={60} collapsed={4} src={rowResult} name="data" onEdit={onEdit} /* onDelete={onEdit} */ /> (note the change of collapsed to a boolean)

I tried a fix to the issue. I added the quoted test case. However, instead of <ReactJson collapseStringsAfterLength={60} collapsed={4} src={rowResult} name="data" onEdit={onEdit} /* onDelete={onEdit} */ />, it should sort to <ReactJson collapseStringsAfterLength={60} collapsed={4} name="data" src={rowResult} onEdit={onEdit} /* onDelete={onEdit} */ />

ljharb commented 2 years ago

oh sure, yes - it's the change to a boolean that i'm concerned about :-)

ROSSROSALES commented 2 years ago

I believe the fix should fix the boolean problem! But if I am not understanding the issue correctly please let me know or if the fix was not appropriate. I will try my best to solve this issue.