Skip to content

Commit d1e4dd0

Browse files
committed
chore(linting): massive eslint fixes
1 parent ed8a8f3 commit d1e4dd0

File tree

203 files changed

+68337
-65990
lines changed

Some content is hidden

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

203 files changed

+68337
-65990
lines changed

Diff for: .prettierrc.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"trailingComma": "es5",
3-
"tabWidth": 4,
4-
"semi": true,
5-
"importOrder": [
6-
"^components/(.*)$",
7-
"^containers/(.*)$",
8-
"^plugins/(.*)$",
9-
"^utils/(.*)$",
10-
"^~/(.*)$",
11-
"^[./]"
12-
],
13-
"importOrderSeparation": true,
14-
"importOrderSortSpecifiers": true
2+
"trailingComma": "es5",
3+
"tabWidth": 4,
4+
"semi": true,
5+
"importOrder": [
6+
"^components/(.*)$",
7+
"^containers/(.*)$",
8+
"^plugins/(.*)$",
9+
"^utils/(.*)$",
10+
"^~/(.*)$",
11+
"^[./]"
12+
],
13+
"importOrderSeparation": true,
14+
"importOrderSortSpecifiers": true
1515
}

Diff for: .storybook/main.js

+76-68
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,84 @@
1-
const path = require('path');
2-
const clientConfig = require('preact-cli/lib/lib/webpack/webpack-client-config');
3-
const transformConfig = require('preact-cli/lib/lib/webpack/transform-config');
1+
const path = require("path");
2+
const clientConfig = require("preact-cli/lib/lib/webpack/webpack-client-config");
3+
const transformConfig = require("preact-cli/lib/lib/webpack/transform-config");
44

55
module.exports = {
6-
framework: '@storybook/preact',
7-
stories: ['../stories/**/*stories.js', '../plugins/**/*stories.js',],
8-
addons: [
9-
'@storybook/addon-actions',
10-
'@storybook/addon-controls',
11-
'@storybook/addon-essentials',
12-
],
13-
features: {
14-
interactionsDebugger: true,
15-
},
16-
webpackFinal: async (config, {configType}) => {
17-
// Load preact config
18-
const isProd = configType === 'PRODUCTION';
19-
const cwd = process.env.PWD;
20-
const src = path.resolve(cwd, 'src');
21-
const source = (dir) => path.resolve(cwd, 'src', dir);
22-
const env = { isProd, isWatch: !isProd, cwd, src, source, config: 'preact.config.js', esm:false };
23-
preactConfig = await clientConfig(env);
24-
await transformConfig(env, preactConfig);
6+
framework: "@storybook/preact",
7+
stories: ["../stories/**/*stories.js", "../plugins/**/*stories.js"],
8+
addons: [
9+
"@storybook/addon-actions",
10+
"@storybook/addon-controls",
11+
"@storybook/addon-essentials",
12+
],
13+
features: {
14+
interactionsDebugger: true,
15+
},
16+
webpackFinal: async (config, { configType }) => {
17+
// Load preact config
18+
const isProd = configType === "PRODUCTION";
19+
const cwd = process.env.PWD;
20+
const src = path.resolve(cwd, "src");
21+
const source = (dir) => path.resolve(cwd, "src", dir);
22+
const env = {
23+
isProd,
24+
isWatch: !isProd,
25+
cwd,
26+
src,
27+
source,
28+
config: "preact.config.js",
29+
esm: false,
30+
};
31+
preactConfig = await clientConfig(env);
32+
await transformConfig(env, preactConfig);
2533

26-
// Add custom alias
27-
config.resolve.alias = {
28-
...config.resolve.alias,
29-
...preactConfig.resolve.alias,
30-
}
34+
// Add custom alias
35+
config.resolve.alias = {
36+
...config.resolve.alias,
37+
...preactConfig.resolve.alias,
38+
};
3139

32-
// Add proxy
33-
config.devServer = {
34-
...config.devServer,
35-
...preactConfig.devServer,
36-
}
40+
// Add proxy
41+
config.devServer = {
42+
...config.devServer,
43+
...preactConfig.devServer,
44+
};
3745

38-
// Parse .less files
39-
config.resolve.extensions.push('.less')
40-
config.module.rules.push({
41-
test: /\.(p?css|less|s[ac]ss|styl)$/,
42-
use: [
43-
require.resolve('style-loader'),
44-
{
45-
loader: require.resolve('css-loader'),
46-
options: {
47-
importLoaders: 1,
48-
modules: {
49-
localIdentName: '[name]__[local]___[hash:base64:5]',
50-
},
51-
},
52-
},
53-
require.resolve('less-loader'),
54-
],
55-
});
46+
// Parse .less files
47+
config.resolve.extensions.push(".less");
48+
config.module.rules.push({
49+
test: /\.(p?css|less|s[ac]ss|styl)$/,
50+
use: [
51+
require.resolve("style-loader"),
52+
{
53+
loader: require.resolve("css-loader"),
54+
options: {
55+
importLoaders: 1,
56+
modules: {
57+
localIdentName: "[name]__[local]___[hash:base64:5]",
58+
},
59+
},
60+
},
61+
require.resolve("less-loader"),
62+
],
63+
});
5664

57-
return config;
58-
},
59-
babel: async (options) => {
60-
options.plugins.slice(-1)
61-
options.plugins = [
62-
...options.plugins,
63-
[
64-
'@babel/plugin-transform-react-jsx', { pragma: 'h' }
65-
],
66-
[
67-
'babel-plugin-jsx-pragmatic', {
68-
module: 'preact',
69-
import: 'h',
70-
export: 'h',
71-
},],
72-
]
65+
return config;
66+
},
67+
babel: async (options) => {
68+
options.plugins.slice(-1);
69+
options.plugins = [
70+
...options.plugins,
71+
["@babel/plugin-transform-react-jsx", { pragma: "h" }],
72+
[
73+
"babel-plugin-jsx-pragmatic",
74+
{
75+
module: "preact",
76+
import: "h",
77+
export: "h",
78+
},
79+
],
80+
];
7381

74-
return options
75-
},
82+
return options;
83+
},
7684
};

Diff for: .storybook/mockFetch.js

+63-58
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,78 @@
1-
import { Component } from 'preact'
2-
import fetchMock from 'fetch-mock/esm/client'
1+
import fetchMock from "fetch-mock/esm/client";
2+
import { Component } from "preact";
33

44
class FetchStory extends Component {
5-
componentWillMount() {
6-
this.mock()
7-
}
5+
componentWillMount() {
6+
this.mock();
7+
}
88

9-
componentWillUnmount() {
10-
if (fetchMock.__prevProxy === this) {
11-
this.unmock()
9+
componentWillUnmount() {
10+
if (fetchMock.__prevProxy === this) {
11+
this.unmock();
12+
}
1213
}
13-
}
1414

15-
mock() {
16-
// Clear mocks from a previous FetchStory
17-
this.unmock()
15+
mock() {
16+
// Clear mocks from a previous FetchStory
17+
this.unmock();
1818

19-
const mocks = this.props.mocks
20-
if (mocks) {
21-
mocks.forEach(mock => {
22-
fetchMock.mock({
23-
...mock,
24-
response: (url, opts) => {
25-
if (!this.props.silent) {
26-
console.info('fetch', url, opts)
27-
}
28-
let result = {
29-
body: mock.response,
30-
headers: new Headers({
31-
'content-type': 'plain/text',
32-
}),
33-
}
19+
const mocks = this.props.mocks;
20+
if (mocks) {
21+
mocks.forEach((mock) => {
22+
fetchMock.mock({
23+
...mock,
24+
response: (url, opts) => {
25+
if (!this.props.silent) {
26+
console.info("fetch", url, opts);
27+
}
28+
let result = {
29+
body: mock.response,
30+
headers: new Headers({
31+
"content-type": "plain/text",
32+
}),
33+
};
3434

35-
if (
36-
mock.response.hasOwnProperty('body') ||
37-
mock.response.hasOwnProperty('status') ||
38-
mock.response.hasOwnProperty('headers')
39-
) {
40-
result = {
41-
...result,
42-
...mock.response,
43-
}
44-
}
35+
if (
36+
mock.response.hasOwnProperty("body") ||
37+
mock.response.hasOwnProperty("status") ||
38+
mock.response.hasOwnProperty("headers")
39+
) {
40+
result = {
41+
...result,
42+
...mock.response,
43+
};
44+
}
4545

46-
return this.props.throttle
47-
? new Promise(resolve => {
48-
setTimeout(() => resolve(result), this.props.throttle)
49-
})
50-
: result
51-
},
52-
})
53-
})
46+
return this.props.throttle
47+
? new Promise((resolve) => {
48+
setTimeout(
49+
() => resolve(result),
50+
this.props.throttle
51+
);
52+
})
53+
: result;
54+
},
55+
});
56+
});
5457

55-
// Allow unmocked requests to fall through
56-
fetchMock.catch((...args) => fetchMock.realFetch.apply(window, args))
57-
fetchMock.__prevProxy = this
58+
// Allow unmocked requests to fall through
59+
fetchMock.catch((...args) =>
60+
fetchMock.realFetch.apply(window, args)
61+
);
62+
fetchMock.__prevProxy = this;
63+
}
5864
}
59-
}
6065

61-
unmock() {
62-
if (typeof fetchMock.restore === 'function') {
63-
fetchMock.restore()
64-
delete fetchMock.__prevProxy
66+
unmock() {
67+
if (typeof fetchMock.restore === "function") {
68+
fetchMock.restore();
69+
delete fetchMock.__prevProxy;
70+
}
6571
}
66-
}
6772

68-
render() {
69-
return this.props.children
70-
}
73+
render() {
74+
return this.props.children;
75+
}
7176
}
7277

73-
export default FetchStory
78+
export default FetchStory;

0 commit comments

Comments
 (0)