Commit b98c85d8 by Zoltán Bedi Committed by GitHub

Chore: eslint plugin react hooks fix in jeager (#27580)

* Use eslintignore instead of gitignore

* Fix jaeger errors
parent 92c804fd
node_modules
compiled
build
vendor
devenv
data
dist
......@@ -3,7 +3,7 @@
"root": true,
"overrides": [
{
"files": ["packages/**/*.{ts,tsx}", "public/app/**/*.{ts,tsx}"],
"files": ["packages/grafana-ui/**/*.{ts,tsx}", "public/app/**/*.{ts,tsx}"],
"rules": {
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off"
......
......@@ -13,7 +13,7 @@
"e2e:debug": "./e2e/start-and-run-suite debug",
"e2e:dev": "./e2e/start-and-run-suite dev",
"jest": "jest --notify --watch",
"lint": "eslint . --ext .js,.tsx,.ts --cache --ignore-path .gitignore --ignore-pattern devenv",
"lint": "eslint . --ext .js,.tsx,.ts --cache",
"jest-ci": "mkdir -p reports/junit && export JEST_JUNIT_OUTPUT_DIR=reports/junit && jest --ci --reporters=default --reporters=jest-junit -w ${TEST_MAX_WORKERS:-100%}",
"lint:fix": "yarn lint --fix",
"packages:build": "lerna run clean && lerna run build --ignore @grafana-plugins/input-datasource",
......
{
"rules": {
"no-restricted-imports": ["error", { "patterns": ["@grafana/runtime"] }]
}
},
"overrides": [
{
"files": ["./**/*.{ts,tsx}"],
"rules": {
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off"
}
}
]
}
......@@ -164,14 +164,13 @@ export const HEADER_ITEMS = [
{
key: 'timestamp',
label: 'Trace Start',
renderer: (trace: Trace) => {
const styles = getStyles(useTheme());
renderer: (trace: Trace, styles?: ReturnType<typeof getStyles>) => {
const dateStr = formatDatetime(trace.startTime);
const match = dateStr.match(/^(.+)(:\d\d\.\d+)$/);
return match ? (
<span className={styles.TracePageHeaderOverviewItemValue}>
<span className={styles?.TracePageHeaderOverviewItemValue}>
{match[1]}
<span className={styles.TracePageHeaderOverviewItemValueDetail}>{match[2]}</span>
<span className={styles?.TracePageHeaderOverviewItemValueDetail}>{match[2]}</span>
</span>
) : (
dateStr
......@@ -223,22 +222,26 @@ export default function TracePageHeader(props: TracePageHeaderEmbedProps) {
hideSearchButtons,
} = props;
const styles = getStyles(useTheme());
const links = useMemo(() => {
if (!trace) {
return [];
}
return getTraceLinks(trace);
}, [trace]);
if (!trace) {
return null;
}
const links = useMemo(() => getTraceLinks(trace), [trace]);
const summaryItems =
!hideSummary &&
!slimView &&
HEADER_ITEMS.map(item => {
const { renderer, ...rest } = item;
return { ...rest, value: renderer(trace) };
return { ...rest, value: renderer(trace, styles) };
});
const styles = getStyles(useTheme());
const title = (
<h1 className={cx(styles.TracePageHeaderTitle, canCollapse && styles.TracePageHeaderTitleCollapsible)}>
<TraceName traceName={getTraceName(trace.spans)} />{' '}
......
......@@ -96,10 +96,12 @@ type AccordianKeyValuesProps = {
// export for tests
export function KeyValuesSummary(props: { data?: TraceKeyValuePair[] }) {
const { data } = props;
const styles = getStyles(useTheme());
if (!Array.isArray(data) || !data.length) {
return null;
}
const styles = getStyles(useTheme());
return (
<ul className={styles.summary}>
{data.map((item, i) => (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment