.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / tslint / lib / configs / all.js
1 "use strict";
2 /**
3  * @license
4  * Copyright 2017 Palantir Technologies, Inc.
5  *
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
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
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
23 exports.rules = {
24     // TypeScript Specific
25     "adjacent-overload-signatures": true,
26     "ban-types": {
27         options: [
28             ["Object", "Avoid using the `Object` type. Did you mean `object`?"],
29             [
30                 "Function",
31                 "Avoid using the `Function` type. Prefer a specific function type, like `() => void`.",
32             ],
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`?"],
37         ],
38     },
39     "ban-ts-ignore": true,
40     "member-access": {
41         options: ["check-accessor", "check-constructor", "check-parameter-property"],
42     },
43     "member-ordering": {
44         options: {
45             order: "statics-first",
46             alphabetize: true,
47         },
48     },
49     "no-any": true,
50     "no-empty-interface": true,
51     "no-for-in": 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,
57     "no-namespace": true,
58     "no-non-null-assertion": true,
59     "no-reference": 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,
67     typedef: {
68         options: [
69             "call-signature",
70             "arrow-call-signature",
71             "parameter",
72             "arrow-parameter",
73             "property-declaration",
74             "variable-declaration",
75             "member-variable-declaration",
76         ],
77     },
78     "typedef-whitespace": {
79         options: [
80             {
81                 "call-signature": "nospace",
82                 "index-signature": "nospace",
83                 parameter: "nospace",
84                 "property-declaration": "nospace",
85                 "variable-declaration": "nospace",
86             },
87             {
88                 "call-signature": "onespace",
89                 "index-signature": "onespace",
90                 parameter: "onespace",
91                 "property-declaration": "onespace",
92                 "variable-declaration": "onespace",
93             },
94         ],
95     },
96     "unified-signatures": true,
97     // Functionality
98     "await-promise": true,
99     // "ban": no sensible default
100     "ban-comma-operator": true,
101     curly: true,
102     forin: true,
103     "function-constructor": true,
104     // "import-blacklist": no sensible default
105     "label-position": true,
106     "no-arg": true,
107     "no-async-without-await": true,
108     "no-bitwise": true,
109     "no-conditional-assignment": true,
110     "no-console": true,
111     "no-construct": true,
112     "no-debugger": true,
113     "no-duplicate-super": true,
114     "no-duplicate-switch-case": true,
115     "no-duplicate-variable": { options: ["check-parameters"] },
116     "no-dynamic-delete": true,
117     "no-empty": true,
118     "no-eval": 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,
147     radix: true,
148     "restrict-plus-operands": true,
149     "static-this": 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,
158     "use-isnan": true,
159     // Maintainability
160     "cyclomatic-complexity": true,
161     eofline: 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 },
167     "max-line-length": {
168         options: { limit: 120 },
169     },
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,
180     "trailing-comma": {
181         options: {
182             esSpecCompliant: true,
183             multiline: "always",
184             singleline: "never",
185         },
186     },
187     // Style
188     align: {
189         options: ["parameters", "arguments", "statements", "elements", "members"],
190     },
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,
196     "class-name": true,
197     "comment-format": { options: ["check-space", "check-uppercase"] },
198     "comment-type": { options: ["singleline", "multiline", "doc", "directive"] },
199     "completed-docs": true,
200     deprecation: true,
201     encoding: 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,
209     "new-parens": 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,
225     "one-line": {
226         options: [
227             "check-catch",
228             "check-else",
229             "check-finally",
230             "check-open-brace",
231             "check-whitespace",
232         ],
233     },
234     "one-variable-per-declaration": true,
235     "ordered-imports": {
236         options: {
237             "grouped-imports": true,
238             "import-sources-order": "case-insensitive",
239             "named-imports-order": "case-insensitive",
240             "module-source-path": "full",
241         },
242     },
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,
249     quotemark: {
250         options: ["double", "avoid-escape", "avoid-template"],
251     },
252     "return-undefined": true,
253     semicolon: { options: ["always"] },
254     "space-before-function-paren": {
255         options: {
256             anonymous: "never",
257             asyncArrow: "always",
258             constructor: "never",
259             method: "never",
260             named: "never",
261         },
262     },
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"] },
269     whitespace: {
270         options: [
271             "check-branch",
272             "check-decl",
273             "check-operator",
274             "check-module",
275             "check-separator",
276             "check-type",
277             "check-typecast",
278             "check-preblock",
279             "check-type-operator",
280             "check-rest-spread",
281         ],
282     },
283 };
284 exports.RULES_EXCLUDED_FROM_ALL_CONFIG = [
285     "ban",
286     "fileHeader",
287     "importBlacklist",
288     "noInvalidThis",
289     "noSwitchCaseFallThrough",
290     "typeofCompare",
291     "noUnusedVariable",
292 ];
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++) {
296     var key = _a[_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 + "'.");
300     }
301     if (!Rule.metadata.typescriptOnly) {
302         exports.jsRules[key] = exports.rules[key];
303     }
304 }