1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-02 18:17:46 +01:00

Add TSLint (#340)

* Add tslint.

* Disable alphabetic ordering.

* Change place on selectionTitle.
This commit is contained in:
Oscar Hinton 2017-10-30 22:49:56 +01:00 committed by Kyle Spearrin
parent 77f9270131
commit f922b2e0cb
5 changed files with 61 additions and 8 deletions

View File

@ -5,7 +5,9 @@
"start:firefox": "web-ext run --source-dir ./dist/", "start:firefox": "web-ext run --source-dir ./dist/",
"dev": "gulp build && webpack --config webpack.dev.js", "dev": "gulp build && webpack --config webpack.dev.js",
"dev:watch": "gulp build && webpack --config webpack.dev.js --watch", "dev:watch": "gulp build && webpack --config webpack.dev.js --watch",
"prod": "gulp build && webpack --config webpack.prod.js" "prod": "gulp build && webpack --config webpack.prod.js",
"lint": "tslint src/**/*.ts || true",
"lint:fix": "tslint src/**/*.ts --fix"
}, },
"devDependencies": { "devDependencies": {
"angular": "1.6.6", "angular": "1.6.6",
@ -52,6 +54,8 @@
"sweetalert": "1.1.3", "sweetalert": "1.1.3",
"tldjs": "2.0.0", "tldjs": "2.0.0",
"ts-loader": "^3.0.5", "ts-loader": "^3.0.5",
"tslint": "^5.8.0",
"tslint-loader": "^3.5.3",
"typescript": "^2.5.3", "typescript": "^2.5.3",
"vinyl-source-stream": "1.1.0", "vinyl-source-stream": "1.1.0",
"web-ext": "2.0.0", "web-ext": "2.0.0",

View File

@ -1 +1 @@
declare module '*.html'; declare module '*.html';

View File

@ -8,11 +8,11 @@ class CipherItemsController implements ng.IController {
} }
public view(cipher: any) { view(cipher: any) {
return this.onView()(cipher); return this.onView()(cipher);
} }
public select(cipher: any) { select(cipher: any) {
return this.onSelected()(cipher); return this.onSelected()(cipher);
} }
@ -22,9 +22,9 @@ export const CipherItemsComponent = {
bindings: { bindings: {
ciphers: '<', ciphers: '<',
selectionTitle: '<', selectionTitle: '<',
onSelected: '&',
onView: '&', onView: '&',
onSelected: '&'
}, },
template: template, controller: CipherItemsController,
controller: CipherItemsController template,
} };

44
tslint.json Normal file
View File

@ -0,0 +1,44 @@
{
"extends": "tslint:recommended",
"rules": {
"ban-types": {
"options": [
["Object", "Avoid using the `Object` type. Did you mean `object`?"],
["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
["Number", "Avoid using the `Number` type. Did you mean `number`?"],
["String", "Avoid using the `String` type. Did you mean `string`?"],
["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"]
]
},
"member-access": [true, "no-public"],
"member-ordering": [true, {"order": [
"public-static-field",
"public-static-method",
"protected-static-field",
"protected-static-method",
"private-static-field",
"private-static-method",
"public-instance-field",
"protected-instance-field",
"private-instance-field",
"public-constructor",
"protected-constructor",
"private-constructor",
"public-instance-method",
"protected-instance-method",
"private-instance-method"
]}],
"object-literal-sort-keys": false,
"quotemark": [true, "single"],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-module",
"check-operator",
"check-preblock",
"check-separator",
"check-type"
]
}
}

View File

@ -15,6 +15,11 @@ module.exports = {
}, },
module: { module: {
rules: [ rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader'
},
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
use: 'ts-loader', use: 'ts-loader',