Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ module.exports = {
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-floating-promises': 'error',
'space-infix-ops': 'off',
'@typescript-eslint/space-infix-ops': 'error',
'object-curly-spacing': 'off',
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
'comma-spacing': 'off',
'@typescript-eslint/comma-spacing': ['error'],

// disallow non-import statements appearing before import statements
'import/first': 'error',
Expand Down
641 changes: 258 additions & 383 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"packages/cli"
],
"dependencies": {
"@changesets/changelog-github": "^0.4.4",
"@changesets/cli": "^2.22.0",
"@changesets/changelog-github": "^0.4.5",
"@changesets/cli": "^2.23.0",
"@changesets/release-utils": "^0.1.8"
},
"devDependencies": {
"@commitlint/cli": "^17.0.1",
"@commitlint/config-conventional": "^17.0.0",
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"cz-conventional-changelog": "^3.3.0",
"rimraf": "^3.0.2"
}
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
"@types/jest": "^28.1.1",
"@types/js-yaml": "^4.0.5",
"@types/node": "^16.11.36",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"eslint": "^8.16.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"eslint": "^8.17.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.2.2",
"eslint-plugin-jest": "^26.5.3",
"jest": "^28.1.0",
"jest-extended": "^0.11.5",
"oclif": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/capabilities/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export default class CapabilitiesCreateCommand extends APIOrganizationCommand<ty
name: 'answer',
message: `Attribute Name ${name} is too long to make a setter.`,
choices: [
{ name: 'Enter a shorter name (max 33 characters)', value: 'shorter '},
{ name: 'Enter a shorter name (max 33 characters)', value: 'shorter ' },
{ name: 'I won\'t need a setter', value: 'noSetter' },
],
})).answer
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/capabilities/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CapabilityId, capabilityIdOrIndexInputArgs, CapabilitySummaryWithNamesp
export function buildTableOutput(tableGenerator: TableGenerator, data: CapabilityLocalization): string {
let result = `Tag: ${data.tag}`
if (data.attributes) {
const table = tableGenerator.newOutputTable({head: ['Name','Label','Description', 'Template']})
const table = tableGenerator.newOutputTable({ head: ['Name', 'Label', 'Description', 'Template'] })
for (const name of Object.keys(data.attributes)) {
const attr = data.attributes[name]
table.push([name, attr.label, attr.description || '', attr.displayTemplate || ''])
Expand All @@ -26,7 +26,7 @@ export function buildTableOutput(tableGenerator: TableGenerator, data: Capabilit
result += '\n\nAttributes:\n' + table.toString()
}
if (data.commands) {
const table = tableGenerator.newOutputTable({head: ['Name','Label','Description']})
const table = tableGenerator.newOutputTable({ head: ['Name', 'Label', 'Description'] })
for (const name of Object.keys(data.commands)) {
const cmd = data.commands[name]
table.push([name, cmd.label || '', cmd.description || ''])
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/deviceprofiles/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default class DeviceProfileCreateCommand extends APIOrganizationCommand<t
capabilityId = await chooseCapabilityFiltered(this, `${prompt}:`, idStr.slice(0, idStr.length - 1))
} else {
// TODO - update once capability versions are supported
capabilityId = {id: idStr, version: 1}
capabilityId = { id: idStr, version: 1 }
}
}

Expand Down Expand Up @@ -229,7 +229,7 @@ export default class DeviceProfileCreateCommand extends APIOrganizationCommand<t
})).componentId

if (componentId) {
components.push({id: componentId, capabilities: []})
components.push({ id: componentId, capabilities: [] })
} else {
componentId = previousComponentId
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/deviceprofiles/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { chooseDeviceProfile } from '../deviceprofiles'
export function buildTableOutput(tableGenerator: TableGenerator, data: DeviceProfileTranslations): string {
let result = `Tag: ${data.tag}`
if (data.components) {
const table = tableGenerator.newOutputTable({ head: ['Component','Label','Description'] })
const table = tableGenerator.newOutputTable({ head: ['Component', 'Label', 'Description'] })
for (const name of Object.keys(data.components)) {
const component = data.components[name]
table.push([name, component.label, component.description || ''])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default class DeviceProfileTranslationsUpsertCommand extends APIOrganizat
const id = await chooseDeviceProfile(this, this.args.id)

await inputAndOutputItem<DeviceProfileTranslations, DeviceProfileTranslations>(this,
{ buildTableOutput: data => buildTableOutput(this.tableGenerator, data)},
{ buildTableOutput: data => buildTableOutput(this.tableGenerator, data) },
async (_, data) => this.client.deviceProfiles.upsertTranslations(id, data))
}
}
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devices/capability-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { prettyPrintAttribute } from './status'


function buildTableOutput(tableGenerator: TableGenerator, capability: CapabilityStatus): string {
const table = tableGenerator.newOutputTable({head: ['Attribute', 'Value']})
const table = tableGenerator.newOutputTable({ head: ['Attribute', 'Value'] })

for (const attributeName of Object.keys(capability)) {
const attribute = capability[attributeName]
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devices/component-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { prettyPrintAttribute } from './status'


function buildTableOutput(tableGenerator: TableGenerator, component: ComponentStatus): string {
const table = tableGenerator.newOutputTable({head: ['Capability', 'Attribute', 'Value']})
const table = tableGenerator.newOutputTable({ head: ['Capability', 'Attribute', 'Value'] })
for (const capabilityName of Object.keys(component)) {
const capability = component[capabilityName]
for (const attributeName of Object.keys(capability)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devices/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { APICommand, chooseDevice, formatAndWriteItem, TableGenerator } from '@s
export function buildTableOutput(tableGenerator: TableGenerator, data: DevicePreferenceResponse): string {
let output = ''
if (data.values) {
const table = tableGenerator.newOutputTable({head: ['Name', 'Type','Value']})
const table = tableGenerator.newOutputTable({ head: ['Name', 'Type', 'Value'] })
const names = Object.keys(data.values).sort()
for (const name of names) {
const item = data.values[name]
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devices/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function buildTableOutput(tableGenerator: TableGenerator, data: DeviceSta
if (data.components) {
const componentIds = Object.keys(data.components)
for (const componentId of componentIds) {
const table = tableGenerator.newOutputTable({head: ['Capability', 'Attribute','Value']})
const table = tableGenerator.newOutputTable({ head: ['Capability', 'Attribute', 'Value'] })
if (componentIds.length > 1) {
output += `\n${componentId} component\n`
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/installedapps/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Flags } from '@oclif/core'

import { InstalledApp, InstalledAppListOptions } from '@smartthings/core-sdk'

import {selectFromList, APICommand, withLocations} from '@smartthings/cli-lib'
import { selectFromList, APICommand, withLocations } from '@smartthings/cli-lib'


export default class InstalledAppDeleteCommand extends APICommand<typeof InstalledAppDeleteCommand.flags> {
Expand Down
8 changes: 4 additions & 4 deletions packages/lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
"@types/lodash.at": "^4.6.7",
"@types/node": "^16.11.36",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"eslint": "^8.16.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"eslint": "^8.17.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.2.2",
"eslint-plugin-jest": "^26.5.3",
"jest": "^28.1.0",
"jest-environment-jsdom": "^28.1.0",
"jest-extended": "^0.11.5",
Expand Down
8 changes: 4 additions & 4 deletions packages/lib/src/__tests__/cli-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ describe('cli-config', () => {
profileName: 'chosenProfile',
}

const profiles: ProfilesByName = { mainConfig: { mainConfigProfile: { key: 'value' }} }
const managedProfiles: ProfilesByName = { managedConfig: { managedConfigProfile: { key: 'value' }} }
const profiles: ProfilesByName = { mainConfig: { mainConfigProfile: { key: 'value' } } }
const managedProfiles: ProfilesByName = { managedConfig: { managedConfigProfile: { key: 'value' } } }

const yamlDumpMock = jest.mocked(yaml.dump)
const writeFileMock = jest.mocked(writeFile)
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('cli-config', () => {
} as CLIConfig

const updatedManagedConfig: ProfilesByName = { updated: { managed: 'managed' } }
const updateMergedConfig: ProfilesByName = { update: { merged: 'config' }}
const updateMergedConfig: ProfilesByName = { update: { merged: 'config' } }
mergeProfilesSpy.mockReturnValueOnce(updatedManagedConfig)
mergeProfilesSpy.mockReturnValueOnce(updateMergedConfig)
yamlDumpMock.mockReturnValueOnce('yaml output')
Expand All @@ -285,7 +285,7 @@ describe('cli-config', () => {
profiles,
managedProfiles: { ...managedProfilesWithProfileToReset },
} as CLIConfig
const updateMergedConfig: ProfilesByName = { update: { merged: 'config' }}
const updateMergedConfig: ProfilesByName = { update: { merged: 'config' } }
yamlDumpMock.mockReturnValueOnce('yaml output')
mergeProfilesSpy.mockReturnValueOnce(updateMergedConfig)

Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/cli-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const managedConfigHeader =
* in the future but not override user settings.
*/
export const setConfigKey = async (config: CLIConfig, key: string, value: unknown): Promise<void> => {
config.managedProfiles = mergeProfiles({ [config.profileName]: { [key]: value }}, config.managedProfiles)
config.managedProfiles = mergeProfiles({ [config.profileName]: { [key]: value } }, config.managedProfiles)
await writeFile(config.managedConfigFilename, managedConfigHeader + yaml.dump(config.managedProfiles))
config.mergedProfiles = mergeProfiles(config.profiles, config.managedProfiles)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/src/table-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class DefaultTableGenerator implements TableGenerator {
}

newOutputTable(options?: Partial<TableOptions>): Table {
const configuredOptions = { style: { compact: this.compact }}
const configuredOptions = { style: { compact: this.compact } }

if (options) {
return new Table({ ...configuredOptions, ...options })
Expand Down
8 changes: 4 additions & 4 deletions packages/testlib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"@types/jest": "^28.1.1",
"@types/js-yaml": "^4.0.5",
"@types/node": "^16.11.36",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"eslint": "^8.16.0",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"eslint": "^8.17.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.2.2",
"eslint-plugin-jest": "^26.5.3",
"jest": "^28.1.0",
"jest-extended": "^0.11.5",
"rimraf": "^3.0.2",
Expand Down