@admc.com/eslintplugin-sn-test 1.0.0 → 1.0.3

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/.eslintrc.json CHANGED
@@ -6,10 +6,8 @@
6
6
  "parserOptions": { "ecmaVersion": "latest" },
7
7
  "ignorePatterns": ["goodScripts/**", "badScripts/**", "test/**"],
8
8
  "rules": {
9
- "camelcase": "warn",
9
+ "camelcase": ["warn", { "properties": "never" }],
10
10
  "eqeqeq": "error",
11
- "no-var": "error",
12
- "prefer-const": "error",
13
11
  "semi": "error",
14
12
  "no-unreachable-loop": "error",
15
13
  "no-use-before-define": ["error", { "functions": false, "classes": false }],
@@ -52,6 +50,8 @@
52
50
  "array-callback-return": ["error", { "checkForEach": true }],
53
51
 
54
52
  // Post-ES6
53
+ "no-var": "error",
54
+ "prefer-const": "error",
55
55
  "strict": ["error", "safe"],
56
56
  "prefer-exponentiation-operator": "error",
57
57
  "prefer-arrow-callback": "error",
@@ -1,2 +1,4 @@
1
+ (function() {
1
2
  var unusedVar = undefined;
2
3
  if (!unusedVar) gs.log("notset", "2nd");
4
+ })(previous, current);
@@ -0,0 +1,3 @@
1
+ (function() {
2
+ console.log("This will fail", "blaine");
3
+ }(); // Invocation params here is what is constrained
@@ -0,0 +1 @@
1
+ console.log("here without IIFE", "blaine");
@@ -0,0 +1 @@
1
+ gs.log(patternId, "2nd");
@@ -0,0 +1 @@
1
+ gs.log(request.queryParams, "2nd");
@@ -1 +1,3 @@
1
+ (function() {
1
2
  var unusedVar = 3;
3
+ })(previous, current);
@@ -0,0 +1,3 @@
1
+ (function() {
2
+ console.log("This will fail", "blaine");
3
+ }(alpha, beta); // Invocation params here is what is constrained
@@ -0,0 +1,2 @@
1
+ function fn() { gs.log("I do nothing", "src"); }
2
+ fn();
@@ -0,0 +1,4 @@
1
+ const gr = new GlideRecord("sys_script_fix");
2
+ gr.setLimit(1);
3
+ gr.next();
4
+ gs.log("Got sys_script_fix " + gr.sys_id, "src");
@@ -0,0 +1,3 @@
1
+ const ar = ["alpha", "beta", "gamma"];
2
+ var i = 0;
3
+ for (i = 0; i < ar.length; i++) gs.log("#" + (i+1) + " = " + ar[i], "src");
@@ -1,2 +1,4 @@
1
+ (function() {
1
2
  let x = 3;
2
3
  gs.log(3, 'src');
4
+ })(previous, current);
package/functions.bash CHANGED
@@ -1,7 +1,7 @@
1
1
  # Useful shell functions
2
2
 
3
3
  function rchead() {
4
- local TARGET_FILE=eslintrc.json
4
+ local TARGET_FILE=sneslintrc.json
5
5
  local SYNTAX_MSG='SYNTAX: rchead n # where n is a positive integer'
6
6
  [ -f "$TARGET_FILE" ] || {
7
7
  echo "rchead file '$TARGET_FILE' not present or not a file" 1>&2
@@ -1,4 +1,4 @@
1
- var TstCls = Class.create();
1
+ const TstCls = Class.create();
2
2
  TstCls.prototype.initialize = function(o) {
3
3
  this.o = o;
4
4
  this.p = String(Packages.java.lang.System.getProperty(o));
@@ -1,7 +1,7 @@
1
+ (function() {
1
2
  // Test availability of global vars from the different component lists:
2
3
  gs.log("a message", "a source"); // coreServerObjects.txt
3
4
  gs.log(SNC.CMDBUtil.getTables0("sys_db_object"), "src"); // directly in exports.js
4
- // eslint-disable-next-line camelcase
5
5
  gs.log(Object.keys(new sn_codesearch.CodeSearch()).length, "src"); // SIScopes
6
6
 
7
7
  var varsAreAllowed = "a val";
@@ -10,3 +10,4 @@ gs.log(varsAreAllowed, "2nd");
10
10
  const con = "a val";
11
11
  con += "addition"; // Can't test for const changes
12
12
  gs.log(con, "2nd");
13
+ })(previous, current);
@@ -1,7 +1,7 @@
1
1
  // This passes test because we assign to the new class.
2
2
  // This is how SI classes are generally instantiated on SN, because this
3
3
  // is how the auto-generated code templates do it.
4
- var OtherAjaxProcessor = Class.create();
4
+ const OtherAjaxProcessor = Class.create();
5
5
 
6
6
  OtherAjaxProcessor.prototype = Object.extendsObject(AbstractAjaxProcessor, {
7
7
  type: "OtherAjaxProcessor",
@@ -0,0 +1 @@
1
+ gs.info(patternId, "2nd");
@@ -1,6 +1,6 @@
1
+ (function() {
1
2
  // Test availability of scoped vars from the different component lists:
2
- gs.info("a message"); // coreServerObjects.txt
3
- // eslint-disable-next-line camelcase
3
+ gs.info(new sn_ws_err.NotAcceptableError("fake err")); // coreServerObjects.txt
4
4
  gs.info(Object.keys(new sn_codesearch.CodeSearch()).length); // SIScopes
5
5
 
6
6
  var varsAreAllowed = "a val";
@@ -9,3 +9,4 @@ gs.info(varsAreAllowed);
9
9
  const con = "a val";
10
10
  con += "addition"; // Can't test for const changes
11
11
  gs.info(con);
12
+ })(previous, current);
@@ -0,0 +1,2 @@
1
+ gs.info(request.http.inputParam);
2
+ response.setStatus(200);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admc.com/eslintplugin-sn-test",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "External tests for ESLint plugin @admc.com/eslint-plugin-sn",
5
5
  "scripts": {
6
6
  "test": "mocha --recursive",
@@ -25,7 +25,9 @@
25
25
  },
26
26
  "homepage": "https://github.com/unsaved/eslint-plugin-sn#readme",
27
27
  "dependencies": {
28
- "@admc.com/eslint-plugin-sn": "^1.0.1",
29
28
  "mocha": "^10.0.0"
29
+ },
30
+ "peerDependencies": {
31
+ "@admc.com/eslint-plugin-sn": "^1.0.6"
30
32
  }
31
33
  }
@@ -17,14 +17,20 @@
17
17
  "no-array-constructor": "error",
18
18
  "max-depth": "error",
19
19
  "dot-notation": "error",
20
- "camelcase": "error",
20
+ "camelcase": ["error", { "properties": "never" }],
21
21
  "no-template-curly-in-string": "error",
22
22
  "eqeqeq": "error",
23
23
  "semi": "error",
24
- "no-extra-parens": "error"
24
+ "no-extra-parens": "error",
25
+ "@admc.com/sn/prefer-array-iterator": "error"
25
26
  },
26
27
  "overrides": [
27
28
  {
29
+ "files": ["**/@(sa_pattern_prepost_script|sys_script_fix|sys_script|sys_script_include|sys_auto_script|sys_ws_operation|sys_web_service)/@(global|scoped)/*.js"],
30
+ "rules": {
31
+ "camelcase": ["error", { "properties": "never", "ignoreGlobals": true }]
32
+ }
33
+ },{ // ES6 overrides
28
34
  "files": ["**/@(sys|catalog|expert)_script_client/@(noniso|iso)/*.js"],
29
35
  "rules": {
30
36
  "strict": ["error", "safe"],