Skip to content

Commit

Permalink
[lint] Remove no-control-regex (#1258)
Browse files Browse the repository at this point in the history
* [lint] Remove no-control-regex

This commit enables 'no-control-regex' rule
and removes the errors accordingly.

ONE-vscode-DCO-1.0-Signed-off-by: dayo09 <[email protected]>

* Add comments

ONE-vscode-DCO-1.0-Signed-off-by: dayo09 <[email protected]>

* Update src/View/PasswordQuickInput.ts

* format

ONE-vscode-DCO-1.0-Signed-off-by: dayo09 <[email protected]>
  • Loading branch information
dayo09 authored Sep 8, 2022
1 parent f2a75f0 commit 5fd09de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off",
"no-control-regex": "warn",
"no-extra-semi": "warn",
"no-case-declarations": "warn",
"no-useless-escape" : "warn",
Expand Down
14 changes: 13 additions & 1 deletion src/View/PasswordQuickInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,20 @@

import * as vscode from 'vscode';

// NOTE ASCII characters have codes ranging from u+0000 to u+007f
// NOTE
//
// u+0000-u+001f: control ascii codes, ascii (ALLOWED) *
// u+0020-u+007f: printable ascii codes, ascii (ALLOWED)
// u+0080-u+00ff: extended ascii codes, extended ascii (NOT ALLOWED) **
//
// *By experience, Linux os takes all extended ascii characters(u+0000-u+00ff) for passwords, even
// controll asciis, whereas 'eslint' recommends not to use the regex which includes any control
// ascii. Therefore, we allow users to put control ascii codes.
//
// **By experience, the passwords including extended ascii characters are not working when loging in
// to remote vscode. Therefore, here we allow only 'ascii characters'(0x00-0x7f).
function containsNonAscii(str: string): boolean {
// eslint-disable-next-line no-control-regex
return !/^[\u0000-\u007f]*$/.test(str);
}

Expand Down

0 comments on commit 5fd09de

Please sign in to comment.