@admc.com/eslintplugin-sn-test 3.6.1 → 3.8.0

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
@@ -4,7 +4,7 @@
4
4
  "env": { "es2022": true, "node": true },
5
5
  "extends": "eslint:recommended",
6
6
  "parserOptions": { "ecmaVersion": "latest" },
7
- "ignorePatterns": ["goodScripts/**", "badScripts/**", "test/**"],
7
+ "ignorePatterns": ["*Scripts/**", "test/**"],
8
8
  "rules": {
9
9
  "camelcase": ["warn", { "properties": "never" }],
10
10
  "eqeqeq": "error",
@@ -35,7 +35,7 @@
35
35
  "no-eval": "warn",
36
36
  "no-extra-label": "error",
37
37
  "no-extra-bind": "error",
38
- "no-else-return": "error",
38
+ "no-else-return": ["error", {"allowElseIf": false}],
39
39
  "no-array-constructor": "warn",
40
40
  "new-cap": "error",
41
41
  "max-depth": "warn",
@@ -48,6 +48,13 @@
48
48
  "no-constructor-return": "error",
49
49
  "no-constant-binary-expression": "error",
50
50
  "array-callback-return": ["error", { "checkForEach": true }],
51
+ "no-unused-vars": ["error", {
52
+ "args": "all",
53
+ "argsIgnorePattern": "^_?dummy",
54
+ "caughtErrors": "all",
55
+ "caughtErrorsIgnorePattern": "^_?dummy"
56
+ }],
57
+ "no-eq-null": "error",
51
58
 
52
59
  // Post-ES6
53
60
  "no-var": "error",
@@ -63,6 +70,8 @@
63
70
  "require-atomic-updates": "error",
64
71
  "no-unused-private-class-members": "error",
65
72
  "no-promise-executor-return": "error",
73
+ "prefer-rest-params": "error",
74
+ "prefer-spread": "error",
66
75
 
67
76
  // formatting
68
77
  "comma-spacing": "warn",
package/.gitattributes CHANGED
@@ -1,18 +1,18 @@
1
1
  * text=auto
2
2
 
3
- *.bash eol=lf
4
- *.sh eol=lf
5
- *.ksh eol=lf
6
- *.csh eol=lf
7
- *.pem eol=lf
8
- *.cmd eol=crlf
9
- *.bat eol=crlf
10
- *.BAT eol=crlf
11
- *.CMD eol=crlf
12
- *.dsp eol=crlf
13
- *.sln eol=crlf
14
- *.vcproj eol=crlf
15
- *.reg eol=crlf
3
+ *.bash text eol=lf
4
+ *.sh text eol=lf
5
+ *.ksh text eol=lf
6
+ *.csh text eol=lf
7
+ *.pem text eol=lf
8
+ *.cmd text eol=crlf
9
+ *.bat text eol=crlf
10
+ *.BAT text eol=crlf
11
+ *.CMD text eol=crlf
12
+ *.dsp text eol=crlf
13
+ *.sln text eol=crlf
14
+ *.vcproj text eol=crlf
15
+ *.reg text eol=crlf
16
16
 
17
17
  *.PNG -text
18
18
  *.png -text
@@ -52,8 +52,8 @@
52
52
  *.list text
53
53
  *.text text
54
54
  *.tpl text
55
- *.dsv lf
56
- *.html lf
55
+ *.dsv text eol=lf
56
+ *.html text eol=lf
57
57
  *.ent text
58
58
  *.xhtml text
59
59
  *.dtd text
@@ -97,8 +97,8 @@ makefile text
97
97
  *.csv text
98
98
  *.shtml text
99
99
  *.htm text
100
- *.js lf
101
- *.jsm lf
100
+ *.js text eol=lf
101
+ *.jsm text eol=lf
102
102
  *.sql text
103
103
  *.isq text
104
104
  *.nsq text
@@ -112,6 +112,6 @@ makefile text
112
112
  *.xsl text
113
113
  *.xslt text
114
114
  *.dtd text
115
- *.json lf
115
+ *.json text eol=lf
116
116
  *.md text
117
117
  LICENSE text
@@ -0,0 +1,13 @@
1
+ dummy = function($scope) {
2
+ "use strict";
3
+ const fName = "spclient/" + $scope.widget.id + ":" + $scope.$id;
4
+ console.warn("UPDATE02");
5
+ console.warn("$scope", $scope);
6
+ console.info("Executing " + fName + " with this", this);
7
+ this.thisVar = "I am here"; // To facilitate checking for this exact instance
8
+ console.info(fName + " inputs", this.inputs);
9
+ console.info(fName + " data", this.data);
10
+ console.info(fName + " options", this.options);
11
+ $scope.pneu = "new string";
12
+ console.info("this", this);
13
+ };
@@ -1 +1,13 @@
1
- if (gs.getUserName() === null) throw new Error("bad");
1
+ function($scope) {
2
+ "use strict";
3
+ const fName = "spclient/" + $scope.widget.id + ":" + $scope.$id;
4
+ console.warn("UPDATE02");
5
+ console.warn("$scope", $scope);
6
+ console.info("Executing " + fName + " with this", this);
7
+ this.thisVar = "I am here"; // To facilitate checking for this exact instance
8
+ console.info(fName + " inputs", this.inputs);
9
+ gs.info(fName + " data", this.data);
10
+ console.info(fName + " options", this.options);
11
+ $scope.pneu = "new string";
12
+ console.info("this", this);
13
+ }
@@ -0,0 +1,13 @@
1
+ function dummy($scope) {
2
+ "use strict";
3
+ const fName = "spclient/" + $scope.widget.id + ":" + $scope.$id;
4
+ console.warn("UPDATE02");
5
+ console.warn("$scope", $scope);
6
+ console.info("Executing " + fName + " with this", this);
7
+ this.thisVar = "I am here"; // To facilitate checking for this exact instance
8
+ console.info(fName + " inputs", this.inputs);
9
+ console.info(fName + " data", this.data);
10
+ console.info(fName + " options", this.options);
11
+ $scope.pneu = "new string";
12
+ console.info("this", this);
13
+ }
@@ -0,0 +1,9 @@
1
+ api.controller=function() {
2
+ // Doing this instead of eslint-disable notation since that notation would conflict with wrapping:
3
+ "use strict";
4
+ // This is as close as can get to OOTB while not failing more basic rules that we don't
5
+ // want to test for here.
6
+ /* eslint-disable no-var,no-unused-vars */
7
+ /* widget controller */
8
+ var c = this;
9
+ };
@@ -0,0 +1,13 @@
1
+ function($scope) {
2
+ "use strict";
3
+ const fName = "spclient/" + $scope.widget.id + ":" + $scope.$id;
4
+ console.warn("UPDATE02");
5
+ console.warn("$scope", $scope);
6
+ console.info("Executing " + fName + " with this", this);
7
+ this.thisVar = "I am here"; // To facilitate checking for this exact instance
8
+ console.info(fName + " inputs", this.inputs);
9
+ console.info(fName + " data", this.data);
10
+ console.info(fName + " options", this.options);
11
+ $scope.pneu = "new string";
12
+ console.info("this", this);
13
+ }
@@ -0,0 +1,14 @@
1
+ console.info("helo");
2
+ function($scope) {
3
+ "use strict";
4
+ const fName = "spclient/" + $scope.widget.id + ":" + $scope.$id;
5
+ console.warn("UPDATE02");
6
+ console.warn("$scope", $scope);
7
+ console.info("Executing " + fName + " with this", this);
8
+ this.thisVar = "I am here"; // To facilitate checking for this exact instance
9
+ console.info(fName + " inputs", this.inputs);
10
+ console.info(fName + " data", this.data);
11
+ console.info(fName + " options", this.options);
12
+ $scope.pneu = "new string";
13
+ console.info("this", this);
14
+ }
@@ -0,0 +1,7 @@
1
+ (function() {
2
+ "use strict";
3
+ if (input.datum) {
4
+ data.datum = input.datum;
5
+ gs.info(`Set datum for client to (${input.data})`);
6
+ }
7
+ })();
@@ -0,0 +1,5 @@
1
+ (iput) => {
2
+ if (!iput.propertyName) return {"error" : "missing property name"};
3
+ gs.info(`transformTst:brokertran requested prop '${iput.propertyName}'`);
4
+ return `${gs.getProperty(iput.propertyName)}>`;
5
+ }
@@ -1,11 +1,13 @@
1
- let v = "four";
2
- const dblr = v=>{'use strict'; return v+v;};
3
-
4
- api.onLoad = function($scope) {
1
+ function($scope) {
5
2
  "use strict";
6
- console.info('Running api.onLoad');
7
- $scope.thisRef = this;
8
- };
9
-
10
- v = dblr(v);
11
- console.info(window.name, v, jQuery("body").length, document.URL);
3
+ const fName = "spclient/" + $scope.widget.id + ":" + $scope.$id;
4
+ console.warn("UPDATE02");
5
+ console.warn("$scope", $scope);
6
+ console.info("Executing " + fName + " with this", this);
7
+ this.thisVar = "I am here"; // To facilitate checking for this exact instance
8
+ console.info(fName + " inputs", this.inputs);
9
+ console.info(fName + " data", this.data);
10
+ console.info(fName + " options", this.options);
11
+ $scope.pneu = "new string";
12
+ console.info("this", this);
13
+ }
@@ -0,0 +1,5 @@
1
+ // Header comment
2
+ a => {
3
+ console.info(`Something about ${a}`);
4
+ }
5
+ /* Tail comment */
@@ -0,0 +1,5 @@
1
+ // Header comment
2
+ () => {
3
+ console.info(`Something`);
4
+ }
5
+ /* Tail comment */
@@ -0,0 +1,7 @@
1
+ (function() {
2
+ "use strict";
3
+ if (input.datum) {
4
+ data.datum = input.datum;
5
+ gs.info("Set datum for client" + input.datum);
6
+ }
7
+ })();
@@ -0,0 +1,5 @@
1
+ function(iput) {
2
+ if (!iput.propertyNames) return {"error" : "missing property names"};
3
+ iput.propertyNames.forEach(p => { gs.info(`Next prop (${p})`); });
4
+ return null;
5
+ }
@@ -1,6 +1,6 @@
1
1
  (function() {
2
2
  if (input.datum) {
3
3
  data.datum = input.datum;
4
- gs.info("Set datum for client");
4
+ gs.info("Set datum for client" + input.datum);
5
5
  }
6
6
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@admc.com/eslintplugin-sn-test",
3
- "version": "3.6.1",
3
+ "version": "3.8.0",
4
4
  "description": "External tests for ESLint plugin @admc.com/eslint-plugin-sn",
5
5
  "scripts": {
6
6
  "test": "mocha --recursive",
package/sneslintrc.json CHANGED
@@ -22,14 +22,12 @@
22
22
  "eqeqeq": "error",
23
23
  "semi": "error",
24
24
  "no-extra-parens": "error",
25
+ "no-eq-null": "error",
25
26
  "@admc.com/sn/prefer-array-iterator": "error",
26
27
  "@admc.com/sn/no-init-emptystring": "error"
27
28
  },
28
29
  "overrides": [
29
- {
30
- "files": ["**/sys_ui_script/*/*.js"],
31
- "rules": { "@admc.com/sn/no-uiscript-curlyref": "error" }
32
- }, { // ES6 overrides
30
+ { // ES6 overrides
33
31
  "files": [ "**/@(noniso|iso)/*.js",
34
32
  "**/@(sys_ui_script|sys_script_validator|sp_widget.client_script|sys_ux_data_broker_scriptlet)/all/*.js"], // eslint-disable-line max-len
35
33
  "rules": {
@@ -39,6 +37,8 @@
39
37
  "no-useless-rename": "error",
40
38
  "no-var": "error",
41
39
  "prefer-template": "error",
40
+ "prefer-rest-params": "error",
41
+ "prefer-spread": "error",
42
42
  "@admc.com/sn/no-client-gr": "error"
43
43
  }
44
44
  }, { // ES 12 overrides
@@ -49,8 +49,19 @@
49
49
  "object-shorthand": "error",
50
50
  "no-useless-rename": "error",
51
51
  "no-var": "error",
52
+ "prefer-rest-params": "error",
53
+ "prefer-spread": "error",
52
54
  "prefer-template": "error"
53
55
  }
56
+ }, {
57
+ // Reverting eslint-plugin-sn exceptions back, because we overrode them generally above
58
+ // when raising warnings to errors.
59
+ "files":
60
+ ["**/@(sys_ui_script|sp_widget.script|sp_widget.client_script|sp_widget.link)/*/*.js"],
61
+ "rules": {
62
+ "prefer-template": "off",
63
+ "no-template-curly-in-string": "off"
64
+ }
54
65
  }, { // Overriding for ES12 IIFE scriptlets}
55
66
  "files": [
56
67
  "**/@(sys_script|sys_ws_operation|sys_web_service|sys_processor|sys_script_email|sys_transform_map|sys_transform_script|sp_widget.script|sys_ui_page.processing_script)/scoped-es12/*.js", // eslint-disable-line max-len