V3-896 Added TS & Vue lint rules (#769)

This commit is contained in:
Bogdan Artemenko 2018-12-06 14:12:09 +02:00 committed by GitHub
parent 828a8b6907
commit 8592e29260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 69 additions and 2 deletions

View File

@ -37,15 +37,21 @@
"@vue/test-utils": "^1.0.0-beta.25",
"babel-core": "7.0.0-bridge.0",
"css-loader": "^1.0.0",
"eslint": "^5.9.0",
"eslint-plugin-vue": "^5.0.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.1",
"sinon": "^7.0.0",
"ts-jest": "^23.0.0",
"tslint": "^5.11.0",
"tslint-consistent-codestyle": "^1.14.1",
"tslint-loader": "^3.5.4",
"typescript": "^3.0.0",
"vue-html-webpack-plugin": "^3.2.2",
"vue-loader": "^15.4.2",
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.5.17",
"vue-tslint-loader": "^3.5.6",
"webpack": "^4.21.0",
"webpack-cli": "^3.1.2",
"webpack-node-externals": "^1.7.2"

View File

@ -3,17 +3,78 @@
"extends": [
"tslint:recommended"
],
"rulesDirectory": [
"tslint-consistent-codestyle"
],
"linterOptions": {
"exclude": [
"node_modules/**"
]
},
"rules": {
// Enforces function overloads to be consecutive.
"adjacent-overload-signatures": true,
// Enforces vertical alignment.
"align": [true, "parameters", "statements"],
// Enforces use of T[] if T is a simple type.
"array-type": [true, "array-simple"],
// Enforces PascalCased class and interface names.
"class-name": true,
// Enforces formatting rules for single-line comments.
"comment-format": [true, "check-space"],
"quotemark": [true, "single"],
"indent": [true, "spaces", 2],
"indent": [true, "tabs", 4],
// Ensures the file ends with a newline.
"eofline": true,
// Ensures proper spacing between import statement keywords.
"import-spacing": true,
"interface-name": false,
"ordered-imports": false,
// Enforces consistent semicolon usage at the end of every statement.
"semicolon": [true, "always"],
// Enforces braces for if/for/do/while statements.
"curly": [true, "ignore-same-line"],
// Enforces blank line before return when not the only line in the block.
"newline-before-return": true,
// Disallows multiple variable definitions in the same declaration statement.(Exception for loops)
"one-variable-per-declaration": [true, "ignore-for-loop"],
"object-literal-sort-keys": false,
"no-consecutive-blank-lines": false
// Enforces whitespace style conventions.
"file-header": [true,
"// Copyright (C) 2018 Storj Labs, Inc.\n// See LICENSE for copying information.\n"
],
"whitespace": [
true,
"check-branch", // checks branching statements (if/else/for/while) are followed by whitespace.
"check-decl", // checks that variable declarations have whitespace around the equals token.
"check-operator", // checks for whitespace around operator tokens.
"check-module", // checks for whitespace in import & export statements.
"check-separator", // checks for whitespace after separator tokens (,/;).
"check-type-operator", // checks for whitespace between type operators | and &.
"check-preblock" // checks for whitespace before the opening brace of a block.
],
// Recommends to use an early exit instead of a long if block.
"early-exit": true,
// Bans the use of specified console methods.
"no-console": [true, "log"],
"no-default-export": true,
// Ban the use of this in static methods.
"no-static-this": true,
// Warns if super() appears twice in a constructor.
"no-duplicate-super": true,
// Disallows any type of assignment in conditionals.
"no-conditional-assignment": true,
// Disallows the use constant number values outside of variable assignments.
"no-magic-numbers": true,
// Prevents duplicate cases in switch statements.
"no-duplicate-switch-case": true,
// Disallows empty blocks.
"no-empty": true,
// Disallows two or more blank lines in a row.
"no-consecutive-blank-lines": [true, 2],
// Warns on use of ${ in non-template strings.
"no-invalid-template-strings": true,
// Disallows using the this keyword outside of classes.
"no-invalid-this": true
}
}