Skip to content

Commit 8e9a8a8

Browse files
committed
autofix all violations
1 parent a3553c9 commit 8e9a8a8

File tree

4,245 files changed

+87576
-82737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,245 files changed

+87576
-82737
lines changed

Gruntfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
require('./src/setup_node_env');
2121

22-
module.exports = function (grunt) {
22+
module.exports = function(grunt) {
2323
// set the config once before calling load-grunt-config
2424
// and once during so that we have access to it via
2525
// grunt.config.get() within the config files
@@ -35,8 +35,8 @@ module.exports = function (grunt) {
3535
init: true,
3636
config: config,
3737
loadGruntTasks: {
38-
pattern: ['grunt-*', '@*/grunt-*', 'gruntify-*', '@*/gruntify-*']
39-
}
38+
pattern: ['grunt-*', '@*/grunt-*', 'gruntify-*', '@*/gruntify-*'],
39+
},
4040
});
4141

4242
// load task definitions

packages/kbn-analytics/babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
plugins: ['@babel/plugin-proposal-class-properties'],
2323
env: {
2424
web: {
25-
presets: ['@kbn/babel-preset/webpack_preset']
25+
presets: ['@kbn/babel-preset/webpack_preset'],
2626
},
2727
node: {
2828
presets: ['@kbn/babel-preset/node_preset'],

packages/kbn-babel-code-parser/src/can_require.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function canRequire(entry, cwd = require.resolve.paths(entry) || []) {
2828
// looking recursively as normal starting
2929
// from those locations.
3030
return require.resolve(entry, {
31-
paths: [].concat(cwd)
31+
paths: [].concat(cwd),
3232
});
3333
} catch (e) {
3434
return false;

packages/kbn-babel-code-parser/src/code_parser.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export async function parseEntries(cwd, entries, strategy, results, wasParsed =
8181
// Test each entry against canRequire function
8282
const entriesQueue = entries.map(entry => canRequire(entry));
8383

84-
while(entriesQueue.length) {
84+
while (entriesQueue.length) {
8585
// Get the first element in the queue as
8686
// select it as our current entry to parse
8787
const mainEntry = entriesQueue.shift();
@@ -93,7 +93,9 @@ export async function parseEntries(cwd, entries, strategy, results, wasParsed =
9393
}
9494

9595
// Find new entries and adds them to the end of the queue
96-
entriesQueue.push(...(await strategy(sanitizedCwd, parseSingleFile, mainEntry, wasParsed, results)));
96+
entriesQueue.push(
97+
...(await strategy(sanitizedCwd, parseSingleFile, mainEntry, wasParsed, results))
98+
);
9799

98100
// Mark the current main entry as already parsed
99101
wasParsed[mainEntry] = true;

packages/kbn-babel-code-parser/src/strategies.test.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import { parseSingleFile } from './code_parser';
2323
import { _calculateTopLevelDependency, dependenciesParseStrategy } from './strategies';
2424

2525
jest.mock('./can_require', () => ({
26-
canRequire: jest.fn()
26+
canRequire: jest.fn(),
2727
}));
2828

2929
jest.mock('fs', () => ({
30-
readFile: jest.fn()
30+
readFile: jest.fn(),
3131
}));
3232

3333
const mockCwd = '/tmp/project/dir/';
@@ -69,7 +69,13 @@ describe('Code Parser Strategies', () => {
6969
}
7070
});
7171

72-
const results = await dependenciesParseStrategy(mockCwd, parseSingleFile, 'dep1/file.js', {}, {});
72+
const results = await dependenciesParseStrategy(
73+
mockCwd,
74+
parseSingleFile,
75+
'dep1/file.js',
76+
{},
77+
{}
78+
);
7379
expect(results[0]).toBe(`${mockCwd}node_modules/dep_from_node_modules/index.js`);
7480
});
7581

@@ -78,15 +84,21 @@ describe('Code Parser Strategies', () => {
7884
cb(null, `require('./relative_dep')`);
7985
});
8086

81-
canRequire.mockImplementation((entry) => {
87+
canRequire.mockImplementation(entry => {
8288
if (entry === `${mockCwd}dep1/relative_dep`) {
8389
return `${entry}/index.js`;
8490
}
8591

8692
return false;
8793
});
8894

89-
const results = await dependenciesParseStrategy(mockCwd, parseSingleFile, 'dep1/file.js', {}, {});
95+
const results = await dependenciesParseStrategy(
96+
mockCwd,
97+
parseSingleFile,
98+
'dep1/file.js',
99+
{},
100+
{}
101+
);
90102
expect(results[0]).toBe(`${mockCwd}dep1/relative_dep/index.js`);
91103
});
92104

packages/kbn-babel-code-parser/src/visitors.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ export function dependenciesVisitorsGenerator(dependenciesAcc) {
2121
// raw values on require + require.resolve
2222
CallExpression: ({ node }) => {
2323
// AST check for require expressions
24-
const isRequire = (node) => {
24+
const isRequire = node => {
2525
return matches({
2626
callee: {
2727
type: 'Identifier',
28-
name: 'require'
29-
}
28+
name: 'require',
29+
},
3030
})(node);
3131
};
3232

3333
// AST check for require.resolve expressions
34-
const isRequireResolve = (node) => {
34+
const isRequireResolve = node => {
3535
return matches({
3636
callee: {
3737
type: 'MemberExpression',
3838
object: {
3939
type: 'Identifier',
40-
name: 'require'
40+
name: 'require',
4141
},
4242
property: {
4343
type: 'Identifier',
44-
name: 'resolve'
45-
}
46-
}
44+
name: 'resolve',
45+
},
46+
},
4747
})(node);
4848
};
4949

@@ -66,12 +66,12 @@ export function dependenciesVisitorsGenerator(dependenciesAcc) {
6666
// raw values on import
6767
ImportDeclaration: ({ node }) => {
6868
// AST check for supported import expressions
69-
const isImport = (node) => {
69+
const isImport = node => {
7070
return matches({
7171
type: 'ImportDeclaration',
7272
source: {
73-
type: 'StringLiteral'
74-
}
73+
type: 'StringLiteral',
74+
},
7575
})(node);
7676
};
7777

@@ -85,12 +85,12 @@ export function dependenciesVisitorsGenerator(dependenciesAcc) {
8585
// raw values on export from
8686
ExportNamedDeclaration: ({ node }) => {
8787
// AST check for supported export from expressions
88-
const isExportFrom = (node) => {
88+
const isExportFrom = node => {
8989
return matches({
9090
type: 'ExportNamedDeclaration',
9191
source: {
92-
type: 'StringLiteral'
93-
}
92+
type: 'StringLiteral',
93+
},
9494
})(node);
9595
};
9696

@@ -104,12 +104,12 @@ export function dependenciesVisitorsGenerator(dependenciesAcc) {
104104
// raw values on export * from
105105
ExportAllDeclaration: ({ node }) => {
106106
// AST check for supported export * from expressions
107-
const isExportAllFrom = (node) => {
107+
const isExportAllFrom = node => {
108108
return matches({
109109
type: 'ExportAllDeclaration',
110110
source: {
111-
type: 'StringLiteral'
112-
}
111+
type: 'StringLiteral',
112+
},
113113
})(node);
114114
};
115115

@@ -118,7 +118,7 @@ export function dependenciesVisitorsGenerator(dependenciesAcc) {
118118
const exportAllFromSource = node.source;
119119
dependenciesAcc.push(exportAllFromSource.value);
120120
}
121-
}
121+
},
122122
};
123123
})();
124124
}

packages/kbn-babel-code-parser/src/visitors.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import * as parser from '@babel/parser';
2121
import traverse from '@babel/traverse';
2222
import { dependenciesVisitorsGenerator } from './visitors';
2323

24-
const visitorsApplier = (code) => {
24+
const visitorsApplier = code => {
2525
const result = [];
2626
traverse(
2727
parser.parse(code, {
2828
sourceType: 'unambiguous',
29-
plugins: ['exportDefaultFrom']
29+
plugins: ['exportDefaultFrom'],
3030
}),
3131
dependenciesVisitorsGenerator(result)
3232
);

packages/kbn-babel-preset/common_babel_parser_options.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ module.exports = {
2828
'exportDefaultFrom',
2929
'exportNamespaceFrom',
3030
'objectRestSpread',
31-
'throwExpressions'
31+
'throwExpressions',
3232
],
3333
};

packages/kbn-babel-preset/istanbul_preset.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
* under the License.
1818
*/
1919

20-
2120
module.exports = () => {
2221
return {
23-
plugins: ['istanbul']
22+
plugins: ['istanbul'],
2423
};
2524
};

packages/kbn-babel-preset/node_preset.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,19 @@
2020
module.exports = (_, options = {}) => {
2121
const overrides = [];
2222
if (!process.env.ALLOW_PERFORMANCE_HOOKS_IN_TASK_MANAGER) {
23-
overrides.push(
24-
{
25-
test: [/x-pack[\/\\]legacy[\/\\]plugins[\/\\]task_manager/],
26-
plugins: [
27-
[
28-
require.resolve('babel-plugin-filter-imports'),
29-
{
30-
imports: {
31-
perf_hooks: ['performance'],
32-
},
23+
overrides.push({
24+
test: [/x-pack[\/\\]legacy[\/\\]plugins[\/\\]task_manager/],
25+
plugins: [
26+
[
27+
require.resolve('babel-plugin-filter-imports'),
28+
{
29+
imports: {
30+
perf_hooks: ['performance'],
3331
},
34-
],
32+
},
3533
],
36-
}
37-
);
34+
],
35+
});
3836
}
3937

4038
return {

0 commit comments

Comments
 (0)