Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style(js): Apply curly: ['error'] #29764

Merged
merged 1 commit into from
Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion static/app/components/dataExport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class DataExport extends React.Component<Props, State> {

componentDidUpdate({payload: prevPayload}) {
const {payload} = this.props;
if (!isEqual(prevPayload, payload)) this.resetState();
if (!isEqual(prevPayload, payload)) {
this.resetState();
}
}

get initialState(): State {
Expand Down
4 changes: 3 additions & 1 deletion static/app/components/events/contexts/chunk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ class Chunk extends React.Component<Props, State> {
case 'trace':
return t('Trace Details');
case 'default':
if (alias === 'state') return t('Application State');
if (alias === 'state') {
return t('Application State');
}
return toTitleCase(alias);
default:
return toTitleCase(type);
Expand Down
4 changes: 3 additions & 1 deletion static/app/components/modals/addDashboardWidgetModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ class AddDashboardWidgetModal extends React.Component<Props, State> {

componentDidMount() {
const {fromDiscover} = this.props;
if (fromDiscover) this.fetchDashboards();
if (fromDiscover) {
this.fetchDashboards();
}
this.handleDefaultFields();
}

Expand Down
3 changes: 2 additions & 1 deletion static/app/components/stream/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,14 @@ class StreamGroup extends React.Component<Props, State> {

if (isFiltered && typeof query === 'string') {
const queryObj = queryToObj(query);
for (const queryTag in queryObj)
for (const queryTag in queryObj) {
if (!DiscoveryExclusionFields.includes(queryTag)) {
const queryVal = queryObj[queryTag].includes(' ')
? `"${queryObj[queryTag]}"`
: queryObj[queryTag];
queryTerms.push(`${queryTag}:${queryVal}`);
}
}

if (queryObj.__text) {
queryTerms.push(queryObj.__text);
Expand Down
4 changes: 3 additions & 1 deletion static/app/utils/performance/contexts/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export function createDefinedContext<ContextType>(options: {

function useContext() {
const context = React.useContext(Context);
if (!context && strict) throw new Error(errorMessage);
if (!context && strict) {
throw new Error(errorMessage);
}
return context;
}

Expand Down
3 changes: 2 additions & 1 deletion static/app/views/dashboardsV2/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function constructWidgetFromQuery(query?: Query): Widget | undefined {
queryNames &&
queryFields &&
typeof query.queryOrderby === 'string'
)
) {
queryConditions.forEach((condition, index) => {
queries.push({
name: queryNames[index],
Expand All @@ -70,6 +70,7 @@ export function constructWidgetFromQuery(query?: Query): Widget | undefined {
orderby: query.queryOrderby as string,
});
});
}
if (query.title && query.displayType && query.interval && queries.length > 0) {
const newWidget: Widget = {
...(pick(query, ['title', 'displayType', 'interval']) as {
Expand Down
11 changes: 8 additions & 3 deletions static/app/views/eventsV2/results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ class Results extends React.Component<Props, State> {
addRoutePerformanceContext(selection);
}

if (prevState.confirmedQuery !== confirmedQuery) this.fetchTotalCount();
if (prevState.confirmedQuery !== confirmedQuery) {
this.fetchTotalCount();
}
}

tagsApi: Client = new Client();
Expand Down Expand Up @@ -196,8 +198,11 @@ class Results extends React.Component<Props, State> {
try {
const results = await fetchProjectsCount(api, organization.slug);

if (projectLength === 0) projectLength = results.myProjects;
else projectLength = results.allProjects;
if (projectLength === 0) {
projectLength = results.myProjects;
} else {
projectLength = results.allProjects;
}
} catch (err) {
// do nothing, so the length is 0 or 1 and the query is assumed safe
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ export class SentryAppExternalForm extends Component<Props, State> {
const requiredFields = this.state.required_fields || [];
const optionalFields = this.state.optional_fields || [];

if (!sentryAppInstallationUuid) return '';
if (!sentryAppInstallationUuid) {
return '';
}

return (
<Form
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ function generateEventView(location: Location, transactionName: string): EventVi
.setFilterValues('transaction', [transactionName]);

Object.keys(conditions.filters).forEach(field => {
if (isAggregateField(field)) conditions.removeFilter(field);
if (isAggregateField(field)) {
conditions.removeFilter(field);
}
});

// Default fields for relative span view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ class OperationSort extends Component<Props, State> {
checked={eventView.sorts.some(({field}) => field === operation)}
onClick={() => {
const sortLink = this.generateSortLink({field: operation});
if (sortLink) browserHistory.push(sortLink);
if (sortLink) {
browserHistory.push(sortLink);
}
}}
/>
<span>{title}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ function generateEventView(location: Location, transactionName: string): EventVi
.setFilterValues('transaction', [transactionName]);

Object.keys(conditions.filters).forEach(field => {
if (isAggregateField(field)) conditions.removeFilter(field);
if (isAggregateField(field)) {
conditions.removeFilter(field);
}
});

const fields = ['id', 'user.display', 'transaction.duration', 'trace', 'timestamp'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ function generateEventView(location: Location, transactionName: string): EventVi
.setFilterValues('transaction', [transactionName]);

Object.keys(conditions.filters).forEach(field => {
if (isAggregateField(field)) conditions.removeFilter(field);
if (isAggregateField(field)) {
conditions.removeFilter(field);
}
});

const vitals = VITAL_GROUPS.reduce((allVitals: WebVital[], group) => {
Expand Down
13 changes: 9 additions & 4 deletions static/app/views/performance/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,15 @@ export function addRoutePerformanceContext(selection: GlobalSelection) {

transaction?.setTag('query.period', seconds.toString());
let groupedPeriod = '>30d';
if (seconds <= oneDay) groupedPeriod = '<=1d';
else if (seconds <= oneDay * 7) groupedPeriod = '<=7d';
else if (seconds <= oneDay * 14) groupedPeriod = '<=14d';
else if (seconds <= oneDay * 30) groupedPeriod = '<=30d';
if (seconds <= oneDay) {
groupedPeriod = '<=1d';
} else if (seconds <= oneDay * 7) {
groupedPeriod = '<=7d';
} else if (seconds <= oneDay * 14) {
groupedPeriod = '<=14d';
} else if (seconds <= oneDay * 30) {
groupedPeriod = '<=30d';
}
transaction?.setTag('query.period.grouped', groupedPeriod);
}

Expand Down
15 changes: 8 additions & 7 deletions static/app/views/releases/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,24 @@ class ReleasesList extends AsyncView<Props, State> {
if (
sort === ReleasesSortOption.USERS_24_HOURS &&
display === ReleasesDisplayOption.SESSIONS
)
) {
sort = ReleasesSortOption.SESSIONS_24_HOURS;
else if (
} else if (
sort === ReleasesSortOption.SESSIONS_24_HOURS &&
display === ReleasesDisplayOption.USERS
)
) {
sort = ReleasesSortOption.USERS_24_HOURS;
else if (
} else if (
sort === ReleasesSortOption.CRASH_FREE_USERS &&
display === ReleasesDisplayOption.SESSIONS
)
) {
sort = ReleasesSortOption.CRASH_FREE_SESSIONS;
else if (
} else if (
sort === ReleasesSortOption.CRASH_FREE_SESSIONS &&
display === ReleasesDisplayOption.USERS
)
) {
sort = ReleasesSortOption.CRASH_FREE_USERS;
}

router.push({
...location,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ function convertRelayPiiConfig(relayPiiConfig?: string) {
const typeAndMethod = rule.slice(1).split(':');
let [type] = typeAndMethod;
const [, method] = typeAndMethod;
if (type === 'urlauth') type = 'url_auth';
if (type === 'usssn') type = 'us_ssn';
if (type === 'urlauth') {
type = 'url_auth';
}
if (type === 'usssn') {
type = 'us_ssn';
}

convertedRules.push({
id,
Expand Down