Skip to content

Commit

Permalink
refactor: Enable strict-boolean-expressions (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
fb55 authored Apr 4, 2022
1 parent 57dd4ee commit ce2b30b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@
}
},
"rules": {
"@typescript-eslint/prefer-for-of": 0,
"@typescript-eslint/member-ordering": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-unused-vars": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-unused-vars": [
2,
{ "argsIgnorePattern": "^_" }
],
"@typescript-eslint/strict-boolean-expressions": 2,
"@typescript-eslint/no-use-before-define": [
2,
{ "functions": false }
Expand Down
2 changes: 1 addition & 1 deletion src/decode_codepoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const decodeMap = new Map([

const fromCodePoint =
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, node/no-unsupported-features/es-builtins
String.fromCodePoint ||
String.fromCodePoint ??
function (codePoint: number): string {
let output = "";

Expand Down
4 changes: 2 additions & 2 deletions src/encode-trie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export function encodeHTMLTrieRe(regExp: RegExp, str: string): string {
typeof next.n === "number"
? next.n === str.charCodeAt(i + 1)
? next.o
: null
: undefined
: next.n.get(str.charCodeAt(i + 1));

if (value) {
if (value !== undefined) {
ret += str.substring(lastIdx, i) + value;
lastIdx = regExp.lastIndex += 1;
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function encodeXML(str: string): string {
const char = str.charCodeAt(i);
const next = xmlCodeMap.get(char);

if (next) {
if (next !== undefined) {
ret += str.substring(lastIdx, i) + next;
lastIdx = i + 1;
} else {
Expand Down

0 comments on commit ce2b30b

Please sign in to comment.