1067 Commits (1afe682c65b1bb73e5c646abe40049c1f39cb4f6)
 

Author SHA1 Message Date
David Majda e61ae59681 Code style: Fix ESLint "default-case" errors
Part of #407.
8 years ago
David Majda 364482dd68 Code style: Fix ESLint "no-prototype-builtins" errors
Part of #407.
8 years ago
David Majda 1870308afb Code style: Fix ESLint "object-shorthand" errors
Part of #407.
8 years ago
David Majda 6f34b542b4 Code style: Use eslint-config-dmajda ESLint configuration
This change leads to quite some errors being reported by ESLint. These
will be fixed in subsequent commits.

Part of #407.
8 years ago
David Majda 5dd8e797f7 Code style: Do not lint lib/parser.js
The idea behind linting lib/parser.js was that it would improve quality
of code generated by PEG.js in general. However, there is a couple of
problems with it:

  1. Code in lib/parser.js is ES5 while the rest of the code is ES2015.
     This would mean a separate ESLint configuration and a separate set
     of code style rules just for lib/parser.js once code style checks
     are added.

  2. Code in lib/parser.js is generated. This means that even today it
     violates checks like "no-unused-var", which have to be disabled.
     This would get worse once code style checks are added, again
     requiring a separate ESLint configuration just for lib/parser.js.

  3. Linting lib/parser.js checks only small portion of possible code
     generator output. For example, code generated when optimizing for
     size or when tracing is not checked at all. Thus, linting
     lib/parser.js gives a false sense of security.

Because of these problems I decided not to lint lib/parser.js at all and
rely on ad-hoc linting of parser files produced by PEG.js with ignoring
false-positives. I consider this more of a pragmatic cost vs. benefits
decision than a principial one.

Part of #407.
8 years ago
David Majda f82d9872ba Replace stray "var" by "let"
Likely missed in bdf91b5941.
8 years ago
David Majda 65afb7fd5d Remove unnecessary parens around arrow function parameters 8 years ago
David Majda 7495e6e03f Add missing semicolons 8 years ago
David Majda b81afb1471 Do not quote the "class" key
Quoting reserved words in property names is not needed since dropping
support of IE < 9.
8 years ago
David Majda fb26d6425b Remove extra newlines 8 years ago
David Majda 45b62d66d2 Whitespace fixes 8 years ago
David Majda 47bc456dcd Remove useless variable reference 8 years ago
David Majda ec3f7f5bb0 Remove extra indentation 8 years ago
David Majda 7ca229a432 Improve indentation of variable declarations
Before this commit, continuation lines of multi-line values in variable
declaration initializers were aligned with the variable name:

  let foo = {
        a: 5,
        b: 6
      };

This was highly irregular, maintenance intensive, and made declarations
look different from assignments.

This commit changes the indentation to be more regular and similar to
assignments:

  let foo = {
    a: 5,
    b: 6
  };
8 years ago
David Majda b5eb1a0ec4 Use eslint 3.6.1 8 years ago
David Majda ca5ac6bd5f LICENSE: Use more standard format
The LICENSE file used weird word wrapping and it didn't explicitly name
the license. I'm not sure where I originally copied it from.

I decided to replace it with more standard form from here:

  http://choosealicense.com/licenses/mit/

The content of the license stays exactly the same.
8 years ago
David Majda c0efd83394 benchmark/README.md: Fix command to execute the benchmark suite 8 years ago
David Majda e29d62558d Do not prepend the "eslint-env" directive to lib/parser.js
The lib/parser.js file is a CommonJS module like all the other files in
lib/, so setting the environment explicitly is not needed. Besides, the
environment set by "eslint-env" was wrong (since transitioning from the
AMD format).
8 years ago
David Majda c721b9bf6e Omit PEG.js version from browser version file name
This makes upgrades easier for browser version users and it is in line
with most other JavaScript projects.
8 years ago
David Majda ff3cc7930e CSS Example: Move null filtering from extractList to buildList
This makes extractList identical to the same function in other grammars
and makes it so that nulls are dealt with in only one function (until
now, they were dealt with both in extractList and buildList).

The refactoring should be safe as extractList isn't by itself used in
contexts where it can be passed a list containing nulls.
8 years ago
David Majda 647d488147 JSON example: Fix link to RFC 4234. 8 years ago
David Majda 2baeace235 JSON example: Expand some one-line rules to multiple lines
Blocks of one-line rules with aligned "=" signs should be used only in
cases where the rules are symmetric and we want to emphasize that.

Follow-up to ff7193776e.
8 years ago
David Majda 1508e804a6 parser.spec.js: Remove extra spaces 8 years ago
David Majda 65ea01cd63 parser.spec.js: Fix comment typo 8 years ago
David Majda 9808b88ccb generated-parser-behavior.spec.js: Move variable inside loop 8 years ago
David Majda 6e463e2113 {spec,benchmark}/server: Use template literals 8 years ago
David Majda 70e59fc5d0 {spec,benchmark}/server: Remove extra trailing newline 8 years ago
David Majda 9648ca53d7 Use the "eslint-disable" directive instead of "eslint"
The "eslint-disable" directive is more specific.
8 years ago
David Majda 60821bb80b Sort "require" calls by variable names and group them
This makes things consistent and reduces thinking about "require"
ordering.
8 years ago
David Majda c134e06229 Move "use strict" directives up
Move "use strict" directives to the first line of each file. In
particular, move them above any ESLint comments, which are far less
important.

There are few exceptions:

  Executable files

    In these, the "use strict" directive must give way to the shebang.

  lib/parser.js

    Here, the "Generated by..." comment comes first. Also, ESLint
    comments are prepended in post-processing.
8 years ago
David Majda ff7193776e Avoid aligning "="
The only exception left are instances where aligning "=" helps to
express symmetry between lines.

See #443.
8 years ago
David Majda 400a3cfa3c Avoid aligning object keys
The only exception left are objects representing a mapping with simple
keys and values -- essentially tables written as object literals.

See #443.
8 years ago
David Majda 12112310f2 Use only double quotes for strings
See #443
8 years ago
David Majda 6294bb5b13 Use only "//" comments
See #443.
8 years ago
David Majda 1da6abc458 Use one var/let/const per variable (fixup)
Fix few instances in generated code which I missed in the previous
commit.

See #443.
8 years ago
David Majda 516023546d Use one var/let/const per variable (for initialized variables)
Use one var/let/const per variable, but only for initialized variables.
Uninitialized variables are still grouped into one var/let/const
declaration as I don't see any value in separating them. This approach
reflects the fact that initialized and uninitialized var/let/const
declarations are really two different things.

See #443.
8 years ago
David Majda 381b5f4db7 Merge pull request #455 from Mingun/fix-testing 8 years ago
Mingun fcddfbebdd Add `glob` dev dependency used in spec and benchmark servers 8 years ago
Mingun 26ded450f4 Add "use strict" for spec and benchmark servers 8 years ago
David Majda 7f01db2fb8 Get rid of for-in loops
The for-in statement in JavaScript iterates also over inherited
properties. This is typically not desired and requires adding a
check using Object.prototype.hasOwnProperty inside the loop.

This commit replaces all for-in statements and related checks inside
them with iteration over Object.keys(...). The iteration is performed
using either Array.prototype.forEach of a plain for loop.
8 years ago
David Majda b2a9dabcff Remove now unused lib/utils/objects.js
See #442.
8 years ago
David Majda 5fbb557f80 Don't use "objects" in lib/peg.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 66ca7e2168 Don't use "objects" in lib/compiler/visitor.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 76e70c3923 Don't use "objects" in lib/compiler/passes/report-duplicate-labels.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda d2569b9bf3 Don't use "objects" in lib/compiler/passes/generate-js.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 8a75d19468 Don't use "objects" in lib/compiler/passes/generate-bytecode.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda 97d92c9d8b Don't use "objects" in lib/compiler/index.js
The "objects" module will be removed.

See #442.
8 years ago
David Majda c344460855 Remove now unused lib/utils/arrays.js
See #442.
8 years ago
David Majda f81ae1845b Don't use "arrays" in lib/compiler/passes/report-infinite-recursion.js
The "arrays" module will be removed.

See #442.
8 years ago
David Majda 71ef4c9b91 Don't use "arrays" in lib/compiler/passes/remove-proxy-rules.js
The "arrays" module will be removed.

See #442.
8 years ago