1. 21 Feb, 2019 2 commits
  2. 20 Feb, 2019 1 commit
  3. 16 Feb, 2019 1 commit
  4. 15 Feb, 2019 4 commits
  5. 12 Feb, 2019 1 commit
  6. 07 Feb, 2019 1 commit
  7. 06 Feb, 2019 2 commits
  8. 28 Jan, 2019 28 commits
    • Florian Müllner's avatar
      ci: Allow gradual switch to new style · 47beeb1a
      Florian Müllner authored
      It doesn't make too much sense to declare parts of the existing style
      "legacy", but then enforce it via CI. To allow for a gradual switch,
      generate a report with all issues that eslint considers errors in both
      configurations.
      
      !50
      47beeb1a
    • Florian Müllner's avatar
      ci: Add "source_check" stage · 945eddbc
      Florian Müllner authored
      More testing is always good, and the static analysis that eslint
      provides goes well beyond what js60 offers, so run it as part of
      the CI.
      
      This will also ensure that new contributions comply with the style
      rules we have set up.
      
      !50
      945eddbc
    • Florian Müllner's avatar
      ci: Don't use global image/before_script · c37ba087
      Florian Müllner authored
      We are about to add another job that will use different parameters,
      so it makes sense to set them under the job they belong to rather
      than globally.
      
      !50
      c37ba087
    • Florian Müllner's avatar
      extensions: Mark exported symbols · 3861ffae
      Florian Müllner authored
      eslint obviously doesn't know about gnome-shell's extension API, so
      the various entry points trigger unused-variable errors. To fix,
      explicitly mark those symbols as exported.
      
      !50
      3861ffae
    • Florian Müllner's avatar
      lib: Mark globals used from other modules as exported · 20813096
      Florian Müllner authored
      eslint cannot figure out that those symbols are used from other modules
      via imports, so they trigger unused-variable errors. To fix, explicitly
      mark those symbols as exported.
      
      !50
      20813096
    • Florian Müllner's avatar
      cleanup: Mark unused (but useful) variables as ignored · 08a04b2f
      Florian Müllner authored
      While we aren't using those destructured variables, they are still useful
      to document the meaning of those elements. We don't want eslint to keep
      warning about them though, so mark them accordingly.
      
      !50
      08a04b2f
    • Florian Müllner's avatar
      cleanup: Mark unused arguments as unused · 7b363fd6
      Florian Müllner authored
      This will stop eslint from warning about them, while keeping their
      self-documenting benefit.
      
      !50
      7b363fd6
    • Florian Müllner's avatar
      lint: Allow marking variables/arguments as unused · 85112394
      Florian Müllner authored
      Unused variables or arguments can indicate bugs, but they can also
      help document the code, in particular in case of signal handlers
      and destructuring.
      
      Account for this by keeping the error, but set up patterns that allow
      us to opt out of if for individual variables/arguments. For arguments
      we pick a '_' prefix, while for variables we go with a suffix instead,
      to not accidentally exempt private module-scope variables.
      
      !50
      85112394
    • Florian Müllner's avatar
      lint: Add "legacy" configuration · 190243ee
      Florian Müllner authored
      Regarding coding style, gjs is moving in a direction that departs quite
      significantly from the established style, in particular when indenting
      multi-line array/object literals or method arguments:
      
      Currently we are keeping those elements aligned, while the gjs rules now
      expect them to use the regular 4-space indentation.
      
      There are certainly good arguments that can be made for that move - it's
      much less prone to leading to overly-long lines, and matches popluar JS
      styles elsewhere. But switching coding style implies large diffs which
      interfere with git-blame and friends, so in order to allow for a more
      gradual change, add a separate set of "legacy" rules that match more
      closely the style we would expect up to now.
      
      It also disables the rules for quotes and template strings - the former
      because we cannot match the current style to use double-quotes for
      translatable strings and single-quotes otherwise, the latter because
      template strings are still relatively new, so we haven't adopted them
      yet.
      
      !50
      190243ee
    • Florian Müllner's avatar
      lint: Don't require indent for GObject.registerClass() · 1141d996
      Florian Müllner authored
      That function will eventually be replaced with decorators, and we don't
      want to re-indent all GObject classes when that happens, so allow class
      declarations with no indent:
      
          GObject.registerClass(
          class Foo extends GObject.Object {
          });
      
      !50
      1141d996
    • Florian Müllner's avatar
      lint: Tweak indenting rule · f7cbd0d6
      Florian Müllner authored
      I simply cannot deal with multi-line trinary expressions where the
      two "branches" don't align, so add an exception for them.
      
      And while the strict 4-line indent for objects is growing on me for
      "regular" objects:
      
          let foo = new Foo({
              bar: 42,
              baz: 'bam'
          });
      
      I do prefer the current style of compact braces and aligned properties
      for object lists:
      
          let entries = [
              { name: 'foo',
                visible: true },
              { name: 'bar',
                halign: Gtk.Align.START }
          ];
      
      So allow the latter style as well, at least for the time being.
      
      !50
      f7cbd0d6
    • Florian Müllner's avatar
      lint: Allow single-line braces · c704f0de
      Florian Müllner authored
      When using arrow functions, we only omit the braces when we are using
      the return value:
      
          this.get_children().filter(w => w.visible);
      
      When braces are used, eslint by default enforces line breaks, but
      there are cases where the expression is hardly less concise than
      the above:
      
          this.get_children().forEach(w => { w.destroy(); });
      
      So change the default to allow this.
      
      !50
      c704f0de
    • Florian Müllner's avatar
      lint: Allow multiple spaces before key values · c8a1cd9c
      Florian Müllner authored
      This is useful for imitating namespaced flags/enums:
      
      ```
      const FooFlags = {
          NONE :   0,
          SMEAGLY: 1 << 0,
          SMOGLEY: 1 << 1,
          MUGGLY:  1 << 2
      };
      ```
      
      !50
      c8a1cd9c
    • Florian Müllner's avatar
      lint: Enforce camelCase · ff79588d
      Florian Müllner authored
      All variables should be in camelCase, so configure the corresponding
      rule to enforce this. Exempt properties for now, to accommodate the
      existing practice of using C-style underscore names for construct
      properties of introspected objects.
      
      !50
      ff79588d
    • Florian Müllner's avatar
      lint: Enforce arrow notation · 8ae84703
      Florian Müllner authored
      We replaced all Lang.bind() calls with arrow functions or the standardized
      Function.prototype.bind(), at least for the former eslint has some options
      to ensure that the old custom doesn't sneak back in.
      
      !50
      8ae84703
    • Florian Müllner's avatar
      lint: Require spaces inside braces in object literals · f18b2810
      Florian Müllner authored
      Prohibiting spaces where the established GNOME style has required
      them for a decade would be a harsh change for no good reason.
      
      !50
      f18b2810
    • Florian Müllner's avatar
      lint: Tweak the whitelist of globals · 75503b5f
      Florian Müllner authored
      gjs doesn't include any gettext wrappers, and obviously can't know
      about the shell's global object, so include those in the list of
      globals.
      
      !50
      75503b5f
    • Florian Müllner's avatar
      lint: Import eslint rules from gjs · 1d96f833
      Florian Müllner authored
      gjs started to run eslint during its CI a while ago, so there is an
      existing rules set we can use as a starting point for our own setup.
      
      As we will adapt those rules to our code base, we don't want those
      changes to make it harder to synchronize the copy with future gjs
      changes, so include the rules from a separate file rather than using
      the configuration directly.
      
      !50
      1d96f833
    • Florian Müllner's avatar
      style: Use consistent style for object literal parameters · b3f00901
      Florian Müllner authored
      Spotted by eslint.
      
      !49
      b3f00901
    • Florian Müllner's avatar
      style: Avoid trailing commas in array destructuring · 05d961df
      Florian Müllner authored
      When destructuring multiple return values, we often use trailing commas
      to indicate that there are additional elements that we are ignoring.
      
      There isn't anything inherently wrong with that, but it's a style that's
      too confusing for eslint - on the one hand we require a space after a
      comma, on the other hand we require no space before closing brackets.
      
      !49
      05d961df
    • Florian Müllner's avatar
      style: Stop using string concatenation · 8a2b9abc
      Florian Müllner authored
      String concatenation is considered bad style after ES6 added
      template strings. The latter is the replacement we generally
      want, except where the aforementioned xgettext bug would trip
      over the backtick/slash combination.
      
      !49
      8a2b9abc
    • Florian Müllner's avatar
      style: Fix indentation errors · 3effc9cf
      Florian Müllner authored
      While we have some style inconsistencies - mostly regarding split lines,
      i.e. aligning to the first arguments vs. a four-space indent - there are
      a couple of places where the spacing is simply wrong. Fix those.
      
      Spotted by eslint.
      
      !49
      3effc9cf
    • Florian Müllner's avatar
      style: Fix stray/missing spaces · 1be7061d
      Florian Müllner authored
      Spotted by eslint.
      
      !49
      1be7061d
    • Florian Müllner's avatar
      style: Fix stray/missing semi-colons · f75d1d75
      Florian Müllner authored
      Spotted by eslint.
      
      !49
      f75d1d75
    • Florian Müllner's avatar
      style: Use space after catch · 67f9e4c4
      Florian Müllner authored
      We currently use a consistent style of not adding spaces in catch
      clauses, however that's inconsistent with the style we use for any
      other statement. There's not really a good reason to stick with it,
      so switch to the style gjs/eslint default to.
      
      !49
      67f9e4c4
    • Florian Müllner's avatar
      style: Use camelCase for variable names · aaeff6d1
      Florian Müllner authored
      Spotted by eslint.
      
      !49
      aaeff6d1
    • Florian Müllner's avatar
      cleanup: Remove unhelpful unused init() argument · 912ba1e6
      Florian Müllner authored
      Virtually all extensions use the getCurrentExtension() helper instead
      of the obscure init() argument, and we are no exception.
      
      !49
      912ba1e6
    • Florian Müllner's avatar
      cleanup: Remove empty init() functions · b741b1bb
      Florian Müllner authored
      The method is optional, so there's no point at all in letting the
      shell call an empty method during initialization.
      
      !49
      b741b1bb