Skip to content

Commit 1f70836

Browse files
authored
chore: lint fix (#5123)
1 parent 5de0b42 commit 1f70836

27 files changed

+123
-101
lines changed

frontend/common/code-help/create-user/create-user-php.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ module.exports = (
77
) => `use Flagsmith\\Flagsmith;
88
99
$flagsmith = new Flagsmith('${envId}'${
10-
Constants.isCustomFlagsmithUrl() && `,\n '${Constants.getFlagsmithSDKUrl()}'\n`
10+
Constants.isCustomFlagsmithUrl() &&
11+
`,\n '${Constants.getFlagsmithSDKUrl()}'\n`
1112
});
1213
1314
// Identify the user

frontend/common/code-help/init/init-dotnet.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ module.exports = (
99
static FlagsmithClient _flagsmithClient;
1010
1111
_flagsmithClient = new("${envId}"${
12-
Constants.isCustomFlagsmithUrl() ? `, apiUrl: "${Constants.getFlagsmithSDKUrl()}"` : ''
12+
Constants.isCustomFlagsmithUrl()
13+
? `, apiUrl: "${Constants.getFlagsmithSDKUrl()}"`
14+
: ''
1315
});
1416
1517
var flags = await _flagsmithClient.GetEnvironmentFlags(); # This method triggers a network request

frontend/common/code-help/init/init-js.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ module.exports = (
66
) => `import ${LIB_NAME} from "${NPM_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm
77
88
${LIB_NAME}.init({
9-
environmentID: "${envId}",${Constants.isCustomFlagsmithUrl() ? `\n api: "${Constants.getFlagsmithSDKUrl()}",` : ''}
9+
environmentID: "${envId}",${
10+
Constants.isCustomFlagsmithUrl()
11+
? `\n api: "${Constants.getFlagsmithSDKUrl()}",`
12+
: ''
13+
}
1014
onChange: (oldFlags, params) => { // Occurs whenever flags are changed
1115
// Determines if the update came from the server or local cached storage
1216
const { isFromServer } = params;

frontend/common/code-help/traits/traits-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Constants from 'common/constants'
22

33
module.exports = (
44
envId,
5-
{ FEATURE_NAME, TRAIT_NAME, LIB_NAME, NPM_NODE_CLIENT, USER_ID },
5+
{ FEATURE_NAME, LIB_NAME, NPM_NODE_CLIENT, TRAIT_NAME, USER_ID },
66
userId,
77
) => `import Flagsmith from "${NPM_NODE_CLIENT}"; // Add this line if you're using ${LIB_NAME} via npm
88

frontend/common/code-help/traits/traits-php.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import Constants from 'common/constants'
22
module.exports = (envId, { TRAIT_NAME }, userId) => `use Flagsmith\\Flagsmith;
33
44
$flagsmith = new Flagsmith('${envId}'${
5-
Constants.isCustomFlagsmithUrl() && `,\n '${Constants.getFlagsmithSDKUrl()}'\n`
5+
Constants.isCustomFlagsmithUrl() &&
6+
`,\n '${Constants.getFlagsmithSDKUrl()}'\n`
67
});
78
89
$traits = (object) [ '${TRAIT_NAME}' => 42 ];

frontend/common/providers/Permission.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { useGetPermissionQuery } from 'common/services/usePermission'
33
import { PermissionLevel } from 'common/types/requests'
44
import AccountStore from 'common/stores/account-store'
55
import intersection from 'lodash/intersection'
6-
import { add } from 'ionicons/icons';
7-
import { cloneDeep } from 'lodash'; // we need this to make JSX compile
6+
import { add } from 'ionicons/icons'
7+
import { cloneDeep } from 'lodash' // we need this to make JSX compile
88

99
type PermissionType = {
1010
id: any

frontend/common/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const baseApiOptions = (queryArgs?: Partial<FetchBaseQueryArgs>) => {
1616
| 'extractRehydrationInfo'
1717
> = {
1818
baseQuery: fetchBaseQuery({
19-
credentials: Project.cookieAuthEnabled ? 'include' : undefined,
2019
baseUrl: Project.api,
20+
credentials: Project.cookieAuthEnabled ? 'include' : undefined,
2121
prepareHeaders: async (headers, { endpoint, getState }) => {
2222
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2323
const state = getState() as StoreStateType
@@ -33,7 +33,7 @@ export const baseApiOptions = (queryArgs?: Partial<FetchBaseQueryArgs>) => {
3333
if (token && !Project.cookieAuthEnabled) {
3434
headers.set('Authorization', `Token ${token}`)
3535
}
36-
} catch (e) { }
36+
} catch (e) {}
3737
}
3838

3939
return headers

frontend/common/stores/account-store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import dataRelay from 'data-relay'
88
import { sortBy } from 'lodash'
99
import Project from 'common/project'
1010
import { getStore } from 'common/store'
11-
import { service } from "common/service";
11+
import { service } from 'common/service'
1212

1313
const controller = {
1414
acceptInvite: (id) => {

frontend/common/stores/feature-list-store.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ import {
1212
} from 'common/services/useProjectFlag'
1313
import OrganisationStore from './organisation-store'
1414
import {
15-
ChangeRequest,
16-
Environment,
17-
FeatureState,
18-
PagedResponse,
19-
ProjectFlag, TypedFeatureState,
20-
} from 'common/types/responses';
15+
ChangeRequest,
16+
Environment,
17+
FeatureState,
18+
PagedResponse,
19+
ProjectFlag,
20+
TypedFeatureState,
21+
} from 'common/types/responses'
2122
import Utils from 'common/utils/utils'
2223
import Actions from 'common/dispatcher/action-constants'
2324
import Project from 'common/project'
@@ -472,16 +473,17 @@ const controller = {
472473
API.trackEvent(Constants.events.EDIT_FEATURE)
473474
const env: Environment = ProjectStore.getEnvironment(environmentId) as any
474475
// Detect differences between change request and existing feature states
475-
const res: { data: PagedResponse<TypedFeatureState> } = await getFeatureStates(
476-
getStore(),
477-
{
478-
environment: environmentFlag.environment,
479-
feature: projectFlag.id,
480-
},
481-
{
482-
forceRefetch: true,
483-
},
484-
)
476+
const res: { data: PagedResponse<TypedFeatureState> } =
477+
await getFeatureStates(
478+
getStore(),
479+
{
480+
environment: environmentFlag.environment,
481+
feature: projectFlag.id,
482+
},
483+
{
484+
forceRefetch: true,
485+
},
486+
)
485487
const segmentResult = await getSegments(getStore(), {
486488
include_feature_specific: true,
487489
page_size: 1000,

frontend/common/utils/utils.tsx

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ const Utils = Object.assign({}, require('./base/_utils'), {
122122
return res
123123
},
124124

125+
copyToClipboard: async (
126+
value: string,
127+
successMessage?: string,
128+
errorMessage?: string,
129+
) => {
130+
try {
131+
await navigator.clipboard.writeText(value)
132+
toast(successMessage ?? 'Copied to clipboard')
133+
} catch (error) {
134+
toast(errorMessage ?? 'Failed to copy to clipboard')
135+
throw error
136+
}
137+
},
125138
displayLimitAlert(type: string, percentage: number | undefined) {
126139
const envOrProject =
127140
type === 'segment overrides' ? 'environment' : 'project'
@@ -158,6 +171,7 @@ const Utils = Object.assign({}, require('./base/_utils'), {
158171
return featureState.string_value
159172
}
160173
},
174+
161175
findOperator(
162176
operator: SegmentCondition['operator'],
163177
value: string,
@@ -174,20 +188,10 @@ const Utils = Object.assign({}, require('./base/_utils'), {
174188

175189
return conditions.find((v) => v.value === operator)
176190
},
177-
178-
copyToClipboard: async (value: string, successMessage?: string, errorMessage?: string) => {
179-
try {
180-
await navigator.clipboard.writeText(value)
181-
toast(successMessage ?? 'Copied to clipboard')
182-
} catch (error) {
183-
toast(errorMessage ?? 'Failed to copy to clipboard')
184-
throw error
185-
}
186-
},
187191
/** Checks whether the specified flag exists, which is different from the flag being enabled or not. This is used to
188192
* only add behaviour to Flagsmith-on-Flagsmith flags that have been explicitly created by customers.
189193
*/
190-
flagsmithFeatureExists(flag: string) {
194+
flagsmithFeatureExists(flag: string) {
191195
return Object.prototype.hasOwnProperty.call(flagsmith.getAllFlags(), flag)
192196
},
193197
getApproveChangeRequestPermission() {

0 commit comments

Comments
 (0)