Skip to content

Commit

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

* fix

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: yosuke ota <otameshiyo23@gmail.com>
  • Loading branch information
3 people committed Mar 13, 2021
1 parent 17c1e68 commit 7005d6d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -39,7 +39,7 @@
"yaml": "^1.10.0"
},
"devDependencies": {
"@ota-meshi/eslint-plugin": "^0.2.0",
"@ota-meshi/eslint-plugin": "^0.3.0",
"@types/eslint": "^7.2.0",
"@types/eslint-visitor-keys": "^1.0.0",
"@types/lodash": "^4.14.167",
Expand Down
4 changes: 2 additions & 2 deletions src/convert.ts
Expand Up @@ -731,7 +731,7 @@ function convertBlockLiteral(
const punctuatorRange: Range = [cst.header.start, cst.header.end]
ctx.addToken("Punctuator", punctuatorRange)
const text = ctx.code.slice(cst.valueRange!.start, cst.valueRange!.end)
const offset = /^[^\S\r\n]*/.exec(text)![0].length
const offset = /^[^\S\n\r]*/.exec(text)![0].length
const tokenRange: Range = [
cst.valueRange!.start + offset,
cst.valueRange!.end,
Expand Down Expand Up @@ -769,7 +769,7 @@ function convertBlockFolded(
ctx.addToken("Punctuator", punctuatorRange)

const text = ctx.code.slice(cst.valueRange!.start, cst.valueRange!.end)
const offset = /^[^\S\r\n]*/.exec(text)![0].length
const offset = /^[^\S\n\r]*/.exec(text)![0].length
const tokenRange: Range = [
cst.valueRange!.start + offset,
cst.valueRange!.end,
Expand Down
8 changes: 4 additions & 4 deletions src/tags.ts
Expand Up @@ -48,7 +48,7 @@ export const INT: TagResolver<number> = {
tag: "tag:yaml.org,2002:int",
test(str) {
// see https://yaml.org/spec/1.2/spec.html#id2805071
return /^[-+]?\d+$/u.test(str)
return /^[+-]?\d+$/u.test(str)
},
resolve(str) {
return parseInt(str, 10)
Expand All @@ -70,7 +70,7 @@ export const INT_BASE16: TagResolver<number> = {
tag: "tag:yaml.org,2002:int",
test(str) {
// see https://yaml.org/spec/1.2/spec.html#id2805071
return /^0x[\da-fA-F]+$/u.test(str)
return /^0x[\dA-Fa-f]+$/u.test(str)
},
resolve(str) {
return parseInt(str.slice(2), 16)
Expand All @@ -81,7 +81,7 @@ export const FLOAT: TagResolver<number> = {
tag: "tag:yaml.org,2002:float",
test(str) {
// see https://yaml.org/spec/1.2/spec.html#id2805071
return /^[-+]?(\.\d+|\d+(\.\d*)?)([eE][-+]?\d+)?$/u.test(str)
return /^[+-]?(\.\d+|\d+(\.\d*)?)([Ee][+-]?\d+)?$/u.test(str)
},
resolve(str) {
return parseFloat(str)
Expand All @@ -92,7 +92,7 @@ export const INFINITY: TagResolver<number> = {
tag: "tag:yaml.org,2002:float",
test(str) {
// see https://yaml.org/spec/1.2/spec.html#id2805071
return /^[-+]?(\.inf|\.Inf|\.INF)$/u.test(str)
return /^[+-]?(\.inf|\.Inf|\.INF)$/u.test(str)
},
resolve(str) {
return str.startsWith("-") ? -Infinity : Infinity
Expand Down

0 comments on commit 7005d6d

Please sign in to comment.