question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow when linting a single file

See original GitHub issue

xo seems to load really slowly when linting a single file. The main issue from what I can see relies around eslint:glob-util and loading plugin:unicorn/recommended because of these two the lint can take upwards of 2 seconds to lint a 19 line file. This doesn’t sound so bad until you take into account it takes the same time when running in atom with the atom-linter-xo package.

I used this to run xo DEBUG=* xo js/helpers/config.js.

This is the file I was linting.

// @TODO: Setup defaults so we can use config before the api resolves the request
export default {
    baseUrl: $('body').attr('base-url'),
    token: $('body').attr('token'),
    posterSortby: undefined,
    animeSplitHome: undefined,
    rootDirs: undefined,
    selectedRootIndex: undefined,
    layout: {
        show: {
            specials: true,
            allSeasons: true
        },
        home: 'banner',
        history: 'detailed',
        schedule: 'banner'
    }
};
xo Using local install of XO. +0ms
  eslint:config-file Loading /Users/xo/code/Medusa/node_modules/xo/config/plugins.js +0ms
  eslint:config-file Loading JS config file: /Users/xo/code/Medusa/node_modules/xo/config/plugins.js +3ms
  eslint:config-file Loading plugin:unicorn/recommended +741ms
  eslint:config-file Attempting to resolve eslint-plugin-unicorn +1ms
  eslint:config-file Loading JS config file: /Users/xo/code/Medusa/node_modules/eslint-plugin-unicorn/index.js +1ms
  eslint:config-file Loading plugin:ava/recommended +5ms
  eslint:config-file Attempting to resolve eslint-plugin-ava +1ms
  eslint:config-file Loading JS config file: /Users/xo/code/Medusa/node_modules/eslint-plugin-ava/index.js +0ms
  eslint:config-file Loading /Users/xo/code/Medusa/node_modules/xo/config/overrides.js +8ms
  eslint:config-file Loading JS config file: /Users/xo/code/Medusa/node_modules/xo/config/overrides.js +0ms
  eslint:config-file Loading xo +2ms
  eslint:config-file Attempting to resolve eslint-config-xo +0ms
  eslint:config-file Loading JS config file: /Users/xo/code/Medusa/node_modules/eslint-config-xo/index.js +1ms
  eslint:glob-util Creating list of files to process. +620ms
  eslint:ignored-paths Looking for ignore file in /Users/xo/code/Medusa +7ms
  eslint:ignored-paths Could not find ignore file in cwd +0ms
  eslint:config Constructing config for /Users/xo/code/Medusa/js/helpers/config.js +7ms
  eslint:config Not using .eslintrc or package.json files +0ms
  eslint:config Merging command line environment settings +0ms
  eslint:config Merging command line rules +1ms
  eslint:config Merging command line plugins +0ms
  eslint:config-ops Apply environment settings to config +0ms
  eslint:config-ops Creating config for environment node +1ms
  eslint:config-ops Creating config for environment es6 +0ms
  eslint:config-ops Creating config for environment browser +0ms
  eslint:config-ops Creating config for environment jquery +1ms
  eslint:cli-engine Processing /Users/xo/code/Medusa/js/helpers/config.js +12ms
  eslint:cli-engine Linting /Users/xo/code/Medusa/js/helpers/config.js +1ms
  eslint:config Constructing config for /Users/xo/code/Medusa/js/helpers/config.js +1ms
  eslint:config Using config from cache +0ms
  eslint:code-path onCodePathStart s1 +200ms
  eslint:code-path onCodePathSegmentStart s1_1 +3ms
  eslint:code-path s1_1) Program +2ms
  eslint:code-path s1_1) ExportDefaultDeclaration +46ms
  eslint:code-path s1_1) ObjectExpression +6ms
  eslint:code-path s1_1) Property +10ms
  eslint:code-path s1_1) Identifier +3ms
  eslint:code-path s1_1) Identifier:exit +2ms
  eslint:code-path s1_1) CallExpression +0ms
  eslint:code-path s1_1) MemberExpression +8ms
  eslint:code-path s1_1) CallExpression +3ms
  eslint:code-path s1_1) Identifier +2ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Literal +0ms
  eslint:code-path s1_1) Literal:exit +3ms
  eslint:code-path s1_1) CallExpression:exit +0ms
  eslint:code-path s1_1) Identifier +1ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) MemberExpression:exit +0ms
  eslint:code-path s1_1) Literal +0ms
  eslint:code-path s1_1) Literal:exit +1ms
  eslint:code-path s1_1) CallExpression:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +1ms
  eslint:code-path s1_1) CallExpression +0ms
  eslint:code-path s1_1) MemberExpression +1ms
  eslint:code-path s1_1) CallExpression +0ms
  eslint:code-path s1_1) Identifier +1ms
  eslint:code-path s1_1) Identifier:exit +1ms
  eslint:code-path s1_1) Literal +0ms
  eslint:code-path s1_1) Literal:exit +0ms
  eslint:code-path s1_1) CallExpression:exit +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +1ms
  eslint:code-path s1_1) MemberExpression:exit +0ms
  eslint:code-path s1_1) Literal +0ms
  eslint:code-path s1_1) Literal:exit +0ms
  eslint:code-path s1_1) CallExpression:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +1ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +1ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +1ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +2ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +1ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +1ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) ObjectExpression +0ms
  eslint:code-path s1_1) Property +1ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +1ms
  eslint:code-path s1_1) ObjectExpression +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Literal +1ms
  eslint:code-path s1_1) Literal:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Literal +0ms
  eslint:code-path s1_1) Literal:exit +0ms
  eslint:code-path s1_1) Property:exit +1ms
  eslint:code-path s1_1) ObjectExpression:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +0ms
  eslint:code-path s1_1) Literal +1ms
  eslint:code-path s1_1) Literal:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +0ms
  eslint:code-path s1_1) Identifier:exit +1ms
  eslint:code-path s1_1) Literal +1ms
  eslint:code-path s1_1) Literal:exit +1ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) Property +0ms
  eslint:code-path s1_1) Identifier +1ms
  eslint:code-path s1_1) Identifier:exit +7ms
  eslint:code-path s1_1) Literal +1ms
  eslint:code-path s1_1) Literal:exit +1ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) ObjectExpression:exit +0ms
  eslint:code-path s1_1) Property:exit +0ms
  eslint:code-path s1_1) ObjectExpression:exit +0ms
  eslint:code-path s1_1) ExportDefaultDeclaration:exit +0ms
  eslint:code-path s1_1) Program:exit +1ms
  eslint-plugin-import:rules:newline-after-import exit processing for /Users/xo/code/Medusa/js/helpers/config.js +17ms
  eslint-plugin-import:rules:newline-after-import got scope: [ Node {
    type: 'ExportDefaultDeclaration',
    start: 83,
    end: 482,
    loc: SourceLocation { start: [Object], end: [Object] },
    range: [ 83, 482 ],
    declaration: 
     Node {
       type: 'ObjectExpression',
       start: 98,
       end: 481,
       loc: [Object],
       range: [Object],
       properties: [Object],
       parent: [Circular] },
    leadingComments: [ [Object] ],
    parent: 
     Node {
       type: 'Program',
       start: 0,
       end: 483,
       loc: [Object],
       range: [Object],
       body: [Circular],
       sourceType: 'module',
       comments: [Object],
       tokens: [Object],
       parent: null } } ] +0ms
  eslint:code-path onCodePathSegmentEnd s1_1 +8ms
  eslint:code-path onCodePathEnd s1 +1ms
  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\nExportDefaultDeclaration\nObjectExpression\nProperty\nIdentifier (baseUrl)\nCallExpression\nMemberExpression\nCallExpression\nIdentifier ($)\nLiteral (body)\nIdentifier (attr)\nLiteral (base-url)\nProperty\nIdentifier (token)\nCallExpression\nMemberExpression\nCallExpression\nIdentifier ($)\nLiteral (body)\nIdentifier (attr)\nLiteral (token)\nProperty\nIdentifier (posterSortby)\nIdentifier (undefined)\nProperty\nIdentifier (animeSplitHome)\nIdentifier (undefined)\nProperty\nIdentifier (rootDirs)\nIdentifier (undefined)\nProperty\nIdentifier (selectedRootIndex)\nIdentifier (undefined)\nProperty\nIdentifier (layout)\nObjectExpression\nProperty\nIdentifier (show)\nObjectExpression\nProperty\nIdentifier (specials)\nLiteral (true)\nProperty\nIdentifier (allSeasons)\nLiteral (true)\nProperty\nIdentifier (home)\nLiteral (banner)\nProperty\nIdentifier (history)\nLiteral (detailed)\nProperty\nIdentifier (schedule)\nLiteral (banner)\nIdentifier:exit (baseUrl)\nIdentifier:exit ($)\nLiteral:exit (body)\nCallExpression:exit\nIdentifier:exit (attr)\nMemberExpression:exit\nLiteral:exit (base-url)\nCallExpression:exit\nProperty:exit\nIdentifier:exit (token)\nIdentifier:exit ($)\nLiteral:exit (body)\nCallExpression:exit\nIdentifier:exit (attr)\nMemberExpression:exit\nLiteral:exit (token)\nCallExpression:exit\nProperty:exit\nIdentifier:exit (posterSortby)\nIdentifier:exit (undefined)\nProperty:exit\nIdentifier:exit (animeSplitHome)\nIdentifier:exit (undefined)\nProperty:exit\nIdentifier:exit (rootDirs)\nIdentifier:exit (undefined)\nProperty:exit\nIdentifier:exit (selectedRootIndex)\nIdentifier:exit (undefined)\nProperty:exit\nIdentifier:exit (layout)\nIdentifier:exit (show)\nIdentifier:exit (specials)\nLiteral:exit (true)\nProperty:exit\nIdentifier:exit (allSeasons)\nLiteral:exit (true)\nProperty:exit\nObjectExpression:exit\nProperty:exit\nIdentifier:exit (home)\nLiteral:exit (banner)\nProperty:exit\nIdentifier:exit (history)\nLiteral:exit (detailed)\nProperty:exit\nIdentifier:exit (schedule)\nLiteral:exit (banner)\nProperty:exit\nObjectExpression:exit\nProperty:exit\nObjectExpression:exit\nExportDefaultDeclaration:exit\nProgram:exit"];
initial->s1_1->final;
} +3ms
  eslint:cli-engine Linting complete in: 389ms +4ms

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:43 (23 by maintainers)

github_iconTop GitHub Comments

2reactions
pvdlgcommented, Sep 28, 2018

That was probably due to yarn.lock containing an outdated version of eslint.

That was painful - thank you so much @pvdlg for your time and patience here. Do you have a Patreon or way to donate for your help?

Sindre the creator of XO has a Patreon. I personally don’t need money for my OSS work. Contributions to XO are always welcome and appreciated and can take many form: bug fixes, new features, issue reporting, documentation improvement, support to other users here or on Gitter, etc… Promoting the XO project is also a nice way to support it.

0reactions
niftylettucecommented, Apr 1, 2020

This seems to be fixed on my side (after updating)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Speeding Up ESLint - Medium
Today, I happened to notice that on my project of 8 files, it's equally slow with the whole project as it is with...
Read more >
Angular project with eslint is super slow - Stack Overflow
Check the Notes on Performance in the Angular es-lint guide · Check (in one of the first lines) whether the expected tsconfig files...
Read more >
Why typescript-eslint Performance is Slow - Duncan Leung
Problem: Slow Lint Run Process While setting up our team's ESLint… ... overhead work of initializing the type checker in every single file....
Read more >
Webstorm slow with linting of .ts, .tsx files : WEB-43794
Since we are converting more of our code to TS I have started seeing now very slow lprocessing/linting of the tsx, ts files...
Read more >
Lint Modes — SublimeLinter 3.4.24 documentation
There are four lint modes in SublimeLinter: background, load/save, save only, and manual. ... If you have very large files that are relatively...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found