xo: Slow when linting a single file
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
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 43 (23 by maintainers)
That was probably due to
yarn.lockcontaining an outdated version ofeslint.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.