Skip to content

Commit

Permalink
Remove destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
yacinehmito committed May 9, 2020
1 parent 57c8ebb commit 4f038ed
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/rules/jsx-pascal-case.js
Expand Up @@ -28,9 +28,8 @@ function testPascalCase(name) {
if (!testUpperCase(name.charAt(0))) {
return false;
}
const {length} = name;
let atLeastOneLowerCase = false;
for (let i = 1; i < length; i += 1) {
for (let i = 1; i < name.length; i += 1) {
const char = name.charAt(i);
if (!(char.toLowerCase() !== char.toUpperCase() || testDigit(char))) {
return false;
Expand All @@ -43,18 +42,17 @@ function testPascalCase(name) {
}

function testAllCaps(name) {
const {length} = name;
const firstChar = name.charAt(0);
if (!(testUpperCase(firstChar) || testDigit(firstChar))) {
return false;
}
for (let i = 1; i < length - 1; i += 1) {
for (let i = 1; i < name.length - 1; i += 1) {
const char = name.charAt(i);
if (!(testUpperCase(char) || testDigit(char) || char === '_')) {
return false;
}
}
const lastChar = name.charAt(length - 1);
const lastChar = name.charAt(name.length - 1);
if (!(testUpperCase(lastChar) || testDigit(lastChar))) {
return false;
}
Expand Down

0 comments on commit 4f038ed

Please sign in to comment.