Skip to content

Commit

Permalink
chore: enable unicorn/no-length-as-slice-end (#9915)
Browse files Browse the repository at this point in the history
  • Loading branch information
abrahamguo authored Sep 3, 2024
1 parent 15a76ea commit 70fb505
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 14 deletions.
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export default tseslint.config(
// eslint-plugin-unicorn
//

'unicorn/no-length-as-slice-end': 'error',
'unicorn/no-lonely-if': 'error',
'unicorn/no-typeof-undefined': 'error',
'unicorn/no-useless-spread': 'error',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-sonarjs": "^1.0.4",
"eslint-plugin-unicorn": "^50.0.1",
"eslint-plugin-unicorn": "^55.0.0",
"execa": "7.2.0",
"glob": "^10.3.12",
"globals": "^15.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/website/src/components/ast/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function getNodeType(value: unknown): ParentNodeType {

export function ucFirst(value: string): string {
if (value.length > 0) {
return value.slice(0, 1).toUpperCase() + value.slice(1, value.length);
return value.slice(0, 1).toUpperCase() + value.slice(1);
}
return value;
}
Expand Down
89 changes: 77 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/helper-validator-identifier@npm:^7.22.20, @babel/helper-validator-identifier@npm:^7.24.6, @babel/helper-validator-identifier@npm:^7.24.7":
"@babel/helper-validator-identifier@npm:^7.24.5, @babel/helper-validator-identifier@npm:^7.24.6, @babel/helper-validator-identifier@npm:^7.24.7":
version: 7.24.7
resolution: "@babel/helper-validator-identifier@npm:7.24.7"
checksum: 6799ab117cefc0ecd35cd0b40ead320c621a298ecac88686a14cffceaac89d80cdb3c178f969861bf5fa5e4f766648f9161ea0752ecfe080d8e89e3147270257
Expand Down Expand Up @@ -5877,7 +5877,7 @@ __metadata:
eslint-plugin-react-hooks: ^4.6.0
eslint-plugin-simple-import-sort: ^10.0.0
eslint-plugin-sonarjs: ^1.0.4
eslint-plugin-unicorn: ^50.0.1
eslint-plugin-unicorn: ^55.0.0
execa: 7.2.0
glob: ^10.3.12
globals: ^15.0.0
Expand Down Expand Up @@ -7238,6 +7238,20 @@ __metadata:
languageName: node
linkType: hard

"browserslist@npm:^4.23.3":
version: 4.23.3
resolution: "browserslist@npm:4.23.3"
dependencies:
caniuse-lite: ^1.0.30001646
electron-to-chromium: ^1.5.4
node-releases: ^2.0.18
update-browserslist-db: ^1.1.0
bin:
browserslist: cli.js
checksum: 7906064f9970aeb941310b2fcb8b4ace4a1b50aa657c986677c6f1553a8cabcc94ee9c5922f715baffbedaa0e6cf0831b6fed7b059dde6873a4bfadcbe069c7e
languageName: node
linkType: hard

"bser@npm:2.1.1":
version: 2.1.1
resolution: "bser@npm:2.1.1"
Expand Down Expand Up @@ -7407,6 +7421,13 @@ __metadata:
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001646":
version: 1.0.30001655
resolution: "caniuse-lite@npm:1.0.30001655"
checksum: 3739c8f6d0fb55cff3c631d28c4fdafc81ab28756ce17a373428042c06f84a5877288d89fbe41be5ac494dd5092dca38ab91c9304e81935b9f2938419d2c23b3
languageName: node
linkType: hard

"ccount@npm:^2.0.0":
version: 2.0.1
resolution: "ccount@npm:2.0.1"
Expand Down Expand Up @@ -8110,6 +8131,15 @@ __metadata:
languageName: node
linkType: hard

"core-js-compat@npm:^3.37.0":
version: 3.38.1
resolution: "core-js-compat@npm:3.38.1"
dependencies:
browserslist: ^4.23.3
checksum: a0a5673bcd59f588f0cd0b59cdacd4712b82909738a87406d334dd412eb3d273ae72b275bdd8e8fef63fca9ef12b42ed651be139c7c44c8a1acb423c8906992e
languageName: node
linkType: hard

"core-js-pure@npm:^3.30.2":
version: 3.36.0
resolution: "core-js-pure@npm:3.36.0"
Expand Down Expand Up @@ -9204,6 +9234,13 @@ __metadata:
languageName: node
linkType: hard

"electron-to-chromium@npm:^1.5.4":
version: 1.5.13
resolution: "electron-to-chromium@npm:1.5.13"
checksum: f18ac84dd3bf9a200654a6a9292b9ec4bced0cf9bd26cec9941b775f4470c581c9d043e70b37a124d9752dcc0f47fc96613d52b2defd8e59632852730cb418b9
languageName: node
linkType: hard

"emittery@npm:^0.13.1":
version: 0.13.1
resolution: "emittery@npm:0.13.1"
Expand Down Expand Up @@ -9674,6 +9711,13 @@ __metadata:
languageName: node
linkType: hard

"escalade@npm:^3.1.2":
version: 3.2.0
resolution: "escalade@npm:3.2.0"
checksum: 47b029c83de01b0d17ad99ed766347b974b0d628e848de404018f3abee728e987da0d2d370ad4574aa3d5b5bfc368754fd085d69a30f8e75903486ec4b5b709e
languageName: node
linkType: hard

"escape-goat@npm:^4.0.0":
version: 4.0.0
resolution: "escape-goat@npm:4.0.0"
Expand Down Expand Up @@ -9935,29 +9979,29 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-unicorn@npm:^50.0.1":
version: 50.0.1
resolution: "eslint-plugin-unicorn@npm:50.0.1"
"eslint-plugin-unicorn@npm:^55.0.0":
version: 55.0.0
resolution: "eslint-plugin-unicorn@npm:55.0.0"
dependencies:
"@babel/helper-validator-identifier": ^7.22.20
"@babel/helper-validator-identifier": ^7.24.5
"@eslint-community/eslint-utils": ^4.4.0
"@eslint/eslintrc": ^2.1.4
ci-info: ^4.0.0
clean-regexp: ^1.0.0
core-js-compat: ^3.34.0
core-js-compat: ^3.37.0
esquery: ^1.5.0
globals: ^15.7.0
indent-string: ^4.0.0
is-builtin-module: ^3.2.1
jsesc: ^3.0.2
pluralize: ^8.0.0
read-pkg-up: ^7.0.1
regexp-tree: ^0.1.27
regjsparser: ^0.10.0
semver: ^7.5.4
semver: ^7.6.1
strip-indent: ^3.0.0
peerDependencies:
eslint: ">=8.56.0"
checksum: 6d3d2057e65b696e4897bff142437cbea76f3a86c18253cebdec40a9fb69061f698e22a9d0795244f21173f2389e38e9b41ca10afae9de91632682c104dcee2b
checksum: c925254406e687c5caaf7e019c083107b9d309569c78ec8d32e5d7c539cfb6331b5f88dc647c35e26f07493c287d39970f05fa0279787ba86bfc6edd7701bd8c
languageName: node
linkType: hard

Expand Down Expand Up @@ -11142,7 +11186,7 @@ __metadata:
languageName: node
linkType: hard

"globals@npm:^15.0.0":
"globals@npm:^15.0.0, globals@npm:^15.7.0":
version: 15.9.0
resolution: "globals@npm:15.9.0"
checksum: 32c4470ffcc26db3ddbc579ddf968b74c26462d1a268039980c2fa2e107090fd442a7a7445d953dc4ee874f68846e713066c5a8e63d146fd9349cd1fc5a6f63d
Expand Down Expand Up @@ -15312,6 +15356,13 @@ __metadata:
languageName: node
linkType: hard

"node-releases@npm:^2.0.18":
version: 2.0.18
resolution: "node-releases@npm:2.0.18"
checksum: ef55a3d853e1269a6d6279b7692cd6ff3e40bc74947945101138745bfdc9a5edabfe72cb19a31a8e45752e1910c4c65c77d931866af6357f242b172b7283f5b3
languageName: node
linkType: hard

"nopt@npm:^6.0.0":
version: 6.0.0
resolution: "nopt@npm:6.0.0"
Expand Down Expand Up @@ -17869,7 +17920,7 @@ __metadata:
languageName: node
linkType: hard

"semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.3":
"semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.1, semver@npm:^7.6.3":
version: 7.6.3
resolution: "semver@npm:7.6.3"
bin:
Expand Down Expand Up @@ -19763,6 +19814,20 @@ __metadata:
languageName: node
linkType: hard

"update-browserslist-db@npm:^1.1.0":
version: 1.1.0
resolution: "update-browserslist-db@npm:1.1.0"
dependencies:
escalade: ^3.1.2
picocolors: ^1.0.1
peerDependencies:
browserslist: ">= 4.21.0"
bin:
update-browserslist-db: cli.js
checksum: 7b74694d96f0c360f01b702e72353dc5a49df4fe6663d3ee4e5c628f061576cddf56af35a3a886238c01dd3d8f231b7a86a8ceaa31e7a9220ae31c1c1238e562
languageName: node
linkType: hard

"update-notifier@npm:^6.0.2":
version: 6.0.2
resolution: "update-notifier@npm:6.0.2"
Expand Down

0 comments on commit 70fb505

Please sign in to comment.