doesn't remove unicode BOM from empty file - Lightrun
文章推薦指數: 80 %
Prettier 1.18.2 No playground. For example using CLI : prettier --write test.js. Input: Empty file with unicode BOM. Output: Empty file with unicode BOM. doesn'tremoveunicodeBOMfromemptyfile(OriginalURL) Prettier1.18.2 Noplayground. ForexampleusingCLI: prettier--writetest.js Input: EmptyfilewithunicodeBOM Output: EmptyfilewithunicodeBOM Expectedbehavior: EmptyfilewithoutunicodeBOM IfyouaddcontentBOMwillberemove. .editorconfig #Formoreinformationpleasevisithttp://editorconfig.org root=true [*] indent_style=space indent_size=2 end_of_line=lf charset=utf-8 trim_trailing_whitespace=true insert_final_newline=true TryLightruntocollectproductionstacktraceswithoutstoppingyourJavaapplications!Comments(8)byalexander-akait+2@lydellifoundwerecommenddisableunicode-bomrulehttps://github.com/prettier/eslint-config-prettier/blob/master/index.js#L89,butidon’tfindcodethatremovingoraddingBOM. WerespectBOMfromsource(i.e.ifBOMexistswereturnthis,butifnoBOMwedon’taddthis)https://github.com/prettier/prettier/blob/master/src/main/core.js#L356. Whywerecommendremovedisablerule? Alsoithinkwecanimprovethis-autoremoving/addingBOMbasedoneditorconfig. Forexampleifyouhave charset=utf-8 weremoveBOM Ifyouhave charset=utf-8-bom weaddBOM, itisnothard byMaxim-Mazurok ifyouhave charset=utf-8 weremoveBOM Ifyouhave charset=utf-8-bom weaddBOM Forsomereason,Iassumedthatprettieralreadydoesthat,andwassurprisedtofindoutthatitdoesn’t… ItkeepsEOLconsistentwith.editorconfig,sowhywouldn’titdothesameforcharset? bylydellYeah,ifPrettierpreservesBOM/no-BOMoffilesthenitisabugineslint-config-prettiertodisablethatrule byalexander-akait@fiskeritisveryweird,becauseeslint-config-prettierrecommendtodisableunicode-bomrule,butwedon’ttouchBOM,soweshouldnotrecommendtodisableit byfiskerIdon’tthinkit’sbug. [email protected]?Otherwisewestillrespectfromsource. byalexander-akait@lydellithinkweshouldremovethisrulerightnow,afterweimplementlogicabove bylydell"unicode-bom":"off",hasbeenpresentineslint-config-prettiersincetheinitialcommit.Ithinkit’sjustanoversight,orPrettierusedtodealwithBOMdifferentlyinJanuary2017,Ican’tremember. PreviousissueWarningswhendebugginginVSCodeNextissue[FeatureRequest]Allowdependencylengthtochangeinhooks
延伸文章資訊
- 1remove utf-8 bom with javascript - gists · GitHub
remove utf-8 BOM from ressource "res". // res.charCodeAt(0) === 0xFEFF | res.charCodeAt(0) === 65...
- 2Bom | npm.io
strip-bom, remove-bom-buffer, remove-bom-stream, strip-bom-stream, ... Creates CycloneDX Software...
- 3Node.js去除文字檔案BOM頭
Node.js去除文字檔案BOM頭 · BOM · BOM新增 · BOM移除 · 參考.
- 4remove utf8 bom javascript-掘金
remove utf8 bom javascript技术、学习、经验文章掘金开发者社区搜索结果。掘金是一个帮助开发者成长的社区,remove utf8 bom javascript技术文章由稀土...
- 5How to remove the BOM from UTF-8 files
So, if it's not needed, the code below allows removing the BOM from the UTF-8 files. JavaScript/J...