8000 v2021.5.26 by kaizhu256 · Pull Request #295 · jslint-org/jslint · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

v2021.5.26 #295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 26, 2021
Merged

v2021.5.26 #295

merged 9 commits into from
May 26, 2021

Conversation

kaizhu256
Copy link
Member
  • coverage - increase regression testing and coverage to 98.41% (almost 100% baby!)
  • ci - fix ci silently failing in node-v12 and node-v14.
  • cli - add env var JSLINT_CLI to force-trigger cli in jslint.js (used for code-coverage of cli).
  • jslint - add "globalThis" to default globals.
  • jslint - add new rules unordered_param_a, unordered_property_a, that warn if parameters and properties are listed in nonascii-order.
  • jslint - fix bug where (global) functionage missing properties finally and try.
  • jslint - fix bug failing to parse unicode "\u{12345}".
  • jslint - fix bug falsely warning against conditional-chaining-operator "?.".
  • jslint - remove deadcode for preaction-binary-".".
  • jslint - remove deadcode warning bad_option_a.
  • website - add fork-me ribbon.
  • website - load index.html with example code.
  • website - merge file report.js into browser.js.

demo of release-candidate available @ https://www.jslint.com/branch.beta/index.html

image

kaizhu256 added 9 commits May 24, 2021 00:59
…t warn if parameters and properties are listed in nonascii-order.

- jslint - add "globalThis" to default globals.
- ci - continue addng regression tests and improve code-coverage.
- cli - add env var JSLINT_CLI to force-trigger cli in jslint.js
- jslint - fix bug failing to parse unicode "\\u{12345}"
- ci - fix ci silently failing in node-v12 and node-v14
- jslint - fix (global) functionage missing properties finally and try.
- website - add fork-me ribbon.
- jslint - remove deadcode warning bad_option_a.
- jslint - fix bug failing to parse unicode "\\u{12345}"
- ci - fix ci silently failing in node-v12 and node-v14
- jslint - remove deadcode for preaction-binary-".".
- cli - add env var JSLINT_CLI to force-trigger cli in jslint.js
- jslint - fix bug falsely warning against conditional-chaining-operator "?.".
- website - load index.html with example code.
- website - merge file report.js into browser.js.
- jslint - add new rules unordered_param_a, unordered_property_a, that warn if parameters and properties are listed in nonascii-order.
- jslint - add "globalThis" to default globals.
@kaizhu256 kaizhu256 merged commit 597693e into master May 26, 2021
@chrswk
Copy link
chrswk commented May 27, 2021

Not sure if this is the right place, but I feel like the unordered_param_a/unordered_property_a is quite the change and to just have it on by default, without an option to disable it. I've been using JSLint for years and have always gone with what ever changes were introduced, because in the end they made my code better. But this feels a bit weird?

Oh and I love the new self contained CLI!

@kaizhu256
Copy link
Member Author

hi @chrswk, jslint will be shipping with ignore-macros shortly. i eventually want to get rid of most of the directives, and use /*jslint ignore:...*/ macros whenever a need to ignore warnings arise, e.g.:

/* jslint ignore:start */
/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */
!function(e,t){"use strict";"object"==typeof module&&...
/* jslint ignore:end */

let err = {
    statusCode: 404,
    // suppress warning unordered_property_a
    message: "Not Found", // jslint ignore:line
    type: "httpError",
    url: "https://www.undefined.com/undefined"
};

would that satisfy your needs? and appreciate knowing the cli helps : )

@chrswk
Copy link
chrswk commented May 27, 2021

Thank for the input.

To be honest, I'm not really a fan of the macros instead of the config flags, but I see why it would be easier in some cases. If that is the "solution", I think I will go through the trouble of reordering all my properties and parameters, even if that's a lot of work.

But out of curiosity: What is the reason or expected benefit of having ordered properties/parameters?

@kaizhu256
Copy link
Member Author

when inspecting/editing large dictionaries/json-objects with > 50 items, scrolling around the editor to find a key becomes troublesome if they're not sorted in some canonical order.

you've made me consider maybe adding a new directive classical or something similar which allows jslint to only enforce warnings pre v2021.5.26.

in meantime, since jslint is tool-less, you are free to disable (or add) warnings by simply editing jslint.js:

https://raw.githubusercontent.com/jslint-org/jslint/v2021.5.26/jslint.js
diff --git a/.a00.js b/.a00.js
index 2b62242..bee1d2a 100644
--- a/.a00.js
+++ b/.a00.js
@@ -2769,9 +2769,9 @@ function parameter_list() {
                     survey(subparam);
                     a = b;
                     b = String(subparam.value || subparam.id);
-                    if (a > b) {
-                        warn("unordered_param_a", subparam);
-                    }
+                    //!! if (a > b) {
+                        //!! warn("unordered_param_a", subparam);
+                    //!! }
                     advance();
                     signature.push(subparam.id);
                     if (next_token.id === ":") {
@@ -3123,9 +3123,9 @@ prefix("{", function () {
             advance();
             a = b;
             b = String(name.value || name.id);
-            if (a > b) {
-                warn("unordered_property_a", name);
-            }
+            //!! if (a > b) {
+                //!! warn("unordered_property_a", name);
+            //!! }
             if (
                 (name.id === "get" || name.id === "set")
                 && next_token.identifier
@@ -3284,9 +3284,9 @@ function do_var() {
                 survey(name);
                 a = b;
                 b = String(name.value || name.id);
-                if (a > b) {
-                    warn("unordered_param_a", name);
-                }
+                //!! if (a > b) {
+                    //!! warn("unordered_param_a", name);
+                //!! }
                 advance();
                 if (next_token.id === ":") {
                     advance(":");

@kaizhu256
Copy link
Member Author

new version v2021.5.27 has been pushed to branch master and https://www.jslint.com/jslint.js with new directive /*jslint unordered*/.

also in future, please use https://github.com/jslint-org/jslint/issues to raise issues/feature-requests/ideas ; )

image

@chrswk
Copy link
chrswk commented May 28, 2021

Oh no. As a developer who fights every day to not have to add new config parameters for X and Y to my software, I now have a config parameter on my conscience! 😅

I really appreciate your efforts. Your explanation makes sense and I think it should also reduce the mental effort of reasoning about a "logical" order. If you will excuse me, I have some properties and params reordering to do...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0