eslint-plugin-crisp 1.1.13 → 1.1.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-crisp",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "Custom ESLint Rules for Crisp",
5
5
  "author": "Crisp IM SAS",
6
6
  "main": "index.js",
@@ -50,7 +50,7 @@ export default {
50
50
  if (fileExtension === ".vue") {
51
51
  headerStart = "<!--";
52
52
  headerEnd = "-->";
53
- } else if (fileExtension === ".js") {
53
+ } else if ([".js", ".ts"].includes(fileExtension)) {
54
54
  headerStart = "\/\\*";
55
55
  headerEnd = "\\*\/";
56
56
  }
@@ -12,8 +12,8 @@ export default {
12
12
  create(context) {
13
13
  const filename = context.getFilename();
14
14
 
15
- // Only apply this rule to .js files
16
- if (!filename.endsWith(".js")) {
15
+ // Only apply this rule to .js and .ts files
16
+ if (!filename.endsWith(".js") && !filename.endsWith(".ts")) {
17
17
  return {};
18
18
  }
19
19
 
@@ -12,12 +12,14 @@ export default {
12
12
  create(context) {
13
13
  function isRegex(node) {
14
14
  if (
15
+ node &&
15
16
  node.type === "NewExpression" &&
16
17
  node.callee.name === "RegExp"
17
18
  ) {
18
19
  // Check for RegExp constructor
19
20
  return true;
20
21
  } else if (
22
+ node &&
21
23
  node.type === "Literal" &&
22
24
  node.regex
23
25
  ) {