diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..8d1c3c310 --- /dev/null +++ b/.clang-format @@ -0,0 +1,3 @@ +Language: JavaScript +BasedOnStyle: Google +ColumnLimit: 100 diff --git a/package.json b/package.json index 2b5386328..34ffd6d2e 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,9 @@ "postbuild_npm": "cp package.json README.md .npmignore dist/ && npm run rewrite_npm_package", "postinstall": "typings install", "rewrite_npm_package": "node --harmony_destructuring tools/rewrite-published-package.js", - "build_bundle": "cp -r src angularfire2 && tsc typings/main.d.ts angularfire2.ts --rootDir . --module system -t es5 --outFile dist/bundles/angularfire2.js --moduleResolution node --emitDecoratorMetadata --experimentalDecorators" + "build_bundle": "cp -r src angularfire2 && tsc typings/main.d.ts angularfire2.ts --rootDir . --module system -t es5 --outFile dist/bundles/angularfire2.js --moduleResolution node --emitDecoratorMetadata --experimentalDecorators", + "lint": "tslint \"src/**/*.ts\"", + "format": "clang-format -style=file -i --glob=src/**/*.ts" }, "keywords": [ "angular2", @@ -65,7 +67,10 @@ "typedoc": "github:jeffbcross/typedoc", "typescript": "1.8.9", "typings": "^0.6.2", - "zone.js": "^0.6.6" + "zone.js": "^0.6.6", + "clang-format": "^1.0.35", + "tslint": "^3.6.0", + "codelyzer": "0.0.14" }, "typings": "dist/angularfire2.d.ts" } diff --git a/tslint.json b/tslint.json new file mode 100644 index 000000000..7e9411165 --- /dev/null +++ b/tslint.json @@ -0,0 +1,72 @@ +{ + "rulesDirectory": ["node_modules/codelyzer"], + "rules": { + "max-line-length": [true, 100], + "no-inferrable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "indent": [ + true, + "spaces" + ], + "eofline": true, + "no-duplicate-variable": true, + "no-eval": true, + "no-arg": true, + "no-internal-module": true, + "no-trailing-whitespace": true, + "no-bitwise": true, + "no-shadowed-variable": true, + "no-unused-expression": true, + "no-unused-variable": true, + "one-line": [ + true, + "check-catch", + "check-else", + "check-open-brace", + "check-whitespace" + ], + "quotemark": [ + true, + "single", + "avoid-escape" + ], + "semicolon": [true, "always"], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "curly": true, + "variable-name": [ + true, + "ban-keywords", + "check-format", + "allow-trailing-underscore" + ], + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "component-selector-name": [true, "kebab-case"], + "component-selector-type": [true, "element"], + "host-parameter-decorator": true, + "input-parameter-decorator": true, + "output-parameter-decorator": true, + "attribute-parameter-decorator": true, + "input-property-directive": true, + "output-property-directive": true + } +}