How to use the @typescript-eslint/typescript-estree.AST_NODE_TYPES.ExportNamedDeclaration function in @typescript-eslint/typescript-estree

To help you get started, we’ve selected a few @typescript-eslint/typescript-estree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / lib / config / src / preshake.ts View on Github external
ast.program.body = ast.program.body.filter((i: any) => {
    // export function a() {}
    // export interface Bang {}
    // export type Foo = string | number;
    if (
      i.type === AST_NODE_TYPES.ExportNamedDeclaration &&
      (i.declaration.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
        i.declaration.type === AST_NODE_TYPES.FunctionDeclaration ||
        i.declaration.type === AST_NODE_TYPES.TSInterfaceDeclaration)
    ) {
      return allowed.includes(i.declaration.id.name);
    }

    // export const manager = {};
    // export const {f,g: h} = {f: 4, g:5};
    if (
      i.type === AST_NODE_TYPES.ExportNamedDeclaration &&
      i.declaration.type === AST_NODE_TYPES.VariableDeclaration
    ) {
      // MUTATION!
      // eslint-disable-next-line no-param-reassign
      i.declaration.declarations = i.declaration.declarations.filter((d: any) => {
github storybookjs / storybook / lib / config / src / preshake.ts View on Github external
// export function a() {}
    // export interface Bang {}
    // export type Foo = string | number;
    if (
      i.type === AST_NODE_TYPES.ExportNamedDeclaration &&
      (i.declaration.type === AST_NODE_TYPES.TSTypeAliasDeclaration ||
        i.declaration.type === AST_NODE_TYPES.FunctionDeclaration ||
        i.declaration.type === AST_NODE_TYPES.TSInterfaceDeclaration)
    ) {
      return allowed.includes(i.declaration.id.name);
    }

    // export const manager = {};
    // export const {f,g: h} = {f: 4, g:5};
    if (
      i.type === AST_NODE_TYPES.ExportNamedDeclaration &&
      i.declaration.type === AST_NODE_TYPES.VariableDeclaration
    ) {
      // MUTATION!
      // eslint-disable-next-line no-param-reassign
      i.declaration.declarations = i.declaration.declarations.filter((d: any) => {
        if (d.id.type === AST_NODE_TYPES.ObjectPattern) {
          // MUTATION!
          // eslint-disable-next-line no-param-reassign
          d.id.properties = d.id.properties.filter(
            (p: any) =>
              p.type === AST_NODE_TYPES.Property &&
              p.value.type === AST_NODE_TYPES.Identifier &&
              allowed.includes(p.value.name)
          );
          return !!d.id.properties.length;
        }
github Halliwood / ts2lua / src / gen / LuaMaker.ts View on Github external
str += this.codeFromDoWhileStatement(ast);
        break;
  
      case AST_NODE_TYPES.EmptyStatement:
        str += this.codeFromEmptyStatement(ast);
        break;
  
      case AST_NODE_TYPES.ExportAllDeclaration:
        str += this.codeFromExportAllDeclaration(ast);
        break;
  
      case AST_NODE_TYPES.ExportDefaultDeclaration:
        str += this.codeFromExportDefaultDeclaration(ast);
        break;
  
      case AST_NODE_TYPES.ExportNamedDeclaration:
        str += this.codeFromExportNamedDeclaration(ast);
        break;
  
      case AST_NODE_TYPES.ExportSpecifier:
        str += this.codeFromExportSpecifier(ast);
        break;
  
      case AST_NODE_TYPES.ExpressionStatement:
        str += this.codeFromExpressionStatement(ast);
        break;
  
      case AST_NODE_TYPES.ForInStatement:
        str += this.codeFromForInStatement(ast);
        break;
  
      case AST_NODE_TYPES.ForOfStatement:

@typescript-eslint/typescript-estree

A parser that converts TypeScript source code into an ESTree compatible form

BSD-2-Clause
Latest version published 8 days ago

Package Health Score

95 / 100
Full package analysis