Skip to content

Commit

Permalink
Restrict the use of Array.join
Browse files Browse the repository at this point in the history
commit_hash:968a2ce31444a727f3ab13dfa6e635fe95df508b
  • Loading branch information
sabio committed Nov 6, 2024
1 parent 412abdc commit c4d4590
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 4 additions & 0 deletions eslintBannedFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ const bannedFunctions = [
name: 'reduce',
message: 'Use cReduce from utils',
},
{
name: 'join',
message: 'Use arrayJoin from utils',
},
// timeout
{
name: 'setTimeout',
Expand Down
8 changes: 3 additions & 5 deletions src/utils/dom/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { isNativeFunction } from 'src/utils/function/isNativeFunction/isNativeFunction';
import { getNativeFunction } from 'src/utils/function/isNativeFunction/getNativeFunction';
import { ctxPath, isNil, getPath, isFunction } from 'src/utils/object';
import { toArray, cIndexOf, cFind, cSome, arrayJoin } from 'src/utils/array';
import { toArray, cIndexOf, cFind, cSome } from 'src/utils/array';
import { isString, convertToString } from 'src/utils/string';
import { isIE } from 'src/utils/browser';

Expand Down Expand Up @@ -391,10 +391,8 @@ export const INPUT_NODES = [
'SELECT',
'PROGRESS',
];
export const IS_INPUT_REGEX = new RegExp(
`^(${arrayJoin('|', INPUT_NODES)})$`,
'i',
);
// eslint-disable-next-line no-restricted-properties -- the join is evaluated at build time
export const IS_INPUT_REGEX = new RegExp(`^(${INPUT_NODES.join('|')})$`, 'i');
export const isInput = pipe(getNodeName, bindThisForMethodTest(IS_INPUT_REGEX));

const inputTypesWithoutValue = ['submit', 'image', 'hidden'];
Expand Down

0 comments on commit c4d4590

Please sign in to comment.