eslint /test/ directory #383
Conversation
|
I would like to avoid unnecessary changes in api.js :
|
do you mean revert commit 4 (hoist all vars to top of function-scope)? i can do that. just making sure that is the meaning. |
yes |
|
added 2 more follow-on commits: commit 6
commit 7
i still want to keep relaxed the eslint-rule:
reason is if you look at |
|
pinging about status of this pull-request? have more pull-requests in pipeline, but would like a style-guide inplace first if possible. |
|
There is a lot of what looks like unchecked auto-formatting. Can you proofread the whole code you generated, and re-request a review once it's clean ? |
|
K, I'll try to get around to it this weekend. |
|
want to re-introduce default airbnb eslint-rule according to official es5 language-spec @ https://www.ecma-international.org/ecma-262/5.1/#sec-12.1:
so this code in src/api.js: function extract_blob(ptr) {
...
for (var j = 0; j < size; j += 1) {
blob_arg[j] = HEAP8[blob_ptr + j];
}
return blob_arg;
}is internally transformed by spec-compliant engines to this: function extract_blob(ptr) {
+ var j = undefined; // Variables are initialised to undefined when created as defined in 10.5
...
- for (var j = 0; j < size; j += 1) {
+ for (j = 0; j < size; j += 1) { // Initialiser is assigned when executed
blob_arg[j] = HEAP8[blob_ptr + j];
}
return blob_arg;
}the eslint-rule it also makes proof-reading /test/ directory easier, since i (and future test-writers) no longer have to keep track of where the first variable assignment took place (when there are multiple assignments). |
|
I know how variable declarations in javascript work, thank you |
|
finished proofreading/linting the 2 most problematic test-files:
with proposed eslint-flag changes: + // reason - test-cases use nameless, anonymous-functions for callbacks
+ "func-names": "off",
+ // reason - test-cases use lazy/conditional require
+ "global-require": "off",
+ // reason - test-cases use console.log and console.error
+ "no-console": ["error", { allow: ["error", "log"] }],
- "vars-on-top": "off"lets just focus this pull-request on above 2 test-files. once merged, a separate pull-request to lint remaining test files should be trivial. |
|
closing this due to inactivity, but may re-open in future. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

this pull-request currently has 4 commits:
commit 1
commit 2
commit 3
commit 4
not sure if others feel commit 4 is acceptably motivated or not. but am open to revert/change it (or any of the other commits).