Skip to content
This repository was archived by the owner on Dec 1, 2022. It is now read-only.

Commit 39d9b04

Browse files
committed
Fixed lint errors
1 parent a368c43 commit 39d9b04

17 files changed

+574
-184
lines changed

.eslintrc

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
{
2+
"parser": "babel-eslint",
3+
4+
"plugins": [
5+
"babel"
6+
],
7+
8+
"env": {
9+
"es6": true,
10+
"node": true
11+
},
12+
13+
"ecmaFeatures": {
14+
"arrowFunctions": true,
15+
"binaryLiterals": true,
16+
"blockBindings": true,
17+
"classes": true,
18+
"defaultParams": true,
19+
"destructuring": true,
20+
"experimentalObjectRestSpread": true,
21+
"forOf": true,
22+
"generators": true,
23+
"globalReturn": true,
24+
"jsx": true,
25+
"modules": true,
26+
"objectLiteralComputedProperties": true,
27+
"objectLiteralDuplicateProperties": true,
28+
"objectLiteralShorthandMethods": true,
29+
"objectLiteralShorthandProperties": true,
30+
"octalLiterals": true,
31+
"regexUFlag": true,
32+
"regexYFlag": true,
33+
"restParams": true,
34+
"spread": true,
35+
"superInFunctions": true,
36+
"templateStrings": true,
37+
"unicodeCodePointEscapes": true
38+
},
39+
40+
"rules": {
41+
"babel/arrow-parens": [2, "as-needed"],
42+
43+
"array-bracket-spacing": [2, "always"],
44+
"arrow-spacing": 2,
45+
"block-scoped-var": 0,
46+
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
47+
"callback-return": 2,
48+
"camelcase": [2, {"properties": "always"}],
49+
"comma-dangle": 0,
50+
"comma-spacing": 0,
51+
"comma-style": [2, "last"],
52+
"complexity": 0,
53+
"computed-property-spacing": [2, "never"],
54+
"consistent-return": 0,
55+
"consistent-this": 0,
56+
"curly": [2, "all"],
57+
"default-case": 0,
58+
"dot-location": [2, "property"],
59+
"dot-notation": 0,
60+
"eol-last": 2,
61+
"eqeqeq": 2,
62+
"func-names": 0,
63+
"func-style": 0,
64+
"generator-star-spacing": [0, {"before": true, "after": false}],
65+
"guard-for-in": 2,
66+
"handle-callback-err": [2, "error"],
67+
"id-length": 0,
68+
"id-match": [2, "^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$"],
69+
"indent": [2, 2, {"SwitchCase": 1}],
70+
"init-declarations": 0,
71+
"key-spacing": [2, {"beforeColon": false, "afterColon": true}],
72+
"linebreak-style": 2,
73+
"lines-around-comment": 0,
74+
"max-depth": 0,
75+
"max-len": [2, 80, 4],
76+
"max-nested-callbacks": 0,
77+
"max-params": 0,
78+
"max-statements": 0,
79+
"new-cap": 0,
80+
"new-parens": 2,
81+
"newline-after-var": 0,
82+
"no-alert": 2,
83+
"no-array-constructor": 2,
84+
"no-bitwise": 0,
85+
"no-caller": 2,
86+
"no-catch-shadow": 0,
87+
"no-class-assign": 2,
88+
"no-cond-assign": 2,
89+
"no-console": 1,
90+
"no-const-assign": 2,
91+
"no-constant-condition": 2,
92+
"no-continue": 0,
93+
"no-control-regex": 0,
94+
"no-debugger": 1,
95+
"no-delete-var": 2,
96+
"no-div-regex": 2,
97+
"no-dupe-args": 2,
98+
"no-dupe-keys": 2,
99+
"no-duplicate-case": 2,
100+
"no-else-return": 2,
101+
"no-empty": 2,
102+
"no-empty-character-class": 2,
103+
// "no-empty-label": 2,
104+
"no-eq-null": 0,
105+
"no-eval": 2,
106+
"no-ex-assign": 2,
107+
"no-extend-native": 2,
108+
"no-extra-bind": 2,
109+
"no-extra-boolean-cast": 2,
110+
"no-extra-parens": 0,
111+
"no-extra-semi": 2,
112+
"no-fallthrough": 2,
113+
"no-floating-decimal": 2,
114+
"no-func-assign": 2,
115+
"no-implicit-coercion": 2,
116+
"no-implied-eval": 2,
117+
"no-inline-comments": 0,
118+
"no-inner-declarations": [2, "functions"],
119+
"no-invalid-regexp": 2,
120+
"no-invalid-this": 0,
121+
"no-irregular-whitespace": 2,
122+
"no-iterator": 2,
123+
"no-label-var": 2,
124+
"no-labels": 0,
125+
"no-lone-blocks": 2,
126+
"no-lonely-if": 2,
127+
"no-loop-func": 0,
128+
"no-mixed-requires": [2, true],
129+
"no-mixed-spaces-and-tabs": 2,
130+
"no-multi-spaces": 2,
131+
"no-multi-str": 2,
132+
"no-multiple-empty-lines": 0,
133+
"no-native-reassign": 0,
134+
"no-negated-in-lhs": 2,
135+
"no-nested-ternary": 0,
136+
"no-new": 2,
137+
"no-new-func": 0,
138+
"no-new-object": 2,
139+
"no-new-require": 2,
140+
"no-new-wrappers": 2,
141+
"no-obj-calls": 2,
142+
"no-octal": 2,
143+
"no-octal-escape": 2,
144+
"no-param-reassign": 2,
145+
"no-path-concat": 2,
146+
"no-plusplus": 0,
147+
"no-process-env": 0,
148+
"no-process-exit": 0,
149+
"no-proto": 2,
150+
"no-redeclare": 2,
151+
"no-regex-spaces": 2,
152+
"no-restricted-modules": 0,
153+
"no-return-assign": 2,
154+
"no-script-url": 2,
155+
"no-self-compare": 0,
156+
"no-sequences": 2,
157+
"no-shadow": 2,
158+
"no-shadow-restricted-names": 2,
159+
"no-spaced-func": 2,
160+
"no-sparse-arrays": 2,
161+
"no-sync": 2,
162+
"no-ternary": 0,
163+
"no-this-before-super": 2,
164+
"no-throw-literal": 2,
165+
"no-trailing-spaces": 2,
166+
"no-undef": 2,
167+
"no-undef-init": 2,
168+
"no-undefined": 0,
169+
"no-underscore-dangle": 0,
170+
"no-unexpected-multiline": 2,
171+
"no-unneeded-ternary": 2,
172+
"no-unreachable": 2,
173+
"no-unused-expressions": 2,
174+
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
175+
"no-use-before-define": 0,
176+
"no-useless-call": 2,
177+
"no-var": 0,
178+
"no-void": 2,
179+
"no-warning-comments": 0,
180+
"no-with": 2,
181+
"object-curly-spacing": [0, "always"],
182+
"object-shorthand": [2, "always"],
183+
"one-var": [2, "never"],
184+
"operator-assignment": [2, "always"],
185+
"operator-linebreak": [2, "after"],
186+
"padded-blocks": 0,
187+
"prefer-const": 0,
188+
"prefer-reflect": 0,
189+
"prefer-spread": 0,
190+
"quote-props": [2, "as-needed"],
191+
"quotes": [2, "single"],
192+
"radix": 2,
193+
"require-yield": 2,
194+
"semi": [2, "always"],
195+
"semi-spacing": [2, {"before": false, "after": true}],
196+
"sort-vars": 0,
197+
// "space-after-keywords": [2, "always"],
198+
"space-before-blocks": [2, "always"],
199+
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
200+
"space-in-parens": 0,
201+
"space-infix-ops": [2, {"int32Hint": false}],
202+
// "space-return-throw-case": 2,
203+
"space-unary-ops": [2, {"words": true, "nonwords": false}],
204+
"spaced-comment": [2, "always"],
205+
"strict": 0,
206+
"use-isnan": 2,
207+
"valid-jsdoc": 0,
208+
"valid-typeof": 2,
209+
"vars-on-top": 0,
210+
"wrap-iife": 2,
211+
"wrap-regex": 0,
212+
"yoda": [2, "never", {"exceptRange": true}]
213+
}
214+
}

.flowconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[ignore]
2+
.*/lib/.*
3+
.*/dist/.*
4+
.*/coverage/.*
5+
.*/resources/.*
6+
7+
[include]
8+
9+
[libs]
10+
11+
[options]

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ node_modules
3232
# Optional REPL history
3333
.node_repl_history
3434

35-
lib/
3635
dist/
3736
dist.zip
3837
build/

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Tom Mitchell
3+
Copyright (c) 2016 for dynamodb-lambda-autoscale
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

gulpfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ gulp.task('clean', function(cb) {
1616
});
1717

1818
gulp.task("webpack", function () {
19-
return gulp.src('src/index.js')
19+
return gulp.src('src/Index.js')
2020
.pipe(webpack( require('./webpack-dev.config.js') ))
2121
.pipe(gulp.dest('build/'));
2222
});
2323

2424
// The js task could be replaced with gulp-coffee as desired.
2525
gulp.task("js", function () {
2626
return gulp
27-
.src("build/index.js")
27+
.src("build/Index.js")
2828
.pipe(gulp.dest("dist/"));
2929
});
3030

make-webpack-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var StatsPlugin = require("stats-webpack-plugin");
44
var ContextReplacementPlugin = require("webpack/lib/ContextReplacementPlugin");
55

66
module.exports = function(options) {
7-
var entry = { 'index': './src/index.js' };
7+
var entry = { 'index': './src/Index.js' };
88

99
var loaders = [
1010
{ test: /\.jsx$/, loader: options.hotComponents ? ["react-hot-loader", "babel-loader?stage=0"] : "babel-loader?stage=0"},

package.json

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
{
2-
"name": "DynamoDBAutoscaleLambda",
3-
"version": "0.1.0",
4-
"description": "Autoscale DynamoDB using AWS Lambda",
5-
"main": "index.js",
2+
"name": "dynamodb-lambda-autoscale",
3+
"version": "0.2.0",
4+
"description": "Autoscale DynamoDB provisioned capacity using AWS Lambda",
5+
"contributors": [
6+
"Thomas Mitchell <[email protected]>"
7+
],
8+
"license": "MIT",
9+
"repository": {
10+
"type": "git",
11+
"url": "http://github.com/channl/dynamodb-lambda-autoscale.git"
12+
},
13+
"main": "dist/Index.js",
14+
"options": {
15+
"mocha": "--require resources/mocha-bootload src/**/__tests__/**/*.js"
16+
},
617
"scripts": {
7-
"start": "node ./scripts/start.js",
8-
"debug": "node-debug ./scripts/start.js",
9-
"build": "gulp dist"
18+
"test": "npm run lint && npm run check && npm run testonly",
19+
"testonly": "mocha $npm_package_options_mocha",
20+
"lint": "eslint src",
21+
"check": "flow check",
22+
"build": "gulp dist",
23+
"start": "node ./scripts/Start.js",
24+
"debug": "node-debug ./scripts/Start.js"
1025
},
11-
"author": "tmitchel2 <[email protected]>",
12-
"license": "MIT",
1326
"dependencies": {
1427
"winston": "^2.2.0"
1528
},
@@ -21,6 +34,7 @@
2134
"measured": "^1.1.0",
2235
"babel": "^6.5.2",
2336
"babel-cli": "^6.7.7",
37+
"babel-eslint": "^6.0.4",
2438
"babel-preset-react-native": "^1.5.7",
2539
"webpack": "^1.13.0",
2640
"babel-loader": "^6.2.4",
@@ -32,21 +46,8 @@
3246
"gulp-zip": "^3.2.0",
3347
"run-sequence": "^1.1.5",
3448
"webpack-stream": "^3.2.0",
35-
"stats-webpack-plugin": "^0.3.1"
36-
},
37-
"keywords": [
38-
"dynamoDB",
39-
"autoscale",
40-
"dynamic",
41-
"aws",
42-
"lambda"
43-
],
44-
"repository": {
45-
"type": "git",
46-
"url": "https://github.com/tmitchel2/DynamoDBAutoscaleLambda.git"
47-
},
48-
"bugs": {
49-
"url": "https://github.com/tmitchel2/DynamoDBAutoscaleLambda/issues"
50-
},
51-
"homepage": "https://github.com/tmitchel2/DynamoDBAutoscaleLambda"
49+
"stats-webpack-plugin": "^0.3.1",
50+
"eslint": "^2.9.0",
51+
"eslint-plugin-babel": "^3.2.0"
52+
}
5253
}

scripts/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
try {
2-
var lambda = require('../build/index.js');
2+
var lambda = require('../dist/Index.js');
33

44
process.chdir('./build');
55

src/CloudWatch.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import AWS from 'aws-sdk-promise';
2-
import Global from './global';
2+
import Global from './Global';
33
const {
44
stats,
55
logger
@@ -12,12 +12,14 @@ export default class CloudWatch {
1212

1313
async getMetricStatisticsAsync(params) {
1414
logger.debug('CloudWatch.getMetricStatisticsAsync');
15-
let sw = stats.timer('CloudWatch.getMetricStatisticsAsync').start()
15+
let sw = stats.timer('CloudWatch.getMetricStatisticsAsync').start();
1616
try {
1717
let res = await this._cw.getMetricStatistics(params).promise();
1818
return res.data;
1919
} catch (ex) {
20-
logger.warn('CloudWatch.getMetricStatisticsAsync failed', JSON.stringify({params}));
20+
logger.warn(
21+
'CloudWatch.getMetricStatisticsAsync failed',
22+
JSON.stringify({params}));
2123
throw ex;
2224
} finally {
2325
sw.end();

0 commit comments

Comments
 (0)