eslint-plugin-lube 0.2.3 → 0.2.5

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
@@ -22,5 +22,5 @@
22
22
  "test": "mocha"
23
23
  },
24
24
  "type": "commonjs",
25
- "version": "0.2.3"
25
+ "version": "0.2.5"
26
26
  }
@@ -115,7 +115,7 @@ module.exports = {
115
115
  if (semicolon) {
116
116
  corrected_text += ";"
117
117
  }
118
- if (corrected_text != text.slice(node.range[0], node.range[1])) report(node, corrected_text)
118
+ if (corrected_text != get_text(node)) report(node, corrected_text)
119
119
  }
120
120
  },
121
121
  /** @param {import("../private").ASTNode & import("estree").ImportDeclaration} node */
@@ -26,7 +26,7 @@ module.exports = {
26
26
  const fix_same_names = /** @type {boolean} */ (context.options[0]?.fixSameNames) ?? true
27
27
 
28
28
  // let name | const name | class name
29
- const allow_regex = /^[_$]?[_$]?(?:[\da-z]+(?:_[\da-z]+)*\$?\$?)?$|^[A-Z][\dA-Z_]*$|^(?:[\dA-Z][\da-z]*)+$/
29
+ const allow_regex = /^[_$]?[_$]?(?:[\da-z]+(?:_[\da-z]+)*\$?\$?)?$|^[A-Z](?:_?[\dA-Z]+)*$|^(?:[\dA-Z][\da-z]*)+$/
30
30
  const fixable_name_regex = /^[_$]?[_$]?(?:[\dA-Za-z]+(?:_[\dA-Za-z]+)*\$?\$?)?$/
31
31
  const fix_regex = /([\da-z]?)([A-Z][\dA-Z]*)/g
32
32
  const camel_case_regex = /^[\da-z]+([A-Z][\da-z]*)*$/
@@ -30,5 +30,23 @@ exports.module = (valid, invalid) => {
30
30
  }],
31
31
  output: "var camel_case = 'Hello'"
32
32
  },
33
+ {
34
+ code: "var NO_SNAKE__CASE = 'Hello'",
35
+ errors: [{
36
+ ...error,
37
+ line: 1,
38
+ column: 5
39
+ }],
40
+ output: "var NO_SNAKE__CASE = 'Hello'"
41
+ },
42
+ {
43
+ code: "var NO_SNAKE_CASE_ = 'Hello'",
44
+ errors: [{
45
+ ...error,
46
+ line: 1,
47
+ column: 5
48
+ }],
49
+ output: "var NO_SNAKE_CASE_ = 'Hello'"
50
+ },
33
51
  )
34
52
  }