Skip to content

Commit

Permalink
chore(deps-dev): bump eslint-plugin-sonarjs from 1.0.4 to 2.0.2 (#103)
Browse files Browse the repository at this point in the history
* chore(deps-dev): bump eslint-plugin-sonarjs from 1.0.4 to 2.0.2

Bumps [eslint-plugin-sonarjs](https://github.com/SonarSource/SonarJS) from 1.0.4 to 2.0.2.
- [Release notes](https://github.com/SonarSource/SonarJS/releases)
- [Commits](https://github.com/SonarSource/SonarJS/commits)

---
updated-dependencies:
- dependency-name: eslint-plugin-sonarjs
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: update code (#112)

Signed-off-by: Jeff MAURY <jmaury@redhat.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Jeff MAURY <jmaury@redhat.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff MAURY <jmaury@redhat.com>
  • Loading branch information
dependabot[bot] and jeffmaury committed Sep 5, 2024
1 parent b9ddc47 commit 81bb6c3
Show file tree
Hide file tree
Showing 7 changed files with 1,825 additions and 174 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-redundant-undefined": "^1.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-sonarjs": "^1.0.4",
"eslint-plugin-sonarjs": "^2.0.2",
"eslint-plugin-unicorn": "^55.0.0",
"mkdirp": "^3.0.1",
"prettier": "^3.3.3",
Expand Down
22 changes: 5 additions & 17 deletions src/create-cluster.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const telemetryLoggerMock = {
test('expect error is cli returns non zero exit code', async () => {
try {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: -1, error: 'error' });
await createCluster({}, undefined, '', telemetryLoggerMock, undefined);
await createCluster({}, undefined, '', telemetryLoggerMock);
} catch (err) {
expect(err).to.be.a('Error');
expect(err.message).equal('Failed to create minikube cluster. error');
Expand All @@ -66,7 +66,7 @@ test('expect error is cli returns non zero exit code', async () => {

test('expect cluster to be created', async () => {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: 0 });
await createCluster({}, undefined, '', telemetryLoggerMock, undefined);
await createCluster({}, undefined, '', telemetryLoggerMock);
expect(telemetryLogUsageMock).toHaveBeenNthCalledWith(
1,
'createCluster',
Expand All @@ -85,7 +85,7 @@ test('expect error if Kubernetes reports error', async () => {
warn: vi.fn(),
};
(extensionApi.kubernetes.createResources as Mock).mockRejectedValue(new Error('Kubernetes error'));
await createCluster({}, logger, '', telemetryLoggerMock, undefined);
await createCluster({}, logger, '', telemetryLoggerMock);
} catch (err) {
expect(extensionApi.kubernetes.createResources).toBeCalled();
expect(err).to.be.a('Error');
Expand All @@ -99,13 +99,7 @@ test('expect error if Kubernetes reports error', async () => {

test('expect cluster to be created with custom base image', async () => {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: 0 });
await createCluster(
{ 'minikube.cluster.creation.base-image': 'myCustomImage' },
undefined,
'',
telemetryLoggerMock,
undefined,
);
await createCluster({ 'minikube.cluster.creation.base-image': 'myCustomImage' }, undefined, '', telemetryLoggerMock);
expect(telemetryLogUsageMock).toHaveBeenNthCalledWith(
1,
'createCluster',
Expand All @@ -132,13 +126,7 @@ test('expect cluster to be created with custom base image', async () => {

test('expect cluster to be created with custom mount', async () => {
(extensionApi.process.exec as Mock).mockReturnValue({ exitCode: 0 });
await createCluster(
{ 'minikube.cluster.creation.mount-string': '/foo:/bar' },
undefined,
'',
telemetryLoggerMock,
undefined,
);
await createCluster({ 'minikube.cluster.creation.mount-string': '/foo:/bar' }, undefined, '', telemetryLoggerMock);
expect(telemetryLogUsageMock).toHaveBeenNthCalledWith(
1,
'createCluster',
Expand Down
2 changes: 1 addition & 1 deletion src/create-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function createCluster(
const baseImage = params['minikube.cluster.creation.base-image'];
const mountString = params['minikube.cluster.creation.mount-string'];

const env = Object.assign({}, process.env);
const env = { ...process.env };

const startArgs = ['start', '--profile', clusterName, '--driver', driver, '--container-runtime', runtime];

Expand Down
1 change: 1 addition & 0 deletions src/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class MinikubeDownload {

async makeExecutable(filePath: string): Promise<void> {
if (process.platform === 'darwin' || process.platform === 'linux') {
// eslint-disable-next-line sonarjs/file-permissions
await promises.chmod(filePath, 0o755);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async function updateClusters(provider: extensionApi.Provider, containers: exten
const lifecycle: extensionApi.ProviderConnectionLifecycle = {
start: async (): Promise<void> => {
try {
const env = Object.assign({}, process.env);
const env = { ...process.env };
env.PATH = getMinikubePath();
await extensionApi.process.exec(minikubeCli, ['start', '--profile', cluster.name], { env });
} catch (err) {
Expand All @@ -129,14 +129,14 @@ async function updateClusters(provider: extensionApi.Provider, containers: exten
}
},
stop: async (): Promise<void> => {
const env = Object.assign({}, process.env);
const env = { ...process.env };
env.PATH = getMinikubePath();
await extensionApi.process.exec(minikubeCli, ['stop', '--profile', cluster.name, '--keep-context-active'], {
env,
});
},
delete: async (logger): Promise<void> => {
const env = Object.assign({}, process.env);
const env = { ...process.env };
env.PATH = getMinikubePath();
env.MINIKUBE_HOME = getMinikubeHome();
await extensionApi.process.exec(minikubeCli, ['delete', '--profile', cluster.name], { env, logger });
Expand Down
2 changes: 1 addition & 1 deletion src/image-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class ImageHandler {
if (selectedCluster) {
let name = image.name;
let filename: string;
const env = Object.assign({}, process.env);
const env = { ...process.env };

// Create a name:tag string for the image
if (image.tag) {
Expand Down
Loading

0 comments on commit 81bb6c3

Please sign in to comment.