Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
chore: update versions (next) (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] authored Jun 7, 2022
1 parent 4a53a77 commit 96c0eef
Show file tree
Hide file tree
Showing 23,585 changed files with 3,088,908 additions and 3 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
"initialVersions": {
"generator-verdaccio-plugin": "3.0.1"
},
"changesets": []
"changesets": [
"early-ads-flow"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

var testArray = function testArray(t, actual, expected, msg) {
t.deepEqual(actual, expected, msg);
t.equal(actual.length, expected.length, 'expected ' + expected.length + ', got ' + actual.length);
};

module.exports = function (flat, t) {
t.test('flattens', function (st) {
testArray(st, flat([1, [2], [[3]], [[['four']]]]), [1, 2, [3], [['four']]], 'missing depth only flattens 1 deep');

testArray(st, flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, [3], [['four']]], 'depth of 1 only flattens 1 deep');
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 1), [1, 2, 3, ['four']], 'depth of 1 only flattens 1 deep: sanity check');

testArray(st, flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, ['four']], 'depth of 2 only flattens 2 deep');
st.notDeepEqual(flat([1, [2], [[3]], [[['four']]]], 2), [1, 2, 3, 'four'], 'depth of 2 only flattens 2 deep: sanity check');

testArray(st, flat([1, [2], [[3]], [[['four']]]], 3), [1, 2, 3, 'four'], 'depth of 3 only flattens 3 deep');
testArray(st, flat([1, [2], [[3]], [[['four']]]], Infinity), [1, 2, 3, 'four'], 'depth of Infinity flattens all the way');

st.end();
});

t.test('sparse arrays', function (st) {
// eslint-disable-next-line no-sparse-arrays
st.deepEqual(flat([, [1]]), flat([[], [1]]), 'an array hole is treated the same as an empty array');

st.end();
});
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { concat as concatStatic } from '../observable/concat';
import { Observable } from '../Observable';
import { ObservableInput, OperatorFunction, MonoTypeOperatorFunction, SchedulerLike } from '../types';

/* tslint:disable:max-line-length */
/** @deprecated Deprecated in favor of static concat. */
export function concat<T>(scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
/** @deprecated Deprecated in favor of static concat. */
export function concat<T, T2>(v2: ObservableInput<T2>, scheduler?: SchedulerLike): OperatorFunction<T, T | T2>;
/** @deprecated Deprecated in favor of static concat. */
export function concat<T, T2, T3>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, scheduler?: SchedulerLike): OperatorFunction<T, T | T2 | T3>;
/** @deprecated Deprecated in favor of static concat. */
export function concat<T, T2, T3, T4>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, scheduler?: SchedulerLike): OperatorFunction<T, T | T2 | T3 | T4>;
/** @deprecated Deprecated in favor of static concat. */
export function concat<T, T2, T3, T4, T5>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, scheduler?: SchedulerLike): OperatorFunction<T, T | T2 | T3 | T4 | T5>;
/** @deprecated Deprecated in favor of static concat. */
export function concat<T, T2, T3, T4, T5, T6>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, scheduler?: SchedulerLike): OperatorFunction<T, T | T2 | T3 | T4 | T5 | T6>;
/** @deprecated Deprecated in favor of static concat. */
export function concat<T>(...observables: Array<ObservableInput<T> | SchedulerLike>): MonoTypeOperatorFunction<T>;
/** @deprecated Deprecated in favor of static concat. */
export function concat<T, R>(...observables: Array<ObservableInput<any> | SchedulerLike>): OperatorFunction<T, R>;
/* tslint:enable:max-line-length */

/**
* @deprecated Deprecated in favor of static {@link concat}.
*/
export function concat<T, R>(...observables: Array<ObservableInput<any> | SchedulerLike>): OperatorFunction<T, R> {
return (source: Observable<T>) => source.lift.call(concatStatic(source, ...observables));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const ts = __importStar(require("typescript"));
const util = __importStar(require("../util"));
var Usefulness;
(function (Usefulness) {
Usefulness[Usefulness["Always"] = 0] = "Always";
Usefulness["Never"] = "will";
Usefulness["Sometimes"] = "may";
})(Usefulness || (Usefulness = {}));
exports.default = util.createRule({
name: 'no-base-to-string',
meta: {
docs: {
description: 'Requires that `.toString()` is only called on objects which provide useful information when stringified',
recommended: 'strict',
requiresTypeChecking: true,
},
messages: {
baseToString: "'{{name}} {{certainty}} evaluate to '[object Object]' when stringified.",
},
schema: [
{
type: 'object',
properties: {
ignoredTypeNames: {
type: 'array',
items: {
type: 'string',
},
},
},
additionalProperties: false,
},
],
type: 'suggestion',
},
defaultOptions: [
{
ignoredTypeNames: ['RegExp'],
},
],
create(context, [option]) {
var _a;
const parserServices = util.getParserServices(context);
const typeChecker = parserServices.program.getTypeChecker();
const ignoredTypeNames = (_a = option.ignoredTypeNames) !== null && _a !== void 0 ? _a : [];
function checkExpression(node, type) {
if (node.type === utils_1.AST_NODE_TYPES.Literal) {
return;
}
const certainty = collectToStringCertainty(type !== null && type !== void 0 ? type : typeChecker.getTypeAtLocation(parserServices.esTreeNodeToTSNodeMap.get(node)));
if (certainty === Usefulness.Always) {
return;
}
context.report({
data: {
certainty,
name: context.getSourceCode().getText(node),
},
messageId: 'baseToString',
node,
});
}
function collectToStringCertainty(type) {
const toString = typeChecker.getPropertyOfType(type, 'toString');
const declarations = toString === null || toString === void 0 ? void 0 : toString.getDeclarations();
if (!toString || !declarations || declarations.length === 0) {
return Usefulness.Always;
}
// Patch for old version TypeScript, the Boolean type definition missing toString()
if (type.flags & ts.TypeFlags.Boolean ||
type.flags & ts.TypeFlags.BooleanLiteral) {
return Usefulness.Always;
}
if (ignoredTypeNames.includes(util.getTypeName(typeChecker, type))) {
return Usefulness.Always;
}
if (declarations.every(({ parent }) => !ts.isInterfaceDeclaration(parent) || parent.name.text !== 'Object')) {
return Usefulness.Always;
}
if (type.isIntersection()) {
for (const subType of type.types) {
const subtypeUsefulness = collectToStringCertainty(subType);
if (subtypeUsefulness === Usefulness.Always) {
return Usefulness.Always;
}
}
return Usefulness.Never;
}
if (!type.isUnion()) {
return Usefulness.Never;
}
let allSubtypesUseful = true;
let someSubtypeUseful = false;
for (const subType of type.types) {
const subtypeUsefulness = collectToStringCertainty(subType);
if (subtypeUsefulness !== Usefulness.Always && allSubtypesUseful) {
allSubtypesUseful = false;
}
if (subtypeUsefulness !== Usefulness.Never && !someSubtypeUseful) {
someSubtypeUseful = true;
}
}
if (allSubtypesUseful && someSubtypeUseful) {
return Usefulness.Always;
}
if (someSubtypeUseful) {
return Usefulness.Sometimes;
}
return Usefulness.Never;
}
return {
'AssignmentExpression[operator = "+="], BinaryExpression[operator = "+"]'(node) {
const leftType = typeChecker.getTypeAtLocation(parserServices.esTreeNodeToTSNodeMap.get(node.left));
const rightType = typeChecker.getTypeAtLocation(parserServices.esTreeNodeToTSNodeMap.get(node.right));
if (util.getTypeName(typeChecker, leftType) === 'string') {
checkExpression(node.right, rightType);
}
else if (util.getTypeName(typeChecker, rightType) === 'string' &&
node.left.type !== utils_1.AST_NODE_TYPES.PrivateIdentifier) {
checkExpression(node.left, leftType);
}
},
'CallExpression > MemberExpression.callee > Identifier[name = "toString"].property'(node) {
const memberExpr = node.parent;
checkExpression(memberExpr.object);
},
TemplateLiteral(node) {
if (node.parent &&
node.parent.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression) {
return;
}
for (const expression of node.expressions) {
checkExpression(expression);
}
},
};
},
});
//# sourceMappingURL=no-base-to-string.js.map
Loading

0 comments on commit 96c0eef

Please sign in to comment.