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
延伸文章資訊
- 1doesn't remove unicode BOM from empty file - Lightrun
Prettier 1.18.2 No playground. For example using CLI : prettier --write test.js. Input: Empty fil...
- 2remove utf-8 bom with javascript - gists · GitHub
remove utf-8 BOM from ressource "res". // res.charCodeAt(0) === 0xFEFF | res.charCodeAt(0) === 65...
- 3Removing BOM characters from AJAX-posted string
The characters are in the middle of strings I want to simply remove them all. The data comes from...
- 4Node.js去除文字檔案BOM頭
Node.js去除文字檔案BOM頭 · BOM · BOM新增 · BOM移除 · 參考.
- 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...