Skip to content

Commit 9b20f59

Browse files
committed
refactor: Fix lint issues
1 parent a8877b2 commit 9b20f59

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
},
2222
"eslintConfig": {
2323
"extends": "@serverless/eslint-config/node",
24-
"root": true
24+
"root": true,
25+
"rules": {
26+
"no-console": "off"
27+
}
2528
}
2629
}

src/serverless.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
'use strict'
22

33
const { mergeDeepRight, pick } = require('ramda')
4+
// eslint-disable-next-line import/no-extraneous-dependencies
45
const AWS = require('aws-sdk')
6+
// eslint-disable-next-line import/no-unresolved
57
const { Component } = require('@serverless/core')
68
const { log, createTable, deleteTable, describeTable, updateTable } = require('./utils')
79

@@ -124,7 +126,7 @@ class AwsDynamoDb extends Component {
124126
/**
125127
* Remove
126128
*/
127-
async remove(inputs = {}) {
129+
async remove() {
128130
console.log('Removing')
129131

130132
// If "delete: false", don't delete the table, and warn instead
@@ -138,7 +140,7 @@ class AwsDynamoDb extends Component {
138140

139141
if (!name) {
140142
console.log('Aborting removal. Table name not found in state.')
141-
return
143+
return null
142144
}
143145

144146
const dynamodb = new AWS.DynamoDB({

src/utils.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const { isEmpty, not, equals, pick } = require('ramda')
3+
const { isEmpty } = require('ramda')
44

55
function log(msg) {
66
return console.log(msg)
@@ -28,11 +28,9 @@ async function createTable({
2828
}
2929

3030
async function describeTable({ dynamodb, name }) {
31-
let res
32-
3331
try {
3432
const data = await dynamodb.describeTable({ TableName: name }).promise()
35-
res = {
33+
return {
3634
arn: data.Table.TableArn,
3735
name: data.Table.TableName,
3836
attributeDefinitions: data.Table.AttributeDefinitions,
@@ -41,11 +39,10 @@ async function describeTable({ dynamodb, name }) {
4139
}
4240
} catch (error) {
4341
if (error.code === 'ResourceNotFoundException') {
44-
res = null
42+
return null
4543
}
46-
} finally {
47-
return res
4844
}
45+
return null
4946
}
5047

5148
async function updateTable({

0 commit comments

Comments
 (0)