This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
forked from progre/tslint-config-airbnb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtslint.js
120 lines (119 loc) · 3.66 KB
/
tslint.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
const path = require('path');
module.exports = {
extends: ['tslint-react', 'tslint-eslint-rules'],
rulesDirectory: [
path.join(path.dirname(require.resolve('tslint-consistent-codestyle')), './'),
path.join(path.dirname(require.resolve('tslint-eslint-rules')), 'dist/rules'),
path.join(path.dirname(require.resolve('tslint-microsoft-contrib')), './'),
],
rules: { // base on https://github.com/airbnb/javascript/tree/44dbd0bdc41d08eb5de8ad698099ae44240f4b0d
'prefer-const': true, // 2.1, 13.1
'no-var-keyword': true, // 2.2
'object-literal-shorthand': true, // 3.3, 3.4
'object-shorthand-properties-first': true, // 3.5
'object-literal-key-quotes': [true, 'as-needed'], // 3.6
'prefer-array-literal': true, // 4.1
quotemark: [
true,
'single',
'jsx-double',
], // 6.1
'no-eval': true, // 6.4
'no-function-constructor-with-string-args': true, // 7.10
'space-before-function-paren': [
true,
{
anonymous: 'always', // 7.11
named: 'never', // 19.3
},
],
'no-parameter-reassignment': true, // 7.12
align: [
true,
'arguments',
'parameters',
], // 7.15
'ter-prefer-arrow-callback': [true], // 8.1
'arrow-parens': false, // 8.2
'ter-arrow-parens': [
true,
'as-needed',
{ 'requireForBlockBody': true }
], // 8.4
'no-duplicate-imports': true, // 10.4
'one-variable-per-declaration': [true, 'ignore-for-loop'], // 13.2
'no-increment-decrement': true, // 13.6
'triple-equals': [true, 'allow-null-check'], // 15.1
'no-boolean-literal-compare': true, // 15.3
// NOTE(will): This can be reenabled once https://github.com/palantir/tslint/issues/3279 is
// fixed. Currently fails in conditional JSX because a JSX element is always truthy.
'strict-boolean-expressions': [ // 15.3
false,
'allow-null-union',
'allow-undefined-union',
'allow-string',
'allow-mix',
],
'brace-style': [
true,
'1tbs',
{ allowSingleLine: true },
], // 16.2
'no-else-after-return': true, // 16.3
'comment-format': [true, 'check-space'], // 18.3
indent: [true, 'space'], // 19.1
'ter-indent': [
true,
2,
{ 'SwitchCase': 1 },
], // 19.1
whitespace: [
true,
'check-branch', // 19.3
'check-decl', // 19.4
'check-operator', // 19.4
'check-preblock', // 19.2
],
eofline: true, // 19.5
'space-in-parens': [true, 'never'], // 19.9
'array-bracket-spacing': [true, 'never'], // 19.10
'object-curly-spacing': [true, 'always'], // 19.11
'ter-max-len': [
true,
{
'code': 100,
'tabWidth': 2,
'ignoreStrings': true,
// NOTE(will): This is currently broken with TS 2.7
'ignoreTemplateLiterals': true,
},
],
'trailing-comma': [
true,
{
multiline: 'always',
singleline: 'never',
},
], // 20.2
semicolon: [true, 'always', 'ignore-bound-class-methods'], // 21.1
'no-construct': true, // 22.2, 22.3, 22.6
radix: true, // 22.3
'function-name': [
true,
{
'function-regex': /^[a-z$][\w\d]+$/,
'method-regex': /^[a-z$][\w\d]+$/,
'private-method-regex': /^[a-z$][\w\d]+$/,
'protected-method-regex': /^[a-z$][\w\d]+$/,
'static-method-regex': /^[a-z$][\w\d]+$/,
}, // 23.1
],
'variable-name': [true, 'check-format', 'allow-pascal-case'], // 23.2
'no-this-assignment': true, // 23.5
'jsx-no-multiline-js': false,
'jsx-no-lambda': false,
'jsx-boolean-value': false,
'no-unused-variable': true,
'no-console': [true, "log", "error"],
},
};