Skip to content

Commit 5d3a676

Browse files
renovate[bot]renovate-botota-meshi
authored
Update dependency @ota-meshi/eslint-plugin to ^0.3.0 (#72)
* Update dependency @ota-meshi/eslint-plugin to ^0.3.0 * fix Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: yosuke ota <[email protected]>
1 parent 57097db commit 5d3a676

13 files changed

+16
-16
lines changed

lib/rules/no-binary-numeric-literals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { AST } from "jsonc-eslint-parser"
22
import { createRule } from "../utils"
33

4-
const binaryNumericLiteralPattern = /^0[bB]/u
4+
const binaryNumericLiteralPattern = /^0[Bb]/u
55

66
export default createRule("no-binary-numeric-literals", {
77
meta: {

lib/rules/no-escape-sequence-in-identifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default createRule("no-escape-sequence-in-identifier", {
3434
*/
3535
function verify(node: AST.JSONNode) {
3636
const escapeMatcher = new PatternMatcher(
37-
/\\u\{[\da-fA-F]+\}|\\u\d{4}/gu,
37+
/\\u\{[\dA-Fa-f]+\}|\\u\d{4}/gu,
3838
)
3939
const text = sourceCode.text.slice(...node.range)
4040
for (const match of escapeMatcher.execAll(text)) {

lib/rules/no-hexadecimal-numeric-literals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { AST } from "jsonc-eslint-parser"
22
import { createRule } from "../utils"
33

4-
const hexadecimalNumericLiteralPattern = /^0[xX]/u
4+
const hexadecimalNumericLiteralPattern = /^0[Xx]/u
55

66
export default createRule("no-hexadecimal-numeric-literals", {
77
meta: {

lib/rules/no-octal-numeric-literals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { AST } from "jsonc-eslint-parser"
22
import { createRule } from "../utils"
33

4-
const octalNumericLiteralPattern = /^0[oO]/u
4+
const octalNumericLiteralPattern = /^0[Oo]/u
55

66
export default createRule("no-octal-numeric-literals", {
77
meta: {

lib/rules/no-unicode-codepoint-escapes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default createRule("no-unicode-codepoint-escapes", {
4242
*/
4343
function verify(node: AST.JSONNode) {
4444
const codePointEscapeMatcher = new PatternMatcher(
45-
/\\u\{[\da-fA-F]+\}/gu,
45+
/\\u\{[\dA-Fa-f]+\}/gu,
4646
)
4747
const text = sourceCode.text.slice(...node.range)
4848
for (const match of codePointEscapeMatcher.execAll(text)) {

lib/rules/valid-json-number.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isNumberIdentifier } from "jsonc-eslint-parser"
44
import type { RuleListener } from "../types"
55
import { createRule } from "../utils"
66

7-
const nonDecimalNumericLiteralPattern = /^0[oOxXbB\d]/u
7+
const nonDecimalNumericLiteralPattern = /^0[\dBOXbox]/u
88

99
/**
1010
* Checks if the given string is valid number as JSON.

lib/utils/casing.ts

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

3636
/**
@@ -150,7 +150,7 @@ export function isCamelCase(str: string): boolean {
150150
if (
151151
hasSymbols(str) ||
152152
/^[A-Z]/u.test(str) ||
153-
/-|_|\s/u.test(str) // kebab or snake or space
153+
/[\s\-_]/u.test(str) // kebab or snake or space
154154
) {
155155
return false
156156
}
@@ -174,7 +174,7 @@ export function isPascalCase(str: string): boolean {
174174
if (
175175
hasSymbols(str) ||
176176
/^[a-z]/u.test(str) ||
177-
/-|_|\s/u.test(str) // kebab or snake or space
177+
/[\s\-_]/u.test(str) // kebab or snake or space
178178
) {
179179
return false
180180
}

lib/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function createRule(
3737
{
3838
target(lang: string | null, block: V.VElement) {
3939
if (lang) {
40-
return /^json(?:c|5)?$/i.test(lang)
40+
return /^json[5c]?$/i.test(lang)
4141
}
4242
return block.name === "i18n"
4343
},

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.2.0",
61+
"@ota-meshi/eslint-plugin": "^0.3.0",
6262
"@types/eslint": "^7.2.0",
6363
"@types/eslint-scope": "^3.7.0",
6464
"@types/eslint-visitor-keys": "^1.0.0",

tests/lib/auto-rule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe("auto rule", () => {
2222
fixtures[filename] = code
2323
const invalidCode = code
2424
.split("\n")
25-
.map((line) => line.replace(/^[ \t]+/u, ""))
25+
.map((line) => line.replace(/^[\t ]+/u, ""))
2626
.join("\n")
2727
fs.writeFileSync(
2828
path.join(FIXTURE_ROOT, filename),

0 commit comments

Comments
 (0)