Re: GJS internal linter



Hi Andrea,

On Sat, Apr 9, 2016 at 11:31 AM Andrea Giammarchi <andrea giammarchi gmail com> wrote:
Since I've received zero answers on this one, I've assumed there was no way to do that.

I'm sure there is a way, but I just had no time to investigate this week. Sorry.

I believe the "internal linter" is a SpiderMonkey thing, not GJS, so it would be more a question of whether GJS would accept a patch to disable it.

FWIW I've run into the same problem with jasmine-gjs, where I had to patch Jasmine core to avoid those warnings: https://github.com/ptomato/jasmine-gjs/blob/master/lib/local-modifications.patch

I originally submitted a patch to upstream Jasmine where I fixed those warnings, and they accepted some of my modifications, but not these particular ones, as they said that putting functions after an unconditional return statement is a style choice that they prefer. (Since functions are [I think?] hoisted then this warning is probably not a good one, anyway.)

However since most of the SpiderMonkey warnings are reasonable, the upstream modules might well accept your modifications.

If interested, I've fixed that one for you. I've forked and hand-patched babel-standalone build to be compatible with GJS internal linter:

This is really interesting!

That fork made it possible for jsgtk ( https://github.com/WebReflection/jsgtk#jsgtk ) to include modules via `require("npm-module")` or `require("./local-module")` written directly in ES2015 syntax.

The following is the plugins "preset" I'm using for mozjs24 since it's IMO not worth bringing in the entire ES2015 preset because most of it "just works":

Anyway, my babel-standalone fork would be capable of translating at runtime that too.

What does it mean for GJS develoeprs? Following just few improvements:
  1. forget about `imports.lang` and old MooTools, write native `class` as if there's no yesterday
Is there a way to write GObject-derived classes using the native ES6 class keyword? (That's the only reason for the existence of the Lang.Class metaclass, as far as I'm concerned.)
  1. string templates all the things
  2. methods shorthands for any `{objects(){ return this.constructor; }}` or class definition
  3. named parameters
  4. unicode capable RegExp /via/u <-- flag
Hope somebody will find jsgtk or at least the GJS compatible version of babel-standalone useful.

I'm here to answer any question, if needed.

Best Regards



On Thu, Apr 7, 2016 at 10:27 AM, Andrea Giammarchi <andrea giammarchi gmail com> wrote:
I wonder if there's a way to suppress, either via code or via CLI option, warnings about functions never returning (actually, every sort of warning, not just this one).

It's cool to have an integrated linter but it also makes it impossible to reuse code that doesn't care about those messages or rules.

This is not about how good-practice is to lint code and how dangerous a function that is meant to return undefined could be if it actually does not explicitly return undefined ... this is about code/modules interoperability with GJS.

For instance, in jsgtk I'm trying to bring in babel-standalone at runtime for lazily npm-like imported modules (so that mozjs core can be polyfilled where needed) but there are gazillion errors shown each time simply importing that file.

I really don't care about these errors: the library is huge, well tested, and not even mine.
Having a way to suppress, even temporarily, those warnings, would be a huge help.

Thanks in advance for any possible outcome.

Best Regards

_______________________________________________
_javascript_-list mailing list
_javascript_-list gnome org
https://mail.gnome.org/mailman/listinfo/_javascript_-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]