Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

Commit

Permalink
Chore: Minor cleanup, fix jQuery foundation copyright (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed Sep 7, 2017
1 parent 5576fb4 commit 9e17d0b
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 61 deletions.
1 change: 1 addition & 0 deletions lib/ast-converter.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Converts TypeScript AST into ESTree format.
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
1 change: 1 addition & 0 deletions lib/ast-node-types.js
@@ -1,6 +1,7 @@
/**
* @fileoverview The AST node types produced by the parser.
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/convert-comments.js
@@ -1,6 +1,6 @@
/**
* @fileoverview Convert comment using TypeScript token scanner
* @author James Henry
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
1 change: 1 addition & 0 deletions lib/convert.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Converts TypeScript AST into ESTree format.
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/node-utils.js
@@ -1,6 +1,6 @@
/**
* @fileoverview Utilities for finding and converting TSNodes into ESTreeNodes
* @author James Henry
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
10 changes: 6 additions & 4 deletions tests/ast-alignment/known-issues.js
@@ -1,10 +1,12 @@
"use strict";

/**
* ==================================================
* KNOWN/DIAGNOSED ISSUES
* ==================================================
*/

// const fixturePatternsToTest = [
module.exports = [
/**
* "ExperimentalSpreadProperty" in espree/typescript-eslint-parser vs "SpreadElement" in Babylon
* comes up a lot in this section
Expand Down Expand Up @@ -41,7 +43,7 @@
* Babylon parse error because of more strict spec enforcement than other parsers.
*/

/**
/**
* super() is being used outside of constructor. Other parsers (e.g. espree, acorn) do not error on this.
*/
// "ecma-features/classes/class-one-method-super.src.js", // babylon parse errors
Expand Down Expand Up @@ -78,11 +80,11 @@
// pattern: "ecma-features/modules/error-delete.src.js",
// config: { babylonParserOptions: { sourceType: "module" } }
// },
/**
/**
* 'with' in strict mode
*/
// {
// pattern: "ecma-features/modules/error-strict.src.js",
// config: { babylonParserOptions: { sourceType: "module" } }
// },
// ];
];
53 changes: 20 additions & 33 deletions tests/ast-alignment/spec.js
Expand Up @@ -226,7 +226,6 @@ const fixturePatternsToTest = [
* so we have to specify the "sourceType" we want to use.
*
* By default we have configured babylon to use "script", but for the examples below we need "module".
* Maybe fixed by https://github.com/babel/babylon/commit/00ad6d8310ce826dcdd59c7a819dbd50955058d7?
*/
{
pattern: "comments/export-default-anonymous-class.src.js",
Expand Down Expand Up @@ -637,6 +636,14 @@ fixturePatternsToTest.forEach(fixturePattern => {
});
});

/* eslint-disable */
/**
* Common predicates for Babylon AST preprocessing
*/
const always = () => true;
const ifNumber = (val) => typeof val === "number";
/* eslint-enable */

/**
* - Babylon wraps the "Program" node in an extra "File" node, normalize this for simplicity for now...
* - Remove "start" and "end" values from Babylon nodes to reduce unimportant noise in diffs ("loc" data will still be in
Expand All @@ -649,65 +656,45 @@ function preprocessBabylonAST(ast) {
return parseUtils.omitDeep(ast.program, [
{
key: "start",
predicate(val) {
// only remove the "start" number (not the "start" object within loc)
return typeof val === "number";
}
// only remove the "start" number (not the "start" object within loc)
predicate: ifNumber
},
{
key: "end",
predicate(val) {
// only remove the "end" number (not the "end" object within loc)
return typeof val === "number";
}
// only remove the "end" number (not the "end" object within loc)
predicate: ifNumber
},
{
key: "identifierName",
predicate() {
return true;
}
predicate: always
},
{
key: "extra",
predicate() {
return true;
}
predicate: always
},
{
key: "directives",
predicate() {
return true;
}
predicate: always
},
{
key: "directive",
predicate() {
return true;
}
predicate: always
},
{
key: "innerComments",
predicate() {
return true;
}
predicate: always
},
{
key: "leadingComments",
predicate() {
return true;
}
predicate: always
},
{
key: "trailingComments",
predicate() {
return true;
}
predicate: always
},
{
key: "guardedHandlers",
predicate() {
return true;
}
predicate: always
}
]);
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/basics.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Tests for basic expressions
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
24 changes: 3 additions & 21 deletions tests/lib/comments.js
@@ -1,27 +1,9 @@
/**
* @fileoverview Tests for parsing and attaching comments.
* @author Nicholas C. Zakas
* @copyright 2014 Nicholas C. Zakas. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/

"use strict";
Expand Down
1 change: 1 addition & 0 deletions tests/lib/ecma-features.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Tests for ECMA feature flags
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
1 change: 1 addition & 0 deletions tests/lib/jsx.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Tests for ECMA feature flags
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
1 change: 1 addition & 0 deletions tests/lib/parse.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Tests for tokenize().
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
1 change: 1 addition & 0 deletions tests/lib/typescript.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Tests for ECMA feature flags
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down
2 changes: 1 addition & 1 deletion tools/test-utils.js
@@ -1,6 +1,7 @@
/**
* @fileoverview Tools for running test cases
* @author Nicholas C. Zakas
* @author James Henry <https://github.com/JamesHenry>
* @copyright jQuery Foundation and other contributors, https://jquery.org/
* MIT License
*/
Expand Down Expand Up @@ -29,7 +30,6 @@ function getRaw(ast) {
if ((key === "start" || key === "end") && typeof value === "number") {
return undefined;
}

return value;
}));
}
Expand Down

0 comments on commit 9e17d0b

Please sign in to comment.