Skip to content

Commit

Permalink
fixes mostly lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Roy Razon committed Dec 14, 2023
1 parent 7696f78 commit f2b5267
Show file tree
Hide file tree
Showing 64 changed files with 150 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
site
.eslintrc.js
.eslintrc.cjs
build_utils
4 changes: 1 addition & 3 deletions build_utils/eslintrc.js → build_utils/eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = {
'single',
{ avoidEscape: true, allowTemplateLiterals: false },
],
'import/extensions': 'off',
'dot-location': 'warn',
'no-trailing-spaces': 'warn',
'no-multi-spaces': 'warn',
Expand Down Expand Up @@ -101,9 +102,6 @@ module.exports = {
}
],
'jest/valid-describe': ['off'],
'import/extensions': ['error', 'never', {
'json': 'always',
}],
'no-restricted-imports': ['error', { patterns: ['**/dist/**', 'src/*'] }],
// copied from https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js#L334
// removed rule about generators/iterators since es2019 natively supports them
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-common/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.eslintrc.js
/.eslintrc.cjs
/dist
/build.mjs
1 change: 1 addition & 0 deletions packages/cli-common/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/cli-common/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/cli-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"@jest/globals": "29.7.0",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli-common/src/lib/plugins/model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FlagProps } from '@oclif/core/lib/interfaces/parser.js'
import { Topic } from '@oclif/core/lib/interfaces'
import { Command, Interfaces } from '@oclif/core'
import { Command } from '@oclif/core'
import { ComposeModel, config as coreConfig } from '@preevy/core'
import { PluginInitContext } from './context.js'
import { HookFuncs, HooksListeners } from '../hooks.js'
Expand Down
1 change: 1 addition & 0 deletions packages/cli/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/cli/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@types/shell-escape": "^0.2.1",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
Expand Down
16 changes: 5 additions & 11 deletions packages/cli/src/commands/profile/cp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Flags, ux } from '@oclif/core'
import inquirer from 'inquirer'
import * as inquirer from '@inquirer/prompts'
import { BaseCommand, text } from '@preevy/cli-common'
import { LocalProfilesConfig } from '@preevy/core'
import { loadProfileConfig } from '../../profile-command.js'
Expand All @@ -13,16 +13,10 @@ const validateFsType = (fsType: string) => {
return fsType
}

const chooseTargetAlias = async (defaultAlias: string) => (
await inquirer.prompt<{ targetAlias: string }>([
{
type: 'input',
name: 'targetAlias',
message: 'Target profile name',
default: defaultAlias,
},
])
).targetAlias
const chooseTargetAlias = async (defaultAlias: string) => await inquirer.input({
message: 'Target profile name',
default: defaultAlias,
})

// eslint-disable-next-line no-use-before-define
export default class CopyProfile extends BaseCommand<typeof CopyProfile> {
Expand Down
9 changes: 4 additions & 5 deletions packages/cli/src/commands/profile/link.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { link, Org, localFs, profileStore, TokenExpiredError, getLivecycleTokensFromLocalFs } from '@preevy/core'
import { Flags, ux } from '@oclif/core'
import inquirer from 'inquirer'
import * as inquirer from '@inquirer/prompts'
import ProfileCommand from '../../profile-command.js'
import { LC_API_URL } from '../../defaults.js'

Expand Down Expand Up @@ -43,14 +43,13 @@ export default class Link extends ProfileCommand<typeof Link> {
if (orgs.length === 1) {
return orgs[0]
}
const selection = await inquirer.prompt<{org: string}>({ type: 'list',
name: 'org',
org = await inquirer.select({
message: 'Choose the organization to link the profile to',
choices: orgs.map(o => ({
name: o.name,
value: o.slug,
})) })
org = selection.org
})),
})
}
const orgInfo = orgs.find(o => o.slug === org)
if (!orgInfo) {
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ export const chooseFs: Record<FsType, FsChooser> = {
}) => {
const region = await inquirerAutoComplete<string>({
message: 'S3 bucket region',
source: async input => S3_REGIONS.filter(r => !input || r.includes(input.toLowerCase())).map(value => ({ value })),
source: async input => S3_REGIONS
.filter(r => !input || r.includes(input.toLowerCase()))
.map(value => ({ value })),
default: driver?.name === 'lightsail' && S3_REGIONS.includes(driver.flags.region as string)
? driver.flags.region as string
: 'us-east-1',
Expand Down
2 changes: 1 addition & 1 deletion packages/common/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.eslintrc.js
/.eslintrc.cjs
/dist
/build.mjs
1 change: 1 addition & 0 deletions packages/common/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/common/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"@types/node": "18",
"@types/shell-escape": "^0.2.1",
"@types/ssh2": "^1.11.8",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"esbuild": "^0.19.9",
"eslint": "^8.36.0",
"husky": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/compose-tunnel-agent/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.eslintrc.js
/.eslintrc.cjs
/dist
/build.mjs
1 change: 1 addition & 0 deletions packages/compose-tunnel-agent/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/compose-tunnel-agent/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/compose-tunnel-agent/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'path'
import Docker from 'dockerode'
import { rimraf } from 'rimraf'
import { pino } from 'pino'
import { default as pinoPrettyModule } from 'pino-pretty'
import pinoPrettyModule from 'pino-pretty'
import {
requiredEnv,
formatPublicKey,
Expand Down
4 changes: 2 additions & 2 deletions packages/compose-tunnel-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"@types/node-fetch": "^2.6.3",
"@types/shell-escape": "^0.2.1",
"@types/ssh2": "^1.11.8",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"esbuild": "^0.19.9",
"eslint": "^8.36.0",
"husky": "^8.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/compose-tunnel-agent/src/api-server/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { AddressInfo } from 'node:net'
import { describe, expect, beforeAll, afterAll, jest, it } from '@jest/globals'
import { ChildProcess, spawn, exec } from 'child_process'
import { pino } from 'pino'
import { default as pinoPrettyModule } from 'pino-pretty'
import pinoPrettyModule from 'pino-pretty'
import Dockerode from 'dockerode'
import { inspect, promisify } from 'node:util'
import { default as waitForExpectModule } from 'wait-for-expect'
import waitForExpectModule from 'wait-for-expect'
import WebSocket from 'ws'
import stripAnsi from 'strip-ansi'
import { createApp } from './index.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.eslintrc.js
/.eslintrc.cjs
/dist
/build.mjs
1 change: 1 addition & 0 deletions packages/core/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/core/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"@types/sshpk": "^1.17.1",
"@types/tar": "^6.1.4",
"@types/tar-stream": "^2.2.2",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/compose/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ const fixModelForRemote = async (
}
const matchingVolumeSkipIndex = volumeSkipRes.findIndex(re => re.test(volume.source))
if (matchingVolumeSkipIndex !== -1) {
skippedVolumes.push({ service: serviceName, source: volume.source, matchingRule: volumeSkipList[matchingVolumeSkipIndex] })
skippedVolumes.push({
service: serviceName,
source: volume.source,
matchingRule: volumeSkipList[matchingVolumeSkipIndex],
})
return volume
}

Expand Down
28 changes: 9 additions & 19 deletions packages/core/src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import * as jose from 'jose'
import { z } from 'zod'
import open from 'open'
import inquirer from 'inquirer'
import * as inquirer from '@inquirer/prompts'
import { VirtualFS, localFs } from './store/index.js'
import { Logger } from './log.js'
import { withSpinner } from './spinner.js'
Expand Down Expand Up @@ -165,24 +165,14 @@ export const login = async (dataDir: string, loginUrl: string, lcUrl: string, cl
if (postLoginResponse.ok) {
const postLoginData = await postLoginResponse.json() as PostLoginResult
if (!('currentOrg' in postLoginData)) {
const {
orgName,
associateDomain,
// eslint-disable-next-line no-use-before-define
} = await inquirer.prompt<{ orgName: string; associateDomain: string }>([
{
type: 'input',
name: 'orgName',
message: 'Select a name for your organization',
default: postLoginData.organizationDomainDetails.name,
},
{
type: 'confirm',
name: 'associateDomain',
message: `Allow anyone with @${postLoginData.organizationDomainDetails.domain} email domain to join your organization as viewers`,
default: true,
},
])
const orgName = await inquirer.input({
message: 'Select a name for your organization',
default: postLoginData.organizationDomainDetails.name,
})
const associateDomain = await inquirer.confirm({
message: `Allow anyone with @${postLoginData.organizationDomainDetails.domain} email domain to join your organization as viewers`,
default: true,
})

const createOrganizationResponse = await withSpinner(
() => fetch(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/ssh/client/exec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ssh2 from 'ssh2'
import { default as isStreamModule } from 'is-stream'
import isStreamModule from 'is-stream'
import { orderedOutput } from '@preevy/common'
import { ExecResult, CommandExecuter, commandWith, checkResult, execResultFromOrderedOutput } from '../../command-executer.js'
import { outputFromStdio } from '../../child-process.js'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/ssh/keypair.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import crypto from 'crypto'
import { promisify } from 'util'
import { default as sshpkModule } from 'sshpk'
import sshpkModule from 'sshpk'

const { parseKey, parsePrivateKey } = sshpkModule

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/telemetry/emitter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os from 'os'
import fs from 'fs'
import crypto from 'crypto'
import { default as stringifyModule } from 'fast-safe-stringify'
import stringifyModule from 'fast-safe-stringify'
import { debounce } from 'lodash-es'
import pLimit from 'p-limit'
import { inspect } from 'util'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/upload-files/walk.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs'
import { default as PQueueModule } from 'p-queue'
import PQueueModule from 'p-queue'
import { DirInfo, FileInfo } from './files.js'

const PQueue = PQueueModule.default
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-azure/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.eslintrc.js
/.eslintrc.cjs
/dist
/build.mjs
1 change: 1 addition & 0 deletions packages/driver-azure/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/driver-azure/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/driver-azure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"@types/inquirer-autocomplete-prompt": "^3.0.3",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
Expand Down
1 change: 1 addition & 0 deletions packages/driver-azure/src/static.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path'
import url from 'url'

// eslint-disable-next-line no-underscore-dangle
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

export const DIR = path.join(__dirname, '../static')
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-gce/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.eslintrc.js
/.eslintrc.cjs
/dist
/build.mjs
1 change: 1 addition & 0 deletions packages/driver-gce/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/driver-gce/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/driver-gce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"@types/inquirer-autocomplete-prompt": "^3.0.3",
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
Expand Down
1 change: 1 addition & 0 deletions packages/driver-gce/src/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path'
import fs from 'fs'
import url from 'url'

// eslint-disable-next-line no-underscore-dangle
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))

export const DIR = path.join(__dirname, '../static')
Expand Down
2 changes: 1 addition & 1 deletion packages/driver-kube-pod/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.eslintrc.js
/.eslintrc.cjs
/dist
/build.mjs
1 change: 1 addition & 0 deletions packages/driver-kube-pod/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('../../build_utils/eslintrc.cjs')
1 change: 0 additions & 1 deletion packages/driver-kube-pod/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/driver-kube-pod/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@types/lodash-es": "^4.17.12",
"@types/node": "18",
"@types/stream-buffers": "^3.0.4",
"@typescript-eslint/eslint-plugin": "6.10.0",
"@typescript-eslint/parser": "6.10.0",
"@typescript-eslint/eslint-plugin": "6.14.0",
"@typescript-eslint/parser": "6.14.0",
"eslint": "^8.36.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-oclif": "^4",
Expand Down
Loading

0 comments on commit f2b5267

Please sign in to comment.