Skip to content

Commit 2e056ee

Browse files
committed
chore(eslint): sort props and interfaces
1 parent 87b4dac commit 2e056ee

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"eslint:recommended",
1010
"plugin:@typescript-eslint/recommended",
1111
"plugin:@typescript-eslint/recommended-requiring-type-checking",
12+
"plugin:typescript-sort-keys/recommended",
1213
"standard",
1314
"standard-jsx",
1415
"standard-react",
@@ -17,5 +18,9 @@
1718
"env": {
1819
"browser": true,
1920
"jest": true
21+
},
22+
"rules": {
23+
"react/jsx-sort-props": "error",
24+
"react/sort-prop-types": "error"
2025
}
2126
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
"eslint-plugin-node": "^11.1.0",
9999
"eslint-plugin-promise": "^6.0.1",
100100
"eslint-plugin-react": "^7.31.8",
101+
"eslint-plugin-typescript-sort-keys": "^2.1.0",
101102
"npm-run-all": "^4.1.5",
102103
"postcss": "^8.4.16",
103104
"prettier": "^2.7.1",

src/index.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ export interface ReactInputVerificationCodeProps {
1616
onChange?: (data: string) => void;
1717
onCompleted?: (data: string) => void;
1818
placeholder?: string;
19-
value?: string;
20-
dataCy?: string;
2119
type?: 'alphanumeric' | 'number';
20+
value?: string;
2221
}
2322

2423
const ReactInputVerificationCode = ({
@@ -27,9 +26,8 @@ const ReactInputVerificationCode = ({
2726
onChange = () => null,
2827
onCompleted = () => null,
2928
placeholder = '·',
30-
value: defaultValue = '',
31-
dataCy = 'verification-code',
3229
type = 'number',
30+
value: defaultValue = '',
3331
}: ReactInputVerificationCodeProps) => {
3432
/**
3533
* generate a new array, map through it
@@ -213,25 +211,17 @@ const ReactInputVerificationCode = ({
213211

214212
return (
215213
<div className='ReactInputVerificationCode-container'>
216-
{/* <S.Input
217-
autoComplete='one-time-code'
218-
type='text'
219-
activeIndex={activeIndex}
220-
data-cy={`${dataCy}-otc-input`}
221-
/> */}
222-
223214
{inputsRefs.map((ref, i) => (
224215
<input
225-
key={i}
226-
ref={ref}
227216
className='ReactInputVerificationCode-item'
228-
data-cy={`${dataCy}-${i}-item`}
229-
value={values[i]}
217+
key={i}
230218
onChange={(event) => onInputChange(event, i)}
231219
onFocus={() => onInputFocus(i)}
232220
onKeyDown={(event) => onInputKeyDown(event, i)}
233221
onPaste={(event) => onInputPaste(event, i)}
234222
placeholder={placeholder}
223+
ref={ref}
224+
value={values[i]}
235225
/>
236226
))}
237227
</div>

yarn.lock

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,6 +2950,13 @@
29502950
semver "^7.3.7"
29512951
tsutils "^3.21.0"
29522952

2953+
"@typescript-eslint/experimental-utils@^5.0.0":
2954+
version "5.38.0"
2955+
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.38.0.tgz#84e593a66138d75c11e85a0dbe9a8a6a013bf3cb"
2956+
integrity sha512-kzXBRfvGlicgGk4CYuRUqKvwc2s3wHXNssUWWJU18bhMRxriFm3BZWyQ6vEHBRpEIMKB6b7MIQHO+9lYlts19w==
2957+
dependencies:
2958+
"@typescript-eslint/utils" "5.38.0"
2959+
29532960
"@typescript-eslint/parser@^5.38.0":
29542961
version "5.38.0"
29552962
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.38.0.tgz#5a59a1ff41a7b43aacd1bb2db54f6bf1c02b2ff8"
@@ -5956,6 +5963,15 @@ eslint-plugin-react@^7.31.8:
59565963
semver "^6.3.0"
59575964
string.prototype.matchall "^4.0.7"
59585965

5966+
eslint-plugin-typescript-sort-keys@^2.1.0:
5967+
version "2.1.0"
5968+
resolved "https://registry.yarnpkg.com/eslint-plugin-typescript-sort-keys/-/eslint-plugin-typescript-sort-keys-2.1.0.tgz#f51764518aa512d83df9ba68ab2520b7b85ece2d"
5969+
integrity sha512-ET7ABypdz19m47QnKynzNfWPi4CTNQ5jQQC1X5d0gojIwblkbGiCa5IilsqzBTmqxZ0yXDqKBO/GBkBFQCOFsg==
5970+
dependencies:
5971+
"@typescript-eslint/experimental-utils" "^5.0.0"
5972+
json-schema "^0.4.0"
5973+
natural-compare-lite "^1.4.0"
5974+
59595975
eslint-scope@5.1.1, eslint-scope@^5.1.1:
59605976
version "5.1.1"
59615977
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
@@ -8201,6 +8217,11 @@ json-schema-traverse@^0.4.1:
82018217
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
82028218
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
82038219

8220+
json-schema@^0.4.0:
8221+
version "0.4.0"
8222+
resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5"
8223+
integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==
8224+
82048225
json-stable-stringify-without-jsonify@^1.0.1:
82058226
version "1.0.1"
82068227
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
@@ -8975,6 +8996,11 @@ nanomatch@^1.2.9:
89758996
snapdragon "^0.8.1"
89768997
to-regex "^3.0.1"
89778998

8999+
natural-compare-lite@^1.4.0:
9000+
version "1.4.0"
9001+
resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4"
9002+
integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==
9003+
89789004
natural-compare@^1.4.0:
89799005
version "1.4.0"
89809006
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"

0 commit comments

Comments
 (0)