Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Bug in src/embed.js @getParser(node, opts)

Đang mở
#810 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

blocked

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)

Screenshot 2024-08-12 at 11 23 49 AM

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

Screenshot 2024-08-12 at 11 27 04 AM

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
Ngôn ngữ chính
JavaScript
Star
278
Fork
46
Merge trung bình
1 phút
Pull request đã merge (30 ngày)
13

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của prettier/plugin-xml

Tất cả issue của prettier/plugin-xml

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.