Skip to content

Commit

Permalink
infra(unicorn): no-array-push-push (#2454)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Oct 9, 2023
1 parent 72bf57d commit 350dfbf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ module.exports = defineConfig({
'unicorn/import-style': 'off',
'unicorn/no-array-callback-reference': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-array-push-push': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/no-for-loop': 'off',
Expand Down
14 changes: 7 additions & 7 deletions scripts/generateLocales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ async function generateLocalesIndexFile(
content.push(
...modules.map(
(module) => `import ${escapeImport(name, module)} from './${module}';`
)
);

content.push(`\nconst ${name}${fieldType} = {
),
'',
`const ${name}${fieldType} = {
${modules.map((module) => `${escapeField(name, module)},`).join('\n')}
};\n`);

content.push(`export default ${name};`);
};`,
'',
`export default ${name};`
);

writeFileSync(
resolve(path, 'index.ts'),
Expand Down
12 changes: 8 additions & 4 deletions src/modules/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,10 @@ export class SimpleHelpersModule {
if (range[0].indexOf('-') === -1) {
// handle non-ranges
if (isCaseInsensitive && isNaN(Number(range[0]))) {
rangeCodes.push(range[0].toUpperCase().charCodeAt(0));
rangeCodes.push(range[0].toLowerCase().charCodeAt(0));
rangeCodes.push(
range[0].toUpperCase().charCodeAt(0),
range[0].toLowerCase().charCodeAt(0)
);
} else {
rangeCodes.push(range[0].charCodeAt(0));
}
Expand All @@ -481,8 +483,10 @@ export class SimpleHelpersModule {
for (let i = min; i <= max; i++) {
if (isCaseInsensitive && isNaN(Number(String.fromCharCode(i)))) {
const ch = String.fromCharCode(i);
rangeCodes.push(ch.toUpperCase().charCodeAt(0));
rangeCodes.push(ch.toLowerCase().charCodeAt(0));
rangeCodes.push(
ch.toUpperCase().charCodeAt(0),
ch.toLowerCase().charCodeAt(0)
);
} else {
rangeCodes.push(i);
}
Expand Down

0 comments on commit 350dfbf

Please sign in to comment.