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 - ESLint - Pluggable JavaScript Linter
The Unicode Byte Order Mark (BOM) is used to specify whether code units are big endian or little ...
- 2unicode-bom - Rules - ESLint中文文档
Unicode 字节顺序标记(BOM) 用来指定代码单元是高字节序还是低字节序。也就是说,是高位在前还是低位在前。UTF-8 不需要BOM 来表明字节顺序,因为单个字节并不影响字节 ...
- 3「带BOM 的UTF-8」和「无BOM 的UTF-8」有什么区别?网页 ...
UTF-8 不需要BOM,尽管Unicode 标准允许在UTF-8 中使用BOM。 所以不含BOM 的UTF-8 才是标准形式,在UTF-8 文件中放置BOM 主要是微软的习惯(顺便提一下:把带...
- 4Python: 關於Unicode 的BOM - 傑克! 真是太神奇了! - 痞客邦
註一: 主要是因為可使用的編碼數只有256 個, 而不同code page 之間會對應不同的符號, 進而無法得知資訊的原始樣貌. 關於Unicode 的BOM (Byte Order Mark)...
- 5What'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...