Skip to content

Commit db83ea4

Browse files
committed
Merge branch 'master' into legend-item-updates
2 parents 2b67e89 + 35248d1 commit db83ea4

File tree

173 files changed

+2251
-1919
lines changed

Some content is hidden

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

173 files changed

+2251
-1919
lines changed

.eslintrc.js

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module.exports = {
66
'plugin:@typescript-eslint/recommended',
77
'plugin:@typescript-eslint/recommended-requiring-type-checking',
88
'airbnb/hooks',
9+
'prettier/@typescript-eslint',
10+
'plugin:prettier/recommended',
911
'plugin:eslint-comments/recommended',
1012
'plugin:jest/recommended',
1113
'plugin:promise/recommended',
@@ -16,14 +18,44 @@ module.exports = {
1618
'plugin:import/warnings',
1719
'plugin:import/typescript',
1820
],
19-
plugins: ['@typescript-eslint', 'eslint-comments', 'jest', 'import', 'promise', 'unicorn', 'header', 'react-hooks', 'jsx-a11y'],
21+
plugins: [
22+
'@typescript-eslint',
23+
'eslint-comments',
24+
'jest',
25+
'import',
26+
'promise',
27+
'unicorn',
28+
'header',
29+
'react-hooks',
30+
'jsx-a11y',
31+
'prettier',
32+
],
2033
rules: {
2134
/**
2235
* depricated to be deleted
2336
*/
2437
// https://github.com/typescript-eslint/typescript-eslint/issues/2077
2538
'@typescript-eslint/camelcase': 0,
2639

40+
/**
41+
*****************************************
42+
* Rules with high processing demand
43+
*****************************************
44+
*/
45+
'import/no-restricted-paths':
46+
process.env.NODE_ENV === 'production'
47+
? [
48+
'error',
49+
{
50+
zones: [
51+
{ target: './src', from: './src/index.ts' },
52+
{ target: './src', from: './', except: ['./src', './node_modules/'] },
53+
],
54+
},
55+
]
56+
: 0,
57+
'import/namespace': process.env.NODE_ENV === 'production' ? 2 : 0,
58+
2759
/**
2860
*****************************************
2961
* Rules to consider adding/fixing later
@@ -99,14 +131,18 @@ module.exports = {
99131
ExportDeclaration: { consistent: true },
100132
},
101133
],
102-
quotes: ['error', 'single'],
103134
semi: ['error', 'always'],
104135
// https://github.com/typescript-eslint/typescript-eslint/issues/1824
105-
indent: ['error', 2, {
106-
SwitchCase: 1,
107-
MemberExpression: 1,
108-
offsetTernaryExpressions: true,
109-
}],
136+
// TODO: Add back once indent ts rule is fixed
137+
// indent: [
138+
// 'error',
139+
// 2,
140+
// {
141+
// SwitchCase: 1,
142+
// MemberExpression: 1,
143+
// offsetTernaryExpressions: true,
144+
// },
145+
// ],
110146
'max-len': [
111147
'warn',
112148
{
@@ -144,7 +180,6 @@ module.exports = {
144180
'@typescript-eslint/indent': 0,
145181
'@typescript-eslint/no-inferrable-types': 0,
146182
'@typescript-eslint/ban-ts-comment': 1,
147-
'@typescript-eslint/space-before-function-paren': [2, 'never'],
148183
'@typescript-eslint/no-unused-vars': [
149184
'error',
150185
{
@@ -166,22 +201,15 @@ module.exports = {
166201
/*
167202
* import plugin
168203
*/
169-
'import/order': ['error', {
170-
'newlines-between': 'always',
171-
groups: [
172-
'builtin',
173-
'external',
174-
['parent', 'sibling', 'index', 'internal'],
175-
],
176-
alphabetize: { order: 'asc', caseInsensitive: true }, // todo replace with directory gradient ordering
177-
}],
178-
'import/no-unresolved': ['error', { ignore: ['theme_dark.scss', 'theme_light.scss'] }],
179-
'import/no-restricted-paths': [
204+
'import/order': [
180205
'error',
181206
{
182-
zones: [{ target: './src', from: './src/index.ts' }, { target: './src', from: './', except: ['./src', './node_modules/'] }],
207+
'newlines-between': 'always',
208+
groups: ['builtin', 'external', ['parent', 'sibling', 'index', 'internal']],
209+
alphabetize: { order: 'asc', caseInsensitive: true }, // todo replace with directory gradient ordering
183210
},
184211
],
212+
'import/no-unresolved': ['error', { ignore: ['theme_dark.scss', 'theme_light.scss'] }],
185213
// https://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html
186214
'import/prefer-default-export': 0,
187215
// Limit usage in development directories
@@ -192,6 +220,10 @@ module.exports = {
192220
*/
193221
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
194222
'react/prop-types': 0,
223+
'react/sort-comp': 0,
224+
'react/jsx-one-expression-per-line': 0,
225+
'react/jsx-curly-newline': 0,
226+
'react/jsx-indent': 0,
195227
// Too restrictive: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
196228
'react/destructuring-assignment': 0,
197229
// No jsx extension: https://github.com/facebook/create-react-app/issues/87#issuecomment-234627904
@@ -347,6 +379,12 @@ module.exports = {
347379
],
348380
},
349381
},
382+
{
383+
files: ['.playground/**/*.ts?(x)'],
384+
rules: {
385+
'react/prefer-stateless-function': 0,
386+
},
387+
},
350388
{
351389
files: ['*.test.ts?(x)'],
352390
rules: {

.prettierignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
*.md
22
*.mdx
3-
*.ts
4-
*.tsx
5-
*.js
6-
*.jsx
73
.out/
84
.idea/
95
.vscode/

.storybook-docs/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const scssLoaders = [
3636
'sass-loader',
3737
];
3838

39-
module.exports = async({ config }) => {
39+
module.exports = async ({ config }) => {
4040
// config.plugins.push(new webpack.EnvironmentPlugin({ RNG_SEED: null }));
4141

4242
// Replace default css rules with nonce

.storybook/webpack.config.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,28 @@ const scssLoaders = [
4040
const MAX_CYCLES = 0;
4141
let numCyclesDetected = 0;
4242

43-
module.exports = async({ config }) => {
43+
module.exports = async ({ config }) => {
4444
config.plugins.push(new webpack.EnvironmentPlugin({ RNG_SEED: null }));
45-
config.plugins.push(new CircularDependencyPlugin({
46-
onStart() {
47-
numCyclesDetected = 0;
48-
},
49-
onDetected({ paths, compilation }) {
50-
if (!/^node_modules\/.+/.test(paths[0])) {
51-
numCyclesDetected++;
52-
compilation.warnings.push(new Error(paths.join(' -> ')));
53-
}
54-
},
55-
onEnd({ compilation }) {
56-
if (numCyclesDetected > MAX_CYCLES) {
57-
compilation.errors.push(new Error(
58-
`Detected ${numCyclesDetected} cycles which exceeds configured limit of ${MAX_CYCLES}`
59-
));
60-
}
61-
},
62-
}));
45+
config.plugins.push(
46+
new CircularDependencyPlugin({
47+
onStart() {
48+
numCyclesDetected = 0;
49+
},
50+
onDetected({ paths, compilation }) {
51+
if (!/^node_modules\/.+/.test(paths[0])) {
52+
numCyclesDetected++;
53+
compilation.warnings.push(new Error(paths.join(' -> ')));
54+
}
55+
},
56+
onEnd({ compilation }) {
57+
if (numCyclesDetected > MAX_CYCLES) {
58+
compilation.errors.push(
59+
new Error(`Detected ${numCyclesDetected} cycles which exceeds configured limit of ${MAX_CYCLES}`),
60+
);
61+
}
62+
},
63+
}),
64+
);
6365

6466
config.module.rules.push({
6567
test: /\.tsx?$/,

browsers/browsers.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jest.setTimeout(30000);
2727

2828
let driver: webdriver.WebDriver;
2929
describe('smoke tests', () => {
30-
beforeAll(async() => {
30+
beforeAll(async () => {
3131
let capabilities: webdriver.Capabilities | null = null;
3232
switch (process.env.BROWSER || 'chrome') {
3333
case 'ie':
@@ -59,11 +59,11 @@ describe('smoke tests', () => {
5959
}
6060
});
6161

62-
afterAll(async() => {
62+
afterAll(async () => {
6363
await driver.quit();
6464
});
6565

66-
test('elastic-chart element smoke test', async() => {
66+
test('elastic-chart element smoke test', async () => {
6767
await driver.get('http://localhost:8080');
6868
await driver.sleep(5000);
6969

browsers/setup.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@ const WebpackDevServer = require('webpack-dev-server');
2424

2525
const config = require(path.join(__dirname, '..', '.playground', 'webpack.config.js'));
2626

27-
module.exports = async() => await new Promise((resolve, reject) => {
28-
const compiler = webpack(config);
29-
const server = new WebpackDevServer(compiler);
30-
compiler.hooks.done.tap('done', () => {
31-
resolve();
32-
global.__WP_SERVER__ = server;
33-
});
27+
module.exports = async () =>
28+
await new Promise((resolve, reject) => {
29+
const compiler = webpack(config);
30+
const server = new WebpackDevServer(compiler);
31+
compiler.hooks.done.tap('done', () => {
32+
resolve();
33+
global.__WP_SERVER__ = server;
34+
});
3435

35-
server.listen(8080, 'localhost', (err) => {
36-
if (err) {
37-
reject(err);
38-
}
36+
server.listen(8080, 'localhost', (err) => {
37+
if (err) {
38+
reject(err);
39+
}
40+
});
3941
});
40-
});

browsers/teardown.js

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

20-
module.exports = async() => {
20+
module.exports = async () => {
2121
await global.__WP_SERVER__.close();
2222
};

integration/helpers.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ function encodeString(string: string) {
7272
*/
7373
const storiesToSkip: Record<string, string[]> = {
7474
// Interactions: ['Some story name'],
75-
Legend: [
76-
'Actions',
77-
],
75+
Legend: ['Actions'],
7876
};
7977

8078
/**

integration/jest_puppeteer.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const customConfig = {
5252
},
5353
}
5454
: {
55-
// https://github.com/gidztech/jest-puppeteer-docker/issues/24
55+
// https://github.com/gidztech/jest-puppeteer-docker/issues/24
5656
chromiumFlags: [], // for docker chromium options
5757
connect: {
5858
...sharedConfig,

integration/page_objects/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class CommonPage {
332332
mousePosition: MousePosition,
333333
options?: Omit<ScreenshotElementAtUrlOptions, 'action'>,
334334
) {
335-
const action = async() => await this.moveMouseRelativeToDOMElement(mousePosition, this.chartSelector);
335+
const action = async () => await this.moveMouseRelativeToDOMElement(mousePosition, this.chartSelector);
336336
await this.expectChartAtUrlToMatchScreenshot(url, {
337337
...options,
338338
action,
@@ -353,7 +353,7 @@ class CommonPage {
353353
end: MousePosition,
354354
options?: Omit<ScreenshotElementAtUrlOptions, 'action'>,
355355
) {
356-
const action = async() => await this.dragMouseRelativeToDOMElement(start, end, this.chartSelector);
356+
const action = async () => await this.dragMouseRelativeToDOMElement(start, end, this.chartSelector);
357357
await this.expectChartAtUrlToMatchScreenshot(url, {
358358
...options,
359359
action,

0 commit comments

Comments
 (0)