-
Notifications
You must be signed in to change notification settings - Fork 27k
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
next/script eslint-plugin-next Cannot read property 'name' of undefined #32178
Comments
My bad, it did happen, only I was looking for the error in the wrong place. |
The issue is here: next.js/packages/eslint-plugin-next/lib/rules/inline-script-id.js Lines 35 to 38 in c004322
|
@balazsorban44 are you picking this up? (If not, I would like to give a shot) |
please do! |
Hey, I am trying to run an example app ( |
What I did was:
VSCode shows this in the Output: [Error - 12:49:38 AM] TypeError: Cannot read property 'name' of undefined
Occurred while linting .../pages/index.js:9
Rule: "@next/next/inline-script-id"
at .../node_modules/@next/eslint-plugin-next/lib/rules/inline-script-id.js:35:43
at Array.some (<anonymous>)
at JSXElement (.../node_modules/@next/eslint-plugin-next/lib/rules/inline-script-id.js:34:22)
at ruleErrorHandler (.../node_modules/eslint/lib/linter/linter.js:1076:28)
at .../node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (.../node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (.../node_modules/eslint/lib/linter/node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (.../node_modules/eslint/lib/linter/node-event-generator.js:326:22)
at NodeEventGenerator.enterNode (.../node_modules/eslint/lib/linter/node-event-generator.js:340:14) |
Not able to reproduce.
Is there anything I am missing? |
Try running TypeError: Cannot read properties of undefined (reading 'name')
Occurred while linting .../pages/index.js:9
Rule: "@next/next/inline-script-id"
error Command failed with exit code 1. |
i think changing
- const attributes = node.openingElement.attributes
+ const attributes = node.openingElement.attributes.filter(attribute => attribute.type === 'JSXAttribute')
|
Might be related (if not, I'll open a new issue), but I'm receiving the same error but in what looks like a totally different context: $ npx eslint --parser-options=project:tsconfig.lint.json src
Oops! Something went wrong! :(
ESLint: 8.4.1
TypeError: Cannot read properties of null (reading 'name')
Occurred while linting /repos/.ergodark/xunn.at/src/pages/api/[shortId].ts:9
Rule: "@next/next/no-page-custom-font"
at ExportDefaultDeclaration (/repos/.ergodark/xunn.at/node_modules/@next/eslint-plugin-next/lib/rules/no-page-custom-font.js:46:56)
at ruleErrorHandler (/repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/linter.js:1076:28)
at /repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/safe-emitter.js:45:58
at Array.forEach (<anonymous>)
at Object.emit (/repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
at NodeEventGenerator.applySelector (/repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/node-event-generator.js:297:26)
at NodeEventGenerator.applySelectors (/repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/node-event-generator.js:326:22)
at NodeEventGenerator.enterNode (/repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/node-event-generator.js:340:14)
at CodePathAnalyzer.enterNode (/repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:795:23)
at /repos/.ergodark/xunn.at/node_modules/eslint/lib/linter/linter.js:1107:32 It's doubly strange because I'm mostly doing API stuff so there is no frontend code yet, let alone any code having to do with fonts. Removing |
@Xunnamius I believe that is already fixed #32251 |
* node dep upgrades * turn off next command that generates error on 12.0.7 see: vercel/next.js#32178
fixes #32178 the `inline-script-id` eslint rule crashed when encountering a `JSXSpreadAttribute`. this pr fixes that, and also handles `id` being passed via the spreaded object. ## Bug - [x] Related issues linked using `fixes #number` - [x] ~~Integration~~ Unit tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
…l#32421) fixes vercel#32178 the `inline-script-id` eslint rule crashed when encountering a `JSXSpreadAttribute`. this pr fixes that, and also handles `id` being passed via the spreaded object. ## Bug - [x] Related issues linked using `fixes #number` - [x] ~~Integration~~ Unit tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint`
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
12.0.7
What version of Node.js are you using?
14.17.5
What browser are you using?
Chrome
What operating system are you using?
Windows
How are you deploying your application?
next start
Describe the Bug
When I'm using spread operator for
<Script>
tag, I got an error:Expected Behavior
I expected to have no eslint errors
To Reproduce
<Script {...{ strategy: 'beforeInteractive' }} id={'test'} />
The text was updated successfully, but these errors were encountered: