prettier / prettier/plugin-xml
Bug in src/embed.js @getParser(node, opts)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 278
- Forks
- 46
- Ø Merge
- 1 Min.
- Gemergte PRs (30 T.)
- 13
Beschreibung
Stack trace
TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at getParser (file:///Users/shane/repos/brm/node_modules/@prettier/plugin-xml/src/embed.js:56:21)
at embed (file:///Users/shane/repos/brm/node_modules/@prettier/plugin-xml/src/embed.js:121:18)
at recurse (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:22194:20)
at AstPath.each (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:20791:9)
at recurse (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:22189:16)
at AstPath.call (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:20753:14)
at recurse (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:22191:16)
at AstPath.each (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:20791:9)
at recurse (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:22189:16)
at AstPath.call (file:///Users/shane/repos/brm/node_modules/prettier/index.mjs:20753:14)
console.log(node)
and the function is attempting to destructured some properties that don't exist
const { Name, attribute } = node;
let parser = Name.toLowerCase();
thus we get the undefined TypeError
details of my machine
prettier config
{
"trailingComma": "es5",
"tabWidth": 2,
"printWidth": 120,
"semi": false,
"singleQuote": false,
"language": "postgresql",
"keywordCase": "upper",
"embeddedSqlTags": ["db.sql", "sql"],
"embeddedSqlComments": ["db.sql", "sql"],
"overrides": [
{
"files": ["*.md", "*.y?(a)ml"],
"options": {
"tabWidth": 2
}
}
],
"plugins": ["prettier-plugin-embed", "prettier-plugin-sql", "@prettier/plugin-xml"]
}
command to reproduce
npx prettier --check . --log-level warn
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Start with src/embed.js, especially getParser and the destructuring shown in the report. Run npx prettier --check . --log-level warn using the reported plugin configuration to reproduce the failure. Done means the reported input no longer raises the undefined toLowerCase TypeError, with a regression check for the case found.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100