Skip to content

Commit

Permalink
chore: fix all linting errors - first pass
Browse files Browse the repository at this point in the history
  • Loading branch information
nickofthyme committed May 30, 2020
1 parent 21ef4de commit 8300f99
Show file tree
Hide file tree
Showing 663 changed files with 4,711 additions and 3,455 deletions.
6 changes: 4 additions & 2 deletions .playground/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import 'core-js';
import React from 'react';
import ReactDOM from 'react-dom';

import '../src/theme_light.scss';
import { Playground } from './playground';

ReactDOM.render(<Playground />, document.getElementById('root') as HTMLElement);
ReactDOM.render(<Playground />, document.querySelector('#root') as HTMLElement);
4 changes: 3 additions & 1 deletion .playground/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import React from 'react';

import { Example } from '../stories/treemap/6_custom_style';

export class Playground extends React.Component {
Expand Down
3 changes: 2 additions & 1 deletion .playground/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

module.exports = {
entry: './index.tsx',
Expand Down
3 changes: 2 additions & 1 deletion .storybook-docs/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import '@storybook/addon-actions/register';
import '@storybook/addon-knobs/register';
Expand Down
15 changes: 7 additions & 8 deletions .storybook-docs/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */

* under the License.
*/
// @ts-ignore
import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks';
import { withInfo } from '@storybook/addon-info';
import { withKnobs } from '@storybook/addon-knobs';
import { addDecorator, configure, addParameters } from '@storybook/react';
// @ts-ignore
import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks';

import { switchTheme } from '../.storybook-docs/theme_service';
import { create } from '@storybook/theming';

switchTheme('light');
import { switchTheme } from './theme_service';

import './style.scss';

import { create } from '@storybook/theming';
switchTheme('light');

addParameters({
options: {
Expand Down
11 changes: 6 additions & 5 deletions .storybook-docs/theme_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
/* eslint-disable import/no-unresolved */
* under the License.
*/

// @ts-ignore
import themeDark from '../src/theme_dark.scss?lazy';
import themeDark from '../src/theme_dark.scss?lazy'; // eslint-disable-line import/no-unresolved
// @ts-ignore
import themeLight from '../src/theme_light.scss?lazy';
import themeLight from '../src/theme_light.scss?lazy'; // eslint-disable-line import/no-unresolved

export function switchTheme(theme: string) {
switch (theme) {
Expand All @@ -28,8 +29,8 @@ export function switchTheme(theme: string) {
themeLight.use();
return;
case 'dark':
default:
themeLight.unuse();
themeDark.use();
return;
}
}
8 changes: 4 additions & 4 deletions .storybook-docs/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

const path = require('path');
// const webpack = require('webpack');
// eslint-disable-next-line

const createCompiler = require('@storybook/addon-docs/mdx-compiler-plugin');

Expand All @@ -38,7 +38,7 @@ const scssLoaders = [
];

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

// Replace default css rules with nonce
config.module.rules = config.module.rules.filter(({ test }) => !test.test('.css'));
Expand Down Expand Up @@ -134,5 +134,5 @@ module.exports = async ({ config }) => {

config.resolve.extensions.push('.ts', '.tsx', '.mdx');

return config;
return await config;
};
3 changes: 2 additions & 1 deletion .storybook/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import '@storybook/addon-actions/register';
import '@storybook/addon-knobs/register';
Expand Down
9 changes: 4 additions & 5 deletions .storybook/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,18 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import { withInfo } from '@storybook/addon-info';
import { withKnobs } from '@storybook/addon-knobs';
import { addDecorator, configure, addParameters } from '@storybook/react';
import { create } from '@storybook/theming';

import { switchTheme } from './theme_service';

switchTheme('light');

import './style.scss';

import { create } from '@storybook/theming';
switchTheme('light');

addParameters({
options: {
Expand Down
8 changes: 5 additions & 3 deletions .storybook/theme_service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-unresolved */
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
Expand All @@ -15,12 +14,15 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

/* eslint-disable import/no-unresolved */
// @ts-ignore
import themeDark from '../src/theme_dark.scss?lazy';
// @ts-ignore
import themeLight from '../src/theme_light.scss?lazy';
/* eslint-enable */

export function switchTheme(theme: string) {
switch (theme) {
Expand All @@ -29,8 +31,8 @@ export function switchTheme(theme: string) {
themeLight.use();
return;
case 'dark':
default:
themeLight.unuse();
themeDark.use();
return;
}
}
7 changes: 4 additions & 3 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

// eslint-disable-next-line
const path = require('path');

const webpack = require('webpack');

const nonce = 'Pk1rZ1XDlMuYe8ubWV3Lh0BzwrTigJQ=';
Expand Down Expand Up @@ -122,5 +123,5 @@ module.exports = async ({ config }) => {

config.resolve.extensions.push('.ts', '.tsx');

return config;
return await config;
};
23 changes: 13 additions & 10 deletions browsers/browsers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,44 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import webdriver, { By } from 'selenium-webdriver';
import path from 'path';

import webdriver, { By } from 'selenium-webdriver';

jest.setTimeout(30000);

/* eslint-disable global-require */

let driver: webdriver.WebDriver;
describe('smoke tests', () => {
beforeAll(async () => {
let capabilities: webdriver.Capabilities | null = null;
switch (process.env.BROWSER || 'chrome') {
case 'ie': {
case 'ie':
// HACK: include IEDriver path by nuget
const driverPath = path.join(__dirname, '../Selenium.WebDriver.IEDriver.3.150.0/driver/');
process.env.PATH = `${process.env.PATH};${driverPath};`;
capabilities = webdriver.Capabilities.ie();
capabilities.set('ignoreProtectedModeSettings', true);
capabilities.set('ignoreZoomSetting', true);
break;
}
case 'safari': {
case 'safari':
capabilities = webdriver.Capabilities.safari();
break;
}
case 'firefox': {
require('geckodriver');
capabilities = webdriver.Capabilities.firefox();
break;
}
case 'chrome': {
case 'chrome':
default:
require('chromedriver');
capabilities = webdriver.Capabilities.chrome();
capabilities.set('chromeOptions', {
args: ['--headless', '--no-sandbox', '--disable-gpu', '--window-size=1980,1200'],
});
break;
}
}
if (capabilities) {
driver = await new webdriver.Builder().withCapabilities(capabilities).build();
Expand All @@ -70,3 +71,5 @@ describe('smoke tests', () => {
expect(elements.length).toBeGreaterThan(0);
});
});

/* eslint-enable */
3 changes: 2 additions & 1 deletion browsers/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

module.exports = {
roots: ['<rootDir>'],
Expand Down
9 changes: 6 additions & 3 deletions browsers/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

const path = require('path');

const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const path = require('path');

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

module.exports = async () => {
return new Promise((resolve, reject) => {
return await new Promise((resolve, reject) => {
const compiler = webpack(config);
const server = new WebpackDevServer(compiler);
compiler.hooks.done.tap('done', () => {
Expand Down
5 changes: 3 additions & 2 deletions browsers/teardown.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

module.exports = async () => {
global.__WP_SERVER__.close();
await global.__WP_SERVER__.close();
};
8 changes: 5 additions & 3 deletions docs/charts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import { boolean } from '@storybook/addon-knobs';
import React from 'react';

import {
Chart,
BarSeries,
Expand All @@ -29,10 +32,9 @@ import {
Axis,
LineAnnotationDatum,
} from '../src';
import React from 'react';
import { Icon } from '../src/components/icons/icon';
import { KIBANA_METRICS } from '../src/utils/data_samples/test_dataset_kibana';
import { arrayKnobs, getChartRotationKnob } from '../stories/utils/knobs';
import { Icon } from '../src/components/icons/icon';

export default {
title: 'Introduction',
Expand Down
6 changes: 3 additions & 3 deletions global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

// https://github.com/jest-community/jest-extended
import 'jest-extended';
import 'jest-extended'; // https://github.com/jest-community/jest-extended
3 changes: 2 additions & 1 deletion integration/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

module.exports = {
PORT: '9009',
Expand Down
8 changes: 5 additions & 3 deletions integration/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */
* under the License.
*/

import { join, resolve } from 'path';
import { lstatSync, readdirSync } from 'fs';
import { join, resolve } from 'path';

import { getStorybook, configure } from '@storybook/react';

export type StoryInfo = [string, string];
Expand Down Expand Up @@ -59,7 +61,7 @@ function encodeString(string: string) {
.replace(/\w-\w/g, ' ')
.replace(/\//gi, ' ')
.replace(/-/g, ' ')
.replace(/[^a-z|A-Z|0-9|\s|\/]+/gi, '')
.replace(/[^\d\s/a-z|]+/gi, '')
.trim()
.replace(/\s+/g, '-')
.toLowerCase();
Expand Down
Loading

0 comments on commit 8300f99

Please sign in to comment.