kkoch986 / js-parse

A generic node.js based LR(1) shift-reduce parser.
12 stars 1 forks source link

run jslint #6

Open kkoch986 opened 10 years ago

kkoch986 commented 10 years ago

im sure there will be a litany of things to fix....

platinumazure commented 8 years ago

I decided to try adding ESLint to the project. After configuring what I could to get rid of obviously useless errors, I've pasted the remainder below.

A couple of questions:

  1. This being a Node.JS app, should I turn off no-console to allow console.log statements? I'm not sure if this app is meant to be primarily output to files/terminals or if the console statements are for debugging.
  2. What should be done about the specs that have an early return? ESLint correctly notes that the other statements are unreachable. Is there a plan to re-enable those specs?
  3. If you're attached to accessing properties of the parser/lexer with bracket notation, should I turn off the dot-notation rule?

My lint results:


C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\lexical\literals.js
  230:5   error  Duplicate key '&'                 no-dupe-keys
  315:41  error  Unnecessary escape character: \]  no-useless-escape
  324:15  error  Unnecessary escape character: \]  no-useless-escape
  354:5   error  Expected line before comment      lines-around-comment

C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\lexical\tokens.js
   8:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
   9:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  12:5  error  Expected line before comment  lines-around-comment
  27:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  30:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  31:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  36:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  37:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  38:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  39:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  40:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  43:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs
  44:2  error  Mixed spaces and tabs         no-mixed-spaces-and-tabs

C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\spec\comments_spec.js
   9:48  error  Unexpected trailing comma        comma-dangle
  20:34  error  'ast' is defined but never used  no-unused-vars

C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\spec\literals_spec.js
   31:5   error  Don't use octal: '\012'. Use '\u....' instead  no-octal-escape
   84:11  error  'test' is already defined                      no-redeclare
   85:9   error  'expected' is already defined                  no-redeclare
  107:9   error  'test' is already defined                      no-redeclare

C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\spec\primary_expressions_spec.js
   3:25  error  Use path.join() or path.resolve() instead of + to create paths  no-path-concat
   4:25  error  Use path.join() or path.resolve() instead of + to create paths  no-path-concat
  43:10  error  'test' is already defined                                       no-redeclare
  44:7   error  'expected' is already defined                                   no-redeclare

C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\spec\tokens_spec.js
  55:10  error  'test' is already defined      no-redeclare
  56:7   error  'expected' is already defined  no-redeclare

C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\spec\whitespace_spec.js
  19:34  error  'ast' is defined but never used  no-unused-vars

C:\Users\kpartington\Documents\GitHub\js-parse\examples\php\syntax\primary_expressions.js
  8:2  error  Mixed spaces and tabs  no-mixed-spaces-and-tabs

C:\Users\kpartington\Documents\GitHub\js-parse\examples\re\re.js
  52:2  error  Unexpected console statement         no-console
  56:2  error  Unexpected console statement         no-console
  60:2  error  Unexpected console statement         no-console
  68:2  error  Unexpected console statement         no-console
  86:2  error  More than 2 blank lines not allowed  no-multiple-empty-lines

C:\Users\kpartington\Documents\GitHub\js-parse\examples\site\basic.js
  48:2  error  Unexpected console statement  no-console
  52:2  error  Unexpected console statement  no-console

C:\Users\kpartington\Documents\GitHub\js-parse\examples\site\c.js
  127:30  error  'token_stack' is defined but never used  no-unused-vars
  128:2   error  Unexpected console statement             no-console
  132:2   error  Unexpected console statement             no-console

C:\Users\kpartington\Documents\GitHub\js-parse\examples\site\matching.js
  49:2  error  Unexpected console statement  no-console
  53:2  error  Unexpected console statement  no-console

C:\Users\kpartington\Documents\GitHub\js-parse\lib\index.js
  22:1   error  Unexpected console statement  no-console
  22:17  error  Unexpected console statement  no-console
  23:1   error  Unexpected console statement  no-console

C:\Users\kpartington\Documents\GitHub\js-parse\lib\lexer.js
  146:12  error  'r' is already defined           no-redeclare
  147:9   error  'rule' is already defined        no-redeclare
  223:8   error  'tie' is defined but never used  no-unused-vars
  225:12  error  'r' is already defined           no-redeclare
  226:9   error  'rule' is already defined        no-redeclare
  248:10  error  'value' is already defined       no-redeclare
  249:10  error  'tok' is already defined         no-redeclare

C:\Users\kpartington\Documents\GitHub\js-parse\lib\parser\lr_parser.js
  161:10  error  's' is already defined                           no-redeclare
  180:11  error  'j' is already defined                           no-redeclare
  185:2   error  Unexpected console statement                     no-console
  186:10  error  'i' is already defined                           no-redeclare
  187:3   error  Unexpected console statement                     no-console
  212:2   error  Unexpected console statement                     no-console
  214:3   error  Unexpected console statement                     no-console
  215:3   error  Unexpected console statement                     no-console
  216:3   error  Unexpected console statement                     no-console
  218:4   error  Unexpected console statement                     no-console
  220:3   error  Unexpected console statement                     no-console
  226:10  error  's' is already defined                           no-redeclare
  232:3   error  Unexpected console statement                     no-console
  245:2   error  Unexpected console statement                     no-console
  295:11  error  'innerModName' is already defined                no-redeclare
  296:8   error  'lowestLevelModName' is already defined          no-redeclare
  319:11  error  'p' is already defined                           no-redeclare
  335:12  error  's' is already defined                           no-redeclare
  336:9   error  'constraints' is defined but never used          no-unused-vars
  388:11  error  'type' is already defined                        no-redeclare
  391:8   error  Unexpected console statement                     no-console
  438:10  error  's' is already defined                           no-redeclare
  456:12  error  's' is already defined                           no-redeclare
  489:8   error  Move function declaration to function body root  no-inner-declarations
  559:10  error  's' is already defined                           no-redeclare
  586:10  error  'p' is already defined                           no-redeclare
  603:11  error  's' is already defined                           no-redeclare
  685:7   error  'head' is defined but never used                 no-unused-vars
  826:3   error  Unreachable code                                 no-unreachable
  830:3   error  Unexpected console statement                     no-console
  837:3   error  Unexpected console statement                     no-console
  844:11  error  'i' is defined but never used                    no-unused-vars
  848:8   error  'type' is already defined                        no-redeclare
  886:3   error  Unexpected console statement                     no-console
  893:3   error  Unexpected console statement                     no-console

C:\Users\kpartington\Documents\GitHub\js-parse\lib\parser\utils\first_set.js
  88:14  error  's' is already defined  no-redeclare
  98:12  error  's' is already defined  no-redeclare

C:\Users\kpartington\Documents\GitHub\js-parse\meta.js
   48:2   error  Unexpected console statement     no-console
   57:1   error  Unexpected console statement     no-console
   81:48  error  'AST' is defined but never used  no-unused-vars
   83:2   error  Unexpected console statement     no-console
   87:3   error  Unexpected console statement     no-console
  122:30  error  'AST' is defined but never used  no-unused-vars
  124:3   error  Unexpected console statement     no-console

C:\Users\kpartington\Documents\GitHub\js-parse\spec\parser_action_table_spec.js
   25:1   error  Unreachable code                           no-unreachable
   26:1   error  Unreachable code                           no-unreachable
   26:5   error  'START_SYMBOL' is defined but never used   no-unused-vars
   27:1   error  Unreachable code                           no-unreachable
   27:5   error  'EPSILON' is defined but never used        no-unused-vars
   28:1   error  Unreachable code                           no-unreachable
   31:1   error  Unreachable code                           no-unreachable
   66:7   error  'parserDescription' is already defined     no-redeclare
  125:7   error  'parserDescription' is already defined     no-redeclare
  153:2   error  More than 2 blank lines not allowed        no-multiple-empty-lines
  171:25  error  ["EOF"] is better written in dot notation  dot-notation
  172:48  error  ["EOF"] is better written in dot notation  dot-notation
  173:23  error  ["EOF"] is better written in dot notation  dot-notation

C:\Users\kpartington\Documents\GitHub\js-parse\spec\parser_first_set_spec.js
   27:5   error  'EOF' is defined but never used           no-unused-vars
   67:13  error  ["a"] is better written in dot notation   dot-notation
   68:13  error  ["b"] is better written in dot notation   dot-notation
   69:13  error  ["c"] is better written in dot notation   dot-notation
   70:13  error  ["d"] is better written in dot notation   dot-notation
   71:13  error  ["e"] is better written in dot notation   dot-notation
   74:13  error  ["S"] is better written in dot notation   dot-notation
   75:13  error  ["B"] is better written in dot notation   dot-notation
   76:13  error  ["C"] is better written in dot notation   dot-notation
   93:5   error  Duplicate key 'n'                         no-dupe-keys
  134:13  error  ["i"] is better written in dot notation   dot-notation
  135:13  error  ["c"] is better written in dot notation   dot-notation
  136:13  error  ["n"] is better written in dot notation   dot-notation
  137:13  error  ["b"] is better written in dot notation   dot-notation
  138:13  error  ["a"] is better written in dot notation   dot-notation
  139:13  error  ["d"] is better written in dot notation   dot-notation
  140:13  error  ["e"] is better written in dot notation   dot-notation
  141:13  error  ["n"] is better written in dot notation   dot-notation
  142:13  error  ["q"] is better written in dot notation   dot-notation
  146:13  error  ["P"] is better written in dot notation   dot-notation
  147:13  error  ["Q"] is better written in dot notation   dot-notation
  148:13  error  ["R"] is better written in dot notation   dot-notation
  149:13  error  ["S"] is better written in dot notation   dot-notation
  150:13  error  ["T"] is better written in dot notation   dot-notation
  193:13  error  ["a"] is better written in dot notation   dot-notation
  194:13  error  ["e"] is better written in dot notation   dot-notation
  195:13  error  ["r"] is better written in dot notation   dot-notation
  198:13  error  ["S"] is better written in dot notation   dot-notation
  199:13  error  ["R"] is better written in dot notation   dot-notation
  200:13  error  ["T"] is better written in dot notation   dot-notation
  201:13  error  ["Q"] is better written in dot notation   dot-notation
  243:13  error  ["a"] is better written in dot notation   dot-notation
  244:13  error  ["b"] is better written in dot notation   dot-notation
  245:13  error  ["c"] is better written in dot notation   dot-notation
  246:13  error  ["d"] is better written in dot notation   dot-notation
  247:13  error  ["e"] is better written in dot notation   dot-notation
  248:13  error  ["f"] is better written in dot notation   dot-notation
  249:13  error  ["g"] is better written in dot notation   dot-notation
  252:13  error  ["S"] is better written in dot notation   dot-notation
  253:13  error  ["B"] is better written in dot notation   dot-notation
  254:13  error  ["C"] is better written in dot notation   dot-notation
  278:30  error  Unexpected trailing comma                 comma-dangle
  308:13  error  ["a"] is better written in dot notation   dot-notation
  309:13  error  ["b"] is better written in dot notation   dot-notation
  310:13  error  ["c"] is better written in dot notation   dot-notation
  311:13  error  ["d"] is better written in dot notation   dot-notation
  312:13  error  ["e"] is better written in dot notation   dot-notation
  313:13  error  ["f"] is better written in dot notation   dot-notation
  316:13  error  ["S"] is better written in dot notation   dot-notation
  317:13  error  ["A"] is better written in dot notation   dot-notation
  318:13  error  ["B"] is better written in dot notation   dot-notation
  319:13  error  ["C"] is better written in dot notation   dot-notation
  320:13  error  ["D"] is better written in dot notation   dot-notation
  366:13  error  ["a"] is better written in dot notation   dot-notation
  367:13  error  ["b"] is better written in dot notation   dot-notation
  368:13  error  ["c"] is better written in dot notation   dot-notation
  374:13  error  ["S"] is better written in dot notation   dot-notation
  375:13  error  ["A"] is better written in dot notation   dot-notation
  376:13  error  ["E"] is better written in dot notation   dot-notation
  377:13  error  ["T"] is better written in dot notation   dot-notation
  429:13  error  ["id"] is better written in dot notation  dot-notation
  432:13  error  ["F"] is better written in dot notation   dot-notation
  433:13  error  ["T"] is better written in dot notation   dot-notation
  434:13  error  ["E"] is better written in dot notation   dot-notation

C:\Users\kpartington\Documents\GitHub\js-parse\spec\parser_follow_set_spec.js
   25:1   error  Unreachable code                          no-unreachable
   26:1   error  Unreachable code                          no-unreachable
   27:1   error  Unreachable code                          no-unreachable
   27:5   error  'EPSILON' is defined but never used       no-unused-vars
   28:1   error  Unreachable code                          no-unreachable
   30:1   error  Unreachable code                          no-unreachable
   68:14  error  ["a"] is better written in dot notation   dot-notation
   69:14  error  ["b"] is better written in dot notation   dot-notation
   70:14  error  ["c"] is better written in dot notation   dot-notation
   71:14  error  ["d"] is better written in dot notation   dot-notation
   72:14  error  ["e"] is better written in dot notation   dot-notation
   76:14  error  ["S"] is better written in dot notation   dot-notation
   77:14  error  ["B"] is better written in dot notation   dot-notation
   78:14  error  ["C"] is better written in dot notation   dot-notation
   95:5   error  Duplicate key 'n'                         no-dupe-keys
  134:14  error  ["i"] is better written in dot notation   dot-notation
  135:14  error  ["c"] is better written in dot notation   dot-notation
  136:14  error  ["n"] is better written in dot notation   dot-notation
  137:14  error  ["b"] is better written in dot notation   dot-notation
  138:14  error  ["a"] is better written in dot notation   dot-notation
  139:14  error  ["d"] is better written in dot notation   dot-notation
  140:14  error  ["e"] is better written in dot notation   dot-notation
  141:14  error  ["n"] is better written in dot notation   dot-notation
  142:14  error  ["q"] is better written in dot notation   dot-notation
  146:14  error  ["P"] is better written in dot notation   dot-notation
  147:14  error  ["Q"] is better written in dot notation   dot-notation
  148:14  error  ["R"] is better written in dot notation   dot-notation
  149:14  error  ["S"] is better written in dot notation   dot-notation
  150:14  error  ["T"] is better written in dot notation   dot-notation
  192:14  error  ["a"] is better written in dot notation   dot-notation
  193:14  error  ["b"] is better written in dot notation   dot-notation
  194:14  error  ["c"] is better written in dot notation   dot-notation
  195:14  error  ["d"] is better written in dot notation   dot-notation
  196:14  error  ["e"] is better written in dot notation   dot-notation
  197:14  error  ["f"] is better written in dot notation   dot-notation
  198:14  error  ["g"] is better written in dot notation   dot-notation
  202:14  error  ["S"] is better written in dot notation   dot-notation
  203:14  error  ["B"] is better written in dot notation   dot-notation
  204:14  error  ["C"] is better written in dot notation   dot-notation
  224:30  error  Unexpected trailing comma                 comma-dangle
  254:14  error  ["a"] is better written in dot notation   dot-notation
  255:14  error  ["b"] is better written in dot notation   dot-notation
  256:14  error  ["c"] is better written in dot notation   dot-notation
  257:14  error  ["d"] is better written in dot notation   dot-notation
  258:14  error  ["e"] is better written in dot notation   dot-notation
  259:14  error  ["f"] is better written in dot notation   dot-notation
  263:14  error  ["S"] is better written in dot notation   dot-notation
  264:14  error  ["A"] is better written in dot notation   dot-notation
  265:14  error  ["B"] is better written in dot notation   dot-notation
  266:14  error  ["C"] is better written in dot notation   dot-notation
  267:14  error  ["D"] is better written in dot notation   dot-notation
  313:14  error  ["a"] is better written in dot notation   dot-notation
  314:14  error  ["b"] is better written in dot notation   dot-notation
  315:14  error  ["c"] is better written in dot notation   dot-notation
  322:14  error  ["S"] is better written in dot notation   dot-notation
  323:14  error  ["A"] is better written in dot notation   dot-notation
  324:14  error  ["E"] is better written in dot notation   dot-notation
  325:14  error  ["T"] is better written in dot notation   dot-notation
  377:14  error  ["id"] is better written in dot notation  dot-notation
  380:14  error  ["E"] is better written in dot notation   dot-notation
  383:14  error  ["T"] is better written in dot notation   dot-notation
  386:14  error  ["F"] is better written in dot notation   dot-notation

✖ 236 problems (236 errors, 0 warnings)
kkoch986 commented 8 years ago

wow haha seems like alot of the same thing so maybe not toooo bad thanks for running this!

regarding your questions:

  1. i think for now we can probably turn off the no-console setting, eventually though i may want to remove them.
  2. I think the reason those specs have early returns is because they fail, i may be mistaken its been awhile since i looked at it.
  3. seems like all the dot-notation errors are in the tests where i did things like firstSets["a"].should.eql(["a"]); i'd be happy either way i think i was just cracking away at it and not thinking.