Skip to content

Commit

Permalink
do not wrap lodash import
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerkoser committed Nov 11, 2024
1 parent 9fe7a6e commit 9620c2e
Show file tree
Hide file tree
Showing 157 changed files with 1,030 additions and 1,382 deletions.
25 changes: 0 additions & 25 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
1 change: 0 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ packageExtensions:
"eslint-module-utils@*":
dependencies:
eslint-import-resolver-alias: "*"
eslint-import-resolver-custom-alias: "*"

plugins:
- checksum: ba78c78f5d189f252d4d5e21e924611e496f41dddae35690823bc28dfeccb8f2cb5caf992163503fadf9eece9a70164dd0676ad51aa0692d293d4d123d3f1c34
Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/components/GMachineType.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
notify as notifyPlugin,
} from '@/plugins'

import { map } from '@/lodash'
import map from 'lodash/map'

const { createVuetifyPlugin } = global.fixtures.helper

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { shallowRef } from 'vue'

import { useShootAccessRestrictions } from '@/composables/useShootAccessRestrictions'

import { find } from '@/lodash'
import find from 'lodash/find'

describe('composables', () => {
describe('useShootAccessRestrictions', () => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/__tests__/composables/useShootContext.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import { useAuthzStore } from '@/store/authz'

import { createShootContextComposable } from '@/composables/useShootContext'

import { cloneDeep } from '@/lodash'
import cloneDeep from 'lodash/cloneDeep'

describe('composables', () => {
let shootContextStore

Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/composables/useShootEditor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {

import { EditorCompletions } from '@/composables/useShootEditor/helper'

import { repeat } from '@/lodash'
import repeat from 'lodash/repeat'

const shootCompletions = {
spec: {
Expand Down
8 changes: 3 additions & 5 deletions frontend/__tests__/composables/useShootItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ import { useSeedStore } from '@/store/seed'

import { createShootItemComposable } from '@/composables/useShootItem'

import {
set,
cloneDeep,
unset,
} from '@/lodash'
import set from 'lodash/set'
import cloneDeep from 'lodash/cloneDeep'
import unset from 'lodash/unset'

describe('composables', () => {
describe('useProvideShootItem', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ import {
useShootStatusCredentialRotation,
} from '@/composables/useShootStatusCredentialRotation'

import {
set,
unset,
find,
} from '@/lodash'
import set from 'lodash/set'
import unset from 'lodash/unset'
import find from 'lodash/find'

describe('composables', () => {
describe('useShootStatusCredentialRotation', () => {
Expand Down Expand Up @@ -58,17 +56,17 @@ describe('composables', () => {
})

it('should return completed phase', () => {
set(shootItem.value, 'status.credentials.rotation.certificateAuthorities.phase', 'Completed')
set(shootItem.value, 'status.credentials.rotation.etcdEncryptionKey.phase', 'Completed')
set(shootItem.value, ['status', 'credentials', 'rotation', 'certificateAuthorities', 'phase'], 'Completed')
set(shootItem.value, ['status', 'credentials', 'rotation', 'etcdEncryptionKey', 'phase'], 'Completed')
expect(reactiveShootItem.shootCredentialsRotationAggregatedPhase).toEqual({
type: 'Completed',
caption: 'Completed',
})
})

it('should return prepared phase', () => {
set(shootItem.value, 'status.credentials.rotation.etcdEncryptionKey.phase', 'Prepared')
set(shootItem.value, 'status.credentials.rotation.serviceAccountKey.phase', 'Prepared')
set(shootItem.value, ['status', 'credentials', 'rotation', 'etcdEncryptionKey', 'phase'], 'Prepared')
set(shootItem.value, ['status', 'credentials', 'rotation', 'serviceAccountKey', 'phase'], 'Prepared')
expect(reactiveShootItem.shootCredentialsRotationAggregatedPhase).toEqual({
type: 'Prepared',
caption: 'Prepared',
Expand All @@ -77,7 +75,7 @@ describe('composables', () => {

it('should return incomplete prepared phase', () => {
// treat unrotated credentials as unprepared
unset(shootItem.value, 'status.credentials.rotation.etcdEncryptionKey')
unset(shootItem.value, ['status', 'credentials', 'rotation', 'etcdEncryptionKey'])

expect(reactiveShootItem.shootCredentialsRotationAggregatedPhase).toEqual({
type: 'Prepared',
Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/lib.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
PositionEnum,
} from '@/lib/g-symbol-tree'

import { cloneDeep } from '@/lodash'
import cloneDeep from 'lodash/cloneDeep'

describe('lib', () => {
describe('g-symbol-tree', () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/__tests__/stores/cloudProfile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useConfigStore } from '@/store/config'
import { useCloudProfileStore } from '@/store/cloudProfile'
import { firstItemMatchingVersionClassification } from '@/store/cloudProfile/helper'

import { find } from '@/lodash'
import find from 'lodash/find'

describe('stores', () => {
describe('cloudProfile', () => {
Expand Down
8 changes: 3 additions & 5 deletions frontend/__tests__/stores/shoot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import { parseSearch } from '@/store/shoot/helper'

import { useApi } from '@/composables/useApi'

import {
cloneDeep,
map,
find,
} from '@/lodash'
import cloneDeep from 'lodash/cloneDeep'
import map from 'lodash/map'
import find from 'lodash/find'

const globalSetImmediate = global.setImmediate

Expand Down
6 changes: 2 additions & 4 deletions frontend/__tests__/utils/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import {
convertToGibibyte,
} from '@/utils'

import {
pick,
find,
} from '@/lodash'
import pick from 'lodash/pick'
import find from 'lodash/find'

describe('utils', () => {
describe('authorization', () => {
Expand Down
14 changes: 11 additions & 3 deletions frontend/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ const securityConfig = pluginSecurity.configs.recommended

const lodashConfig = {
plugins: {
lodash: pluginLodash,
lodash: {
meta: {
name: 'eslint-plugin-lodash',
version: '11.0.0',
},
rules: pluginLodash.rules,
},
},
rules: {
'lodash/path-style': ['error', 'array'],
'lodash/path-style': [2, 'array'],
'lodash/import-scope': [2, 'method'],
},
}

Expand Down Expand Up @@ -92,7 +99,7 @@ const importConfig = {
position: 'before',
},
{
pattern: '@/lodash',
pattern: 'lodash/**',
group: 'index',
position: 'after',
},
Expand All @@ -106,6 +113,7 @@ const importConfig = {
group: 'internal',
},
],
pathGroupsExcludedImportTypes: ['builtin'],
'newlines-between': 'always',
}],
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { useProjectStore } from '@/store/project'

import { useCustomColors } from '@/composables/useCustomColors'

import { get } from '@/lodash'
import get from 'lodash/get'

const theme = useTheme()
const route = useRoute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import { useCloudProfileStore } from '@/store/cloudProfile'

import { useShootItem } from '@/composables/useShootItem'

import { some } from '@/lodash'
import some from 'lodash/some'

export default {
inject: [
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/GAnsiText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SPDX-License-Identifier: Apache-2.0
<script>
import ansiHTML from 'ansi-html'

import { escape } from '@/lodash'
import escape from 'lodash/escape'

export default {
props: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/GBreadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SPDX-License-Identifier: Apache-2.0
import { computed } from 'vue'
import { useRoute } from 'vue-router'

import { kebabCase } from '@/lodash'
import kebabCase from 'lodash/kebabCase'

const route = useRoute()

Expand Down
15 changes: 7 additions & 8 deletions frontend/src/components/GClusterMetrics.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SPDX-License-Identifier: Apache-2.0
</template>

<script>

import { useConfigStore } from '@/store/config'

import GUsernamePassword from '@/components/GUsernamePasswordListTile'
Expand All @@ -51,10 +52,8 @@ import { useShootStatus } from '@/composables/useShootStatus'

import { isTruthyValue } from '@/utils'

import {
get,
replace,
} from '@/lodash'
import replace from 'lodash/replace'
import get from 'lodash/get'

export default {
components: {
Expand Down Expand Up @@ -112,18 +111,18 @@ export default {
return `https://au-${this.prefix}.${this.seedIngressDomain}`
},
username () {
return get(this.shootInfo, 'monitoringUsername', '')
return get(this.shootInfo, ['monitoringUsername'], '')
},
password () {
return get(this.shootInfo, 'monitoringPassword', '')
return get(this.shootInfo, ['monitoringPassword'], '')
},
hasAlertmanager () {
const ignoreAlerts = get(this.shootItem, 'metadata.annotations["shoot.gardener.cloud/ignore-alerts"]', 'false')
const ignoreAlerts = get(this.shootItem, ['metadata', 'annotations', 'shoot.gardener.cloud/ignore-alerts'], 'false')
if (isTruthyValue(ignoreAlerts)) {
return false
}

const emailReceivers = get(this.shootItem, 'spec.monitoring.alerting.emailReceivers', [])
const emailReceivers = get(this.shootItem, ['spec', 'monitoring', 'alerting', 'emailReceivers'], [])
return emailReceivers.length > 0
},
prefix () {
Expand Down
8 changes: 3 additions & 5 deletions frontend/src/components/GCodeBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ import yaml from 'highlight.js/lib/languages/yaml'

import GCopyBtn from '@/components/GCopyBtn.vue'

import {
trim,
split,
replace,
} from '@/lodash'
import trim from 'lodash/trim'
import split from 'lodash/split'
import replace from 'lodash/replace'

import 'highlight.js/styles/docco.css'

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/GCredentialTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ import GShootMessages from '@/components/ShootMessages/GShootMessages'
import { useShootItem } from '@/composables/useShootItem'
import { useShootStatusCredentialRotation } from '@/composables/useShootStatusCredentialRotation'

import { get } from '@/lodash'
import get from 'lodash/get'

export default {
components: {
Expand Down Expand Up @@ -167,7 +167,7 @@ export default {
return this.phaseType === 'Preparing' || this.phaseType === 'Completing' || this.phaseType === 'Rotating'
},
phaseCaption () {
return get(this.phase, 'caption', this.phaseType)
return get(this.phase, ['caption'], this.phaseType)
},
phaseColor () {
switch (this.phaseType) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/GForceDeleteCluster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import {
errorCodesFromArray,
} from '@/utils/errorCodes'

import { filter } from '@/lodash'
import filter from 'lodash/filter'

export default {
components: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/GLoginFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { useLoginStore } from '@/store/login'

import { omitKeysWithSuffix } from '@/utils'

import { template } from '@/lodash'
import template from 'lodash/template'

export default {
computed: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/GLoginTeaser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { useLoginStore } from '@/store/login'

import { omitKeysWithSuffix } from '@/utils'

import { template } from '@/lodash'
import template from 'lodash/template'

export default {
props: {
Expand Down
Loading

0 comments on commit 9620c2e

Please sign in to comment.