Skip to content

Commit 6000294

Browse files
renovate[bot]renovate-botota-meshi
authored
Update dependency @ota-meshi/eslint-plugin to ^0.2.0 (#67)
* Update dependency @ota-meshi/eslint-plugin to ^0.2.0 * update Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: yosuke ota <[email protected]>
1 parent bf1af21 commit 6000294

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

lib/utils/casing.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ function capitalize(str: string) {
3030
* @param {string} str
3131
*/
3232
function hasSymbols(str: string) {
33-
return /[!"#%&'()*+,./:;<=>?@[\\\]^`{|}]/u.exec(str) // without " ", "$", "-" and "_"
33+
return /[!"#%&'()*+,./:;<=>?@[\\\]^`{|}]/u.test(str) // without " ", "$", "-" and "_"
3434
}
3535

3636
/**
3737
* Checks whether the given string has upper.
3838
* @param {string} str
3939
*/
4040
function hasUpper(str: string) {
41-
return /[A-Z]/u.exec(str)
41+
return /[A-Z]/u.test(str)
4242
}
4343

4444
/**
4545
* Checks whether the given string has lower.
4646
* @param {string} str
4747
*/
4848
function hasLower(str: string) {
49-
return /[a-z]/u.exec(str)
49+
return /[a-z]/u.test(str)
5050
}
5151

5252
/**
@@ -70,8 +70,8 @@ export function isKebabCase(str: string): boolean {
7070
if (
7171
hasUpper(str) ||
7272
hasSymbols(str) ||
73-
/^-/u.exec(str) || // starts with hyphen is not kebab-case
74-
/_|--|\s/u.exec(str)
73+
str.startsWith("-") || // starts with hyphen is not kebab-case
74+
/_|--|\s/u.test(str)
7575
) {
7676
return false
7777
}
@@ -96,7 +96,7 @@ export function snakeCase(str: string): string {
9696
* @param {string} str
9797
*/
9898
export function isSnakeCase(str: string): boolean {
99-
if (hasUpper(str) || hasSymbols(str) || /-|__|\s/u.exec(str)) {
99+
if (hasUpper(str) || hasSymbols(str) || /-|__|\s/u.test(str)) {
100100
return false
101101
}
102102
return true
@@ -120,7 +120,7 @@ export function screamingSnakeCase(str: string): string {
120120
* @param {string} str
121121
*/
122122
export function isScreamingSnakeCase(str: string): boolean {
123-
if (hasLower(str) || hasSymbols(str) || /-|__|\s/u.exec(str)) {
123+
if (hasLower(str) || hasSymbols(str) || /-|__|\s/u.test(str)) {
124124
return false
125125
}
126126
return true
@@ -149,8 +149,8 @@ export function camelCase(str: string): string {
149149
export function isCamelCase(str: string): boolean {
150150
if (
151151
hasSymbols(str) ||
152-
/^[A-Z]/u.exec(str) ||
153-
/-|_|\s/u.exec(str) // kebab or snake or space
152+
/^[A-Z]/u.test(str) ||
153+
/-|_|\s/u.test(str) // kebab or snake or space
154154
) {
155155
return false
156156
}
@@ -173,8 +173,8 @@ export function pascalCase(str: string): string {
173173
export function isPascalCase(str: string): boolean {
174174
if (
175175
hasSymbols(str) ||
176-
/^[a-z]/u.exec(str) ||
177-
/-|_|\s/u.exec(str) // kebab or snake or space
176+
/^[a-z]/u.test(str) ||
177+
/-|_|\s/u.test(str) // kebab or snake or space
178178
) {
179179
return false
180180
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"eslint": "^5.0.0 || >=6.0.0"
5959
},
6060
"devDependencies": {
61-
"@ota-meshi/eslint-plugin": "^0.1.0",
61+
"@ota-meshi/eslint-plugin": "^0.2.0",
6262
"@types/eslint": "^7.2.0",
6363
"@types/eslint-scope": "^3.7.0",
6464
"@types/eslint-visitor-keys": "^1.0.0",

0 commit comments

Comments
 (0)