Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,37 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Enforces usage of the shorthand return syntax when an arrow function's body does not span multiple lines.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"arrow-return-shorthand\": true }\n "], ["\n \"rules\": { \"arrow-return-shorthand\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const calc = (x: number, y: number) => ({ add: x + y, sub: x - y, mul: x * y });\n const calc2 = (x: number, y: number) => {\n return { add: x + y, sub: x - y, mul: x * y }\n };\n "], ["\n const calc = (x: number, y: number) => ({ add: x + y, sub: x - y, mul: x * y });\n const calc2 = (x: number, y: number) => {\n return { add: x + y, sub: x - y, mul: x * y }\n };\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n const calc = (x: number, y: number) => { return { add: x + y, sub: x - y, mul: x * y } };\n const calc2 = (x: number, y: number) => {\n return { add: x + y, sub: x - y, mul: x * y }\n };\n "], ["\n const calc = (x: number, y: number) => { return { add: x + y, sub: x - y, mul: x * y } };\n const calc2 = (x: number, y: number) => {\n return { add: x + y, sub: x - y, mul: x * y }\n };\n "]))),
},
{
description: "Enforces usage of the shorthand return syntax even when an arrow function's body spans multiple lines.",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"arrow-return-shorthand\": [true, \"multiline\"] }\n "], ["\n \"rules\": { \"arrow-return-shorthand\": [true, \"multiline\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n const calc = (x: number, y: number) => ({ add: x + y, sub: x - y, mul: x * y });\n const calc2 = (x: number, y: number) =>\n ({ add: x + y, sub: x - y, mul: x * y });\n "], ["\n const calc = (x: number, y: number) => ({ add: x + y, sub: x - y, mul: x * y });\n const calc2 = (x: number, y: number) =>\n ({ add: x + y, sub: x - y, mul: x * y });\n "]))),
fail: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n const calc = (x: number, y: number) => { return { add: x + y, sub: x - y, mul: x * y } };\n const calc2 = (x: number, y: number) => {\n return { add: x + y, sub: x - y, mul: x * y }\n };\n "], ["\n const calc = (x: number, y: number) => { return { add: x + y, sub: x - y, mul: x * y } };\n const calc2 = (x: number, y: number) => {\n return { add: x + y, sub: x - y, mul: x * y }\n };\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: 'Disallows the use of "@ts-ignore"',
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"ban-ts-ignore\": true }\n "], ["\n \"rules\": { \"ban-ts-ignore\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n if (false) {\n // Compiler warns about unreachable code error\n console.log(\"hello\");\n }\n "], ["\n if (false) {\n // Compiler warns about unreachable code error\n console.log(\"hello\");\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n if (false) {\n // @ts-ignore: Unreachable code error\n console.log(\"hello\");\n }\n "], ["\n if (false) {\n // @ts-ignore: Unreachable code error\n console.log(\"hello\");\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Enforces PascalCased class and interface names.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"class-name\": true }\n "], ["\n \"rules\": { \"class-name\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n class MyClass { }\n interface MyInterface { }\n "], ["\n class MyClass { }\n interface MyInterface { }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n class myClass { }\n interface myInterface { }\n "], ["\n class myClass { }\n interface myInterface { }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,43 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Require curly braces whenever possible (default)",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"curly\": true }\n "], ["\n \"rules\": { \"curly\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n if (x > 0) {\n doStuff();\n }\n "], ["\n if (x > 0) {\n doStuff();\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n if (x > 0)\n doStuff();\n\n if (x > 0) doStuff();\n "], ["\n if (x > 0)\n doStuff();\n\n if (x > 0) doStuff();\n "]))),
},
{
description: "Make an exception for single-line instances",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"curly\": [true, \"ignore-same-line\"] }\n "], ["\n \"rules\": { \"curly\": [true, \"ignore-same-line\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n if (x > 0) doStuff();\n "], ["\n if (x > 0) doStuff();\n "]))),
fail: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n if (x > 0)\n doStuff()\n "], ["\n if (x > 0)\n doStuff()\n "]))),
},
{
description: "Error on unnecessary curly braces",
config: Lint.Utils.dedent(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"curly\": [true, \"as-needed\"] }\n "], ["\n \"rules\": { \"curly\": [true, \"as-needed\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n if (x > 0)\n doStuff();\n\n if (x > 0) {\n customerUpdates.push(getInfo(customerId));\n return customerUpdates;\n }\n "], ["\n if (x > 0)\n doStuff();\n\n if (x > 0) {\n customerUpdates.push(getInfo(customerId));\n return customerUpdates;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n if (x > 0) {\n doStuff();\n }\n "], ["\n if (x > 0) {\n doStuff();\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
config: string;
description: string;
fail: string;
pass: string;
}[];

View file

@ -0,0 +1,36 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
exports.codeExamples = [
{
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"function-constructor\": true }\n "], ["\n \"rules\": { \"function-constructor\": true }\n "]))),
description: "Use inline lambdas instead of calling Function",
fail: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n let doesNothing = new Function();\n "], ["\n let doesNothing = new Function();\n "]))),
pass: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n let doesNothing = () => {};\n "], ["\n let doesNothing = () => {};\n "]))),
},
{
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"function-constructor\": true }\n "], ["\n \"rules\": { \"function-constructor\": true }\n "]))),
description: "Use parameters instead of constructor strings",
fail: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n let addNumbers = new Function(\"a\", \"b\", \"return a + b\");\n "], ["\n let addNumbers = new Function(\"a\", \"b\", \"return a + b\");\n "]))),
pass: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n let addNumbers = (a, b) => a + b;\n "], ["\n let addNumbers = (a, b) => a + b;\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;

View file

@ -0,0 +1,27 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: ({
description: string;
config: string;
pass: string;
fail: string;
} | {
description: string;
config: string;
pass: string;
fail?: undefined;
})[];

View file

@ -0,0 +1,36 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows usages of `any` as a type declaration.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-any\": true }\n "], ["\n \"rules\": { \"no-any\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n let foo: object;\n "], ["\n let foo: object;\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n let foo: any;\n "], ["\n let foo: any;\n "]))),
},
{
description: "Disallows usages of `any` as a type declaration except rest spread parameters.",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-any\": [true, { \"ignore-rest-args\": true }] }\n "], ["\n \"rules\": { \"no-any\": [true, { \"ignore-rest-args\": true }] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n function foo(a: number, ...rest: any[]): void {\n return;\n }\n "], ["\n function foo(a: number, ...rest: any[]): void {\n return;\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
config: string;
description: string;
fail: string;
pass: string;
}[];

View file

@ -0,0 +1,30 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
exports.codeExamples = [
{
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-async-without-await\": true }\n "], ["\n \"rules\": { \"no-async-without-await\": true }\n "]))),
description: "Do not use the async keyword if it is not needed",
fail: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n async function f() {\n fetch();\n }\n\n async function f() {\n async function g() {\n await h();\n }\n }\n "], ["\n async function f() {\n fetch();\n }\n\n async function f() {\n async function g() {\n await h();\n }\n }\n "]))),
pass: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n async function f() {\n await fetch();\n }\n\n const f = async () => {\n await fetch();\n };\n\n const f = async () => {\n return 'value';\n };\n "], ["\n async function f() {\n await fetch();\n }\n\n const f = async () => {\n await fetch();\n };\n\n const f = async () => {\n return 'value';\n };\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows empty interfaces.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-empty-interface\": true }\n "], ["\n \"rules\": { \"no-empty-interface\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n interface I {\n foo: string;\n }\n "], ["\n interface I {\n foo: string;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n interface I { }\n "], ["\n interface I { }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ICodeExample } from "../../language/rule/rule";
export declare const codeExamples: ICodeExample[];

View file

@ -0,0 +1,36 @@
"use strict";
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallow object literals to appear in type assertion expressions (default). Casting to `any` and `unknown` is allowed.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-object-literal-type-assertion\": true }\n "], ["\n \"rules\": { \"no-object-literal-type-assertion\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n let foo = {} as any;\n let foo = {} as unknown;\n\n let foo = {} as any as Foo;\n let foo = {} as unknown as Foo;\n "], ["\n let foo = {} as any;\n let foo = {} as unknown;\n\n let foo = {} as any as Foo;\n let foo = {} as unknown as Foo;\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n let foo = {} as Foo;\n let foo = <Foo>{};\n "], ["\n let foo = {} as Foo;\n let foo = <Foo>{};\n "]))),
},
{
description: "Allow using a type assertion when the object literal is used as an argument.",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-object-literal-type-assertion\": [true, { \"allow-arguments\": true }] }\n "], ["\n \"rules\": { \"no-object-literal-type-assertion\": [true, { \"allow-arguments\": true }] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n bar({} as Foo)\n "], ["\n bar({} as Foo)\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,37 @@
"use strict";
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows usages of a non-awaited Promise as boolean.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-promise-as-boolean\": true }\n "], ["\n \"rules\": { \"no-promise-as-boolean\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n async function waiter(custumerDecisionPromise: Promise<any>) {\n if (await custumerDecisionPromise) {\n console.log(\"Customer ready to take an order.\")\n }\n }\n "], ["\n async function waiter(custumerDecisionPromise: Promise<any>) {\n if (await custumerDecisionPromise) {\n console.log(\"Customer ready to take an order.\")\n }\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n async function waiter(custumerDecisionPromise: Promise<any>) {\n if (custumerDecisionPromise) {\n console.log(\"Customer ready to take an order.\")\n }\n }\n "], ["\n async function waiter(custumerDecisionPromise: Promise<any>) {\n if (custumerDecisionPromise) {\n console.log(\"Customer ready to take an order.\")\n }\n }\n "]))),
},
{
description: "Disallows usages of a non-awaited third-party promise as boolean.",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-promise-as-boolean\": [true, { \"promise-classes\": [\"CustomPromise\"] }] }\n "], ["\n \"rules\": { \"no-promise-as-boolean\": [true, { \"promise-classes\": [\"CustomPromise\"] }] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n function printOrdersPerLine(orderId: number, orderedFoodPromise: CustomPromise<string[]>) {\n orderedFoodPromise.then(orderedFood => {\n console.log(`${orderId} contains the following items:`);\n\n for (let index = 0; orderedFood; index++) {\n console.log(\"orderedFood[index]\");\n }\n\n console.log(\"Done.\");\n })\n }\n "], ["\n function printOrdersPerLine(orderId: number, orderedFoodPromise: CustomPromise<string[]>) {\n orderedFoodPromise.then(orderedFood => {\n console.log(\\`\\${orderId} contains the following items:\\`);\n\n for (let index = 0; orderedFood; index++) {\n console.log(\"orderedFood[index]\");\n }\n\n console.log(\"Done.\");\n })\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n function printOrdersPerLine(orderId: number, orderedFoodPromise: CustomPromise<string[]>) {\n console.log(`${orderId} contains the following items:`);\n\n for (let index = 0; orderedFoodPromise; index++) {\n console.log(\"orderedFoodPromise[index]\");\n }\n\n console.log(\"Done.\");\n }\n "], ["\n function printOrdersPerLine(orderId: number, orderedFoodPromise: CustomPromise<string[]>) {\n console.log(\\`\\${orderId} contains the following items:\\`);\n\n for (let index = 0; orderedFoodPromise; index++) {\n console.log(\"orderedFoodPromise[index]\");\n }\n\n console.log(\"Done.\");\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows sparse arrays",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-sparse-arrays\": true }\n "], ["\n \"rules\": { \"no-sparse-arrays\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const arr: string[] = ['elemenet1', 'element2'];\n "], ["\n const arr: string[] = ['elemenet1', 'element2'];\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n const arr: string[] = ['elemenet1',, 'element2'];\n "], ["\n const arr: string[] = ['elemenet1',, 'element2'];\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Flags throwing plain strings or concatenations of strings.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-string-throw\": true }\n "], ["\n \"rules\": { \"no-string-throw\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n try {\n // ...\n } catch (e) {\n throw e;\n }\n "], ["\n try {\n // ...\n } catch (e) {\n throw e;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n try {\n // ...\n } catch {\n throw 'There was a problem.';\n }\n "], ["\n try {\n // ...\n } catch {\n throw 'There was a problem.';\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows unnecessary callback wrappers",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-unnecessary-callback-wrapper\": true }\n "], ["\n \"rules\": { \"no-unnecessary-callback-wrapper\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const handleContent = (content) => console.log('Handle content:', content);\n const handleError = (error) => console.log('Handle error:', error);\n promise.then(handleContent).catch(handleError);\n "], ["\n const handleContent = (content) => console.log('Handle content:', content);\n const handleError = (error) => console.log('Handle error:', error);\n promise.then(handleContent).catch(handleError);\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n const handleContent = (content) => console.log('Handle content:', content);\n const handleError = (error) => console.log('Handle error:', error);\n promise.then((content) => handleContent(content)).catch((error) => handleError(error));\n "], ["\n const handleContent = (content) => console.log('Handle content:', content);\n const handleError = (error) => console.log('Handle error:', error);\n promise.then((content) => handleContent(content)).catch((error) => handleError(error));\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2013 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Check that referenced variables are declared beforehand (default)",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"no-use-before-declare\": true }\n "], ["\n \"rules\": { \"no-use-before-declare\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n var hello = 'world';\n var foo;\n\n console.log(hello, foo, capitalize(hello));\n // 'world', undefined, 'WORLD'\n\n function capitalize(val) {\n return val.toUpperCase();\n }\n\n import { default as foo1 } from \"./lib\";\n import foo2 from \"./lib\";\n import _, { map, foldl } from \"./underscore\";\n import * as foo3 from \"./lib\";\n import \"./lib\";\n\n function declaredImports() {\n console.log(foo1);\n console.log(foo2);\n console.log(foo3);\n map([], (x) => x);\n }\n "], ["\n var hello = 'world';\n var foo;\n\n console.log(hello, foo, capitalize(hello));\n // 'world', undefined, 'WORLD'\n\n function capitalize(val) {\n return val.toUpperCase();\n }\n\n import { default as foo1 } from \"./lib\";\n import foo2 from \"./lib\";\n import _, { map, foldl } from \"./underscore\";\n import * as foo3 from \"./lib\";\n import \"./lib\";\n\n function declaredImports() {\n console.log(foo1);\n console.log(foo2);\n console.log(foo3);\n map([], (x) => x);\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n console.log(hello, foo);\n\n var hello = 'world';\n var foo;\n\n function undeclaredImports() {\n console.log(foo1);\n console.log(foo2);\n console.log(foo3);\n map([], (x) => x);\n }\n\n import { default as foo1 } from \"./lib\";\n import foo2 from \"./lib\";\n import _, { map, foldl } from \"./underscore\";\n import * as foo3 from \"./lib\";\n import \"./lib\";\n "], ["\n console.log(hello, foo);\n\n var hello = 'world';\n var foo;\n\n function undeclaredImports() {\n console.log(foo1);\n console.log(foo2);\n console.log(foo3);\n map([], (x) => x);\n }\n\n import { default as foo1 } from \"./lib\";\n import foo2 from \"./lib\";\n import _, { map, foldl } from \"./underscore\";\n import * as foo3 from \"./lib\";\n import \"./lib\";\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,38 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Requires that an object literal's keys be sorted alphabetically.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"object-literal-sort-keys\": true }\n "], ["\n \"rules\": { \"object-literal-sort-keys\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n let o = {\n bar: 2,\n foo: 1\n };\n "], ["\n let o = {\n bar: 2,\n foo: 1\n };\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n let o = {\n foo: 1,\n bar: 2\n };\n "], ["\n let o = {\n foo: 1,\n bar: 2\n };\n "]))),
},
{
description: Lint.Utils
.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["Requires that an object literal's keys be sorted by interface-definition.\n If there is no interface fallback to alphabetically."], ["Requires that an object literal's keys be sorted by interface-definition.\n If there is no interface fallback to alphabetically."]))),
config: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n \"rules\": {\n \"object-literal-sort-keys\": {\n \"options\": \"match-declaration-order\"\n }\n }\n "], ["\n \"rules\": {\n \"object-literal-sort-keys\": {\n \"options\": \"match-declaration-order\"\n }\n }\n "]))),
pass: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n interface I {\n foo: number;\n bar: number;\n }\n\n let o: I = {\n foo: 1,\n bar: 2\n };\n "], ["\n interface I {\n foo: number;\n bar: number;\n }\n\n let o: I = {\n foo: 1,\n bar: 2\n };\n "]))),
fail: Lint.Utils.dedent(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n interface I {\n foo: number;\n bar: number;\n }\n\n let o: I = {\n bar: 2,\n foo: 1\n };\n "], ["\n interface I {\n foo: number;\n bar: number;\n }\n\n let o: I = {\n bar: 2,\n foo: 1\n };\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;

View file

@ -0,0 +1,27 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: ({
description: string;
config: string;
pass: string;
fail: string;
} | {
description: string;
config: string;
pass: string;
fail?: undefined;
})[];

View file

@ -0,0 +1,36 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows multiple variable definitions in the same declaration statement.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"one-variable-per-declaration\": true }\n "], ["\n \"rules\": { \"one-variable-per-declaration\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const foo = 1;\n const bar = '2';\n "], ["\n const foo = 1;\n const bar = '2';\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n const foo = 1, bar = '2';\n "], ["\n const foo = 1, bar = '2';\n "]))),
},
{
description: "Disallows multiple variable definitions in the same declaration statement but allows them in for-loops.",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"one-variable-per-declaration\": [true, \"ignore-for-loop\"] }\n "], ["\n \"rules\": { \"one-variable-per-declaration\": [true, \"ignore-for-loop\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n for (let i = 0, j = 10; i < 10; i++) {\n doSomething(j, i);\n }\n "], ["\n for (let i = 0, j = 10; i < 10; i++) {\n doSomething(j, i);\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows functions with the function keyword",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"only-arrow-functions\": true }\n "], ["\n \"rules\": { \"only-arrow-functions\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const myFunc = () => {\n // do something ...\n };\n\n const myFunc = function() {\n this.doSomething();\n };\n "], ["\n const myFunc = () => {\n // do something ...\n };\n\n const myFunc = function() {\n this.doSomething();\n };\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n function myFunc() {\n // do something ...\n };\n\n const myFunc = function() {\n // do something ...\n };\n "], ["\n function myFunc() {\n // do something ...\n };\n\n const myFunc = function() {\n // do something ...\n };\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,37 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Enforces the use of template strings whenever possible.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"prefer-template\": true }\n "], ["\n \"rules\": { \"prefer-template\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const x: number = 1;\n const y: number = 1;\n const myString: string = `${x} is equals ${y}`;\n "], ["\n const x: number = 1;\n const y: number = 1;\n const myString: string = \\`\\${x} is equals \\${y}\\`;\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n const x: number = 1;\n const y: number = 1;\n const myString: string = x + ' is equals ' + y;\n "], ["\n const x: number = 1;\n const y: number = 1;\n const myString: string = x + ' is equals ' + y;\n "]))),
},
{
description: "Enforces the use of template strings, but allows up to one concatenation.",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"prefer-template\": [true, \"allow-single-concat\"] }\n "], ["\n \"rules\": { \"prefer-template\": [true, \"allow-single-concat\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n const x: number = 1;\n const y: number = 1;\n const myString: string = x + ' is equals 1';\n const myString: string = `${x} is equals ${y}`;\n "], ["\n const x: number = 1;\n const y: number = 1;\n const myString: string = x + ' is equals 1';\n const myString: string = \\`\\${x} is equals \\${y}\\`;\n "]))),
fail: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n const x: number = 1;\n const y: number = 1;\n const myString: string = x + ' is equals ' + y;\n "], ["\n const x: number = 1;\n const y: number = 1;\n const myString: string = x + ' is equals ' + y;\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Prefer `while` loops instead of `for` loops without an initializer and incrementor.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"prefer-while\": true }\n "], ["\n \"rules\": { \"prefer-while\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n for(let i = 1; i < 10; i++) {\n console.log(i);\n }\n\n for (let i = 0; i < 10; i+=1) {\n console.log(i);\n }\n\n for (let i = 0; i < 10;) {\n i += 1;\n }\n "], ["\n for(let i = 1; i < 10; i++) {\n console.log(i);\n }\n\n for (let i = 0; i < 10; i+=1) {\n console.log(i);\n }\n\n for (let i = 0; i < 10;) {\n i += 1;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n for(;;) {\n console.log('Hello World');\n }\n\n for(;true===true;) {\n console.log('Hello World');\n }\n "], ["\n for(;;) {\n console.log('Hello World');\n }\n\n for(;true===true;) {\n console.log('Hello World');\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Requires the inclusion of the radix parameter when calling `parseInt`.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"radix\": true }\n "], ["\n \"rules\": { \"radix\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const x: string = '11';\n const dec: number = parseInt(x, 10);\n const bin: number = parseInt(x, 2);\n const hex: number = parseInt(x, 16);\n "], ["\n const x: string = '11';\n const dec: number = parseInt(x, 10);\n const bin: number = parseInt(x, 2);\n const hex: number = parseInt(x, 16);\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n const x: string = '11';\n const dec: number = parseInt(x);\n "], ["\n const x: string = '11';\n const dec: number = parseInt(x);\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows the `this` keyword usage in static context.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"static-this\": true }\n "], ["\n \"rules\": { \"static-this\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n class Pass {\n static getName() {\n return 'name'\n }\n\n static getFullname() {\n return `full ${Pass.getName()}`\n }\n }\n "], ["\n class Pass {\n static getName() {\n return 'name'\n }\n\n static getFullname() {\n return \\`full \\${Pass.getName()}\\`\n }\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n class Fail {\n static getName() {\n return 'name'\n }\n\n static getFullname() {\n return `full ${this.getName()}`\n }\n }\n "], ["\n class Fail {\n static getName() {\n return 'name'\n }\n\n static getFullname() {\n return \\`full \\${this.getName()}\\`\n }\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,43 @@
"use strict";
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Disallows usage of comparison operators with non-primitive types.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"strict-comparisons\": true }\n "], ["\n \"rules\": { \"strict-comparisons\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n const object1 = {};\n const object2 = {};\n if (isEqual(object1, object2)) {}\n "], ["\n const object1 = {};\n const object2 = {};\n if (isEqual(object1, object2)) {}\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n const object1 = {};\n const object2 = {};\n if (object1 === object2) {}\n "], ["\n const object1 = {};\n const object2 = {};\n if (object1 === object2) {}\n "]))),
},
{
description: "Allows equality operators to be used with non-primitive types, while still disallowing the use of greater than and less than.",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"strict-comparisons\": [true, { \"allow-object-equal-comparison\": true }] }\n "], ["\n \"rules\": { \"strict-comparisons\": [true, { \"allow-object-equal-comparison\": true }] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n const object1 = {};\n const object2 = {};\n if (object1 === object2) {}\n "], ["\n const object1 = {};\n const object2 = {};\n if (object1 === object2) {}\n "]))),
fail: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n const object1 = {};\n const object2 = {};\n if (object1 < object2) {}\n "], ["\n const object1 = {};\n const object2 = {};\n if (object1 < object2) {}\n "]))),
},
{
description: "Allows ordering operators to be used with string types.",
config: Lint.Utils.dedent(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"strict-comparisons\": [true, { \"allow-string-order-comparison\": true }] }\n "], ["\n \"rules\": { \"strict-comparisons\": [true, { \"allow-string-order-comparison\": true }] }\n "]))),
pass: Lint.Utils.dedent(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n const string1 = \"\";\n const string2 = \"\";\n if (string1 < string2) {}\n "], ["\n const string1 = \"\";\n const string2 = \"\";\n if (string1 < string2) {}\n "]))),
fail: Lint.Utils.dedent(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n const object1 = {};\n const object2 = {};\n if (object1 < object2) {}\n "], ["\n const object1 = {};\n const object2 = {};\n if (object1 < object2) {}\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Requires a `default` case in `switch` statements.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"switch-default\": true }\n "], ["\n \"rules\": { \"switch-default\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n let foo: number = 1;\n switch (foo) {\n case 1:\n doSomething();\n break;\n case 2:\n doSomething2();\n break;\n default:\n console.log('default');\n }\n "], ["\n let foo: number = 1;\n switch (foo) {\n case 1:\n doSomething();\n break;\n case 2:\n doSomething2();\n break;\n default:\n console.log('default');\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n let foo: number = 1;\n switch (foo) {\n case 1:\n doSomething();\n break;\n case 2:\n doSomething2();\n }\n "], ["\n let foo: number = 1;\n switch (foo) {\n case 1:\n doSomething();\n break;\n case 2:\n doSomething2();\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,79 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Requires type definitions for call signatures",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"call-signature\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"call-signature\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n function add(x, y): number {\n return x + y;\n }\n "], ["\n function add(x, y): number {\n return x + y;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n function add(x, y) {\n return x + y;\n }\n "], ["\n function add(x, y) {\n return x + y;\n }\n "]))),
},
{
description: "Requires type definitions for arrow call signatures",
config: Lint.Utils.dedent(templateObject_4 || (templateObject_4 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"arrow-call-signature\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"arrow-call-signature\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_5 || (templateObject_5 = tslib_1.__makeTemplateObject(["\n const add = (x, y): number => x + y;\n "], ["\n const add = (x, y): number => x + y;\n "]))),
fail: Lint.Utils.dedent(templateObject_6 || (templateObject_6 = tslib_1.__makeTemplateObject(["\n const add = (x, y) => x + y;\n "], ["\n const add = (x, y) => x + y;\n "]))),
},
{
description: "Requires type definitions for parameters",
config: Lint.Utils.dedent(templateObject_7 || (templateObject_7 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"parameter\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"parameter\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_8 || (templateObject_8 = tslib_1.__makeTemplateObject(["\n function add(x: number, y: number) {\n return x + y;\n }\n "], ["\n function add(x: number, y: number) {\n return x + y;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_9 || (templateObject_9 = tslib_1.__makeTemplateObject(["\n function add(x, y) {\n return x + y;\n }\n "], ["\n function add(x, y) {\n return x + y;\n }\n "]))),
},
{
description: "Requires type definitions for arrow function parameters",
config: Lint.Utils.dedent(templateObject_10 || (templateObject_10 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"arrow-parameter\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"arrow-parameter\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_11 || (templateObject_11 = tslib_1.__makeTemplateObject(["\n const add = (x: number, y: number) => x + y;\n "], ["\n const add = (x: number, y: number) => x + y;\n "]))),
fail: Lint.Utils.dedent(templateObject_12 || (templateObject_12 = tslib_1.__makeTemplateObject(["\n const add = (x, y) => x + y;\n "], ["\n const add = (x, y) => x + y;\n "]))),
},
{
description: "Requires type definitions for property declarations",
config: Lint.Utils.dedent(templateObject_13 || (templateObject_13 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"property-declaration\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"property-declaration\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_14 || (templateObject_14 = tslib_1.__makeTemplateObject(["\n interface I {\n foo: number;\n bar: string;\n }\n "], ["\n interface I {\n foo: number;\n bar: string;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_15 || (templateObject_15 = tslib_1.__makeTemplateObject(["\n interface I {\n foo;\n bar;\n }\n "], ["\n interface I {\n foo;\n bar;\n }\n "]))),
},
{
description: "Requires type definitions for variable declarations",
config: Lint.Utils.dedent(templateObject_16 || (templateObject_16 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"variable-declaration\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"variable-declaration\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_17 || (templateObject_17 = tslib_1.__makeTemplateObject(["\n let x: number;\n "], ["\n let x: number;\n "]))),
fail: Lint.Utils.dedent(templateObject_18 || (templateObject_18 = tslib_1.__makeTemplateObject(["\n let x;\n "], ["\n let x;\n "]))),
},
{
description: "Requires type definitions for member variable declarations",
config: Lint.Utils.dedent(templateObject_19 || (templateObject_19 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"member-variable-declaration\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"member-variable-declaration\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_20 || (templateObject_20 = tslib_1.__makeTemplateObject(["\n class MyClass {\n x: number;\n }\n "], ["\n class MyClass {\n x: number;\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_21 || (templateObject_21 = tslib_1.__makeTemplateObject(["\n class MyClass {\n x;\n }\n "], ["\n class MyClass {\n x;\n }\n "]))),
},
{
description: "Requires type definitions when destructuring objects.",
config: Lint.Utils.dedent(templateObject_22 || (templateObject_22 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"object-destructuring\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"object-destructuring\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_23 || (templateObject_23 = tslib_1.__makeTemplateObject(["\n interface FooBar {\n foo: number;\n bar: string;\n }\n const foobar = { foo: 1, bar: '2' };\n const { foo, bar }: FooBar = foobar;\n "], ["\n interface FooBar {\n foo: number;\n bar: string;\n }\n const foobar = { foo: 1, bar: '2' };\n const { foo, bar }: FooBar = foobar;\n "]))),
fail: Lint.Utils.dedent(templateObject_24 || (templateObject_24 = tslib_1.__makeTemplateObject(["\n interface FooBar {\n foo: number;\n bar: string;\n }\n const foobar = { foo: 1, bar: '2' };\n const { foo, bar } = foobar;\n "], ["\n interface FooBar {\n foo: number;\n bar: string;\n }\n const foobar = { foo: 1, bar: '2' };\n const { foo, bar } = foobar;\n "]))),
},
{
description: "Requires type definitions when destructuring arrays.",
config: Lint.Utils.dedent(templateObject_25 || (templateObject_25 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"typedef\": [true, \"array-destructuring\"] }\n "], ["\n \"rules\": { \"typedef\": [true, \"array-destructuring\"] }\n "]))),
pass: Lint.Utils.dedent(templateObject_26 || (templateObject_26 = tslib_1.__makeTemplateObject(["\n const foobar = [1, '2'];\n const [foo, bar]: Array<number | string> = foobar;\n "], ["\n const foobar = [1, '2'];\n const [foo, bar]: Array<number | string> = foobar;\n "]))),
fail: Lint.Utils.dedent(templateObject_27 || (templateObject_27 = tslib_1.__makeTemplateObject(["\n const foobar = [1, '2'];\n const [foo, bar] = foobar;\n "], ["\n const foobar = [1, '2'];\n const [foo, bar] = foobar;\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2019 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: 'Disallows "else" following "if" blocks ending with "return", "break", "continue" or "throw" statement. ',
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"unnecessary-else\": true }\n "], ["\n \"rules\": { \"unnecessary-else\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n if (someCondition()) {\n return;\n }\n // some code here\n\n if (someCondition()) {\n continue;\n }\n // some code here\n\n if (someCondition()) {\n throw;\n }\n // some code here\n\n if (someCondition()) {\n break;\n }\n // some code here\n\n "], ["\n if (someCondition()) {\n return;\n }\n // some code here\n\n if (someCondition()) {\n continue;\n }\n // some code here\n\n if (someCondition()) {\n throw;\n }\n // some code here\n\n if (someCondition()) {\n break;\n }\n // some code here\n\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n if (someCondition()) {\n return;\n } else {\n // some code here\n }\n\n if (someCondition()) {\n break;\n } else {\n // some code here\n }\n\n if (someCondition()) {\n throw;\n } else {\n // some code here\n }\n\n if (someCondition()) {\n continue;\n } else {\n // some code here\n }\n "], ["\n if (someCondition()) {\n return;\n } else {\n // some code here\n }\n\n if (someCondition()) {\n break;\n } else {\n // some code here\n }\n\n if (someCondition()) {\n throw;\n } else {\n // some code here\n }\n\n if (someCondition()) {\n continue;\n } else {\n // some code here\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;

View file

@ -0,0 +1,22 @@
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export declare const codeExamples: {
description: string;
config: string;
pass: string;
fail: string;
}[];

View file

@ -0,0 +1,31 @@
"use strict";
/**
* @license
* Copyright 2018 Palantir Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.codeExamples = void 0;
var tslib_1 = require("tslib");
var Lint = require("../../index");
// tslint:disable: object-literal-sort-keys
exports.codeExamples = [
{
description: "Enforces usage of `isNan()`.",
config: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n \"rules\": { \"use-isnan\": true }\n "], ["\n \"rules\": { \"use-isnan\": true }\n "]))),
pass: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n if (isNaN(parseInt('_4711'))) {\n doSomething();\n }\n "], ["\n if (isNaN(parseInt('_4711'))) {\n doSomething();\n }\n "]))),
fail: Lint.Utils.dedent(templateObject_3 || (templateObject_3 = tslib_1.__makeTemplateObject(["\n if (parseInt('_4711') === NaN) {\n doSomething();\n }\n "], ["\n if (parseInt('_4711') === NaN) {\n doSomething();\n }\n "]))),
},
];
var templateObject_1, templateObject_2, templateObject_3;