Skip to content

Commit 14ad03e

Browse files
committed
Fix lint issues
1 parent ec55923 commit 14ad03e

File tree

13 files changed

+139
-120
lines changed

13 files changed

+139
-120
lines changed

.eslintcache

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

babel.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2-
presets: ['@babel/preset-env', '@babel/preset-react'],
3-
plugins: ['transform-class-properties'],
2+
presets: ["@babel/preset-env", "@babel/preset-react"],
3+
plugins: ["transform-class-properties"],
44
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"classnames": "^2.2.6",
6666
"clsx": "^1.1.1",
6767
"file-loader": "^6.2.0",
68+
"lodash": "^4.17.20",
6869
"moment": "^2.27.0",
6970
"normalize.css": "^8.0.1",
7071
"react": "16.12.0",

scripts/webpack/postcss.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = () => ({
22
plugins: {
33
autoprefixer: {},
4-
'postcss-reporter': {},
5-
'postcss-browser-reporter': {},
4+
"postcss-reporter": {},
5+
"postcss-browser-reporter": {},
66
},
77
});

scripts/webpack/webpack.common.js

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
1-
const webpack = require('webpack');
2-
const path = require('path');
3-
const HtmlWebpackPlugin = require('html-webpack-plugin');
4-
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
5-
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6-
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
7-
const CopyPlugin = require('copy-webpack-plugin');
8-
const ESLintPlugin = require('eslint-webpack-plugin');
1+
const webpack = require("webpack");
2+
const path = require("path");
3+
const HtmlWebpackPlugin = require("html-webpack-plugin");
4+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
5+
const CopyPlugin = require("copy-webpack-plugin");
6+
const ESLintPlugin = require("eslint-webpack-plugin");
97

10-
const fs = require('fs');
8+
const fs = require("fs");
119

1210
module.exports = {
13-
target: 'web',
11+
target: "web",
1412

1513
entry: {
16-
app: './webapp/javascript/index.jsx',
17-
styles: './webapp/sass/profile.scss',
14+
app: "./webapp/javascript/index.jsx",
15+
styles: "./webapp/sass/profile.scss",
1816
},
1917

2018
output: {
21-
publicPath: '',
22-
path: path.resolve(__dirname, '../../webapp/public/build'),
23-
filename: '[name].[hash].js',
19+
publicPath: "",
20+
path: path.resolve(__dirname, "../../webapp/public/build"),
21+
filename: "[name].[hash].js",
2422
},
2523

2624
resolve: {
27-
extensions: ['.ts', '.tsx', '.es6', '.js', '.jsx', '.json', '.svg'],
25+
extensions: [".ts", ".tsx", ".es6", ".js", ".jsx", ".json", ".svg"],
2826
alias: {
2927
// rc-trigger uses babel-runtime which has internal dependency to core-js@2
3028
// this alias maps that dependency to core-js@t3
31-
'core-js/library/fn': 'core-js/stable',
29+
"core-js/library/fn": "core-js/stable",
3230
},
3331
modules: [
34-
'node_modules',
35-
path.resolve('webapp'),
36-
path.resolve('node_modules'),
32+
"node_modules",
33+
path.resolve("webapp"),
34+
path.resolve("node_modules"),
3735
],
3836
},
3937

@@ -55,30 +53,30 @@ module.exports = {
5553
exclude: /node_modules/,
5654
use: [
5755
{
58-
loader: 'babel-loader',
56+
loader: "babel-loader",
5957
options: {
6058
cacheDirectory: true,
6159
babelrc: true,
6260
// Note: order is bottom-to-top and/or right-to-left
6361
presets: [
6462
[
65-
'@babel/preset-env',
63+
"@babel/preset-env",
6664
{
6765
targets: {
68-
browsers: 'last 3 versions',
66+
browsers: "last 3 versions",
6967
},
70-
useBuiltIns: 'entry',
68+
useBuiltIns: "entry",
7169
corejs: 3,
7270
modules: false,
7371
},
7472
],
7573
[
76-
'@babel/preset-typescript',
74+
"@babel/preset-typescript",
7775
{
7876
allowNamespaces: true,
7977
},
8078
],
81-
'@babel/preset-react',
79+
"@babel/preset-react",
8280
],
8381
},
8482
},
@@ -88,9 +86,9 @@ module.exports = {
8886
test: /\.js$/,
8987
use: [
9088
{
91-
loader: 'babel-loader',
89+
loader: "babel-loader",
9290
options: {
93-
presets: [['@babel/preset-env']],
91+
presets: [["@babel/preset-env"]],
9492
},
9593
},
9694
],
@@ -100,7 +98,7 @@ module.exports = {
10098
exclude: /(index|error)\.html/,
10199
use: [
102100
{
103-
loader: 'html-loader',
101+
loader: "html-loader",
104102
options: {
105103
attrs: [],
106104
minimize: true,
@@ -113,29 +111,29 @@ module.exports = {
113111
{
114112
test: /\.css$/,
115113
// include: MONACO_DIR, // https://github.com/react-monaco-editor/react-monaco-editor
116-
use: ['style-loader', 'css-loader'],
114+
use: ["style-loader", "css-loader"],
117115
},
118116
{
119117
test: /\.scss$/,
120118
use: [
121119
MiniCssExtractPlugin.loader,
122120
{
123-
loader: 'css-loader',
121+
loader: "css-loader",
124122
options: {
125123
importLoaders: 2,
126124
url: true,
127125
sourceMap: true,
128126
},
129127
},
130128
{
131-
loader: 'postcss-loader',
129+
loader: "postcss-loader",
132130
options: {
133131
sourceMap: true,
134132
config: { path: __dirname },
135133
},
136134
},
137135
{
138-
loader: 'sass-loader',
136+
loader: "sass-loader",
139137
options: {
140138
sourceMap: true,
141139
},
@@ -144,27 +142,27 @@ module.exports = {
144142
},
145143
{
146144
test: /\.(svg|ico|jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)(\?.*)?$/,
147-
loader: 'file-loader',
148-
options: { name: 'static/img/[name].[hash:8].[ext]' },
145+
loader: "file-loader",
146+
options: { name: "static/img/[name].[hash:8].[ext]" },
149147
},
150148
],
151149
},
152150

153151
plugins: [
154152
new ESLintPlugin(),
155153
new webpack.ProvidePlugin({
156-
$: 'jquery',
157-
jQuery: 'jquery',
154+
$: "jquery",
155+
jQuery: "jquery",
158156
}),
159157
new HtmlWebpackPlugin({
160-
filename: path.resolve(__dirname, '../../webapp/public/index.html'),
161-
template: path.resolve(__dirname, '../../webapp/templates/index.html'),
158+
filename: path.resolve(__dirname, "../../webapp/public/index.html"),
159+
template: path.resolve(__dirname, "../../webapp/templates/index.html"),
162160
inject: false,
163-
chunksSortMode: 'none',
161+
chunksSortMode: "none",
164162
templateParameters: (compilation, assets, options) => ({
165163
extra_metadata: process.env.EXTRA_METADATA
166164
? fs.readFileSync(process.env.EXTRA_METADATA)
167-
: '',
165+
: "",
168166
mode: process.env.NODE_ENV,
169167
webpack: compilation.getStats().toJson(),
170168
compilation,
@@ -176,17 +174,18 @@ module.exports = {
176174
}),
177175
}),
178176
new MiniCssExtractPlugin({
179-
filename: '[name].[hash].css',
177+
filename: "[name].[hash].css",
180178
}),
181179
new webpack.DefinePlugin({
180+
// eslint-disable-next-line
182181
PYROSCOPE_VERSION: JSON.stringify(require('../../package.json').version),
183182
}),
184183
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
185184
new CopyPlugin({
186185
patterns: [
187186
{
188-
from: 'webapp/images',
189-
to: 'images',
187+
from: "webapp/images",
188+
to: "images",
190189
},
191190
],
192191
}),

scripts/webpack/webpack.dev.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
const { DefinePlugin } = require('webpack');
2-
const { merge } = require('webpack-merge');
1+
const { merge } = require("webpack-merge");
32

4-
const common = require('./webpack.common.js');
3+
const common = require("./webpack.common.js");
54

65
module.exports = merge(common, {
7-
mode: 'development',
6+
mode: "development",
87
});

scripts/webpack/webpack.prod.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
const { DefinePlugin } = require('webpack');
2-
const { merge } = require('webpack-merge');
1+
const { merge } = require("webpack-merge");
32

4-
const common = require('./webpack.common.js');
3+
const common = require("./webpack.common.js");
54

65
module.exports = merge(common, {
7-
mode: 'production',
6+
mode: "production",
87
});
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
export const SET_DATE_RANGE = 'SET_DATE_RANGE';
2-
export const SET_FROM = 'SET_FROM';
3-
export const SET_UNTIL = 'SET_UNTIL';
4-
export const SET_MAX_NODES = 'SET_MAX_NODES';
5-
export const SET_LABELS = 'SET_LABELS';
6-
export const ADD_LABEL = 'ADD_LABEL';
7-
export const REMOVE_LABEL = 'REMOVE_LABEL';
8-
export const REFRESH = 'REFRESH';
9-
export const REQUEST_JSON = 'REQUEST_JSON';
10-
export const RECEIVE_JSON = 'RECEIVE_JSON';
11-
export const REQUEST_NAMES = 'REQUEST_NAMES';
12-
export const RECEIVE_NAMES = 'RECEIVE_NAMES';
1+
export const SET_DATE_RANGE = "SET_DATE_RANGE";
2+
export const SET_FROM = "SET_FROM";
3+
export const SET_UNTIL = "SET_UNTIL";
4+
export const SET_MAX_NODES = "SET_MAX_NODES";
5+
export const SET_LABELS = "SET_LABELS";
6+
export const ADD_LABEL = "ADD_LABEL";
7+
export const REMOVE_LABEL = "REMOVE_LABEL";
8+
export const REFRESH = "REFRESH";
9+
export const REQUEST_JSON = "REQUEST_JSON";
10+
export const RECEIVE_JSON = "RECEIVE_JSON";
11+
export const REQUEST_NAMES = "REQUEST_NAMES";
12+
export const RECEIVE_NAMES = "RECEIVE_NAMES";

webapp/javascript/redux/actions.js

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,36 @@ import {
1111
RECEIVE_JSON,
1212
REQUEST_NAMES,
1313
RECEIVE_NAMES,
14-
} from './actionTypes';
14+
} from "./actionTypes";
1515

16-
export const setDateRange = (from, until) => ({ type: SET_DATE_RANGE, payload: { from, until } });
16+
export const setDateRange = (from, until) => ({
17+
type: SET_DATE_RANGE,
18+
payload: { from, until },
19+
});
1720

1821
export const setFrom = (from) => ({ type: SET_FROM, payload: { from } });
1922

2023
export const setUntil = (until) => ({ type: SET_UNTIL, payload: { until } });
2124

22-
export const setMaxNodes = (maxNodes) => ({ type: SET_MAX_NODES, payload: { maxNodes } });
25+
export const setMaxNodes = (maxNodes) => ({
26+
type: SET_MAX_NODES,
27+
payload: { maxNodes },
28+
});
2329

24-
export const setLabels = (labels) => ({ type: SET_LABELS, payload: { labels } });
30+
export const setLabels = (labels) => ({
31+
type: SET_LABELS,
32+
payload: { labels },
33+
});
2534

26-
export const addLabel = (name, value) => ({ type: ADD_LABEL, payload: { name, value } });
35+
export const addLabel = (name, value) => ({
36+
type: ADD_LABEL,
37+
payload: { name, value },
38+
});
2739

28-
export const removeLabel = (name) => ({ type: REMOVE_LABEL, payload: { name } });
40+
export const removeLabel = (name) => ({
41+
type: REMOVE_LABEL,
42+
payload: { name },
43+
});
2944

3045
export const refresh = (url) => ({ type: REFRESH, payload: { url } });
3146

@@ -35,7 +50,10 @@ export const receiveJSON = (data) => ({ type: RECEIVE_JSON, payload: data });
3550

3651
export const requestNames = () => ({ type: REQUEST_NAMES, payload: {} });
3752

38-
export const receiveNames = (names) => ({ type: RECEIVE_NAMES, payload: { names } });
53+
export const receiveNames = (names) => ({
54+
type: RECEIVE_NAMES,
55+
payload: { names },
56+
});
3957

4058
let currentJSONController;
4159
export function fetchJSON(url) {
@@ -64,7 +82,9 @@ export function fetchNames() {
6482
currentNamesController = new AbortController();
6583

6684
dispatch(requestNames());
67-
return fetch('/label-values?label=__name__', { signal: currentNamesController.signal })
85+
return fetch("/label-values?label=__name__", {
86+
signal: currentNamesController.signal,
87+
})
6888
.then((response) => response.json())
6989
.then((data) => {
7090
dispatch(receiveNames(data));

0 commit comments

Comments
 (0)