4 * Copyright 2017 Palantir Technologies, Inc.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 Object.defineProperty(exports, "__esModule", { value: true });
19 var path_1 = require("path");
20 var ruleLoader_1 = require("../ruleLoader");
21 // tslint:disable object-literal-sort-keys
22 // tslint:disable object-literal-key-quotes
24 // TypeScript Specific
25 "adjacent-overload-signatures": true,
28 ["Object", "Avoid using the `Object` type. Did you mean `object`?"],
31 "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
33 ["Boolean", "Avoid using the `Boolean` type. Did you mean `boolean`?"],
34 ["Number", "Avoid using the `Number` type. Did you mean `number`?"],
35 ["String", "Avoid using the `String` type. Did you mean `string`?"],
36 ["Symbol", "Avoid using the `Symbol` type. Did you mean `symbol`?"],
39 "ban-ts-ignore": true,
41 options: ["check-accessor", "check-constructor", "check-parameter-property"],
45 order: "statics-first",
50 "no-empty-interface": true,
52 "no-import-side-effect": true,
53 // Technically this is not the strictest setting, but don't want to conflict with "typedef"
54 "no-inferrable-types": { options: ["ignore-params"] },
55 "no-internal-module": true,
56 "no-magic-numbers": true,
58 "no-non-null-assertion": true,
60 "no-restricted-globals": true,
61 "no-this-assignment": true,
62 "no-var-requires": true,
63 "only-arrow-functions": true,
64 "prefer-for-of": true,
65 "prefer-readonly": true,
66 "promise-function-async": true,
70 "arrow-call-signature",
73 "property-declaration",
74 "variable-declaration",
75 "member-variable-declaration",
78 "typedef-whitespace": {
81 "call-signature": "nospace",
82 "index-signature": "nospace",
84 "property-declaration": "nospace",
85 "variable-declaration": "nospace",
88 "call-signature": "onespace",
89 "index-signature": "onespace",
90 parameter: "onespace",
91 "property-declaration": "onespace",
92 "variable-declaration": "onespace",
96 "unified-signatures": true,
98 "await-promise": true,
99 // "ban": no sensible default
100 "ban-comma-operator": true,
103 "function-constructor": true,
104 // "import-blacklist": no sensible default
105 "label-position": true,
107 "no-async-without-await": true,
109 "no-conditional-assignment": true,
111 "no-construct": true,
113 "no-duplicate-super": true,
114 "no-duplicate-switch-case": true,
115 "no-duplicate-variable": { options: ["check-parameters"] },
116 "no-dynamic-delete": true,
119 "no-floating-promises": true,
120 "no-for-in-array": true,
121 "no-implicit-dependencies": true,
122 "no-inferred-empty-object-type": true,
123 "no-invalid-template-strings": true,
124 // "no-invalid-this": Won't this be deprecated?
125 "no-misused-new": true,
126 "no-null-keyword": true,
127 "no-null-undefined-union": true,
128 "no-object-literal-type-assertion": true,
129 "no-promise-as-boolean": true,
130 "no-return-await": true,
131 "no-shadowed-variable": true,
132 "no-string-literal": true,
133 "no-string-throw": true,
134 "no-sparse-arrays": true,
135 "no-submodule-imports": true,
136 "no-tautology-expression": true,
137 "no-unbound-method": true,
138 "no-unnecessary-class": { options: ["allow-empty-class"] },
139 "no-unsafe-any": true,
140 "no-unsafe-finally": true,
141 "no-unused-expression": true,
142 // "no-unused-variable" - deprecated in #3919
143 "no-use-before-declare": true,
144 "no-var-keyword": true,
145 "no-void-expression": true,
146 "prefer-conditional-expression": true,
148 "restrict-plus-operands": true,
150 "strict-boolean-expressions": true,
151 "strict-string-expressions": true,
152 "strict-comparisons": true,
153 "strict-type-predicates": true,
154 "switch-default": true,
155 "triple-equals": true,
156 "unnecessary-constructor": true,
157 "use-default-type-parameter": true,
160 "cyclomatic-complexity": true,
162 indent: { options: ["spaces"] },
163 "invalid-void": true,
164 "linebreak-style": { options: "LF" },
165 "max-classes-per-file": { options: 1 },
166 "max-file-line-count": { options: 1000 },
168 options: { limit: 120 },
170 "no-default-export": true,
171 "no-default-import": true,
172 "no-duplicate-imports": true,
173 "no-irregular-whitespace": true,
174 "no-mergeable-namespace": true,
175 "no-parameter-reassignment": true,
176 "no-require-imports": true,
177 "no-trailing-whitespace": true,
178 "object-literal-sort-keys": true,
179 "prefer-const": true,
182 esSpecCompliant: true,
189 options: ["parameters", "arguments", "statements", "elements", "members"],
191 "array-type": { options: "array-simple" },
192 "arrow-parens": true,
193 "arrow-return-shorthand": { options: "multiline" },
194 "binary-expression-operand-order": true,
195 "callable-types": true,
197 "comment-format": { options: ["check-space", "check-uppercase"] },
198 "comment-type": { options: ["singleline", "multiline", "doc", "directive"] },
199 "completed-docs": true,
202 "file-name-casing": { options: "camel-case" },
203 "import-spacing": true,
204 "increment-decrement": true,
205 "interface-name": true,
206 "interface-over-type-literal": true,
207 "jsdoc-format": { options: "check-multiline-start" },
208 "match-default-export-name": true,
210 "newline-before-return": true,
211 "newline-per-chained-call": true,
212 "no-angle-bracket-type-assertion": true,
213 "no-boolean-literal-compare": true,
214 "no-consecutive-blank-lines": true,
215 "no-parameter-properties": true,
216 "no-redundant-jsdoc": true,
217 "no-reference-import": true,
218 "no-unnecessary-callback-wrapper": true,
219 "no-unnecessary-initializer": true,
220 "no-unnecessary-qualifier": true,
221 "no-unnecessary-type-assertion": true,
222 "number-literal-format": true,
223 "object-literal-key-quotes": { options: "consistent-as-needed" },
224 "object-literal-shorthand": true,
234 "one-variable-per-declaration": true,
237 "grouped-imports": true,
238 "import-sources-order": "case-insensitive",
239 "named-imports-order": "case-insensitive",
240 "module-source-path": "full",
243 "prefer-function-over-method": true,
244 "prefer-method-signature": true,
245 "prefer-object-spread": true,
246 "prefer-switch": true,
247 "prefer-template": true,
248 "prefer-while": true,
250 options: ["double", "avoid-escape", "avoid-template"],
252 "return-undefined": true,
253 semicolon: { options: ["always"] },
254 "space-before-function-paren": {
257 asyncArrow: "always",
258 constructor: "never",
263 "space-within-parens": { options: 0 },
264 "switch-final-break": true,
265 "type-literal-delimiter": true,
266 "unnecessary-bind": true,
267 "unnecessary-else": true,
268 "variable-name": { options: ["ban-keywords", "check-format", "require-const-for-all-caps"] },
279 "check-type-operator",
284 exports.RULES_EXCLUDED_FROM_ALL_CONFIG = [
289 "noSwitchCaseFallThrough",
293 // Exclude typescript-only rules from jsRules, otherwise it's identical.
294 exports.jsRules = {};
295 for (var _i = 0, _a = Object.keys(exports.rules); _i < _a.length; _i++) {
297 var Rule = ruleLoader_1.findRule(key, path_1.join(__dirname, "..", "rules"));
298 if (Rule === undefined) {
299 throw new Error("Couldn't find rule '" + key + "'.");
301 if (!Rule.metadata.typescriptOnly) {
302 exports.jsRules[key] = exports.rules[key];