unicode-bom - ESLint - Pluggable JavaScript Linter
文章推薦指數: 80 %
The Unicode Byte Order Mark (BOM) is used to specify whether code units are big endian or little endian. That is, whether the most significant or least ... Skiptomaincontent Versions VersionSwitcher SelectingaversionwilltakeyoutothechosenversionoftheESLintdocs. Version HEAD v8.25.0 Index Search Resultswillbeshownandupdatedasyoutype. Clearsearch UserGuide GettingStarted Configuring ConfigurationFiles(New) ConfigurationFiles ConfiguringLanguageOptions ConfiguringRules ConfiguringPlugins IgnoringCode CommandLineInterface Rules Formatters Integrations Migratingtov8.x DeveloperGuide Architecture GettingtheSourceCode SetUpaDevelopmentEnvironment RuntheTests WorkingwithRules WorkingwithPlugins WorkingwithCustomFormatters WorkingwithCustomParsers ShareableConfigs Node.jsAPI Contributing MaintainerGuide ManagingIssues ReviewingPullRequests ManagingReleases Governance unicode-bom RequireordisallowUnicodebyteordermark(BOM) 🛠Fixable Someproblemsreportedbythisruleareautomaticallyfixablebythe--fixcommandlineoption TableofContents RuleDetails Options always never WhenNotToUseIt Version Resources TheUnicodeByteOrderMark(BOM)isusedtospecifywhethercodeunitsarebig endianorlittleendian.Thatis,whetherthemostsignificantorleast significantbytescomefirst.UTF-8doesnotrequireaBOMbecausebyteordering doesnotmatterwhencharactersareasinglebyte.SinceUTF-8isthedominant encodingoftheweb,wemake"never"thedefaultoption. RuleDetails Ifthe"always"optionisused,thisrulerequiresthatfilesalwaysbegin withtheUnicodeBOMcharacterU+FEFF.If"never"isused,filesmustnever beginwithU+FEFF. Options Thisrulehasastringoption: "always"filesmustbeginwiththeUnicodeBOM "never"(default)filesmustnotbeginwiththeUnicodeBOM always Exampleofcorrectcodeforthisrulewiththe"always"option: /*eslintunicode-bom:["error","always"]*/U+FEFFvarabc; Exampleofincorrectcodeforthisrulewiththe"always"option: /*eslintunicode-bom:["error","always"]*/varabc; never Exampleofcorrectcodeforthisrulewiththedefault"never"option: /*eslintunicode-bom:["error","never"]*/varabc; Exampleofincorrectcodeforthisrulewiththe"never"option: /*eslintunicode-bom:["error","never"]*/U+FEFFvarabc; WhenNotToUseIt IfyouusesomeUTF-16orUTF-32filesandyouwanttoallowafileto optionallybeginwithaUnicodeBOM,youshouldturnthisruleoff. Version ThisrulewasintroducedinESLintv2.11.0. Resources Rulesource Testssource Editthispage TableofContents RuleDetails Options always never WhenNotToUseIt Version Resources
延伸文章資訊
- 1Unicode簽名bom:計算機編程術語 - 中文百科知識
計算機編程術語,BOM 是Byte Order Mark 的縮寫。是UTF編碼方案里用於標識編碼的標準標記,在UTF-16里本來是FF FE,變成UTF-8就成了EF BB BF。這個標記是可選...
- 2Byte order mark - Wikipedia
The byte order mark (BOM) is a particular usage of the special Unicode character, U+FEFF BYTE ORD...
- 3「带BOM 的UTF-8」和「无BOM 的UTF-8」有什么区别?网页 ...
UTF-8 不需要BOM,尽管Unicode 标准允许在UTF-8 中使用BOM。 所以不含BOM 的UTF-8 才是标准形式,在UTF-8 文件中放置BOM 主要是微软的习惯(顺便提一下:把带...
- 4What's the difference between UTF-8 and UTF-8 with BOM?
The Unicode Standard permits the BOM in UTF-8, but does not require or recommend its use. Byte or...
- 5「帶BOM 的UTF-8」和「無BOM 的UTF-8」有什麼區別
utf-16才需要加bom。因為它是按unicode順序編碼,在BMP範圍內是二位元組,需要識別是大或小位元組序。