@admc.com/eslintplugin-sn-test 1.1.3 → 2.0.2
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/README.md +2 -0
- package/badScripts/all/sp_widget.client_script/gs.js +1 -0
- package/badScripts/all/sys_ui_script/backtickRef.js +1 -0
- package/badScripts/all/sys_ui_script/curlyrefComment.js +1 -0
- package/badScripts/global/sp_widget.script/noIife.js +4 -0
- package/badScripts/global/sp_widget.script/otherGlobal.js +6 -0
- package/badScripts/scoped/sp_widget.script/globalLog.js +6 -0
- package/goodScripts/all/sp_widget.client_script/good.js +11 -0
- package/goodScripts/all/sys_ui_script/good.js +2 -0
- package/goodScripts/global/sp_widget.script/good.js +6 -0
- package/goodScripts/scoped/sp_widget.script/good.js +6 -0
- package/goodScripts/sys_script_validator/good.js +4 -3
- package/masterTest.js +17 -4
- package/package.json +2 -2
- package/populateTest.bash +4 -3
- package/{badScripts/global → reallyBadScripts}/invalid_table/invalidTable.js +1 -0
- package/{badScripts → reallybadScripts/global}/invalid_table/invalidTable.js +1 -0
- package/{badScripts → reallybadScripts}/invalid/sys_script/invalidAltscope.js +1 -0
- package/sneslintrc.json +9 -6
- package/badScripts/sys_script_validator/wrongIifeParam.js +0 -4
- package/goodScripts/sys_ui_script/good.js +0 -2
package/README.md
CHANGED
|
@@ -24,3 +24,5 @@ link (non-global) link feature, but this has side-effects since the intermediate
|
|
|
24
24
|
at a shared location on your computer.
|
|
25
25
|
Less invasive is to just manually wipe the subdirectory node_modules/@admc.com/eslint-plugin-sn/
|
|
26
26
|
and replace it with a symlink (or copy) of the development eslint-plugin-sn project directory.
|
|
27
|
+
Be aware that "npm update" will wipe the sym link and replace it with what is found from a
|
|
28
|
+
regular module resolution.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
if (gs.getUserName() === null) throw new Error("bad");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.info(`Value is ${location}`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// A ${curly + 3} expression in a comment
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
let v = "four";
|
|
2
|
+
const dblr = v=>{'use strict'; return v+v;};
|
|
3
|
+
|
|
4
|
+
api.onLoad = function($scope) {
|
|
5
|
+
"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);
|
package/masterTest.js
CHANGED
|
@@ -5,9 +5,23 @@ if (!__filename.startsWith(process.cwd() + "/")) // eslint-disable-line prefer-
|
|
|
5
5
|
const relTestPath = __filename.substring(process.cwd().length + 1);
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const fs = require("fs");
|
|
8
|
-
const ex =
|
|
8
|
+
const ex =
|
|
9
|
+
/^test[/](good|bad|reallybad)[/](?:(\w+)[/])?([\w.]+[/]\w+)-test[.]js$/.exec(relTestPath);
|
|
9
10
|
if (!ex) throw new Error(`Bad test file path: ${relTestPath}`);
|
|
10
|
-
|
|
11
|
+
let expectExitVal;
|
|
12
|
+
switch (ex[1]) {
|
|
13
|
+
case "good":
|
|
14
|
+
expectExitVal = 0;
|
|
15
|
+
break;
|
|
16
|
+
case "bad":
|
|
17
|
+
expectExitVal = 1;
|
|
18
|
+
break;
|
|
19
|
+
case "reallybad":
|
|
20
|
+
expectExitVal = 253;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
if (expectExitVal === undefined)
|
|
24
|
+
throw new Error(`eslintplugin-sn-test framework doesn't support test sub-type '${ex[1]}'`);
|
|
11
25
|
const altscope = ex[2];
|
|
12
26
|
const tableBase = ex[3];
|
|
13
27
|
// eslint-disable-next-line no-extra-parens, prefer-template
|
|
@@ -24,7 +38,6 @@ const childProcess = require("child_process").
|
|
|
24
38
|
spawnSync(process.execPath, params, { stdio: "inherit" });
|
|
25
39
|
|
|
26
40
|
it(altscope ? `${tableBase} | ${altscope}` : tableBase, () => {
|
|
27
|
-
if (
|
|
28
|
-
|| !shouldSucceed && childProcess.status !== 1)
|
|
41
|
+
if (expectExitVal !== childProcess.status)
|
|
29
42
|
throw new Error(`Failed with code ${childProcess.status}`);
|
|
30
43
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admc.com/eslintplugin-sn-test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "External tests for ESLint plugin @admc.com/eslint-plugin-sn",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "mocha --recursive",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"mocha": "^10.0.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@admc.com/eslint-plugin-sn": "^
|
|
31
|
+
"@admc.com/eslint-plugin-sn": "^2.0.8"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/populateTest.bash
CHANGED
|
@@ -51,16 +51,17 @@ TMPFILE="$TMPDIR/${PROGNAME#.*}.$$"
|
|
|
51
51
|
trap 'rm -f "$TMPFILE"' EXIT
|
|
52
52
|
[ -d goodScripts ] || Abort "Directory 'goodScripts' is missing"
|
|
53
53
|
[ -d badScripts ] || Abort "Directory 'badScripts' is missing"
|
|
54
|
-
|
|
54
|
+
[ -d reallybadScripts ] || Abort "Directory 'badScripts' is missing"
|
|
55
|
+
find goodScripts badScripts reallybadScripts -name '*.js' > "$TMPFILE" ||
|
|
55
56
|
Abort 'find command failed'
|
|
56
57
|
[ -n "$REPLACE_MODE" ] && rm -rf test/good test/bad
|
|
57
58
|
while read SCRIPT_PATH; do
|
|
58
59
|
GB=
|
|
59
60
|
case "$SCRIPT_PATH" in
|
|
60
|
-
badScripts/*)
|
|
61
|
-
goodScripts/*) GB=good;;
|
|
61
|
+
badScripts/*|goodScripts/*|reallybadScripts/*) ;;
|
|
62
62
|
*) Abort "Unexpected SCRIPT_PATH prefix: $SCRIPT_PATH";;
|
|
63
63
|
esac
|
|
64
|
+
GB="${SCRIPT_PATH%%Scripts*}"
|
|
64
65
|
REBASED="test/$GB/${SCRIPT_PATH#*Scripts/}"
|
|
65
66
|
TEST_PATH="${REBASED%.js}-test.js"
|
|
66
67
|
[ -e "$TEST_PATH" ] && {
|
package/sneslintrc.json
CHANGED
|
@@ -27,12 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"overrides": [
|
|
29
29
|
{
|
|
30
|
+
"files": ["**/sys_ui_script/*/*.js"],
|
|
31
|
+
"rules": { "@admc.com/sn/no-uiscript-curlyref": "error" }
|
|
32
|
+
},{ // ES6 overrides
|
|
30
33
|
"files": [
|
|
31
|
-
"
|
|
34
|
+
"**/@(global|scoped)/*.js",
|
|
32
35
|
"**/sys_ui_action/@(iso|noniso)_@(global|scoped)action/*.js"
|
|
33
36
|
]
|
|
34
37
|
},{ // ES6 overrides
|
|
35
|
-
"files": [ "**/@(noniso|iso)/*.js" ],
|
|
38
|
+
"files": [ "**/@(noniso|iso)/*.js", "**/@(sys_ui_script|sys_script_validator)/*.js"],
|
|
36
39
|
"rules": {
|
|
37
40
|
"strict": ["error", "safe"],
|
|
38
41
|
"prefer-arrow-callback": "error",
|
|
@@ -40,7 +43,8 @@
|
|
|
40
43
|
"no-useless-rename": "error",
|
|
41
44
|
"no-var": "error",
|
|
42
45
|
"prefer-template": "error"
|
|
43
|
-
}
|
|
46
|
+
}
|
|
47
|
+
}, {
|
|
44
48
|
"files": [ "**/sys_ui_script/*.js" ],
|
|
45
49
|
"rules": {
|
|
46
50
|
"strict": ["error", "safe"],
|
|
@@ -53,14 +57,13 @@
|
|
|
53
57
|
"files": [ "**/custom_table/custom_alt/*.js" ],
|
|
54
58
|
"env": {"@admc.com/sn/sn_server_global": true },
|
|
55
59
|
"rules": {
|
|
56
|
-
"@admc.com/sn/invalid-table-
|
|
60
|
+
"@admc.com/sn/invalid-table-alt": "off",
|
|
57
61
|
"@admc.com/sn/log-global-2-args": "error",
|
|
58
62
|
"@admc.com/sn/no-log-scoped": "error"
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
],
|
|
62
66
|
"settings": {
|
|
63
|
-
"customTables":
|
|
64
|
-
"customAlts": ["custom_alt"]
|
|
67
|
+
"customTables": {"custom_table": ["custom_alt"]}
|
|
65
68
|
}
|
|
66
69
|
}
|