eslint-plugin-lube 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = {
|
|
|
32
32
|
const text_indexes = get_indexed_array(text_length)
|
|
33
33
|
const left_space_regex = /\s+$/
|
|
34
34
|
const right_space_regex = /^\s+/
|
|
35
|
-
const type_regex = /(?<=(?:^|.*\s*)@type\s*\{)
|
|
35
|
+
const type_regex = /(?<=(?:^|.*\s*)@type\s*\{).+(?=\}.*?$)/
|
|
36
36
|
/** @type {import("../private").Comment[]} */
|
|
37
37
|
const comments = []
|
|
38
38
|
for (const comment of /** @type {import("../private").Comment[]} */(source_code.getAllComments().reverse())/**/) {
|
|
@@ -72,6 +72,7 @@ module.exports = {
|
|
|
72
72
|
let open = 0
|
|
73
73
|
let close = 0
|
|
74
74
|
let prev_open = 0
|
|
75
|
+
let prev_close = 0
|
|
75
76
|
let [left, right] = node.range
|
|
76
77
|
W: while (left > 0) {
|
|
77
78
|
if (comments[left - 1]) {
|
|
@@ -100,6 +101,7 @@ module.exports = {
|
|
|
100
101
|
} else {
|
|
101
102
|
if (origin_text[right] == ")") {
|
|
102
103
|
prev_open = left--
|
|
104
|
+
prev_close = right
|
|
103
105
|
temp_text_changes(left, left + 1)
|
|
104
106
|
close++
|
|
105
107
|
if (temp_text.slice(temp_indexes[right + 1], temp_indexes[right + 5]) == "/**/") {
|
|
@@ -122,7 +124,7 @@ module.exports = {
|
|
|
122
124
|
if (close && !types[close - 1]) {
|
|
123
125
|
close--
|
|
124
126
|
temp_text_changes(prev_open, prev_open, "(")
|
|
125
|
-
temp_text_changes(
|
|
127
|
+
temp_text_changes(prev_close, prev_close, ")")
|
|
126
128
|
}
|
|
127
129
|
const start = temp_indexes[node.range[0]]
|
|
128
130
|
let end = temp_indexes[node.range[1]]
|
|
@@ -5,10 +5,16 @@
|
|
|
5
5
|
exports.module = (valid, invalid) => {
|
|
6
6
|
valid.push(
|
|
7
7
|
{
|
|
8
|
-
code: `
|
|
8
|
+
code: `func(
|
|
9
9
|
a
|
|
10
10
|
)`
|
|
11
11
|
},
|
|
12
|
+
{
|
|
13
|
+
code: "a((b - c) / d)"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
code: "var v = /** @type {{}} */(a)/**/"
|
|
17
|
+
},
|
|
12
18
|
{
|
|
13
19
|
code: "var v = /** @type {A} */(/** @type {B} */(/** @type {C} */(a)/**/)/**/)/**/"
|
|
14
20
|
},
|