eslint-plugin-lube 0.1.5 → 0.1.6
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
|
@@ -9,8 +9,7 @@ module.exports = {
|
|
|
9
9
|
},
|
|
10
10
|
fixable: "code",
|
|
11
11
|
messages: {
|
|
12
|
-
not_match: "Identifier '{{name}}' does not match for svelte's naming conventions."
|
|
13
|
-
not_match_private: "PrivateIdentifier '#{{name}}' does not match for svelte's naming conventions."
|
|
12
|
+
not_match: "Identifier '{{name}}' does not match for svelte's naming conventions."
|
|
14
13
|
},
|
|
15
14
|
schema: [{
|
|
16
15
|
properties: {
|
|
@@ -45,6 +44,8 @@ module.exports = {
|
|
|
45
44
|
const reported_declarations = new Set()
|
|
46
45
|
/** @type {Map<string, import("../private").ASTNode[]>} */
|
|
47
46
|
const pending_usages = new Map()
|
|
47
|
+
/** @type {Set<import("../private").ASTNode>} */
|
|
48
|
+
const shortand_properties = new Set()
|
|
48
49
|
|
|
49
50
|
/** @param {import("../private").ASTNode} node */
|
|
50
51
|
function defer(node) {
|
|
@@ -71,7 +72,8 @@ module.exports = {
|
|
|
71
72
|
if (fixable_name_regex.test(name)) {
|
|
72
73
|
return fixer.replaceTextRange(
|
|
73
74
|
node.range,
|
|
74
|
-
node.name
|
|
75
|
+
(shortand_properties.has(node) ? node.name + ": " : "")
|
|
76
|
+
+ node.name.replace(fix_regex, fix_callback)
|
|
75
77
|
)
|
|
76
78
|
}
|
|
77
79
|
return null
|
|
@@ -279,12 +281,15 @@ module.exports = {
|
|
|
279
281
|
// var value = { key: value }
|
|
280
282
|
// var { key: value } = value
|
|
281
283
|
if ("Property" == type) {
|
|
282
|
-
if (parent.value == node
|
|
284
|
+
if (parent.value == node) {
|
|
285
|
+
if (parent.key.name == parent.value.name) {
|
|
286
|
+
shortand_properties.add(node)
|
|
287
|
+
}
|
|
283
288
|
defer(node)
|
|
284
289
|
}
|
|
285
290
|
return
|
|
286
291
|
}
|
|
287
|
-
// class Object {
|
|
292
|
+
// class Object { camelCase = value }
|
|
288
293
|
if ("PropertyDefinition" == type) {
|
|
289
294
|
return
|
|
290
295
|
}
|
|
@@ -858,6 +858,11 @@ exports.module = (valid, invalid) => {
|
|
|
858
858
|
...error,
|
|
859
859
|
line: 5,
|
|
860
860
|
column: 23
|
|
861
|
+
},
|
|
862
|
+
{
|
|
863
|
+
...error,
|
|
864
|
+
line: 6,
|
|
865
|
+
column: 18
|
|
861
866
|
}
|
|
862
867
|
],
|
|
863
868
|
options: [{ fixSameNames: true }],
|
|
@@ -866,7 +871,7 @@ exports.module = (valid, invalid) => {
|
|
|
866
871
|
var value = { key: pending_a }
|
|
867
872
|
var pending_a
|
|
868
873
|
var value = { key: pending_a }
|
|
869
|
-
var value = { pendingA }
|
|
874
|
+
var value = { pendingA: pending_a }
|
|
870
875
|
`,
|
|
871
876
|
parserOptions: { ecmaVersion: "latest" }
|
|
872
877
|
},
|