Skip to content

Commit

Permalink
Do not wrap lodash because of linter (#2174)
Browse files Browse the repository at this point in the history
* do not wrap lodash import

* Update reuse file and add missing headers

* Update frontend/eslint.config.cjs

Co-authored-by: Peter Sutter <[email protected]>

---------

Co-authored-by: Peter Sutter <[email protected]>
  • Loading branch information
holgerkoser and petersutter authored Nov 13, 2024
1 parent 0559483 commit 232a3dc
Show file tree
Hide file tree
Showing 159 changed files with 1,083 additions and 1,387 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.

53 changes: 0 additions & 53 deletions .reuse/dep5

This file was deleted.

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
47 changes: 47 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version = 1
SPDX-PackageName = "Gardener dashboard"
SPDX-PackageSupplier = "The Gardener project <[email protected]>"
SPDX-PackageDownloadLocation = "https://github.com/gardener/dashboard"

[[annotations]]
path = [
"**/.gitignore",
"**/.helmignore",
"**/.browserslistrc",
"**/.editorconfig",
"**/.env",
"**.ico",
"**.json",
"**.png",
"**.sketch",
"**.svg",
"**.gif",
"**.tpl",
"**.snap",
".github/**",
".yarn/**",
"charts/**/Chart.yaml",
"charts/**/values.yaml",
"charts/**/templates/**.yaml",
"charts/**/templates/**/**.yaml",
"frontend/index.html",
"CODEOWNERS",
"VERSION",
".editorconfig",
".gitignore",
".dockerignore",
".yarnrc.yml",
".pnp.cjs",
".pnp.loader.mjs",
"yarn.lock",
"REUSE.toml",
]
precedence = "aggregate"
SPDX-FileCopyrightText = "2017-2024 SAP SE or an SAP affiliate company and Gardener contributors"
SPDX-License-Identifier = "Apache-2.0"

[[annotations]]
path = ["**.md", "docs/usage/shoot.yaml"]
precedence = "aggregate"
SPDX-FileCopyrightText = "2017-2024 SAP SE or an SAP affiliate company and Gardener contributors"
SPDX-License-Identifier = "CC-BY-4.0"
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
12 changes: 10 additions & 2 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/import-scope': ['error', '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
Loading

0 comments on commit 232a3dc

Please sign in to comment.