Skip to content

xo returns "undefined" randomly #245

@niftylettuce

Description

@niftylettuce

When combined with vim-autoformat it will replace the contents of a file entirely with the string "undefined" as per https://github.com/Chiel92/vim-autoformat/issues/200.

I tried running it from the CLI and was able to reproduce the issue @sindresorhus.

cat app/controllers/admin/order.js | DEBUG=* xo --fix --stdin

Output (note the very last line says "undefined" for some reason)

  eslint-plugin-import:rules:newline-after-import node position in scope: 0 +104ms
  eslint-plugin-import:rules:newline-after-import node position in scope: 1 +0ms
  eslint-plugin-import:rules:newline-after-import node position in scope: 2 +0ms
  eslint-plugin-import:rules:newline-after-import node position in scope: 3 +0ms
  eslint-plugin-import:rules:newline-after-import node position in scope: 4 +0ms
  eslint-plugin-import:rules:newline-after-import node position in scope: 5 +0ms
  eslint-plugin-import:rules:newline-after-import node position in scope: 6 +0ms
  eslint-plugin-import:rules:newline-after-import node position in scope: 7 +0ms
  eslint:code-path onCodePathSegmentEnd s1_1 +135ms
  eslint:code-path onCodePathEnd s1 +0ms
  eslint:code-path DOT
digraph {
node[shape=box,style="rounded,filled",fillcolor=white];
initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
s1_1[label="Program\nVariableDeclaration\nVariableDeclarator\nIdentifier (lodash)\nCallExpression\nIdentifier (require)\nLiteral (lodash)\nVariableDeclaration\nVariableDeclarator\nIdentifier (querystring)\nCallExpression\nIdentifier (require)\nLiteral (querystring)\nVariableDeclaration\nVariableDeclarator\nIdentifier (util)\nCallExpression\nIdentifier (require)\nLiteral (util)\nVariableDeclaration\nVariableDeclarator\nIdentifier (async)\nCallExpression\nIdentifier (require)\nLiteral (async)\nVariableDeclaration\nVariableDeclarator\nIdentifier (_)\nCallExpression\nIdentifier (require)\nLiteral (underscore)\nVariableDeclaration\nVariableDeclarator\nIdentifier (moment)\nCallExpression\nIdentifier (require)\nLiteral (moment)\nVariableDeclaration\nVariableDeclarator\nIdentifier (accounting)\nCallExpression\nIdentifier (require)\nLiteral (accounting)\nVariableDeclaration\nVariableDeclarator\nIdentifier (s)\nCallExpression\nIdentifier (require)\nLiteral (underscore.string)\nVariableDeclaration\nVariableDeclarator\nIdentifier (lib)\nExpressionStatement\nAssignmentExpression\nMemberExpression\nIdentifier (module)\nIdentifier (exports)\nFunctionExpression\nFunctionDeclaration\nVariableDeclaration\nVariableDeclarator\nIdentifier (mergeOrders)\nObjectExpression\nProperty\nIdentifier (retrieve)\nArrowFunctionExpression\nProperty\nIdentifier (create)\nArrowFunctionExpression\nVariableDeclaration\nVariableDeclarator\nIdentifier (changeMarketDay)\nObjectExpression\nProperty\nIdentifier (retrieve)\nArrowFunctionExpression\nProperty\nIdentifier (update)\nArrowFunctionExpression\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nFunctionDeclaration\nIdentifier:exit (lodash)\nIdentifier:exit (require)\nLiteral:exit (lodash)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (querystring)\nIdentifier:exit (require)\nLiteral:exit (querystring)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (util)\nIdentifier:exit (require)\nLiteral:exit (util)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (async)\nIdentifier:exit (require)\nLiteral:exit (async)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (_)\nIdentifier:exit (require)\nLiteral:exit (underscore)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (moment)\nIdentifier:exit (require)\nLiteral:exit (moment)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (accounting)\nIdentifier:exit (require)\nLiteral:exit (accounting)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (s)\nIdentifier:exit (require)\nLiteral:exit (underscore.string)\nCallExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (lib)\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (module)\nIdentifier:exit (exports)\nMemberExpression:exit\nFunctionExpression:exit\nAssignmentExpression:exit\nExpressionStatement:exit\nFunctionDeclaration:exit\nIdentifier:exit (mergeOrders)\nIdentifier:exit (retrieve)\nArrowFunctionExpression:exit\nProperty:exit\nIdentifier:exit (create)\nArrowFunctionExpression:exit\nProperty:exit\nObjectExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nIdentifier:exit (changeMarketDay)\nIdentifier:exit (retrieve)\nArrowFunctionExpression:exit\nProperty:exit\nIdentifier:exit (update)\nArrowFunctionExpression:exit\nProperty:exit\nObjectExpression:exit\nVariableDeclarator:exit\nVariableDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nFunctionDeclaration:exit\nProgram:exit"];
initial->s1_1->final;
} +0ms
  eslint:cli-engine Generating fixed text for <text> (pass 1) +1ms
  eslint:text-fixer Applying fixes +1ms
  eslint:text-fixer No fixes to apply +0ms
undefined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions