eslint-plugin-crisp 1.0.6 → 1.0.8

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.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Custom EsLint Rules for Crisp",
5
5
  "main": "index.js",
6
6
  "author": "Crisp IM SAS",
@@ -9,5 +9,9 @@
9
9
  "doctrine": "3.0.0",
10
10
  "eslint": "8.45.0",
11
11
  "eslint-plugin-jsdoc": "43.0.7"
12
+ },
13
+ "peerDependencies": {
14
+ "eslint-plugin-vue": "8.5.0",
15
+ "eslint-plugin-vue-pug": "0.6.0"
12
16
  }
13
17
  }
@@ -27,6 +27,7 @@ module.exports = {
27
27
  "dot-notation": "error",
28
28
  "eqeqeq": "error",
29
29
  "linebreak-style": ["error", "unix"],
30
+ "no-multiple-empty-lines": ["error", { max: 1 }],
30
31
  "no-trailing-spaces": "error",
31
32
  "no-tabs": "error",
32
33
  "object-curly-spacing": ["error", "always"],
@@ -115,7 +116,7 @@ module.exports = {
115
116
  "crisp/no-async": "error",
116
117
  "crisp/no-var-in-blocks": "error",
117
118
  "crisp/no-useless-template-literals": "error",
118
- "crisp/one-space-after-operator": "error",
119
+ "crisp/one-space-after-operator": ["error", { "checkColon": false }],
119
120
  "crisp/regex-in-constructor": "error",
120
121
  "crisp/variable-names": "error",
121
122
  "crisp/no-short-parameters": [
@@ -29,6 +29,7 @@ module.exports = {
29
29
  return (
30
30
  declaration &&
31
31
  declaration.id &&
32
+ declaration.id.name &&
32
33
  declaration.id.name === declaration.id.name.toUpperCase()
33
34
  );
34
35
  }
@@ -7,10 +7,25 @@ module.exports = {
7
7
  recommended: false,
8
8
  },
9
9
  fixable: "whitespace", // or "code" or "whitespace"
10
- schema: [], // no options
10
+ schema: [
11
+ {
12
+ type: "object",
13
+ properties: {
14
+ checkColon: {
15
+ type: "boolean"
16
+ }
17
+ },
18
+ additionalProperties: false,
19
+ default: {
20
+ checkColon: true
21
+ }
22
+ }
23
+ ]
11
24
  },
12
25
  create(context) {
13
26
  const sourceCode = context.getSourceCode();
27
+ const config = context.options[0] || {};
28
+ const checkColon = config.checkColon !== false;
14
29
 
15
30
  const checkSpacing = (node, operatorToken, operatorName) => {
16
31
  if (Math.abs(sourceCode.getTokenBefore(operatorToken).loc.end.column - operatorToken.loc.start.column) < 1 || sourceCode.getTokenAfter(operatorToken).loc.start.column - operatorToken.loc.end.column > 1) {
@@ -38,9 +53,12 @@ module.exports = {
38
53
  checkSpacing(node, operatorToken, '=');
39
54
  }
40
55
  },
56
+
41
57
  Property(node) {
42
- const operatorToken = sourceCode.getTokenBefore(node.value);
43
- checkSpacing(node, operatorToken, ':');
58
+ if (checkColon) {
59
+ const operatorToken = sourceCode.getTokenBefore(node.value);
60
+ checkSpacing(node, operatorToken, ':');
61
+ }
44
62
  },
45
63
  };
46
64
  },