Commit 8420f73f authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Support comma-first style.

Let's be nice to those who prefer different coding style.
parent efb6e6aa
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -70,6 +70,9 @@ module JsDuck
        var_declaration
      elsif look(:ident, ":") || look(:string, ":") then
        property_literal
      elsif look(",", :ident, ":") || look(",", :string, ":")  then
        match(",")
        property_literal
      elsif look(:ident) || look("this") then
        maybe_assignment
      elsif look(:string) then
+13 −0
Original line number Diff line number Diff line
@@ -246,4 +246,17 @@ describe JsDuck::Aggregator do
    end
  end

  describe "comma-first style" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
         * Some documentation.
         */
        ,foo: ""
      EOS
    end
    it_should_behave_like "property"
    it_should_behave_like "cfg or property"
  end

end
+7 −0
Original line number Diff line number Diff line
@@ -129,6 +129,13 @@ describe JsDuck::Aggregator do
    it_should_behave_like "method documentation"
  end

  describe "function-literal in comma-first style" do
    before do
      @doc = parse("/** Some function */ , foo: function() {}")[0]
    end
    it_should_behave_like "method documentation"
  end

  describe "explicit @method without @param-s" do
    before do
      @doc = parse(<<-EOS)[0]