How to use typescript method in ava

Best JavaScript code snippet using ava

tsShim.js

Source:tsShim.js Github

copy

Full Screen

1"use strict";2Object.defineProperty(exports, "__esModule", { value: true });3var ts = require("typescript");4var typescript_1 = require("typescript");5exports.getMeaningFromLocation = ts.getMeaningFromLocation6 || function (node) {7 if (node.parent.kind === typescript_1.SyntaxKind.ExportAssignment) {8 return 1 | 2 | 4;9 }10 else if (isInRightSideOfImport(node)) {11 return getMeaningFromRightHandSideOfImportEquals(node);12 }13 else if (ts.isDeclarationName(node)) {14 return exports.getMeaningFromDeclaration(node.parent);15 }16 else if (isTypeReference(node)) {17 return 2;18 }19 else if (isNamespaceReference(node)) {20 return 4;21 }22 else {23 return 1;24 }25 };26exports.getMeaningFromDeclaration = ts.getMeaningFromDeclaration27 || function (node) {28 switch (node.kind) {29 case typescript_1.SyntaxKind.Parameter:30 case typescript_1.SyntaxKind.VariableDeclaration:31 case typescript_1.SyntaxKind.BindingElement:32 case typescript_1.SyntaxKind.PropertyDeclaration:33 case typescript_1.SyntaxKind.PropertySignature:34 case typescript_1.SyntaxKind.PropertyAssignment:35 case typescript_1.SyntaxKind.ShorthandPropertyAssignment:36 case typescript_1.SyntaxKind.EnumMember:37 case typescript_1.SyntaxKind.MethodDeclaration:38 case typescript_1.SyntaxKind.MethodSignature:39 case typescript_1.SyntaxKind.Constructor:40 case typescript_1.SyntaxKind.GetAccessor:41 case typescript_1.SyntaxKind.SetAccessor:42 case typescript_1.SyntaxKind.FunctionDeclaration:43 case typescript_1.SyntaxKind.FunctionExpression:44 case typescript_1.SyntaxKind.ArrowFunction:45 case typescript_1.SyntaxKind.CatchClause:46 return 1;47 case typescript_1.SyntaxKind.TypeParameter:48 case typescript_1.SyntaxKind.InterfaceDeclaration:49 case typescript_1.SyntaxKind.TypeAliasDeclaration:50 case typescript_1.SyntaxKind.TypeLiteral:51 return 2;52 case typescript_1.SyntaxKind.ClassDeclaration:53 case typescript_1.SyntaxKind.EnumDeclaration:54 return 1 | 2;55 case typescript_1.SyntaxKind.ModuleDeclaration:56 if (ts.isAmbientModule(node)) {57 return 4 | 1;58 }59 else if (ts.getModuleInstanceState(node) === 1) {60 return 4 | 1;61 }62 else {63 return 4;64 }65 case typescript_1.SyntaxKind.NamedImports:66 case typescript_1.SyntaxKind.ImportSpecifier:67 case typescript_1.SyntaxKind.ImportEqualsDeclaration:68 case typescript_1.SyntaxKind.ImportDeclaration:69 case typescript_1.SyntaxKind.ExportAssignment:70 case typescript_1.SyntaxKind.ExportDeclaration:71 return 1 | 2 | 4;72 case typescript_1.SyntaxKind.SourceFile:73 return 4 | 1;74 }75 return 1 | 2 | 4;76 };77function isInRightSideOfImport(node) {78 while (node.parent.kind === typescript_1.SyntaxKind.QualifiedName) {79 node = node.parent;80 }81 return isInternalModuleImportEqualsDeclaration(node.parent) && (node.parent).moduleReference === node;82}83function isInternalModuleImportEqualsDeclaration(node) {84 return node.kind === typescript_1.SyntaxKind.ImportEqualsDeclaration && node.moduleReference.kind !== typescript_1.SyntaxKind.ExternalModuleReference;85}86function getMeaningFromRightHandSideOfImportEquals(node) {87 if (node.parent.kind === typescript_1.SyntaxKind.QualifiedName &&88 (node.parent).right === node &&89 node.parent.parent.kind === typescript_1.SyntaxKind.ImportEqualsDeclaration) {90 return 1 | 2 | 4;91 }92 return 4;93}94function isTypeReference(node) {95 if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) {96 node = node.parent;97 }98 return node.parent.kind === typescript_1.SyntaxKind.TypeReference ||99 (node.parent.kind === typescript_1.SyntaxKind.ExpressionWithTypeArguments && !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent)) ||100 (node.kind === typescript_1.SyntaxKind.ThisKeyword && !isPartOfExpression(node)) ||101 node.kind === typescript_1.SyntaxKind.ThisType;102}103function isNamespaceReference(node) {104 return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node);105}106function isQualifiedNameNamespaceReference(node) {107 var root = node;108 var isLastClause = true;109 if (root.parent.kind === typescript_1.SyntaxKind.QualifiedName) {110 while (root.parent && root.parent.kind === typescript_1.SyntaxKind.QualifiedName) {111 root = root.parent;112 }113 isLastClause = (root).right === node;114 }115 return root.parent.kind === typescript_1.SyntaxKind.TypeReference && !isLastClause;116}117function isPropertyAccessNamespaceReference(node) {118 var root = node;119 var isLastClause = true;120 if (root.parent.kind === typescript_1.SyntaxKind.PropertyAccessExpression) {121 while (root.parent && root.parent.kind === typescript_1.SyntaxKind.PropertyAccessExpression) {122 root = root.parent;123 }124 isLastClause = (root).name === node;125 }126 if (!isLastClause && root.parent.kind === typescript_1.SyntaxKind.ExpressionWithTypeArguments && root.parent.parent.kind === typescript_1.SyntaxKind.HeritageClause) {127 var decl = root.parent.parent.parent;128 return (decl.kind === typescript_1.SyntaxKind.ClassDeclaration && (root.parent.parent).token === typescript_1.SyntaxKind.ImplementsKeyword) ||129 (decl.kind === typescript_1.SyntaxKind.InterfaceDeclaration && (root.parent.parent).token === typescript_1.SyntaxKind.ExtendsKeyword);130 }131 return false;132}133function isPartOfExpression(node) {134 switch (node.kind) {135 case typescript_1.SyntaxKind.ThisKeyword:136 case typescript_1.SyntaxKind.SuperKeyword:137 case typescript_1.SyntaxKind.NullKeyword:138 case typescript_1.SyntaxKind.TrueKeyword:139 case typescript_1.SyntaxKind.FalseKeyword:140 case typescript_1.SyntaxKind.RegularExpressionLiteral:141 case typescript_1.SyntaxKind.ArrayLiteralExpression:142 case typescript_1.SyntaxKind.ObjectLiteralExpression:143 case typescript_1.SyntaxKind.PropertyAccessExpression:144 case typescript_1.SyntaxKind.ElementAccessExpression:145 case typescript_1.SyntaxKind.CallExpression:146 case typescript_1.SyntaxKind.NewExpression:147 case typescript_1.SyntaxKind.TaggedTemplateExpression:148 case typescript_1.SyntaxKind.AsExpression:149 case typescript_1.SyntaxKind.TypeAssertionExpression:150 case typescript_1.SyntaxKind.NonNullExpression:151 case typescript_1.SyntaxKind.ParenthesizedExpression:152 case typescript_1.SyntaxKind.FunctionExpression:153 case typescript_1.SyntaxKind.ClassExpression:154 case typescript_1.SyntaxKind.ArrowFunction:155 case typescript_1.SyntaxKind.VoidExpression:156 case typescript_1.SyntaxKind.DeleteExpression:157 case typescript_1.SyntaxKind.TypeOfExpression:158 case typescript_1.SyntaxKind.PrefixUnaryExpression:159 case typescript_1.SyntaxKind.PostfixUnaryExpression:160 case typescript_1.SyntaxKind.BinaryExpression:161 case typescript_1.SyntaxKind.ConditionalExpression:162 case typescript_1.SyntaxKind.TemplateExpression:163 case typescript_1.SyntaxKind.NoSubstitutionTemplateLiteral:164 case typescript_1.SyntaxKind.OmittedExpression:165 case typescript_1.SyntaxKind.JsxElement:166 case typescript_1.SyntaxKind.JsxSelfClosingElement:167 case typescript_1.SyntaxKind.YieldExpression:168 case typescript_1.SyntaxKind.AwaitExpression:169 return true;170 case typescript_1.SyntaxKind.QualifiedName:171 while (node.parent.kind === typescript_1.SyntaxKind.QualifiedName) {172 node = node.parent;173 }174 return node.parent.kind === typescript_1.SyntaxKind.TypeQuery || ts.isJSXTagName(node);175 case typescript_1.SyntaxKind.Identifier:176 if (node.parent.kind === typescript_1.SyntaxKind.TypeQuery || ts.isJSXTagName(node)) {177 return true;178 }179 case typescript_1.SyntaxKind.NumericLiteral:180 case typescript_1.SyntaxKind.StringLiteral:181 case typescript_1.SyntaxKind.ThisKeyword:182 var parent_1 = node.parent;183 switch (parent_1.kind) {184 case typescript_1.SyntaxKind.VariableDeclaration:185 case typescript_1.SyntaxKind.Parameter:186 case typescript_1.SyntaxKind.PropertyDeclaration:187 case typescript_1.SyntaxKind.PropertySignature:188 case typescript_1.SyntaxKind.EnumMember:189 case typescript_1.SyntaxKind.PropertyAssignment:190 case typescript_1.SyntaxKind.BindingElement:191 return (parent_1).initializer === node;192 case typescript_1.SyntaxKind.ExpressionStatement:193 case typescript_1.SyntaxKind.IfStatement:194 case typescript_1.SyntaxKind.DoStatement:195 case typescript_1.SyntaxKind.WhileStatement:196 case typescript_1.SyntaxKind.ReturnStatement:197 case typescript_1.SyntaxKind.WithStatement:198 case typescript_1.SyntaxKind.SwitchStatement:199 case typescript_1.SyntaxKind.CaseClause:200 case typescript_1.SyntaxKind.ThrowStatement:201 case typescript_1.SyntaxKind.SwitchStatement:202 return (parent_1).expression === node;203 case typescript_1.SyntaxKind.ForStatement:204 var forStatement = parent_1;205 return (forStatement.initializer === node && forStatement.initializer.kind !== typescript_1.SyntaxKind.VariableDeclarationList) ||206 forStatement.condition === node ||207 forStatement.incrementor === node;208 case typescript_1.SyntaxKind.ForInStatement:209 case typescript_1.SyntaxKind.ForOfStatement:210 var forInStatement = parent_1;211 return (forInStatement.initializer === node && forInStatement.initializer.kind !== typescript_1.SyntaxKind.VariableDeclarationList) ||212 forInStatement.expression === node;213 case typescript_1.SyntaxKind.TypeAssertionExpression:214 case typescript_1.SyntaxKind.AsExpression:215 return node === (parent_1).expression;216 case typescript_1.SyntaxKind.TemplateSpan:217 return node === (parent_1).expression;218 case typescript_1.SyntaxKind.ComputedPropertyName:219 return node === (parent_1).expression;220 case typescript_1.SyntaxKind.Decorator:221 case typescript_1.SyntaxKind.JsxExpression:222 case typescript_1.SyntaxKind.JsxSpreadAttribute:223 return true;224 case typescript_1.SyntaxKind.ExpressionWithTypeArguments:225 return (parent_1).expression === node && ts.isExpressionWithTypeArgumentsInClassExtendsClause(parent_1);226 default:227 if (isPartOfExpression(parent_1)) {228 return true;229 }230 }231 }232 return false;233}234function getThisMemberSymbolKind(typeChecker, symbol, location) {235 if (ts.SymbolDisplay && ts.SymbolDisplay.getSymbolKind) {236 return ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location);237 }238 var flags = symbol.getFlags();239 if (flags & typescript_1.SymbolFlags.Class)240 return ts.getDeclarationOfKind(symbol, typescript_1.SyntaxKind.ClassExpression) ?241 typescript_1.ScriptElementKind.localClassElement : typescript_1.ScriptElementKind.classElement;242 if (flags & typescript_1.SymbolFlags.Enum)243 return typescript_1.ScriptElementKind.enumElement;244 if (flags & typescript_1.SymbolFlags.TypeAlias)245 return typescript_1.ScriptElementKind.typeElement;246 if (flags & typescript_1.SymbolFlags.Interface)247 return typescript_1.ScriptElementKind.interfaceElement;248 if (flags & typescript_1.SymbolFlags.TypeParameter)249 return typescript_1.ScriptElementKind.typeParameterElement;250 var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags);251 if (result === typescript_1.ScriptElementKind.unknown) {252 if (flags & typescript_1.SymbolFlags.TypeParameter)253 return typescript_1.ScriptElementKind.typeParameterElement;254 if (flags & typescript_1.SymbolFlags.EnumMember)255 return typescript_1.ScriptElementKind.variableElement;256 if (flags & typescript_1.SymbolFlags.Alias)257 return typescript_1.ScriptElementKind.alias;258 if (flags & typescript_1.SymbolFlags.Module)259 return typescript_1.ScriptElementKind.moduleElement;260 }261 return result;262}263exports.getThisMemberSymbolKind = getThisMemberSymbolKind;264function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, flags) {265 if (typeChecker.isUndefinedSymbol(symbol)) {266 return typescript_1.ScriptElementKind.variableElement;267 }268 if (typeChecker.isArgumentsSymbol(symbol)) {269 return typescript_1.ScriptElementKind.localVariableElement;270 }271 if (flags & typescript_1.SymbolFlags.GetAccessor)272 return typescript_1.ScriptElementKind.memberGetAccessorElement;273 if (flags & typescript_1.SymbolFlags.SetAccessor)274 return typescript_1.ScriptElementKind.memberSetAccessorElement;275 if (flags & typescript_1.SymbolFlags.Method)276 return typescript_1.ScriptElementKind.memberFunctionElement;277 if (flags & typescript_1.SymbolFlags.Constructor)278 return typescript_1.ScriptElementKind.constructorImplementationElement;279 if (flags & typescript_1.SymbolFlags.Property) {280 if (flags & typescript_1.SymbolFlags["SyntheticProperty"]) {281 var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) {282 var rootSymbolFlags = rootSymbol.getFlags();283 if (rootSymbolFlags & (typescript_1.SymbolFlags.PropertyOrAccessor | typescript_1.SymbolFlags.Variable)) {284 return typescript_1.ScriptElementKind.memberVariableElement;285 }286 });287 if (!unionPropertyKind) {288 return typescript_1.ScriptElementKind.memberVariableElement;289 }290 return unionPropertyKind;291 }292 return typescript_1.ScriptElementKind.memberVariableElement;293 }294 return typescript_1.ScriptElementKind.unknown;...

Full Screen

Full Screen

.eslintrc.js

Source:.eslintrc.js Github

copy

Full Screen

1module.exports = {2 "env": {3 "browser": true,4 "es6": true,5 "node": true6 },7 "parser": "@typescript-eslint/parser",8 "parserOptions": {9 "project": "src/tsconfig.node.json",10 "sourceType": "module"11 },12 "plugins": [13 "@typescript-eslint",14 "import",15 "jsdoc",16 "prefer-arrow",17 "unicorn"18 ],19 "rules": {20 "@typescript-eslint/adjacent-overload-signatures": "error",21 "@typescript-eslint/array-type": [22 "error",23 {24 "default": "array"25 }26 ],27 "@typescript-eslint/await-thenable": "error",28 "@typescript-eslint/ban-ts-comment": "error",29 "@typescript-eslint/ban-types": "off",30 "@typescript-eslint/brace-style": [31 "error",32 "1tbs",33 {34 "allowSingleLine": true35 }36 ],37 "@typescript-eslint/camelcase": "off",38 "@typescript-eslint/comma-spacing": "error",39 "@typescript-eslint/consistent-type-assertions": [40 "error",41 {42 "assertionStyle": "angle-bracket"43 }44 ],45 "@typescript-eslint/consistent-type-definitions": "error",46 "@typescript-eslint/default-param-last": "error",47 "@typescript-eslint/explicit-function-return-type": "error",48 "@typescript-eslint/explicit-member-accessibility": [49 "error",50 {51 "accessibility": "explicit"52 }53 ],54 "@typescript-eslint/explicit-module-boundary-types": "error",55 "@typescript-eslint/func-call-spacing": "error",56 "@typescript-eslint/indent": [57 "off",58 459 ],60 "@typescript-eslint/member-delimiter-style": [61 "error",62 {63 "multiline": {64 "delimiter": "semi",65 "requireLast": true66 },67 "singleline": {68 "delimiter": "semi",69 "requireLast": false70 }71 }72 ],73 "@typescript-eslint/member-ordering": "error",74 "@typescript-eslint/naming-convention": [75 "error",76 {77 "selector": "default",78 "format": ["camelCase", "PascalCase"]79 },80 {81 "selector": "variable",82 "format": ["camelCase", "PascalCase", "UPPER_CASE"]83 },84 {85 "selector": "function",86 "format": ["camelCase", "PascalCase"]87 },88 {89 "selector": "class",90 "format": ["PascalCase"]91 },92 {93 "selector": "interface",94 "format": ["PascalCase"],95 "prefix": ["I"]96 },97 {98 "selector": "typeAlias",99 "format": ["PascalCase"],100 "prefix": ["T"]101 },102 {103 "selector": "typeParameter",104 "format": ["PascalCase"]105 },106 {107 "selector": "enum",108 "format": ["PascalCase"]109 },110 {111 "selector": "enumMember",112 "format": null113 },114 {115 "selector": "property",116 "format": ["camelCase", "PascalCase", "snake_case"]117 }118 ],119 "@typescript-eslint/no-empty-function": "off",120 "@typescript-eslint/no-empty-interface": "error",121 "@typescript-eslint/no-explicit-any": "off",122 "@typescript-eslint/no-extra-parens": "off",123 "@typescript-eslint/no-floating-promises": "error",124 "@typescript-eslint/no-for-in-array": "error",125 "@typescript-eslint/no-inferrable-types": "off",126 "@typescript-eslint/no-magic-numbers": "off",127 "@typescript-eslint/no-misused-new": "error",128 "@typescript-eslint/no-namespace": "error",129 "@typescript-eslint/no-non-null-asserted-optional-chain": "error",130 "@typescript-eslint/no-non-null-assertion": "error",131 "@typescript-eslint/no-param-reassign": "off",132 "@typescript-eslint/no-parameter-properties": "error",133 "@typescript-eslint/no-require-imports": "off",134 "@typescript-eslint/no-shadow": "error",135 "@typescript-eslint/no-this-alias": "error",136 "@typescript-eslint/no-unnecessary-qualifier": "error",137 "@typescript-eslint/no-unnecessary-type-arguments": "error",138 "@typescript-eslint/no-unnecessary-type-assertion": "error",139 "@typescript-eslint/no-unused-expressions": "error",140 "@typescript-eslint/no-use-before-define": "off",141 "@typescript-eslint/no-var-requires": "error",142 "@typescript-eslint/prefer-for-of": "error",143 "@typescript-eslint/prefer-function-type": "error",144 "@typescript-eslint/prefer-namespace-keyword": "error",145 "@typescript-eslint/prefer-nullish-coalescing": "error",146 "@typescript-eslint/prefer-optional-chain": "error",147 "@typescript-eslint/prefer-readonly": "error",148 "@typescript-eslint/promise-function-async": "error",149 "@typescript-eslint/quotes": [150 "error",151 "single"152 ],153 "@typescript-eslint/require-array-sort-compare": "error",154 "@typescript-eslint/restrict-plus-operands": "error",155 "@typescript-eslint/semi": [156 "error",157 "always"158 ],159 "@typescript-eslint/space-before-function-paren": "error",160 "@typescript-eslint/strict-boolean-expressions": "off",161 "@typescript-eslint/triple-slash-reference": "error",162 "@typescript-eslint/type-annotation-spacing": "error",163 "@typescript-eslint/typedef": "error",164 "@typescript-eslint/unified-signatures": "error",165 "arrow-body-style": "off",166 "arrow-parens": [167 "off",168 "as-needed"169 ],170 "brace-style": "off",171 "capitalized-comments": "off",172 "comma-dangle": "off",173 "comma-spacing": "off",174 "complexity": [175 "error",176 {177 "max": 10178 }179 ],180 "constructor-super": "error",181 "curly": "error",182 "default-case": "off",183 "dot-notation": "error",184 "eol-last": "error",185 "eqeqeq": [186 "error",187 "smart"188 ],189 "func-call-spacing": "off",190 "guard-for-in": "error",191 "id-blacklist": "off",192 "id-match": "off",193 "import/export": "error",194 "import/first": "error",195 "import/newline-after-import": "error",196 "import/no-absolute-path": "error",197 "import/no-cycle": "error",198 "import/no-default-export": "error",199 "import/no-deprecated": "error",200 "import/no-extraneous-dependencies": "error",201 "import/no-internal-modules": "error",202 "import/no-mutable-exports": "error",203 "import/no-unassigned-import": "off",204 "import/no-useless-path-segments": "error",205 "import/order": "off",206 "indent": "off",207 "jsdoc/no-types": "off",208 "linebreak-style": "off",209 "max-classes-per-file": [210 "error",211 1212 ],213 "max-len": "off",214 "max-lines": [215 "error",216 500217 ],218 "new-parens": "error",219 "newline-per-chained-call": "off",220 "no-bitwise": "off",221 "no-caller": "error",222 "no-cond-assign": "error",223 "no-console": [224 "error",225 {226 "allow": [227 "log",228 "warn",229 "dir",230 "timeLog",231 "assert",232 "clear",233 "count",234 "countReset",235 "group",236 "groupEnd",237 "table",238 "dirxml",239 "error",240 "groupCollapsed",241 "Console",242 "profile",243 "profileEnd",244 "timeStamp",245 "context"246 ]247 }248 ],249 "no-constant-condition": "error",250 "no-control-regex": "off",251 "no-debugger": "error",252 "no-duplicate-case": "error",253 "no-duplicate-imports": "error",254 "no-empty": "off",255 "no-eval": "off",256 "no-extra-bind": "error",257 "no-extra-parens": "off",258 "no-extra-semi": "error",259 "no-fallthrough": "error",260 "no-invalid-regexp": "error",261 "no-invalid-this": "off",262 "no-irregular-whitespace": "error",263 "no-magic-numbers": "off",264 "no-multi-str": "error",265 "no-multiple-empty-lines": "error",266 "no-new-wrappers": "error",267 "no-null/no-null": "off",268 "no-octal": "error",269 "no-octal-escape": "error",270 "no-redeclare": "error",271 "no-regex-spaces": "error",272 "no-restricted-syntax": [273 "error",274 "ForInStatement"275 ],276 "no-return-await": "error",277 "no-sequences": "error",278 "no-shadow": "off",279 "no-sparse-arrays": "error",280 "no-template-curly-in-string": "error",281 "no-throw-literal": "error",282 "no-trailing-spaces": [283 "error",284 {285 "skipBlankLines": true286 }287 ],288 "no-undef-init": "error",289 "no-underscore-dangle": "off",290 "no-unsafe-finally": "error",291 "no-unused-expressions": "off",292 "no-unused-labels": "error",293 "no-var": "error",294 "no-void": "error",295 "object-shorthand": "off",296 "one-var": [297 "error",298 "never"299 ],300 "padding-line-between-statements": [301 "error",302 {303 "blankLine": "always",304 "prev": "*",305 "next": "return"306 }307 ],308 "prefer-arrow/prefer-arrow-functions": "off",309 "prefer-const": "error",310 "prefer-object-spread": "error",311 "prefer-template": "error",312 "quote-props": [313 "error",314 "as-needed"315 ],316 "quotes": "off",317 "radix": "error",318 "space-before-function-paren": "off",319 "spaced-comment": "error",320 "space-in-parens": [321 "error",322 "never"323 ],324 "unicorn/catch-error-name": [325 "error",326 {327 "name": "error"328 }329 ],330 "unicorn/no-nested-ternary": "error",331 "unicorn/no-unreadable-array-destructuring": "error",332 "unicorn/numeric-separators-style": [333 "error",334 {335 number: {336 minimumDigits: 7,337 groupLength: 3338 }339 }340 ],341 "unicorn/prefer-array-find": "error",342 "unicorn/prefer-includes": "error",343 "unicorn/prefer-optional-catch-binding": "error",344 "unicorn/prefer-starts-ends-with": "error",345 "unicorn/prefer-set-has": "error",346 "unicorn/prefer-string-slice": "error",347 "unicorn/prefer-string-trim-start-end": "error",348 "use-isnan": "error",349 "valid-typeof": "error",350 "yoda": "error"351 }...

Full Screen

Full Screen

base.ts

Source:base.ts Github

copy

Full Screen

1import type { Linter } from 'eslint'2import { SharedEditorConfig } from '@fellwork/eslint-shared'3export const typescriptBase: Linter.BaseConfig = {4 rules: {5 '@typescript-eslint/await-thenable': 'off',6 '@typescript-eslint/consistent-type-exports': 'off',7 '@typescript-eslint/naming-convention': 'off',8 '@typescript-eslint/no-base-to-string': 'off',9 '@typescript-eslint/no-confusing-void-expression': 'off',10 '@typescript-eslint/no-floating-promises': 'off',11 '@typescript-eslint/no-meaningless-void-operator': 'off',12 '@typescript-eslint/no-misused-promises': 'off',13 '@typescript-eslint/prefer-regexp-exec': 'off',14 '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',15 '@typescript-eslint/no-unnecessary-condition': 'off',16 '@typescript-eslint/no-unnecessary-qualifier': 'off',17 '@typescript-eslint/no-unnecessary-type-arguments': 'off',18 '@typescript-eslint/no-unnecessary-type-assertion': 'off',19 '@typescript-eslint/no-unsafe-argument': 'off',20 '@typescript-eslint/no-unsafe-assignment': 'off',21 '@typescript-eslint/no-unsafe-call': 'off',22 '@typescript-eslint/no-unsafe-member-access': 'off',23 '@typescript-eslint/no-unsafe-return': 'off',24 '@typescript-eslint/non-nullable-type-assertion-style': 'off',25 '@typescript-eslint/prefer-includes': 'off',26 '@typescript-eslint/prefer-reduce-type-parameter': 'off',27 '@typescript-eslint/prefer-string-starts-ends-with': 'off',28 '@typescript-eslint/prefer-return-this-type': 'off',29 '@typescript-eslint/promise-function-async': 'off',30 '@typescript-eslint/require-array-sort-compare': 'off',31 '@typescript-eslint/restrict-plus-operands': 'off',32 '@typescript-eslint/switch-exhaustiveness-check': 'off',33 '@typescript-eslint/unbound-method': 'off',34 '@typescript-eslint/dot-notation': 'off',35 '@typescript-eslint/require-await': 'off',36 '@typescript-eslint/return-await': 'off',37 '@typescript-eslint/no-for-in-array': 'off',38 '@typescript-eslint/prefer-nullish-coalescing': 'off',39 '@typescript-eslint/prefer-readonly': 'off',40 '@typescript-eslint/prefer-readonly-parameter-types': 'off',41 '@typescript-eslint/no-implied-eval': 'off',42 '@typescript-eslint/no-require-imports': 'off',43 '@typescript-eslint/restrict-template-expressions': 'off',44 '@typescript-eslint/strict-boolean-expressions': 'off',45 '@typescript-eslint/no-throw-literal': 'off',46 // Off47 'no-undef': 'off',48 '@typescript-eslint/ban-tslint-comment': 'off',49 '@typescript-eslint/no-extraneous-class': 'off',50 '@typescript-eslint/no-parameter-properties': 'off',51 '@typescript-eslint/typedef': 'off',52 '@typescript-eslint/no-type-alias': 'off',53 '@typescript-eslint/adjacent-overload-signatures': 'warn',54 // Warn or error55 'indent': 'off',56 '@typescript-eslint/indent': ['warn', SharedEditorConfig.indent_size, {57 SwitchCase: 1,58 VariableDeclarator: 1,59 outerIIFEBody: 1,60 MemberExpression: 1,61 FunctionDeclaration: { parameters: 1, body: 1 },62 FunctionExpression: { parameters: 1, body: 1 },63 CallExpression: { arguments: 1 },64 ArrayExpression: 1,65 ObjectExpression: 1,66 ImportDeclaration: 1,67 flatTernaryExpressions: false,68 ignoreComments: false,69 ignoredNodes: [70 'TemplateLiteral *',71 'JSXElement',72 'JSXElement > *',73 'JSXAttribute',74 'JSXIdentifier',75 'JSXNamespacedName',76 'JSXMemberExpression',77 'JSXSpreadAttribute',78 'JSXExpressionContainer',79 'JSXOpeningElement',80 'JSXClosingElement',81 'JSXFragment',82 'JSXOpeningFragment',83 'JSXClosingFragment',84 'JSXText',85 'JSXEmptyExpression',86 'JSXSpreadChild',87 'TSTypeParameterInstantiation',88 ],89 offsetTernaryExpressions: true,90 }],91 '@typescript-eslint/array-type': [92 'warn',93 {94 default: 'array-simple',95 },96 ],97 '@typescript-eslint/ban-ts-comment': [98 'warn',99 {100 'ts-expect-error': 'allow-with-description',101 'ts-ignore': 'allow-with-description',102 'ts-nocheck': 'allow-with-description',103 'ts-check': 'allow-with-description',104 'minimumDescriptionLength': 5,105 },106 ],107 '@typescript-eslint/consistent-type-assertions': [108 'warn',109 {110 assertionStyle: 'as',111 objectLiteralTypeAssertions: 'allow-as-parameter',112 },113 ],114 '@typescript-eslint/explicit-function-return-type': [115 'warn',116 {117 allowExpressions: true,118 },119 ],120 '@typescript-eslint/explicit-module-boundary-types': 'warn',121 '@typescript-eslint/member-delimiter-style': ['warn', { multiline: { delimiter: 'none' } }],122 '@typescript-eslint/member-ordering': 'warn',123 '@typescript-eslint/no-confusing-non-null-assertion': 'warn',124 '@typescript-eslint/no-empty-interface': [125 'warn',126 {127 allowSingleExtends: true,128 },129 ],130 '@typescript-eslint/no-explicit-any': 'error',131 '@typescript-eslint/no-extra-non-null-assertion': 'warn',132 '@typescript-eslint/no-implicit-any-catch': 'warn',133 '@typescript-eslint/no-inferrable-types': 'warn',134 '@typescript-eslint/no-invalid-void-type': 'warn',135 '@typescript-eslint/no-non-null-assertion': 'warn',136 '@typescript-eslint/no-unnecessary-type-constraint': 'warn',137 '@typescript-eslint/prefer-as-const': 'warn',138 '@typescript-eslint/prefer-enum-initializers': 'warn',139 '@typescript-eslint/prefer-literal-enum-member': 'warn',140 '@typescript-eslint/prefer-ts-expect-error': 'warn',141 '@typescript-eslint/sort-type-union-intersection-members': 'warn',142 '@typescript-eslint/type-annotation-spacing': ['warn', {}],143 '@typescript-eslint/unified-signatures': 'warn',144 // Style145 'brace-style': 'off',146 '@typescript-eslint/brace-style': ['warn', 'stroustrup', { allowSingleLine: true }],147 'comma-dangle': 'off',148 '@typescript-eslint/comma-dangle': ['warn', 'always-multiline'],149 'comma-spacing': 'off',150 '@typescript-eslint/comma-spacing': ['warn', { before: false, after: true }],151 'default-param-last': 'off',152 '@typescript-eslint/default-param-last': 'warn',153 'func-call-spacing': 'off',154 '@typescript-eslint/func-call-spacing': 'warn',155 'keyword-spacing': 'off',156 '@typescript-eslint/keyword-spacing': ['warn', { before: true, after: true }],157 'lines-between-class-members': 'off',158 '@typescript-eslint/lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],159 'no-array-constructor': 'off',160 '@typescript-eslint/no-array-constructor': 'warn',161 'no-empty-function': 'off',162 '@typescript-eslint/no-empty-function': 'warn',163 'no-extra-parens': 'off',164 '@typescript-eslint/no-extra-parens': ['warn', 'functions'],165 'no-extra-semi': 'off',166 '@typescript-eslint/semi': ['warn', 'never'],167 'no-loss-of-precision': 'off',168 '@typescript-eslint/no-loss-of-precision': 'warn',169 'no-magic-numbers': 'off',170 '@typescript-eslint/no-magic-numbers': [171 'warn',172 {173 ignoreEnums: true,174 ignore: [0, 1],175 },176 ],177 'no-shadow': 'off',178 '@typescript-eslint/no-shadow': 'warn',179 'no-unused-expressions': 'off',180 '@typescript-eslint/no-unused-expressions': 'warn',181 'no-unused-vars': 'off',182 '@typescript-eslint/no-unused-vars': [183 'warn',184 {185 argsIgnorePattern: '^_',186 },187 ],188 'no-useless-constructor': 'off',189 '@typescript-eslint/no-useless-constructor': 'warn',190 'object-curly-spacing': 'off',191 '@typescript-eslint/object-curly-spacing': ['warn', 'always'],192 'quotes': 'off',193 '@typescript-eslint/quotes': ['warn', 'single'],194 'semi': 'off',195 'space-before-blocks': 'off',196 '@typescript-eslint/space-before-blocks': ['error', 'always'],197 'space-before-function-paren': 'off',198 '@typescript-eslint/space-before-function-paren': [199 'warn',200 {201 named: 'never',202 anonymous: 'always',203 asyncArrow: 'always',204 },205 ],206 'space-infix-ops': 'off',207 '@typescript-eslint/space-infix-ops': 'warn',208 '@typescript-eslint/prefer-function-type': 'error',209 '@typescript-eslint/ban-types': [210 'error',211 {212 extendDefaults: true,213 },214 ],215 '@typescript-eslint/class-literal-property-style': 'error',216 '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],217 '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],218 '@typescript-eslint/consistent-type-imports': [219 'error',220 {221 prefer: 'type-imports',222 disallowTypeAnnotations: false,223 },224 ],225 '@typescript-eslint/explicit-member-accessibility': [226 'error',227 {228 accessibility: 'explicit',229 },230 ],231 '@typescript-eslint/method-signature-style': 'error',232 '@typescript-eslint/no-dynamic-delete': 'error',233 '@typescript-eslint/no-misused-new': 'error',234 '@typescript-eslint/no-namespace': 'error',235 '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',236 '@typescript-eslint/no-this-alias': 'error',237 '@typescript-eslint/no-var-requires': 'error',238 '@typescript-eslint/prefer-for-of': 'error',239 '@typescript-eslint/prefer-namespace-keyword': 'error',240 '@typescript-eslint/triple-slash-reference': [241 'error',242 {243 path: 'never',244 types: 'never',245 lib: 'never',246 },247 ],248 'init-declarations': 'off',249 '@typescript-eslint/init-declarations': 'error',250 'no-dupe-class-members': 'off',251 '@typescript-eslint/no-dupe-class-members': 'error',252 'no-duplicate-imports': 'off',253 '@typescript-eslint/no-duplicate-imports': 'error',254 'no-invalid-this': 'off',255 '@typescript-eslint/no-invalid-this': 'error',256 'no-loop-func': 'off',257 '@typescript-eslint/no-loop-func': 'error',258 'no-redeclare': 'off',259 '@typescript-eslint/no-redeclare': 'error',260 'no-use-before-define': 'off',261 '@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: false, variables: true }],262 },...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import * as available from "./available";2import * as unavailable from "./unavailable";3var available = require("./available");4var unavailable = require("./unavailable");5available.available();6unavailable.unavailable();7available.available();8unavailable.unavailable();9export function available() {10 console.log("available");11}12export function unavailable() {13 console.log("unavailable");14}15exports.available = function() {16 console.log("available");17}18exports.unavailable = function() {19 console.log("unavailable");20}21{22 "compilerOptions": {23 }24}25{26 "scripts": {27 },28 "devDependencies": {29 }30}

Full Screen

Using AI Code Generation

copy

Full Screen

1const __dirname = dirname(new URL(import.meta.url).pathname);2const file = Deno.args[0];3const path = __dirname + '/' + file;4if (await available(path)) {5 console.log('File available');6} else {7 console.log('File not available');8}

Full Screen

Using AI Code Generation

copy

Full Screen

1var typescript = require('typescript');2var fs = require('fs');3var ts = fs.readFileSync('test.ts').toString();4var result = typescript.transpile(ts);5console.log(result);6var typescript = require('typescript');7var fs = require('fs');8var ts = fs.readFileSync('test.ts').toString();9var result = typescript.transpile(ts);10console.log(result);11var typescript = require('typescript');12var fs = require('fs');13var ts = fs.readFileSync('test.ts').toString();14var result = typescript.transpile(ts);15console.log(result);16var typescript = require('typescript');17var fs = require('fs');18var ts = fs.readFileSync('test.ts').toString();19var result = typescript.transpile(ts);20console.log(result);21var typescript = require('typescript');22var fs = require('fs');23var ts = fs.readFileSync('test.ts').toString();24var result = typescript.transpile(ts);25console.log(result);26var typescript = require('typescript');27var fs = require('fs');28var ts = fs.readFileSync('test.ts').toString();29var result = typescript.transpile(ts);30console.log(result);31var typescript = require('typescript');32var fs = require('fs');33var ts = fs.readFileSync('test.ts').toString();34var result = typescript.transpile(ts);35console.log(result);36var typescript = require('typescript');37var fs = require('fs');38var ts = fs.readFileSync('test.ts').toString();39var result = typescript.transpile(ts);40console.log(result);41var typescript = require('typescript');42var fs = require('fs');43var ts = fs.readFileSync('test.ts').toString();44var result = typescript.transpile(ts);45console.log(result);

Full Screen

Using AI Code Generation

copy

Full Screen

1var available = require('./available');2console.log(available);3var available = require('./available');4console.log(available);5function available() {6 console.log("available");7}8exports.available = available;9var available = require('./available');10console.log(available);11function available() {12 console.log("available");13}14exports.available = available;15var available = require('./available');16console.log(available);17var available = require('./available');18console.log(available);19function available() {20 console.log("available");21}22exports.available = available;23var available = require('./available');24console.log(available);25function available() {26 console.log("available");27}28exports.available = available;29var available = require('./available');30console.log(available);31var available = require('./available');32console.log(available);33function available() {34 console.log("available");35}36exports.available = available;37var available = require('./available');38console.log(available);39function available() {40 console.log("available");41}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { available } from "./available";2available();3export function available() {4 console.log("available");5}6"use strict";7exports.__esModule = true;8exports.available = void 0;9function available() {10 console.log("available");11}12exports.available = available;13export declare function available(): void;

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ava automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful