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
延伸文章資訊
- 1位元組順序記號 - 维基百科
位元組順序記號(英語:byte-order mark,BOM)是位於碼點 U+FEFF 的統一碼字符的名称。 ... 每個Unicode編碼(包括Unicode標準以外的編碼,如UTF-7,見下...
- 2unicode-bom - Rules - ESLint中文文档
Unicode 字节顺序标记(BOM) 用来指定代码单元是高字节序还是低字节序。也就是说,是高位在前还是低位在前。UTF-8 不需要BOM 来表明字节顺序,因为单个字节并不影响字节 ...
- 3What'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...
- 4這些是什麼? BOM/UFT-8有簽章/withBOM/withoutBOM - iT 邦幫忙
這是另一篇關於BOM之亂的描述. Windows 作業系統不少程式(像是記事本),預設會對UTF-8 檔案加上BOM 而Linux 則避免 ...
- 5unicode-bom - ESLint - Pluggable JavaScript Linter
The Unicode Byte Order Mark (BOM) is used to specify whether code units are big endian or little ...