Skip to content

Commit 4f1f520

Browse files
committed
chore: Upgrade to @serverless/eslint-conf
1 parent 94bf3cc commit 4f1f520

File tree

4 files changed

+14
-86
lines changed

4 files changed

+14
-86
lines changed

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 72 deletions
This file was deleted.

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@
44
"author": "Serverless, Inc.",
55
"license": "Apache",
66
"scripts": {
7-
"lint": "eslint . --fix --cache",
7+
"lint": "eslint --ignore-path .gitignore .",
88
"test": "jest ./tests/integration.test.js --testEnvironment node"
99
},
1010
"devDependencies": {
11+
"@serverless/eslint-config": "^2.1.1",
1112
"@serverless/platform-client": "^0.24.0",
1213
"aws-sdk": "^2.640.0",
13-
"babel-eslint": "9.0.0",
1414
"dotenv": "^8.2.0",
15-
"eslint": "5.6.0",
16-
"eslint-config-prettier": "^3.6.0",
17-
"eslint-plugin-import": "^2.18.0",
15+
"eslint": "^7.3.1",
16+
"eslint-plugin-import": "^2.22.0",
1817
"eslint-plugin-prettier": "^3.0.1",
1918
"jest": "^25.1.0",
2019
"prettier": "^1.18.2"
20+
},
21+
"eslintConfig": {
22+
"extends": "@serverless/eslint-config/node",
23+
"root": true
2124
}
2225
}

src/serverless.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AwsDynamoDb extends Component {
2929
async deploy(inputs = {}) {
3030
// this error message assumes that the user is running via the CLI though...
3131
if (Object.keys(this.credentials.aws).length === 0) {
32-
const msg = `Credentials not found. Make sure you have a .env file in the cwd. - Docs: https://git.io/JvArp`
32+
const msg = 'Credentials not found. Make sure you have a .env file in the cwd. - Docs: https://git.io/JvArp'
3333
throw new Error(msg)
3434
}
3535

@@ -39,10 +39,10 @@ class AwsDynamoDb extends Component {
3939
// If first deploy and no name is found, set default name..
4040
if (!config.name && !this.state.name) {
4141
config.name =
42-
'dynamodb-table-' +
42+
`dynamodb-table-${
4343
Math.random()
4444
.toString(36)
45-
.substring(6)
45+
.substring(6)}`
4646
this.state.name = config.name
4747
}
4848
// If first deploy, and a name is set...
@@ -52,7 +52,7 @@ class AwsDynamoDb extends Component {
5252
// If subequent deploy, and name is different from a previously used name, throw error.
5353
else if (config.name && this.state.name && config.name !== this.state.name) {
5454
throw new Error(
55-
`You cannot change the name of your DynamoDB table once it has been deployed (or this will deploy a new table). Please remove this Component Instance first by running "serverless remove", then redeploy it with "serverless deploy".`
55+
'You cannot change the name of your DynamoDB table once it has been deployed (or this will deploy a new table). Please remove this Component Instance first by running "serverless remove", then redeploy it with "serverless deploy".'
5656
)
5757
}
5858

@@ -128,15 +128,15 @@ class AwsDynamoDb extends Component {
128128

129129
// If "delete: false", don't delete the table, and warn instead
130130
if (this.state.deletionPolicy && this.state.deletionPolicy === 'retain') {
131-
console.log(`Skipping table removal because "deletionPolicy" is set to "retain".`)
131+
console.log('Skipping table removal because "deletionPolicy" is set to "retain".')
132132
this.state = {}
133133
return {}
134134
}
135135

136136
const { name, region } = this.state
137137

138138
if (!name) {
139-
console.log(`Aborting removal. Table name not found in state.`)
139+
console.log('Aborting removal. Table name not found in state.')
140140
return
141141
}
142142

0 commit comments

Comments
 (0)