Enforce that source code uses a small subset of Unicode

This commit is contained in:
Alex Dima 2021-11-03 23:34:09 +01:00
parent 3247c31f6a
commit a704a69394
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
33 changed files with 141 additions and 55 deletions

View file

@ -24,6 +24,36 @@ module.exports.all = [
'!**/node_modules/**',
];
module.exports.unicodeFilter = [
'**',
'!**/ThirdPartyNotices.txt',
'!**/LICENSE.{txt,rtf}',
'!LICENSES.chromium.html',
'!**/LICENSE',
'!**/*.{dll,exe,png,bmp,jpg,scpt,cur,ttf,woff,eot,template,ico,icns}',
'!**/test/**',
'!**/*.test.ts',
'!**/*.{d.ts,json,md}',
'!build/win32/**',
'!extensions/markdown-language-features/notebook-out/*.js',
'!extensions/markdown-math/notebook-out/**',
'!extensions/php-language-features/src/features/phpGlobalFunctions.ts',
'!extensions/typescript-language-features/test-workspace/**',
'!extensions/vscode-api-tests/testWorkspace/**',
'!extensions/vscode-api-tests/testWorkspace2/**',
'!extensions/vscode-custom-editor-tests/test-workspace/**',
'!extensions/**/dist/**',
'!extensions/**/out/**',
'!extensions/**/snippets/**',
'!extensions/**/colorize-fixtures/**',
'!src/vs/base/browser/dompurify/**',
'!src/vs/workbench/services/keybinding/browser/keyboardLayouts/**',
];
module.exports.indentationFilter = [
'**',

View file

@ -10,7 +10,7 @@ const vfs = require('vinyl-fs');
const path = require('path');
const fs = require('fs');
const pall = require('p-all');
const { all, copyrightFilter, indentationFilter, jsHygieneFilter, tsHygieneFilter } = require('./filters');
const { all, copyrightFilter, unicodeFilter, indentationFilter, jsHygieneFilter, tsHygieneFilter } = require('./filters');
const copyrightHeaderLines = [
'/*---------------------------------------------------------------------------------------------',
@ -36,10 +36,35 @@ function hygiene(some, linting = true) {
this.emit('data', file);
});
const indentation = es.through(function (file) {
const unicode = es.through(function (file) {
const lines = file.contents.toString('utf8').split(/\r\n|\r|\n/);
file.__lines = lines;
let skipNext = false;
lines.forEach((line, i) => {
if (/allow-any-unicode-next-line/.test(line)) {
skipNext = true;
return;
}
if (skipNext) {
skipNext = false;
return;
}
// Please do not add symbols that resemble ASCII letters!
const m = /([^\t\n\r\x20-\x7E⊃⊇✔✓🎯⚠🛑🔴🚗🚙🚕🎉✨❗⇧⌥⌘×÷¦⋯…↑↓→→←↔⟷·•●◆▼⟪⟫┌└├⏎↩√φ]+)/g.exec(line);
if (m) {
console.error(
file.relative + `(${i + 1},${m.index + 1}): Unexpected unicode character: "${m[0]}". To suppress, use // allow-any-unicode-next-line`
);
errorCount++;
}
});
});
const indentation = es.through(function (file) {
const lines = file.__lines || file.contents.toString('utf8').split(/\r\n|\r|\n/);
file.__lines = lines;
lines.forEach((line, i) => {
if (/^\s*$/.test(line)) {
// empty or whitespace lines are OK
@ -121,12 +146,16 @@ function hygiene(some, linting = true) {
}
const productJsonFilter = filter('product.json', { restore: true });
const unicodeFilterStream = filter(unicodeFilter, { restore: true });
const result = input
.pipe(filter((f) => !f.stat.isDirectory()))
.pipe(productJsonFilter)
.pipe(process.env['BUILD_SOURCEVERSION'] ? es.through() : productJson)
.pipe(productJsonFilter.restore)
.pipe(unicodeFilterStream)
.pipe(unicode)
.pipe(unicodeFilterStream.restore)
.pipe(filter(indentationFilter))
.pipe(indentation)
.pipe(filter(copyrightFilter))

View file

@ -16,7 +16,7 @@ const reAbsoluteWin32 = /^\\+/;
const reAbsolute = path.sep === '/' ? reAbsolutePosix : reAbsoluteWin32;
/**
* Locates given `filePath` on users file system and returns absolute path to it.
* Locates given `filePath` on user's file system and returns absolute path to it.
* This method expects either URL, or relative/absolute path to resource
* @param basePath Base path to use if filePath is not absoulte
* @param filePath File to locate.
@ -43,7 +43,7 @@ function resolveRelative(basePath: string, filePath: string): Promise<string> {
/**
* Resolves absolute file path agaist given editor: tries to find file in every
* parent of editors file
* parent of editor's file
*/
function resolveAbsolute(basePath: string, filePath: string): Promise<string> {
return new Promise((resolve, reject) => {
@ -66,7 +66,7 @@ function resolveAbsolute(basePath: string, filePath: string): Promise<string> {
}
/**
* Check if given file exists and its a file, not directory
* Check if given file exists and it's a file, not directory
*/
function tryFile(file: string): Promise<string> {
return new Promise((resolve, reject) => {

View file

@ -166,6 +166,7 @@ export class GitTimelineProvider implements TimelineProvider {
if (showAuthor) {
item.description = c.authorName;
}
// allow-any-unicode-next-line
item.detail = `${c.authorName} (${c.authorEmail}) — ${c.hash.substr(0, 8)}\n${dateFormatter.format(date)}\n\n${message}`;
const cmd = this.commands.resolveTimelineOpenDiffCommand(item, uri);
@ -191,6 +192,7 @@ export class GitTimelineProvider implements TimelineProvider {
// TODO@eamodio: Replace with a better icon -- reflecting its status maybe?
item.iconPath = new ThemeIcon('git-commit');
item.description = '';
// allow-any-unicode-next-line
item.detail = localize('git.timeline.detail', '{0} — {1}\n{2}\n\n{3}', you, localize('git.index', 'Index'), dateFormatter.format(date), Resource.getStatusText(index.type));
const cmd = this.commands.resolveTimelineOpenDiffCommand(item, uri);
@ -213,6 +215,7 @@ export class GitTimelineProvider implements TimelineProvider {
// TODO@eamodio: Replace with a better icon -- reflecting its status maybe?
item.iconPath = new ThemeIcon('git-commit');
item.description = '';
// allow-any-unicode-next-line
item.detail = localize('git.timeline.detail', '{0} — {1}\n{2}\n\n{3}', you, localize('git.workingTree', 'Working Tree'), dateFormatter.format(date), Resource.getStatusText(working.type));
const cmd = this.commands.resolveTimelineOpenDiffCommand(item, uri);

View file

@ -233,6 +233,7 @@ function slugFromHeading(heading: string): string {
heading.trim()
.toLowerCase()
.replace(/\s+/g, '-') // Replace whitespace with -
// allow-any-unicode-next-line
.replace(/[\]\[\!\'\#\$\%\&\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\_\{\|\}\~\`。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}]/g, '') // Remove known punctuators
.replace(/^\-+/, '') // Remove leading -
.replace(/\-+$/, '') // Remove trailing -

View file

@ -23,6 +23,7 @@ export const githubSlugifier: Slugifier = new class implements Slugifier {
heading.trim()
.toLowerCase()
.replace(/\s+/g, '-') // Replace whitespace with -
// allow-any-unicode-next-line
.replace(/[\]\[\!\'\#\$\%\&\(\)\*\+\,\.\/\:\;\<\=\>\?\@\\\^\_\{\|\}\~\`。,、;:?!…—·ˉ¨‘’“”々~‖∶"'`|〃〔〕〈〉《》「」『』.〖〗【】()[]{}]/g, '') // Remove known punctuators
.replace(/^\-+/, '') // Remove leading -
.replace(/\-+$/, '') // Remove trailing -

View file

@ -90,6 +90,7 @@ function getTagDocumentation(
if (!doc) {
return label;
}
// allow-any-unicode-next-line
return label + (doc.match(/\r\n|\n/g) ? ' \n' + processInlineTags(doc) : `${processInlineTags(doc)}`);
}
}
@ -100,6 +101,7 @@ function getTagDocumentation(
if (!text) {
return label;
}
// allow-any-unicode-next-line
return label + (text.match(/\r\n|\n/g) ? ' \n' + text : `${text}`);
}

View file

@ -48,7 +48,7 @@ function code() {
function code-wsl()
{
HOST_IP=$(echo "" | powershell.exe noprofile -Command "& {(Get-NetIPAddress | Where-Object {\$_.InterfaceAlias -like '*WSL*' -and \$_.AddressFamily -eq 'IPv4'}).IPAddress | Write-Host -NoNewline}")
HOST_IP=$(echo "" | powershell.exe -noprofile -Command "& {(Get-NetIPAddress | Where-Object {\$_.InterfaceAlias -like '*WSL*' -and \$_.AddressFamily -eq 'IPv4'}).IPAddress | Write-Host -NoNewline}")
export DISPLAY="$HOST_IP:0"
# in a wsl shell

View file

@ -54,6 +54,7 @@ export class ModifierLabelProvider {
*/
export const UILabelProvider = new ModifierLabelProvider(
{
// allow-any-unicode-next-line
ctrlKey: '⌃',
shiftKey: '⇧',
altKey: '⌥',

View file

@ -596,43 +596,42 @@ export function containsFullWidthCharacter(str: string): boolean {
export function isFullWidthCharacter(charCode: number): boolean {
// Do a cheap trick to better support wrapping of wide characters, treat them as 2 columns
// http://jrgraphix.net/research/unicode_blocks.php
// 2E80 2EFF CJK Radicals Supplement
// 2F00 2FDF Kangxi Radicals
// 2FF0 2FFF Ideographic Description Characters
// 3000 303F CJK Symbols and Punctuation
// 3040 309F Hiragana
// 30A0 30FF Katakana
// 3100 312F Bopomofo
// 3130 318F Hangul Compatibility Jamo
// 3190 319F Kanbun
// 31A0 31BF Bopomofo Extended
// 31F0 31FF Katakana Phonetic Extensions
// 3200 32FF Enclosed CJK Letters and Months
// 3300 33FF CJK Compatibility
// 3400 4DBF CJK Unified Ideographs Extension A
// 4DC0 4DFF Yijing Hexagram Symbols
// 4E00 9FFF CJK Unified Ideographs
// A000 A48F Yi Syllables
// A490 A4CF Yi Radicals
// AC00 D7AF Hangul Syllables
// [IGNORE] D800 DB7F High Surrogates
// [IGNORE] DB80 DBFF High Private Use Surrogates
// [IGNORE] DC00 DFFF Low Surrogates
// [IGNORE] E000 F8FF Private Use Area
// F900 FAFF CJK Compatibility Ideographs
// [IGNORE] FB00 FB4F Alphabetic Presentation Forms
// [IGNORE] FB50 FDFF Arabic Presentation Forms-A
// [IGNORE] FE00 FE0F Variation Selectors
// [IGNORE] FE20 FE2F Combining Half Marks
// [IGNORE] FE30 FE4F CJK Compatibility Forms
// [IGNORE] FE50 FE6F Small Form Variants
// [IGNORE] FE70 FEFF Arabic Presentation Forms-B
// FF00 FFEF Halfwidth and Fullwidth Forms
// 2E80 - 2EFF CJK Radicals Supplement
// 2F00 - 2FDF Kangxi Radicals
// 2FF0 - 2FFF Ideographic Description Characters
// 3000 - 303F CJK Symbols and Punctuation
// 3040 - 309F Hiragana
// 30A0 - 30FF Katakana
// 3100 - 312F Bopomofo
// 3130 - 318F Hangul Compatibility Jamo
// 3190 - 319F Kanbun
// 31A0 - 31BF Bopomofo Extended
// 31F0 - 31FF Katakana Phonetic Extensions
// 3200 - 32FF Enclosed CJK Letters and Months
// 3300 - 33FF CJK Compatibility
// 3400 - 4DBF CJK Unified Ideographs Extension A
// 4DC0 - 4DFF Yijing Hexagram Symbols
// 4E00 - 9FFF CJK Unified Ideographs
// A000 - A48F Yi Syllables
// A490 - A4CF Yi Radicals
// AC00 - D7AF Hangul Syllables
// [IGNORE] D800 - DB7F High Surrogates
// [IGNORE] DB80 - DBFF High Private Use Surrogates
// [IGNORE] DC00 - DFFF Low Surrogates
// [IGNORE] E000 - F8FF Private Use Area
// F900 - FAFF CJK Compatibility Ideographs
// [IGNORE] FB00 - FB4F Alphabetic Presentation Forms
// [IGNORE] FB50 - FDFF Arabic Presentation Forms-A
// [IGNORE] FE00 - FE0F Variation Selectors
// [IGNORE] FE20 - FE2F Combining Half Marks
// [IGNORE] FE30 - FE4F CJK Compatibility Forms
// [IGNORE] FE50 - FE6F Small Form Variants
// [IGNORE] FE70 - FEFF Arabic Presentation Forms-B
// FF00 - FFEF Halfwidth and Fullwidth Forms
// [https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms]
// of which FF01 - FF5E fullwidth ASCII of 21 to 7E
// [IGNORE] and FF65 - FFDC halfwidth of Katakana and Hangul
// [IGNORE] FFF0 — FFFF Specials
charCode = +charCode; // @perf
// [IGNORE] FFF0 - FFFF Specials
return (
(charCode >= 0x2E80 && charCode <= 0xD7AF)
|| (charCode >= 0xF900 && charCode <= 0xFAFF)

View file

@ -172,6 +172,7 @@ export class TextAreaState {
if (potentialEmojiInput !== null && potentialEmojiInput.length > 0) {
// now we check that this is indeed an emoji
// emojis can grow quite long, so a length check is of no help
// allow-any-unicode-next-line
// e.g. 1F3F4 E0067 E0062 E0065 E006E E0067 E007F ; fully-qualified # 🏴󠁧󠁢󠁥󠁮󠁧󠁿 England
// Oftentimes, emojis use Variation Selector-16 (U+FE0F), so that is a good hint

View file

@ -298,12 +298,10 @@ export interface IEditorOptions {
wrappingStrategy?: 'simple' | 'advanced';
/**
* Configure word wrapping characters. A break will be introduced before these characters.
* Defaults to '([{‘“〈《「『【〔([{「£¥$£¥+'.
*/
wordWrapBreakBeforeCharacters?: string;
/**
* Configure word wrapping characters. A break will be introduced after these characters.
* Defaults to ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」'.
*/
wordWrapBreakAfterCharacters?: string;
/**
@ -4866,10 +4864,12 @@ export const EditorOptions = {
)),
wordWrapBreakAfterCharacters: register(new EditorStringOption(
EditorOption.wordWrapBreakAfterCharacters, 'wordWrapBreakAfterCharacters',
// allow-any-unicode-next-line
' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」',
)),
wordWrapBreakBeforeCharacters: register(new EditorStringOption(
EditorOption.wordWrapBreakBeforeCharacters, 'wordWrapBreakBeforeCharacters',
// allow-any-unicode-next-line
'([{‘“〈《「『【〔([{「£¥$£¥+'
)),
wordWrapColumn: register(new EditorIntOption(

View file

@ -154,6 +154,7 @@ function getClassifier(): CharacterClassifier<CharacterClass> {
if (_classifier === null) {
_classifier = new CharacterClassifier<CharacterClass>(CharacterClass.None);
// allow-any-unicode-next-line
const FORCE_TERMINATION_CHARACTERS = ' \t<>\'\"、。。、,.:;‘〈「『〔([{「」}])〕』」〉’`~…';
for (let i = 0; i < FORCE_TERMINATION_CHARACTERS.length; i++) {
_classifier.set(FORCE_TERMINATION_CHARACTERS.charCodeAt(i), CharacterClass.ForceTermination);

View file

@ -645,8 +645,8 @@ function isControlCharacter(charCode: number): boolean {
// PDF U+202C POP DIRECTIONAL FORMATTING
// LRO U+202D LEFT-TO-RIGHT OVERRIDE
// RLO U+202E RIGHT-TO-LEFT OVERRIDE
// LRI U+2066 LEFTTORIGHT ISOLATE
// RLI U+2067 RIGHTTOLEFT ISOLATE
// LRI U+2066 LEFT-TO-RIGHT ISOLATE
// RLI U+2067 RIGHT-TO-LEFT ISOLATE
// FSI U+2068 FIRST STRONG ISOLATE
// PDI U+2069 POP DIRECTIONAL ISOLATE
// LRM U+200E LEFT-TO-RIGHT MARK

View file

@ -198,9 +198,9 @@ export class SuggestModel implements IDisposable {
this._onCompositionEnd();
}));
this._toDispose.add(this._editor.onDidChangeModelContent(() => {
// only filter completions when the editor isn't
// composing a character, e.g. ¨ + u makes ü but just
// ¨ cannot be used for filtering
// only filter completions when the editor isn't composing a character
// allow-any-unicode-next-line
// e.g. ¨ + u makes ü but just ¨ cannot be used for filtering
if (!editorIsComposing) {
this._refilterCompletionItems();
}

2
src/vs/monaco.d.ts vendored
View file

@ -2957,12 +2957,10 @@ declare namespace monaco.editor {
wrappingStrategy?: 'simple' | 'advanced';
/**
* Configure word wrapping characters. A break will be introduced before these characters.
* Defaults to '([{‘“〈《「『【〔([{「£¥$£¥+'.
*/
wordWrapBreakBeforeCharacters?: string;
/**
* Configure word wrapping characters. A break will be introduced after these characters.
* Defaults to ' \t})]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」'.
*/
wordWrapBreakAfterCharacters?: string;
/**

View file

@ -27,7 +27,7 @@ ExP backend for the VSCode cluster.
https://experimentation.visualstudio.com/Analysis%20and%20Experimentation/_git/AnE.ExP.TAS.TachyonHost.Configuration?path=%2FConfigurations%2Fvscode%2Fvscode.json&version=GBmaster
"X-MSEdge-Market": "detection.market",
"X-FD-Corpnet": "detection.corpnet",
"X-VSCodeAppVersion": "appversion",
"X-VSCode-AppVersion": "appversion",
"X-VSCode-Build": "build",
"X-MSEdge-ClientId": "clientid",
"X-VSCode-ExtensionName": "extensionname",

View file

@ -34,6 +34,6 @@ export class Cache<T> {
if (!Cache.enableDebugLogging) {
return;
}
console.log(`${this.id} cache size ${this._data.size}`);
console.log(`${this.id} cache size - ${this._data.size}`);
}
}

View file

@ -409,6 +409,7 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
},
'window.titleSeparator': {
'type': 'string',
// allow-any-unicode-next-line
'default': isMacintosh ? ' — ' : ' - ',
'markdownDescription': localize("window.titleSeparator", "Separator used by `window.title`.")
},

View file

@ -114,7 +114,7 @@ export interface IEditorDescriptor<T extends IEditorPane> {
export interface IEditorPane extends IComposite {
/**
* An event to notify when the `IEditorControl´ in this
* An event to notify when the `IEditorControl` in this
* editor pane changes.
*
* This can be used for editor panes that are a compound

View file

@ -320,7 +320,7 @@ export class CommentController implements IEditorContribution {
this._commentWidgets.forEach(widget => widget.dispose());
this.editor = null!; // Strict null override nulling out in dispose
this.editor = null!; // Strict null override - nulling out in dispose
}
public onModelChanged(e: IModelChangedEvent): void {

View file

@ -27,6 +27,7 @@ const $ = dom.$;
export class StartDebugActionViewItem extends BaseActionViewItem {
// allow-any-unicode-next-line
private static readonly SEPARATOR = '─────────';
private container!: HTMLElement;

View file

@ -1548,7 +1548,9 @@ export class ExtensionEditor extends EditorPane {
$('td', undefined, l.id),
$('td', undefined, l.name),
$('td', undefined, ...join(l.extensions.map(ext => $('code', undefined, ext)), ' ')),
// allow-any-unicode-next-line
$('td', undefined, document.createTextNode(l.hasGrammar ? '✔︎' : '—')),
// allow-any-unicode-next-line
$('td', undefined, document.createTextNode(l.hasSnippets ? '✔︎' : '—'))
))
)

View file

@ -44,6 +44,7 @@
}
.monaco-workbench .hover-language-status > .element > .left > .detail:not(:empty)::before {
/* allow-any-unicode-next-line */
content: '';
padding: 0 4px;
opacity: 0.6;

View file

@ -271,6 +271,7 @@ export class OutputEditor extends AbstractTextResourceEditor {
class SwitchOutputActionViewItem extends SelectActionViewItem {
// allow-any-unicode-next-line
private static readonly SEPARATOR = '─────────';
private outputChannels: IOutputChannelDescriptor[] = [];

View file

@ -1181,6 +1181,7 @@ export class SettingsEditor2 extends EditorPane {
const query = this.searchWidget.getValue().trim();
this.delayedFilterLogging.cancel();
// allow-any-unicode-next-line
await this.triggerSearch(query.replace(//g, ' '));
if (query && this.searchResultModel) {

View file

@ -520,6 +520,7 @@ export function settingKeyToDisplayFormat(key: string, groupId = ''): { category
function wordifyKey(key: string): string {
key = key
// allow-any-unicode-next-line
.replace(/\.([a-z0-9])/g, (_, p1) => ` ${p1.toUpperCase()}`) // Replace dot with spaced '>'
.replace(/([a-z0-9])([A-Z])/g, '$1 $2') // Camel case to spacing, fooBar => foo Bar
.replace(/^[a-z]/g, match => match.toUpperCase()) // Upper casing all first letters, foo => Foo

View file

@ -47,6 +47,7 @@ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteA
import { SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService';
import { isAbsolute } from 'vs/base/common/path';
// allow-any-unicode-next-line
export const switchTerminalActionViewItemSeparator = '─────────';
export const switchTerminalShowTabsTitle = localize('showTerminalTabs', "Show Tabs");
@ -980,6 +981,7 @@ export function registerTerminalActions() {
const cwdLabel = labelService.getUriLabel(URI.file(term.cwd));
return {
label: term.title,
// allow-any-unicode-next-line
detail: term.workspaceName ? `${term.workspaceName}${cwdLabel}` : cwdLabel,
description: term.pid ? String(term.pid) : '',
term

View file

@ -418,6 +418,7 @@ const terminalConfiguration: IConfigurationNode = {
[TerminalSettingId.WordSeparators]: {
description: localize('terminal.integrated.wordSeparators', "A string containing all characters to be considered word separators by the double click to select word feature."),
type: 'string',
// allow-any-unicode-next-line
default: ' ()[]{}\',"`─‘’'
},
[TerminalSettingId.EnableFileLinks]: {

View file

@ -3,4 +3,5 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// allow-any-unicode-next-line
export const flatTestItemDelimiter = ' ';

View file

@ -1021,12 +1021,19 @@ export class MacLinuxKeyboardMapper implements IKeyboardMapper {
private static _redirectCharCode(charCode: number): number {
switch (charCode) {
// allow-any-unicode-next-line
case CharCode.U_IDEOGRAPHIC_FULL_STOP: return CharCode.Period; // CJK 。 => .
// allow-any-unicode-next-line
case CharCode.U_LEFT_CORNER_BRACKET: return CharCode.OpenSquareBracket; // CJK 「 => [
// allow-any-unicode-next-line
case CharCode.U_RIGHT_CORNER_BRACKET: return CharCode.CloseSquareBracket; // CJK 」 => ]
// allow-any-unicode-next-line
case CharCode.U_LEFT_BLACK_LENTICULAR_BRACKET: return CharCode.OpenSquareBracket; // CJK 【 => [
// allow-any-unicode-next-line
case CharCode.U_RIGHT_BLACK_LENTICULAR_BRACKET: return CharCode.CloseSquareBracket; // CJK 】 => ]
// allow-any-unicode-next-line
case CharCode.U_FULLWIDTH_SEMICOLON: return CharCode.Semicolon; // CJK => ;
// allow-any-unicode-next-line
case CharCode.U_FULLWIDTH_COMMA: return CharCode.Comma; // CJK => ,
}
return charCode;

View file

@ -25,6 +25,7 @@ export const getFileResults = (
text = new TextDecoder('utf-16be').decode(bytes);
} else {
text = new TextDecoder('utf8').decode(bytes);
// allow-any-unicode-next-line
if (text.slice(0, 1000).includes('<27>') && bytes.includes(0)) {
return [];
}

View file

@ -71,13 +71,13 @@ export interface RelativePattern {
/**
* A file glob pattern to match file paths against. This can either be a glob pattern string
* (like `**/*.{ts,js}` or `*.{ts,js}`) or a [relative pattern](#RelativePattern).
* (like `** /*.{ts,js}` without space before / or `*.{ts,js}`) or a [relative pattern](#RelativePattern).
*
* Glob patterns can have the following syntax:
* * `*` to match one or more characters in a path segment
* * `?` to match on one character in a path segment
* * `**` to match any number of path segments, including none
* * `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript and JavaScript files)
* * `{}` to group conditions (e.g. `** /*.{ts,js}` without space before / matches all TypeScript and JavaScript files)
* * `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, )
* * `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
*