doesn't remove unicode BOM from empty file - Lightrun

文章推薦指數: 80 %
投票人數:10人

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



請為這篇文章評分?