Skip to content

Commit

Permalink
Update dependency @ota-meshi/eslint-plugin to ^0.2.0 (#67)
Browse files Browse the repository at this point in the history
* Update dependency @ota-meshi/eslint-plugin to ^0.2.0

* update

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: yosuke ota <otameshiyo23@gmail.com>
  • Loading branch information
3 people authored Mar 6, 2021
1 parent bf1af21 commit 6000294
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions lib/utils/casing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ function capitalize(str: string) {
* @param {string} str
*/
function hasSymbols(str: string) {
return /[!"#%&'()*+,./:;<=>?@[\\\]^`{|}]/u.exec(str) // without " ", "$", "-" and "_"
return /[!"#%&'()*+,./:;<=>?@[\\\]^`{|}]/u.test(str) // without " ", "$", "-" and "_"
}

/**
* Checks whether the given string has upper.
* @param {string} str
*/
function hasUpper(str: string) {
return /[A-Z]/u.exec(str)
return /[A-Z]/u.test(str)
}

/**
* Checks whether the given string has lower.
* @param {string} str
*/
function hasLower(str: string) {
return /[a-z]/u.exec(str)
return /[a-z]/u.test(str)
}

/**
Expand All @@ -70,8 +70,8 @@ export function isKebabCase(str: string): boolean {
if (
hasUpper(str) ||
hasSymbols(str) ||
/^-/u.exec(str) || // starts with hyphen is not kebab-case
/_|--|\s/u.exec(str)
str.startsWith("-") || // starts with hyphen is not kebab-case
/_|--|\s/u.test(str)
) {
return false
}
Expand All @@ -96,7 +96,7 @@ export function snakeCase(str: string): string {
* @param {string} str
*/
export function isSnakeCase(str: string): boolean {
if (hasUpper(str) || hasSymbols(str) || /-|__|\s/u.exec(str)) {
if (hasUpper(str) || hasSymbols(str) || /-|__|\s/u.test(str)) {
return false
}
return true
Expand All @@ -120,7 +120,7 @@ export function screamingSnakeCase(str: string): string {
* @param {string} str
*/
export function isScreamingSnakeCase(str: string): boolean {
if (hasLower(str) || hasSymbols(str) || /-|__|\s/u.exec(str)) {
if (hasLower(str) || hasSymbols(str) || /-|__|\s/u.test(str)) {
return false
}
return true
Expand Down Expand Up @@ -149,8 +149,8 @@ export function camelCase(str: string): string {
export function isCamelCase(str: string): boolean {
if (
hasSymbols(str) ||
/^[A-Z]/u.exec(str) ||
/-|_|\s/u.exec(str) // kebab or snake or space
/^[A-Z]/u.test(str) ||
/-|_|\s/u.test(str) // kebab or snake or space
) {
return false
}
Expand All @@ -173,8 +173,8 @@ export function pascalCase(str: string): string {
export function isPascalCase(str: string): boolean {
if (
hasSymbols(str) ||
/^[a-z]/u.exec(str) ||
/-|_|\s/u.exec(str) // kebab or snake or space
/^[a-z]/u.test(str) ||
/-|_|\s/u.test(str) // kebab or snake or space
) {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"eslint": "^5.0.0 || >=6.0.0"
},
"devDependencies": {
"@ota-meshi/eslint-plugin": "^0.1.0",
"@ota-meshi/eslint-plugin": "^0.2.0",
"@types/eslint": "^7.2.0",
"@types/eslint-scope": "^3.7.0",
"@types/eslint-visitor-keys": "^1.0.0",
Expand Down

0 comments on commit 6000294

Please sign in to comment.