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

Chore: Minor cleanup, fix jQuery foundation copyright #383

Merged
merged 1 commit into from
Sep 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ast-converter.js
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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