Skip to content

Commit

Permalink
enable typechecking for the babel-plugin directory (#35574)
Browse files Browse the repository at this point in the history
* babel plugins: enable typechecking

* @ts-nocheck everywhere
  • Loading branch information
samouri committed Aug 9, 2021
1 parent ca28bdc commit 93ea8ff
Show file tree
Hide file tree
Showing 26 changed files with 80 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* Changes the values of getMode().test, getMode().localDev to false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @interface {babel.PluginPass}
* @param {babel} babel
* @return {babel.PluginObj}
*/
module.exports = function ({types: t}) {
return {
visitor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const {addDefault} = require('@babel/helper-module-imports');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const typeMap = {
'assertElement': 'Element',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @interface {babel.PluginPass}
* @param {babel} babel
* @return {babel.PluginObj}
*/
module.exports = function (babel) {
const {types: t} = babel;
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

// Global typedef map typedefName: typedef comment
const TYPEDEFS = new Map();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* Injects alias identifiers for values with default assignments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const {dirname, join, relative, resolve} = require('path').posix;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

// Reassigns the trailing comments of a statement to be leading comment of its
// next sibling. This is because JSDoc comments (which should be on the next
// statement) get erroneously assigned as trailing comments of this statement.
/**
* Reassigns the trailing comments of a statement to be leading comment of its
* next sibling. This is because JSDoc comments (which should be on the next
* statement) get erroneously assigned as trailing comments of this statement.
*
* @interface {babel.PluginPass}
* @return {babel.PluginObj}
*/
module.exports = function () {
return {
visitor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

// Attempt to convert simple single ReturnStatement FunctionDeclarations to ArrowFunctionExpressions.
// See BAIL_OUT_CONDITIONS for reasons why FunctionDeclarations would not be modified.
/**
* Attempt to convert simple single ReturnStatement FunctionDeclarations to ArrowFunctionExpressions.
* See BAIL_OUT_CONDITIONS for reasons why FunctionDeclarations would not be modified.
* @interface {babel.PluginPass}
* @param {babel} babel
* @return {babel.PluginObj}
*/
module.exports = function ({types: t}) {
/**
* This transform is targetted toward these types only.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const {
staticTemplateFactoryFns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const {dirname, join: joinPath, relative} = require('path');
const {readFileSync} = require('fs');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @interface {babel.PluginPass}
* @param {babel} babel
* @return {babel.PluginObj}
*/
module.exports = function ({template, types: t}) {
/**
* Produces a random number that is guaranteed not to be present in str.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const {dirname, join, relative, resolve} = require('path');
const {readFileSync} = require('fs');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* Takes a .jss.js file and transforms the `useStyles` export to remove side effects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @fileoverview Indirects log messages through expansion calls with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

// Ensure comments in minified build output is minimal.
/**
* Ensure comments in minified build output is minimal.
*
* @interface {babel.PluginPass}
* @return {babel.PluginObj}
*/
module.exports = function () {
return {
visitor: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @interface {babel.PluginPass}
* @param {babel} babel
* @return {babel.PluginObj}
*/
module.exports = function (babel) {
const {types: t} = babel;
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const pathmodule = require('path');
const {addNamed} = require('@babel/helper-module-imports');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @interface {babel.PluginPass}
* @return {babel.PluginObj}
*/
module.exports = function () {
const namespace = '_';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @interface {babel.PluginPass}
* @return {babel.PluginObj}
*/
module.exports = function () {
return {
name: 'remove-strict-directives',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/**
* @interface {babel.PluginPass}
* @param {babel} babel
* @return {babel.PluginObj}
*/
module.exports = function (babel) {
const {types: t} = babel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

const ESCAPE_REGEX = /\${|\\|`/g;

Expand Down
1 change: 1 addition & 0 deletions build-system/babel-plugins/log-module-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/** @fileoverview Definitions of logging methods for transforms and linting. */

Expand Down
1 change: 1 addition & 0 deletions build-system/babel-plugins/static-template-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck

/** Metadata for static template functions `htmlFor` and `svgFor`. */

Expand Down
2 changes: 1 addition & 1 deletion build-system/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"./**/node_modules/**",
"./**/test/**/*.js",
"./**/*test*.js",
"./babel-plugins/**/*.js",
"./babel-plugins/**/(input|output).js",
"./eslint-rules/**/*.js",
"./externs/**/*.js",
"./tasks/make-extension/template/**/*.js",
Expand Down

0 comments on commit 93ea8ff

Please sign in to comment.