Comments (7)
run fisker/prettier#v2dot3-witout-10335 vs 2.2.1
from prettier-regression-testing.
fisker/prettier@v2dot3-witout-10335 VS prettier/[email protected] :: babel/babel@2ae19d0
Diff (437 lines)
diff --git ORI/babel/packages/babel-core/src/config/config-chain.js ALT/babel/packages/babel-core/src/config/config-chain.js
index d51a2102..f7be0b3b 100644
--- ORI/babel/packages/babel-core/src/config/config-chain.js
+++ ALT/babel/packages/babel-core/src/config/config-chain.js
@@ -76,17 +76,15 @@ export function* buildPresetChain(
};
}
-export const buildPresetChainWalker: (
- arg: PresetInstance,
- context: *,
-) => * = makeChainWalker({
- root: preset => loadPresetDescriptors(preset),
- env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
- overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
- overridesEnv: (preset, index, envName) =>
- loadPresetOverridesEnvDescriptors(preset)(index)(envName),
- createLogger: () => () => {}, // Currently we don't support logging how preset is expanded
-});
+export const buildPresetChainWalker: (arg: PresetInstance, context: *) => * =
+ makeChainWalker({
+ root: preset => loadPresetDescriptors(preset),
+ env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
+ overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
+ overridesEnv: (preset, index, envName) =>
+ loadPresetOverridesEnvDescriptors(preset)(index)(envName),
+ createLogger: () => () => {}, // Currently we don't support logging how preset is expanded
+ });
const loadPresetDescriptors = makeWeakCacheSync((preset: PresetInstance) =>
buildRootDescriptors(preset, preset.alias, createUncachedDescriptors),
);
@@ -705,10 +703,8 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
function dedupDescriptors(
items: Array<UnloadedDescriptor>,
): Array<UnloadedDescriptor> {
- const map: Map<
- Function,
- Map<string | void, { value: UnloadedDescriptor }>,
- > = new Map();
+ const map: Map<Function, Map<string | void, { value: UnloadedDescriptor }>> =
+ new Map();
const descriptors = [];
diff --git ORI/babel/packages/babel-core/src/config/files/plugins.js ALT/babel/packages/babel-core/src/config/files/plugins.js
index 4e2f4ba8..1875185f 100644
--- ORI/babel/packages/babel-core/src/config/files/plugins.js
+++ ALT/babel/packages/babel-core/src/config/files/plugins.js
@@ -20,8 +20,10 @@ const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
-const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/;
-const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/;
+const OTHER_PLUGIN_ORG_RE =
+ /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/;
+const OTHER_PRESET_ORG_RE =
+ /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/;
const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
export function resolvePlugin(name: string, dirname: string): string | null {
diff --git ORI/babel/packages/babel-core/src/config/validation/options.js ALT/babel/packages/babel-core/src/config/validation/options.js
index 6289286e..67f9d593 100644
--- ORI/babel/packages/babel-core/src/config/validation/options.js
+++ ALT/babel/packages/babel-core/src/config/validation/options.js
@@ -426,10 +426,8 @@ function throwUnknownError(loc: OptionPath) {
const key = loc.name;
if (removed[key]) {
- const {
- message,
- version = 5,
- }: { message: string, version?: number } = removed[key];
+ const { message, version = 5 }: { message: string, version?: number } =
+ removed[key];
throw new Error(
`Using removed Babel ${version} option: ${msg(loc)} - ${message}`,
diff --git ORI/babel/packages/babel-core/src/transformation/normalize-file.js ALT/babel/packages/babel-core/src/transformation/normalize-file.js
index aca84e1e..8734534c 100644
--- ORI/babel/packages/babel-core/src/transformation/normalize-file.js
+++ ALT/babel/packages/babel-core/src/transformation/normalize-file.js
@@ -98,8 +98,10 @@ export default function* normalizeFile(
// but without // or /* at the beginning of the comment.
// eslint-disable-next-line max-len
-const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/;
-const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/;
+const INLINE_SOURCEMAP_REGEX =
+ /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/;
+const EXTERNAL_SOURCEMAP_REGEX =
+ /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/;
function extractCommentsFromList(regex, comments, lastComment) {
if (comments) {
diff --git ORI/babel/packages/babel-core/test/api.js ALT/babel/packages/babel-core/test/api.js
index 367a03fb..a180d707 100644
--- ORI/babel/packages/babel-core/test/api.js
+++ ALT/babel/packages/babel-core/test/api.js
@@ -289,9 +289,8 @@ describe("api", function () {
new Plugin({
visitor: {
Function: function (path) {
- const alias = path.scope
- .getProgramParent()
- .path.get("body")[0].node;
+ const alias =
+ path.scope.getProgramParent().path.get("body")[0].node;
if (!babel.types.isTypeAlias(alias)) return;
// In case of `passPerPreset` being `false`, the
diff --git ORI/babel/packages/babel-core/test/helpers/esm.js ALT/babel/packages/babel-core/test/helpers/esm.js
index c485f1fa..8565d61e 100644
--- ORI/babel/packages/babel-core/test/helpers/esm.js
+++ ALT/babel/packages/babel-core/test/helpers/esm.js
@@ -66,7 +66,8 @@ async function spawn(runner, filename, cwd = process.cwd()) {
{ cwd, env: process.env },
);
- const EXPERIMENTAL_WARNING = /\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\./;
+ const EXPERIMENTAL_WARNING =
+ /\(node:\d+\) ExperimentalWarning: The ESM module loader is experimental\./;
if (stderr.replace(EXPERIMENTAL_WARNING, "").trim()) {
throw new Error(
diff --git ORI/babel/packages/babel-helper-create-class-features-plugin/src/index.js ALT/babel/packages/babel-helper-create-class-features-plugin/src/index.js
index 5aa2db72..47c84171 100644
--- ORI/babel/packages/babel-helper-create-class-features-plugin/src/index.js
+++ ALT/babel/packages/babel-helper-create-class-features-plugin/src/index.js
@@ -210,21 +210,17 @@ export function createClassFeaturePlugin({
));
} else {
keysNodes = extractComputedKeys(ref, path, computedPaths, this.file);
- ({
- staticNodes,
- pureStaticNodes,
- instanceNodes,
- wrapClass,
- } = buildFieldsInitNodes(
- ref,
- path.node.superClass,
- props,
- privateNamesMap,
- state,
- setPublicClassFields ?? loose,
- privateFieldsAsProperties ?? loose,
- constantSuper ?? loose,
- ));
+ ({ staticNodes, pureStaticNodes, instanceNodes, wrapClass } =
+ buildFieldsInitNodes(
+ ref,
+ path.node.superClass,
+ props,
+ privateNamesMap,
+ state,
+ setPublicClassFields ?? loose,
+ privateFieldsAsProperties ?? loose,
+ constantSuper ?? loose,
+ ));
}
if (instanceNodes.length > 0) {
diff --git ORI/babel/packages/babel-helper-module-transforms/src/index.js ALT/babel/packages/babel-helper-module-transforms/src/index.js
index 558913a7..53fb1851 100644
--- ORI/babel/packages/babel-helper-module-transforms/src/index.js
+++ ALT/babel/packages/babel-helper-module-transforms/src/index.js
@@ -249,23 +249,26 @@ function buildESModuleHeader(
metadata: ModuleMetadata,
enumerableModuleMeta: boolean = false,
) {
- return (enumerableModuleMeta
- ? template.statement`
+ return (
+ enumerableModuleMeta
+ ? template.statement`
EXPORTS.__esModule = true;
`
- : template.statement`
+ : template.statement`
Object.defineProperty(EXPORTS, "__esModule", {
value: true,
});
- `)({ EXPORTS: metadata.exportName });
+ `
+ )({ EXPORTS: metadata.exportName });
}
/**
* Create a re-export initialization loop for a specific imported namespace.
*/
function buildNamespaceReexport(metadata, namespace, constantReexports) {
- return (constantReexports
- ? template.statement`
+ return (
+ constantReexports
+ ? template.statement`
Object.keys(NAMESPACE).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
VERIFY_NAME_LIST;
@@ -274,13 +277,13 @@ function buildNamespaceReexport(metadata, namespace, constantReexports) {
EXPORTS[key] = NAMESPACE[key];
});
`
- : // Also skip already assigned bindings if they are strictly equal
- // to be somewhat more spec-compliant when a file has multiple
- // namespace re-exports that would cause a binding to be exported
- // multiple times. However, multiple bindings of the same name that
- // export the same primitive value are silently skipped
- // (the spec requires an "ambigous bindings" early error here).
- template.statement`
+ : // Also skip already assigned bindings if they are strictly equal
+ // to be somewhat more spec-compliant when a file has multiple
+ // namespace re-exports that would cause a binding to be exported
+ // multiple times. However, multiple bindings of the same name that
+ // export the same primitive value are silently skipped
+ // (the spec requires an "ambigous bindings" early error here).
+ template.statement`
Object.keys(NAMESPACE).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
VERIFY_NAME_LIST;
@@ -293,7 +296,8 @@ function buildNamespaceReexport(metadata, namespace, constantReexports) {
},
});
});
- `)({
+ `
+ )({
NAMESPACE: namespace,
EXPORTS: metadata.exportName,
VERIFY_NAME_LIST: metadata.exportNameListName
diff --git ORI/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.js ALT/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.js
index a5de3a24..0f7af46a 100644
--- ORI/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.js
+++ ALT/babel/packages/babel-helper-module-transforms/src/rewrite-live-references.js
@@ -165,13 +165,8 @@ const buildImportThrow = localName => {
const rewriteReferencesVisitor = {
ReferencedIdentifier(path) {
- const {
- seen,
- buildImportReference,
- scope,
- imported,
- requeueInParent,
- } = this;
+ const { seen, buildImportReference, scope, imported, requeueInParent } =
+ this;
if (seen.has(path.node)) return;
seen.add(path.node);
diff --git ORI/babel/packages/babel-parser/src/parser/statement.js ALT/babel/packages/babel-parser/src/parser/statement.js
index 521b2857..e8473742 100644
--- ORI/babel/packages/babel-parser/src/parser/statement.js
+++ ALT/babel/packages/babel-parser/src/parser/statement.js
@@ -322,9 +322,8 @@ export default class StatementParser extends ExpressionParser {
}
takeDecorators(node: N.HasDecorators): void {
- const decorators = this.state.decoratorStack[
- this.state.decoratorStack.length - 1
- ];
+ const decorators =
+ this.state.decoratorStack[this.state.decoratorStack.length - 1];
if (decorators.length) {
node.decorators = decorators;
this.resetStartLocationFromNode(node, decorators[0]);
@@ -337,9 +336,8 @@ export default class StatementParser extends ExpressionParser {
}
parseDecorators(allowExport?: boolean): void {
- const currentContextDecorators = this.state.decoratorStack[
- this.state.decoratorStack.length - 1
- ];
+ const currentContextDecorators =
+ this.state.decoratorStack[this.state.decoratorStack.length - 1];
while (this.match(tt.at)) {
const decorator = this.parseDecorator();
currentContextDecorators.push(decorator);
@@ -2002,9 +2000,8 @@ export default class StatementParser extends ExpressionParser {
}
}
- const currentContextDecorators = this.state.decoratorStack[
- this.state.decoratorStack.length - 1
- ];
+ const currentContextDecorators =
+ this.state.decoratorStack[this.state.decoratorStack.length - 1];
// If node.declaration is a class, it will take all decorators in the current context.
// Thus we should throw if we see non-empty decorators here.
if (currentContextDecorators.length) {
diff --git ORI/babel/packages/babel-parser/src/plugins/flow/index.js ALT/babel/packages/babel-parser/src/plugins/flow/index.js
index 01bf25e2..9dfa320e 100644
--- ORI/babel/packages/babel-parser/src/plugins/flow/index.js
+++ ALT/babel/packages/babel-parser/src/plugins/flow/index.js
@@ -1350,9 +1350,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>
return this.finishNode(node, "FunctionTypeParam");
}
- flowParseFunctionTypeParams(
- params: N.FlowFunctionTypeParam[] = [],
- ): {
+ flowParseFunctionTypeParams(params: N.FlowFunctionTypeParam[] = []): {
params: N.FlowFunctionTypeParam[],
rest: ?N.FlowFunctionTypeParam,
_this: ?N.FlowFunctionTypeParam,
@@ -3093,7 +3091,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
node.callee = base;
const result = this.tryParse(() => {
- node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
+ node.typeArguments =
+ this.flowParseTypeParameterInstantiationCallOrNew();
this.expect(tt.parenL);
node.arguments = this.parseCallExpressionArguments(tt.parenR, false);
if (subscriptState.optionalChainMember) node.optional = false;
diff --git ORI/babel/packages/babel-parser/src/types.js ALT/babel/packages/babel-parser/src/types.js
index 3217d453..9dd15b78 100644
--- ORI/babel/packages/babel-parser/src/types.js
+++ ALT/babel/packages/babel-parser/src/types.js
@@ -1159,9 +1159,10 @@ export type TsSignatureDeclarationOrIndexSignatureBase = NodeBase & {
typeAnnotation: ?TsTypeAnnotation,
};
-export type TsSignatureDeclarationBase = TsSignatureDeclarationOrIndexSignatureBase & {
- typeParameters: ?TsTypeParameterDeclaration,
-};
+export type TsSignatureDeclarationBase =
+ TsSignatureDeclarationOrIndexSignatureBase & {
+ typeParameters: ?TsTypeParameterDeclaration,
+ };
// ================
// TypeScript type members (for type literal / interface / class)
diff --git ORI/babel/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js ALT/babel/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js
index d860d884..e19a7755 100644
--- ORI/babel/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js
+++ ALT/babel/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js
@@ -33,9 +33,10 @@ const WARNING_CALLS = new WeakSet();
*/
function applyEnsureOrdering(path) {
// TODO: This should probably also hoist computed properties.
- const decorators = (path.isClass()
- ? [path].concat(path.get("body.body"))
- : path.get("properties")
+ const decorators = (
+ path.isClass()
+ ? [path].concat(path.get("body.body"))
+ : path.get("properties")
).reduce((acc, prop) => acc.concat(prop.node.decorators || []), []);
const identDecorators = decorators.filter(
@@ -47,9 +48,8 @@ function applyEnsureOrdering(path) {
identDecorators
.map(decorator => {
const expression = decorator.expression;
- const id = (decorator.expression = path.scope.generateDeclaredUidIdentifier(
- "dec",
- ));
+ const id = (decorator.expression =
+ path.scope.generateDeclaredUidIdentifier("dec"));
return t.assignmentExpression("=", id, expression);
})
.concat([path.node]),
diff --git ORI/babel/packages/babel-plugin-proposal-object-rest-spread/src/index.js ALT/babel/packages/babel-plugin-proposal-object-rest-spread/src/index.js
index b5d232b8..2f353271 100644
--- ORI/babel/packages/babel-plugin-proposal-object-rest-spread/src/index.js
+++ ALT/babel/packages/babel-plugin-proposal-object-rest-spread/src/index.js
@@ -371,11 +371,8 @@ export default declare((api, opts) => {
path.isObjectPattern(),
);
- const [
- impureComputedPropertyDeclarators,
- argument,
- callExpression,
- ] = createObjectRest(objectPatternPath, file, ref);
+ const [impureComputedPropertyDeclarators, argument, callExpression] =
+ createObjectRest(objectPatternPath, file, ref);
if (pureGetters) {
removeUnusedExcludedKeys(objectPatternPath);
@@ -454,11 +451,8 @@ export default declare((api, opts) => {
]),
);
- const [
- impureComputedPropertyDeclarators,
- argument,
- callExpression,
- ] = createObjectRest(leftPath, file, t.identifier(refName));
+ const [impureComputedPropertyDeclarators, argument, callExpression] =
+ createObjectRest(leftPath, file, t.identifier(refName));
if (impureComputedPropertyDeclarators.length > 0) {
nodes.push(
diff --git ORI/babel/packages/babel-plugin-transform-parameters/src/params.js ALT/babel/packages/babel-plugin-transform-parameters/src/params.js
index 335a8e88..aac3e64b 100644
--- ORI/babel/packages/babel-plugin-transform-parameters/src/params.js
+++ ALT/babel/packages/babel-plugin-transform-parameters/src/params.js
@@ -37,8 +37,8 @@ const iifeVisitor = {
}
},
// type annotations don't use or introduce "real" bindings
- "TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration": path =>
- path.skip(),
+ "TypeAnnotation|TSTypeAnnotation|TypeParameterDeclaration|TSTypeParameterDeclaration":
+ path => path.skip(),
};
// last 2 parameters are optional -- they are used by proposal-object-rest-spread/src/index.js
diff --git ORI/babel/packages/babel-preset-env/src/available-plugins.js ALT/babel/packages/babel-preset-env/src/available-plugins.js
index 4da14d52..0d1c9670 100644
--- ORI/babel/packages/babel-preset-env/src/available-plugins.js
+++ ALT/babel/packages/babel-preset-env/src/available-plugins.js
@@ -74,7 +74,8 @@ export default {
"bugfix/transform-safari-block-shadowing": bugfixSafariBlockShadowing,
"bugfix/transform-safari-for-shadowing": bugfixSafariForShadowing,
"bugfix/transform-tagged-template-caching": bugfixTaggedTemplateCaching,
- "bugfix/transform-v8-spread-parameters-in-optional-chaining": bugfixV8SpreadParametersInOptionalChaining,
+ "bugfix/transform-v8-spread-parameters-in-optional-chaining":
+ bugfixV8SpreadParametersInOptionalChaining,
"proposal-async-generator-functions": proposalAsyncGeneratorFunctions,
"proposal-class-properties": proposalClassProperties,
"proposal-dynamic-import": proposalDynamicImport,
diff --git ORI/babel/packages/babel-standalone/src/generated/plugins.js ALT/babel/packages/babel-standalone/src/generated/plugins.js
index bcf2a29f..8d0b9b6c 100644
--- ORI/babel/packages/babel-standalone/src/generated/plugins.js
+++ ALT/babel/packages/babel-standalone/src/generated/plugins.js
@@ -262,7 +262,8 @@ export const all = {
"transform-new-target": transformNewTarget,
"transform-object-assign": transformObjectAssign,
"transform-object-super": transformObjectSuper,
- "transform-object-set-prototype-of-to-assign": transformObjectSetPrototypeOfToAssign,
+ "transform-object-set-prototype-of-to-assign":
+ transformObjectSetPrototypeOfToAssign,
"transform-parameters": transformParameters,
"transform-property-literals": transformPropertyLiterals,
"transform-property-mutators": transformPropertyMutators,
from prettier-regression-testing.
fisker/prettier@v2dot3-witout-10335 VS prettier/[email protected] :: vuejs/eslint-plugin-vue@62f577d
Diff (681 lines)
diff --git ORI/eslint-plugin-vue/lib/rules/attributes-order.js ALT/eslint-plugin-vue/lib/rules/attributes-order.js
index 8f2917d..5af387d 100644
--- ORI/eslint-plugin-vue/lib/rules/attributes-order.js
+++ ALT/eslint-plugin-vue/lib/rules/attributes-order.js
@@ -271,10 +271,8 @@ function create(context) {
return
}
- let {
- attr: previousNode,
- position: previousPosition
- } = attributeAndPositions[0]
+ let { attr: previousNode, position: previousPosition } =
+ attributeAndPositions[0]
for (let index = 1; index < attributeAndPositions.length; index++) {
const { attr, position } = attributeAndPositions[index]
diff --git ORI/eslint-plugin-vue/lib/rules/experimental-script-setup-vars.js ALT/eslint-plugin-vue/lib/rules/experimental-script-setup-vars.js
index b209376..d215a27 100644
--- ORI/eslint-plugin-vue/lib/rules/experimental-script-setup-vars.js
+++ ALT/eslint-plugin-vue/lib/rules/experimental-script-setup-vars.js
@@ -161,8 +161,9 @@ function parseSetup(code, espree, eslintScope) {
fallback: AST.getFallbackKeys
})
- const variables = /** @type {Variable[]} */ (result.globalScope.childScopes[0]
- .variables)
+ const variables = /** @type {Variable[]} */ (
+ result.globalScope.childScopes[0].variables
+ )
return variables.map((v) => v.name)
}
diff --git ORI/eslint-plugin-vue/lib/rules/html-self-closing.js ALT/eslint-plugin-vue/lib/rules/html-self-closing.js
index b54c206..ed4a3dc 100644
--- ORI/eslint-plugin-vue/lib/rules/html-self-closing.js
+++ ALT/eslint-plugin-vue/lib/rules/html-self-closing.js
@@ -164,7 +164,8 @@ module.exports = {
name: node.rawName
},
fix(fixer) {
- const tokens = context.parserServices.getTemplateBodyTokenStore()
+ const tokens =
+ context.parserServices.getTemplateBodyTokenStore()
const close = tokens.getLastToken(node.startTag)
if (close.type !== 'HTMLTagClose') {
return null
@@ -188,7 +189,8 @@ module.exports = {
name: node.rawName
},
fix(fixer) {
- const tokens = context.parserServices.getTemplateBodyTokenStore()
+ const tokens =
+ context.parserServices.getTemplateBodyTokenStore()
const close = tokens.getLastToken(node.startTag)
if (close.type !== 'HTMLSelfClosingTagClose') {
return null
diff --git ORI/eslint-plugin-vue/lib/rules/max-attributes-per-line.js ALT/eslint-plugin-vue/lib/rules/max-attributes-per-line.js
index e379df4..a6d2045 100644
--- ORI/eslint-plugin-vue/lib/rules/max-attributes-per-line.js
+++ ALT/eslint-plugin-vue/lib/rules/max-attributes-per-line.js
@@ -158,12 +158,11 @@ module.exports = {
// Find the closest token before the current prop
// that is not a white space
- const prevToken = /** @type {Token} */ (template.getTokenBefore(
- prop,
- {
+ const prevToken = /** @type {Token} */ (
+ template.getTokenBefore(prop, {
filter: (token) => token.type !== 'HTMLWhitespace'
- }
- ))
+ })
+ )
/** @type {Range} */
const range = [prevToken.range[1], prop.range[0]]
diff --git ORI/eslint-plugin-vue/lib/rules/multiline-html-element-content-newline.js ALT/eslint-plugin-vue/lib/rules/multiline-html-element-content-newline.js
index 49a675c..455692d 100644
--- ORI/eslint-plugin-vue/lib/rules/multiline-html-element-content-newline.js
+++ ALT/eslint-plugin-vue/lib/rules/multiline-html-element-content-newline.js
@@ -179,14 +179,12 @@ module.exports = {
return
}
- const contentFirst = /** @type {Token} */ (template.getTokenAfter(
- element.startTag,
- getTokenOption
- ))
- const contentLast = /** @type {Token} */ (template.getTokenBefore(
- element.endTag,
- getTokenOption
- ))
+ const contentFirst = /** @type {Token} */ (
+ template.getTokenAfter(element.startTag, getTokenOption)
+ )
+ const contentLast = /** @type {Token} */ (
+ template.getTokenBefore(element.endTag, getTokenOption)
+ )
const beforeLineBreaks =
contentFirst.loc.start.line - element.startTag.loc.end.line
diff --git ORI/eslint-plugin-vue/lib/rules/no-extra-parens.js ALT/eslint-plugin-vue/lib/rules/no-extra-parens.js
index 3f202fa..20c2593 100644
--- ORI/eslint-plugin-vue/lib/rules/no-extra-parens.js
+++ ALT/eslint-plugin-vue/lib/rules/no-extra-parens.js
@@ -176,7 +176,8 @@ function createForVueSyntax(context) {
}
return {
- "VAttribute[directive=true][key.name.name='bind'] > VExpressionContainer": verify,
+ "VAttribute[directive=true][key.name.name='bind'] > VExpressionContainer":
+ verify,
'VElement > VExpressionContainer': verify
}
}
diff --git ORI/eslint-plugin-vue/lib/rules/no-irregular-whitespace.js ALT/eslint-plugin-vue/lib/rules/no-irregular-whitespace.js
index 7c05083..1cfbd61 100644
--- ORI/eslint-plugin-vue/lib/rules/no-irregular-whitespace.js
+++ ALT/eslint-plugin-vue/lib/rules/no-irregular-whitespace.js
@@ -15,8 +15,10 @@ const utils = require('../utils')
// Constants
// ------------------------------------------------------------------------------
-const ALL_IRREGULARS = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/u
-const IRREGULAR_WHITESPACE = /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/gmu
+const ALL_IRREGULARS =
+ /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000\u2028\u2029]/u
+const IRREGULAR_WHITESPACE =
+ /[\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000]+/gmu
const IRREGULAR_LINE_TERMINATORS = /[\u2028\u2029]/gmu
// ------------------------------------------------------------------------------
@@ -195,7 +197,8 @@ module.exports = {
const bodyVisitor = utils.defineTemplateBodyVisitor(context, {
...(skipHTMLAttributeValues
? {
- 'VAttribute[directive=false] > VLiteral': removeInvalidNodeErrorsInHTMLAttributeValue
+ 'VAttribute[directive=false] > VLiteral':
+ removeInvalidNodeErrorsInHTMLAttributeValue
}
: {}),
...(skipHTMLTextContents
diff --git ORI/eslint-plugin-vue/lib/rules/no-restricted-v-bind.js ALT/eslint-plugin-vue/lib/rules/no-restricted-v-bind.js
index 02ac6e3..d15bb4c 100644
--- ORI/eslint-plugin-vue/lib/rules/no-restricted-v-bind.js
+++ ALT/eslint-plugin-vue/lib/rules/no-restricted-v-bind.js
@@ -137,9 +137,8 @@ module.exports = {
/** @param {RuleContext} context */
create(context) {
/** @type {ParsedOption[]} */
- const options = (context.options.length === 0
- ? DEFAULT_OPTIONS
- : context.options
+ const options = (
+ context.options.length === 0 ? DEFAULT_OPTIONS : context.options
).map(parseOption)
return utils.defineTemplateBodyVisitor(context, {
diff --git ORI/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js ALT/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js
index 7c0639b..2474869 100644
--- ORI/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js
+++ ALT/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js
@@ -104,9 +104,9 @@ module.exports = {
}
const targetBody = scopeStack.body
- const computedProperty = /** @type {ComponentComputedProperty[]} */ (computedPropertiesMap.get(
- vueNode
- )).find((cp) => {
+ const computedProperty = /** @type {ComponentComputedProperty[]} */ (
+ computedPropertiesMap.get(vueNode)
+ ).find((cp) => {
return (
cp.value &&
node.loc.start.line >= cp.value.loc.start.line &&
diff --git ORI/eslint-plugin-vue/lib/rules/no-useless-mustaches.js ALT/eslint-plugin-vue/lib/rules/no-useless-mustaches.js
index 845c42f..8e5a6ce 100644
--- ORI/eslint-plugin-vue/lib/rules/no-useless-mustaches.js
+++ ALT/eslint-plugin-vue/lib/rules/no-useless-mustaches.js
@@ -19,9 +19,10 @@ function stripQuotesForHTML(text) {
return text.slice(1, -1)
}
- const re = /^(?:&(?:quot|apos|#\d+|#x[\da-f]+);|["'`])([\s\S]*)(?:&(?:quot|apos|#\d+|#x[\da-f]+);|["'`])$/u.exec(
- text
- )
+ const re =
+ /^(?:&(?:quot|apos|#\d+|#x[\da-f]+);|["'`])([\s\S]*)(?:&(?:quot|apos|#\d+|#x[\da-f]+);|["'`])$/u.exec(
+ text
+ )
if (!re) {
return null
}
diff --git ORI/eslint-plugin-vue/lib/rules/no-useless-v-bind.js ALT/eslint-plugin-vue/lib/rules/no-useless-v-bind.js
index 5d4dc00..749a292 100644
--- ORI/eslint-plugin-vue/lib/rules/no-useless-v-bind.js
+++ ALT/eslint-plugin-vue/lib/rules/no-useless-v-bind.js
@@ -145,7 +145,8 @@ module.exports = {
}
return utils.defineTemplateBodyVisitor(context, {
- "VAttribute[directive=true][key.name.name='bind'][key.argument!=null]": verify
+ "VAttribute[directive=true][key.name.name='bind'][key.argument!=null]":
+ verify
})
}
}
diff --git ORI/eslint-plugin-vue/lib/rules/require-explicit-emits.js ALT/eslint-plugin-vue/lib/rules/require-explicit-emits.js
index ec35636..7974282 100644
--- ORI/eslint-plugin-vue/lib/rules/require-explicit-emits.js
+++ ALT/eslint-plugin-vue/lib/rules/require-explicit-emits.js
@@ -387,10 +387,9 @@ function buildSuggest(object, emits, nameNode, context) {
const sourceCode = context.getSourceCode()
const emitsOptionValue = emitsOption.value
if (emitsOptionValue.type === 'ArrayExpression') {
- const leftBracket = /** @type {Token} */ (sourceCode.getFirstToken(
- emitsOptionValue,
- isLeftBracket
- ))
+ const leftBracket = /** @type {Token} */ (
+ sourceCode.getFirstToken(emitsOptionValue, isLeftBracket)
+ )
return [
{
messageId: 'addOneOption',
@@ -406,10 +405,9 @@ function buildSuggest(object, emits, nameNode, context) {
}
]
} else if (emitsOptionValue.type === 'ObjectExpression') {
- const leftBrace = /** @type {Token} */ (sourceCode.getFirstToken(
- emitsOptionValue,
- isLeftBrace
- ))
+ const leftBrace = /** @type {Token} */ (
+ sourceCode.getFirstToken(emitsOptionValue, isLeftBrace)
+ )
return [
{
messageId: 'addOneOption',
@@ -451,14 +449,12 @@ function buildSuggest(object, emits, nameNode, context) {
`,\nemits: ['${nameNode.value}']`
)
} else {
- const objectLeftBrace = /** @type {Token} */ (sourceCode.getFirstToken(
- object,
- isLeftBrace
- ))
- const objectRightBrace = /** @type {Token} */ (sourceCode.getLastToken(
- object,
- isRightBrace
- ))
+ const objectLeftBrace = /** @type {Token} */ (
+ sourceCode.getFirstToken(object, isLeftBrace)
+ )
+ const objectRightBrace = /** @type {Token} */ (
+ sourceCode.getLastToken(object, isRightBrace)
+ )
return fixer.insertTextAfter(
objectLeftBrace,
`\nemits: ['${nameNode.value}']${
@@ -488,14 +484,12 @@ function buildSuggest(object, emits, nameNode, context) {
`,\nemits: {'${nameNode.value}': null}`
)
} else {
- const objectLeftBrace = /** @type {Token} */ (sourceCode.getFirstToken(
- object,
- isLeftBrace
- ))
- const objectRightBrace = /** @type {Token} */ (sourceCode.getLastToken(
- object,
- isRightBrace
- ))
+ const objectLeftBrace = /** @type {Token} */ (
+ sourceCode.getFirstToken(object, isLeftBrace)
+ )
+ const objectRightBrace = /** @type {Token} */ (
+ sourceCode.getLastToken(object, isRightBrace)
+ )
return fixer.insertTextAfter(
objectLeftBrace,
`\nemits: {'${nameNode.value}': null}${
diff --git ORI/eslint-plugin-vue/lib/rules/singleline-html-element-content-newline.js ALT/eslint-plugin-vue/lib/rules/singleline-html-element-content-newline.js
index 52b5ed1..fc016cc 100644
--- ORI/eslint-plugin-vue/lib/rules/singleline-html-element-content-newline.js
+++ ALT/eslint-plugin-vue/lib/rules/singleline-html-element-content-newline.js
@@ -157,14 +157,12 @@ module.exports = {
return
}
- const contentFirst = /** @type {Token} */ (template.getTokenAfter(
- elem.startTag,
- getTokenOption
- ))
- const contentLast = /** @type {Token} */ (template.getTokenBefore(
- elem.endTag,
- getTokenOption
- ))
+ const contentFirst = /** @type {Token} */ (
+ template.getTokenAfter(elem.startTag, getTokenOption)
+ )
+ const contentLast = /** @type {Token} */ (
+ template.getTokenBefore(elem.endTag, getTokenOption)
+ )
context.report({
node: template.getLastToken(elem.startTag),
diff --git ORI/eslint-plugin-vue/lib/rules/syntaxes/dynamic-directive-arguments.js ALT/eslint-plugin-vue/lib/rules/syntaxes/dynamic-directive-arguments.js
index 9a790e9..e670fa3 100644
--- ORI/eslint-plugin-vue/lib/rules/syntaxes/dynamic-directive-arguments.js
+++ ALT/eslint-plugin-vue/lib/rules/syntaxes/dynamic-directive-arguments.js
@@ -20,7 +20,8 @@ module.exports = {
}
return {
- 'VAttribute[directive=true] > VDirectiveKey > VExpressionContainer': reportDynamicArgument
+ 'VAttribute[directive=true] > VDirectiveKey > VExpressionContainer':
+ reportDynamicArgument
}
}
}
diff --git ORI/eslint-plugin-vue/lib/rules/syntaxes/scope-attribute.js ALT/eslint-plugin-vue/lib/rules/syntaxes/scope-attribute.js
index c356a67..af7dbcd 100644
--- ORI/eslint-plugin-vue/lib/rules/syntaxes/scope-attribute.js
+++ ALT/eslint-plugin-vue/lib/rules/syntaxes/scope-attribute.js
@@ -23,7 +23,8 @@ module.exports = {
}
return {
- "VAttribute[directive=true] > VDirectiveKey[name.name='scope']": reportScope
+ "VAttribute[directive=true] > VDirectiveKey[name.name='scope']":
+ reportScope
}
}
}
diff --git ORI/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js ALT/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js
index 8b43927..d5fa618 100644
--- ORI/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js
+++ ALT/eslint-plugin-vue/lib/rules/syntaxes/slot-attribute.js
@@ -128,7 +128,8 @@ module.exports = {
return {
"VAttribute[directive=false][key.name='slot']": reportSlot,
- "VAttribute[directive=true][key.name.name='bind'][key.argument.name='slot']": reportVBindSlot
+ "VAttribute[directive=true][key.name.name='bind'][key.argument.name='slot']":
+ reportVBindSlot
}
}
}
diff --git ORI/eslint-plugin-vue/lib/rules/syntaxes/v-bind-prop-modifier-shorthand.js ALT/eslint-plugin-vue/lib/rules/syntaxes/v-bind-prop-modifier-shorthand.js
index 219d2b3..5a53a9e 100644
--- ORI/eslint-plugin-vue/lib/rules/syntaxes/v-bind-prop-modifier-shorthand.js
+++ ALT/eslint-plugin-vue/lib/rules/syntaxes/v-bind-prop-modifier-shorthand.js
@@ -27,7 +27,8 @@ module.exports = {
}
return {
- "VAttribute[directive=true] > VDirectiveKey[name.name='bind'][name.rawName='.']": reportPropModifierShorthand
+ "VAttribute[directive=true] > VDirectiveKey[name.name='bind'][name.rawName='.']":
+ reportPropModifierShorthand
}
}
}
diff --git ORI/eslint-plugin-vue/lib/rules/v-for-delimiter-style.js ALT/eslint-plugin-vue/lib/rules/v-for-delimiter-style.js
index ef0086c..a50b6a5 100644
--- ORI/eslint-plugin-vue/lib/rules/v-for-delimiter-style.js
+++ ALT/eslint-plugin-vue/lib/rules/v-for-delimiter-style.js
@@ -40,12 +40,14 @@ module.exports = {
context.parserServices.getTemplateBodyTokenStore &&
context.parserServices.getTemplateBodyTokenStore()
- const delimiterToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.left.length
- ? node.left[node.left.length - 1]
- : tokenStore.getFirstToken(node),
- (token) => token.type !== 'Punctuator' || token.value !== ')'
- ))
+ const delimiterToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(
+ node.left.length
+ ? node.left[node.left.length - 1]
+ : tokenStore.getFirstToken(node),
+ (token) => token.type !== 'Punctuator' || token.value !== ')'
+ )
+ )
if (delimiterToken.value === preferredDelimiter) {
return
diff --git ORI/eslint-plugin-vue/lib/rules/v-slot-style.js ALT/eslint-plugin-vue/lib/rules/v-slot-style.js
index f0cbe36..1bb5f57 100644
--- ORI/eslint-plugin-vue/lib/rules/v-slot-style.js
+++ ALT/eslint-plugin-vue/lib/rules/v-slot-style.js
@@ -28,7 +28,10 @@ function normalizeOptions(options) {
}
if (typeof options === 'string') {
- normalized.atComponent = normalized.default = normalized.named = /** @type {"shorthand" | "longform"} */ (options)
+ normalized.atComponent =
+ normalized.default =
+ normalized.named =
+ /** @type {"shorthand" | "longform"} */ (options)
} else if (options != null) {
/** @type {(keyof Options)[]} */
const keys = ['atComponent', 'default', 'named']
diff --git ORI/eslint-plugin-vue/lib/utils/indent-common.js ALT/eslint-plugin-vue/lib/utils/indent-common.js
index 9e6bfde..c4818b4 100644
--- ORI/eslint-plugin-vue/lib/utils/indent-common.js
+++ ALT/eslint-plugin-vue/lib/utils/indent-common.js
@@ -739,10 +739,9 @@ module.exports.defineVisitor = function create(
return true
}
if (parent.type === 'CallExpression' || parent.type === 'NewExpression') {
- const openParen = /** @type {Token} */ (tokenStore.getTokenAfter(
- parent.callee,
- isNotRightParen
- ))
+ const openParen = /** @type {Token} */ (
+ tokenStore.getTokenAfter(parent.callee, isNotRightParen)
+ )
return parent.arguments.some(
(param) =>
getFirstAndLastTokens(param, openParen.range[1]).firstToken
@@ -1078,9 +1077,8 @@ module.exports.defineVisitor = function create(
baseline.add(token)
} else if (baseline.has(offsetInfo.baseToken)) {
// The base token is a baseline token on this line, so inherit it.
- offsetInfo.expectedIndent = offsets.get(
- offsetInfo.baseToken
- ).expectedIndent
+ offsetInfo.expectedIndent =
+ offsets.get(offsetInfo.baseToken).expectedIndent
baseline.add(token)
} else {
// Otherwise, set the expected indent of this line.
@@ -1215,10 +1213,9 @@ module.exports.defineVisitor = function create(
VForExpression(node) {
const firstToken = tokenStore.getFirstToken(node)
const lastOfLeft = last(node.left) || firstToken
- const inToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- lastOfLeft,
- isNotRightParen
- ))
+ const inToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(lastOfLeft, isNotRightParen)
+ )
const rightToken = tokenStore.getFirstToken(node.right)
if (isLeftParen(firstToken)) {
@@ -1296,10 +1293,9 @@ module.exports.defineVisitor = function create(
node
) {
const leftToken = getChainHeadToken(node)
- const opToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.left,
- isNotRightParen
- ))
+ const opToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(node.left, isNotRightParen)
+ )
const rightToken = tokenStore.getTokenAfter(opToken)
const prevToken = tokenStore.getTokenBefore(leftToken)
const shouldIndent =
@@ -1392,15 +1388,13 @@ module.exports.defineVisitor = function create(
ConditionalExpression(node) {
const prevToken = tokenStore.getTokenBefore(node)
const firstToken = tokenStore.getFirstToken(node)
- const questionToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.test,
- isNotRightParen
- ))
+ const questionToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(node.test, isNotRightParen)
+ )
const consequentToken = tokenStore.getTokenAfter(questionToken)
- const colonToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.consequent,
- isNotRightParen
- ))
+ const colonToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(node.consequent, isNotRightParen)
+ )
const alternateToken = tokenStore.getTokenAfter(colonToken)
const isFlat =
prevToken &&
@@ -1421,10 +1415,9 @@ module.exports.defineVisitor = function create(
/** @param {DoWhileStatement} node */
DoWhileStatement(node) {
const doToken = tokenStore.getFirstToken(node)
- const whileToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.body,
- isNotRightParen
- ))
+ const whileToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(node.body, isNotRightParen)
+ )
const leftToken = tokenStore.getTokenAfter(whileToken)
const testToken = tokenStore.getTokenAfter(leftToken)
const lastToken = tokenStore.getLastToken(node)
@@ -1464,8 +1457,8 @@ module.exports.defineVisitor = function create(
ExportDefaultDeclaration(node) {
const exportToken = tokenStore.getFirstToken(node)
const defaultToken = tokenStore.getFirstToken(node, 1)
- const declarationToken = getFirstAndLastTokens(node.declaration)
- .firstToken
+ const declarationToken =
+ getFirstAndLastTokens(node.declaration).firstToken
setOffset([defaultToken, declarationToken], 1, exportToken)
},
/** @param {ExportNamedDeclaration} node */
@@ -1480,10 +1473,9 @@ module.exports.defineVisitor = function create(
if (!firstSpecifier || firstSpecifier.type === 'ExportSpecifier') {
// export {foo, bar}; or export {foo, bar} from "mod";
const leftParenToken = tokenStore.getFirstToken(node, 1)
- const rightParenToken = /** @type {Token} */ (tokenStore.getLastToken(
- node,
- isRightBrace
- ))
+ const rightParenToken = /** @type {Token} */ (
+ tokenStore.getLastToken(node, isRightBrace)
+ )
setOffset(leftParenToken, 0, exportToken)
processNodeList(node.specifiers, leftParenToken, rightParenToken, 1)
@@ -1517,10 +1509,9 @@ module.exports.defineVisitor = function create(
null
const leftParenToken = tokenStore.getTokenAfter(awaitToken || forToken)
const leftToken = tokenStore.getTokenAfter(leftParenToken)
- const inToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- leftToken,
- isNotRightParen
- ))
+ const inToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(leftToken, isNotRightParen)
+ )
const rightToken = tokenStore.getTokenAfter(inToken)
const rightParenToken = tokenStore.getTokenBefore(
node.body,
@@ -1615,10 +1606,9 @@ module.exports.defineVisitor = function create(
processMaybeBlock(node.consequent, ifToken)
if (node.alternate != null) {
- const elseToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.consequent,
- isNotRightParen
- ))
+ const elseToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(node.consequent, isNotRightParen)
+ )
setOffset(elseToken, 0, ifToken)
processMaybeBlock(node.alternate, elseToken)
@@ -1739,10 +1729,9 @@ module.exports.defineVisitor = function create(
'MemberExpression, MetaProperty'(node) {
const objectToken = tokenStore.getFirstToken(node)
if (node.type === 'MemberExpression' && node.computed) {
- const leftBracketToken = /** @type {Token} */ (tokenStore.getTokenBefore(
- node.property,
- isLeftBracket
- ))
+ const leftBracketToken = /** @type {Token} */ (
+ tokenStore.getTokenBefore(node.property, isLeftBracket)
+ )
const propertyToken = tokenStore.getTokenAfter(leftBracketToken)
const rightBracketToken = tokenStore.getTokenAfter(
node.property,
@@ -1772,15 +1761,13 @@ module.exports.defineVisitor = function create(
/** @type {Token} */
let lastKeyToken
if (node.computed) {
- const keyLeftToken = /** @type {Token} */ (tokenStore.getFirstToken(
- node,
- isLeftBracket
- ))
+ const keyLeftToken = /** @type {Token} */ (
+ tokenStore.getFirstToken(node, isLeftBracket)
+ )
const keyToken = tokenStore.getTokenAfter(keyLeftToken)
- const keyRightToken = (lastKeyToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.key,
- isRightBracket
- )))
+ const keyRightToken = (lastKeyToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(node.key, isRightBracket)
+ ))
if (hasPrefix) {
setOffset(keyLeftToken, 0, /** @type {Token} */ (last(prefixTokens)))
@@ -1864,10 +1851,9 @@ module.exports.defineVisitor = function create(
const switchToken = tokenStore.getFirstToken(node)
const leftParenToken = tokenStore.getTokenAfter(switchToken)
const discriminantToken = tokenStore.getTokenAfter(leftParenToken)
- const leftBraceToken = /** @type {Token} */ (tokenStore.getTokenAfter(
- node.discriminant,
- isLeftBrace
- ))
+ const leftBraceToken = /** @type {Token} */ (
+ tokenStore.getTokenAfter(node.discriminant, isLeftBrace)
+ )
const rightParenToken = tokenStore.getTokenBefore(leftBraceToken)
const rightBraceToken = tokenStore.getLastToken(node)
diff --git ORI/eslint-plugin-vue/lib/utils/index.js ALT/eslint-plugin-vue/lib/utils/index.js
index 0bcf801..055ffb4 100644
--- ORI/eslint-plugin-vue/lib/utils/index.js
+++ ALT/eslint-plugin-vue/lib/utils/index.js
@@ -274,10 +274,9 @@ module.exports = {
// Move `Program` handlers to `VElement[parent.type!='VElement']`
const coreHandlers = coreRule.create(context)
- const handlers = /** @type {TemplateListener} */ (Object.assign(
- {},
- coreHandlers
- ))
+ const handlers = /** @type {TemplateListener} */ (
+ Object.assign({}, coreHandlers)
+ )
if (handlers.Program) {
handlers["VElement[parent.type!='VElement']"] = handlers.Program
delete handlers.Program
@@ -838,11 +837,14 @@ module.exports = {
if (propValue.type === 'FunctionExpression') {
value = propValue.body
} else if (propValue.type === 'ObjectExpression') {
- const get = /** @type {(Property & { value: FunctionExpression }) | null} */ (findProperty(
- propValue,
- 'get',
- (p) => p.value.type === 'FunctionExpression'
- ))
+ const get =
+ /** @type {(Property & { value: FunctionExpression }) | null} */ (
+ findProperty(
+ propValue,
+ 'get',
+ (p) => p.value.type === 'FunctionExpression'
+ )
+ )
value = get ? get.value.body : null
}
@@ -870,13 +872,16 @@ module.exports = {
}
if (arg.type === 'ObjectExpression') {
- const getProperty = /** @type {(Property & { value: FunctionExpression | ArrowFunctionExpression }) | null} */ (findProperty(
- arg,
- 'get',
- (p) =>
- p.value.type === 'FunctionExpression' ||
- p.value.type === 'ArrowFunctionExpression'
- ))
+ const getProperty =
+ /** @type {(Property & { value: FunctionExpression | ArrowFunctionExpression }) | null} */ (
+ findProperty(
+ arg,
+ 'get',
+ (p) =>
+ p.value.type === 'FunctionExpression' ||
+ p.value.type === 'ArrowFunctionExpression'
+ )
+ )
return getProperty ? getProperty.value : null
}
diff --git ORI/eslint-plugin-vue/tests/lib/rules/no-irregular-whitespace.js ALT/eslint-plugin-vue/tests/lib/rules/no-irregular-whitespace.js
index 85a0ad4..9c3a40c 100644
--- ORI/eslint-plugin-vue/tests/lib/rules/no-irregular-whitespace.js
+++ ALT/eslint-plugin-vue/tests/lib/rules/no-irregular-whitespace.js
@@ -11,9 +11,10 @@ const tester = new RuleTester({
parserOptions: { ecmaVersion: 2018 }
})
-const IRREGULAR_WHITESPACES = '\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000'.split(
- ''
-)
+const IRREGULAR_WHITESPACES =
+ '\f\v\u0085\ufeff\u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u202f\u205f\u3000'.split(
+ ''
+ )
const IRREGULAR_LINE_TERMINATORS = '\u2028\u2029'.split('')
const ALL_IRREGULAR_WHITESPACES = [].concat(
IRREGULAR_WHITESPACES,
from prettier-regression-testing.
fisker/prettier@v2dot3-witout-10335 VS prettier/[email protected] :: excalidraw/excalidraw@25fd275
Diff (731 lines)
diff --git ORI/excalidraw/src/actions/actionDeleteSelected.tsx ALT/excalidraw/src/actions/actionDeleteSelected.tsx
index dd2ad42..260b7a6 100644
--- ORI/excalidraw/src/actions/actionDeleteSelected.tsx
+++ ALT/excalidraw/src/actions/actionDeleteSelected.tsx
@@ -111,10 +111,8 @@ export const actionDeleteSelected = register({
};
}
- let {
- elements: nextElements,
- appState: nextAppState,
- } = deleteSelectedElements(elements, appState);
+ let { elements: nextElements, appState: nextAppState } =
+ deleteSelectedElements(elements, appState);
fixBindingsAfterDeletion(
nextElements,
elements.filter(({ id }) => appState.selectedElementIds[id]),
diff --git ORI/excalidraw/src/actions/actionExport.tsx ALT/excalidraw/src/actions/actionExport.tsx
index 7d5f228..93338f5 100644
--- ORI/excalidraw/src/actions/actionExport.tsx
+++ ALT/excalidraw/src/actions/actionExport.tsx
@@ -175,10 +175,8 @@ export const actionLoadScene = register({
name: "loadScene",
perform: async (elements, appState) => {
try {
- const {
- elements: loadedElements,
- appState: loadedAppState,
- } = await loadFromJSON(appState);
+ const { elements: loadedElements, appState: loadedAppState } =
+ await loadFromJSON(appState);
return {
elements: loadedElements,
appState: loadedAppState,
diff --git ORI/excalidraw/src/actions/actionFinalize.tsx ALT/excalidraw/src/actions/actionFinalize.tsx
index 30db774..54ad8fd 100644
--- ORI/excalidraw/src/actions/actionFinalize.tsx
+++ ALT/excalidraw/src/actions/actionFinalize.tsx
@@ -20,11 +20,8 @@ export const actionFinalize = register({
name: "finalize",
perform: (elements, appState, _, { canvas }) => {
if (appState.editingLinearElement) {
- const {
- elementId,
- startBindingElement,
- endBindingElement,
- } = appState.editingLinearElement;
+ const { elementId, startBindingElement, endBindingElement } =
+ appState.editingLinearElement;
const element = LinearElementEditor.getElement(elementId);
if (element) {
diff --git ORI/excalidraw/src/appState.ts ALT/excalidraw/src/appState.ts
index 6b763e0..73ccf68 100644
--- ORI/excalidraw/src/appState.ts
+++ ALT/excalidraw/src/appState.ts
@@ -88,7 +88,7 @@ const APP_STATE_STORAGE_CONF = (<
/** whether to keep when exporting to file/database */
export: boolean;
},
- T extends Record<keyof AppState, Values>
+ T extends Record<keyof AppState, Values>,
>(
config: { [K in keyof T]: K extends keyof AppState ? T[K] : never },
) => config)({
diff --git ORI/excalidraw/src/components/App.tsx ALT/excalidraw/src/components/App.tsx
index bc47f57..cf84421 100644
--- ORI/excalidraw/src/components/App.tsx
+++ ALT/excalidraw/src/components/App.tsx
@@ -1954,7 +1954,10 @@ class App extends React.Component<ExcalidrawProps, AppState> {
}));
this.resetShouldCacheIgnoreZoomDebounced();
} else {
- gesture.lastCenter = gesture.initialDistance = gesture.initialScale = null;
+ gesture.lastCenter =
+ gesture.initialDistance =
+ gesture.initialScale =
+ null;
}
if (isHoldingSpace || isPanning || isDraggingScrollBar) {
@@ -2442,10 +2445,11 @@ class App extends React.Component<ExcalidrawProps, AppState> {
allHitElements: [],
wasAddedToSelection: false,
hasBeenDuplicated: false,
- hasHitCommonBoundingBoxOfSelectedElements: this.isHittingCommonBoundingBoxOfSelectedElements(
- origin,
- selectedElements,
- ),
+ hasHitCommonBoundingBoxOfSelectedElements:
+ this.isHittingCommonBoundingBoxOfSelectedElements(
+ origin,
+ selectedElements,
+ ),
},
drag: {
hasOccurred: false,
@@ -2522,14 +2526,15 @@ class App extends React.Component<ExcalidrawProps, AppState> {
const elements = this.scene.getElements();
const selectedElements = getSelectedElements(elements, this.state);
if (selectedElements.length === 1 && !this.state.editingLinearElement) {
- const elementWithTransformHandleType = getElementWithTransformHandleType(
- elements,
- this.state,
- pointerDownState.origin.x,
- pointerDownState.origin.y,
- this.state.zoom,
- event.pointerType,
- );
+ const elementWithTransformHandleType =
+ getElementWithTransformHandleType(
+ elements,
+ this.state,
+ pointerDownState.origin.x,
+ pointerDownState.origin.y,
+ this.state.zoom,
+ event.pointerType,
+ );
if (elementWithTransformHandleType != null) {
this.setState({
resizingElement: elementWithTransformHandleType.element,
@@ -2605,9 +2610,10 @@ class App extends React.Component<ExcalidrawProps, AppState> {
);
const hitElement = pointerDownState.hit.element;
- const someHitElementIsSelected = pointerDownState.hit.allHitElements.some(
- (element) => this.isASelectedElement(element),
- );
+ const someHitElementIsSelected =
+ pointerDownState.hit.allHitElements.some((element) =>
+ this.isASelectedElement(element),
+ );
if (
(hitElement === null || !someHitElementIsSelected) &&
!event.shiftKey &&
diff --git ORI/excalidraw/src/components/ExportDialog.tsx ALT/excalidraw/src/components/ExportDialog.tsx
index bad31a9..9f5da8a 100644
--- ORI/excalidraw/src/components/ExportDialog.tsx
+++ ALT/excalidraw/src/components/ExportDialog.tsx
@@ -76,11 +76,8 @@ const ExportModal = ({
const [scale, setScale] = useState(defaultScale);
const [exportSelected, setExportSelected] = useState(someElementIsSelected);
const previewRef = useRef<HTMLDivElement>(null);
- const {
- exportBackground,
- viewBackgroundColor,
- shouldAddWatermark,
- } = appState;
+ const { exportBackground, viewBackgroundColor, shouldAddWatermark } =
+ appState;
const exportedElements = exportSelected
? getSelectedElements(elements, appState)
diff --git ORI/excalidraw/src/components/LayerUI.tsx ALT/excalidraw/src/components/LayerUI.tsx
index 32b8fac..b976f38 100644
--- ORI/excalidraw/src/components/LayerUI.tsx
+++ ALT/excalidraw/src/components/LayerUI.tsx
@@ -358,25 +358,24 @@ const LayerUI = ({
);
const renderExportDialog = () => {
- const createExporter = (type: ExportType): ExportCB => async (
- exportedElements,
- scale,
- ) => {
- if (canvas) {
- await exportCanvas(type, exportedElements, appState, canvas, {
- exportBackground: appState.exportBackground,
- name: appState.name,
- viewBackgroundColor: appState.viewBackgroundColor,
- scale,
- shouldAddWatermark: appState.shouldAddWatermark,
- })
- .catch(muteFSAbortError)
- .catch((error) => {
- console.error(error);
- setAppState({ errorMessage: error.message });
- });
- }
- };
+ const createExporter =
+ (type: ExportType): ExportCB =>
+ async (exportedElements, scale) => {
+ if (canvas) {
+ await exportCanvas(type, exportedElements, appState, canvas, {
+ exportBackground: appState.exportBackground,
+ name: appState.name,
+ viewBackgroundColor: appState.viewBackgroundColor,
+ scale,
+ shouldAddWatermark: appState.shouldAddWatermark,
+ })
+ .catch(muteFSAbortError)
+ .catch((error) => {
+ console.error(error);
+ setAppState({ errorMessage: error.message });
+ });
+ }
+ };
return (
<ExportDialog
diff --git ORI/excalidraw/src/components/icons.tsx ALT/excalidraw/src/components/icons.tsx
index e817478..5c9b65b 100644
--- ORI/excalidraw/src/components/icons.tsx
+++ ALT/excalidraw/src/components/icons.tsx
@@ -25,8 +25,12 @@ type Opts = {
} & React.SVGProps<SVGSVGElement>;
const createIcon = (d: string | React.ReactNode, opts: number | Opts = 512) => {
- const { width = 512, height = width, mirror, style } =
- typeof opts === "number" ? ({ width: opts } as Opts) : opts;
+ const {
+ width = 512,
+ height = width,
+ mirror,
+ style,
+ } = typeof opts === "number" ? ({ width: opts } as Opts) : opts;
return (
<svg
aria-hidden="true"
diff --git ORI/excalidraw/src/data/restore.ts ALT/excalidraw/src/data/restore.ts
index 2a12c63..99b4f88 100644
--- ORI/excalidraw/src/data/restore.ts
+++ ALT/excalidraw/src/data/restore.ts
@@ -72,10 +72,9 @@ const restoreElement = (
let fontSize = element.fontSize;
let fontFamily = element.fontFamily;
if ("font" in element) {
- const [fontPx, _fontFamily]: [
- string,
- string,
- ] = (element as any).font.split(" ");
+ const [fontPx, _fontFamily]: [string, string] = (
+ element as any
+ ).font.split(" ");
fontSize = parseInt(fontPx, 10);
fontFamily = getFontFamilyByName(_fontFamily);
}
diff --git ORI/excalidraw/src/element/binding.ts ALT/excalidraw/src/element/binding.ts
index 6588810..ec5895f 100644
--- ORI/excalidraw/src/element/binding.ts
+++ ALT/excalidraw/src/element/binding.ts
@@ -137,14 +137,13 @@ export const bindOrUnbindSelectedElements = (
const maybeBindBindableElement = (
bindableElement: NonDeleted<ExcalidrawBindableElement>,
): void => {
- getElligibleElementsForBindableElementAndWhere(
- bindableElement,
- ).forEach(([linearElement, where]) =>
- bindOrUnbindLinearElement(
- linearElement,
- where === "end" ? "keep" : bindableElement,
- where === "start" ? "keep" : bindableElement,
- ),
+ getElligibleElementsForBindableElementAndWhere(bindableElement).forEach(
+ ([linearElement, where]) =>
+ bindOrUnbindLinearElement(
+ linearElement,
+ where === "end" ? "keep" : bindableElement,
+ where === "start" ? "keep" : bindableElement,
+ ),
);
};
@@ -293,9 +292,11 @@ export const updateBoundElements = (
const simultaneouslyUpdatedElementIds = getSimultaneouslyUpdatedElementIds(
simultaneouslyUpdated,
);
- (Scene.getScene(changedElement)!.getNonDeletedElements(
- boundElementIds,
- ) as NonDeleted<ExcalidrawLinearElement>[]).forEach((linearElement) => {
+ (
+ Scene.getScene(changedElement)!.getNonDeletedElements(
+ boundElementIds,
+ ) as NonDeleted<ExcalidrawLinearElement>[]
+ ).forEach((linearElement) => {
const bindableElement = changedElement as ExcalidrawBindableElement;
// In case the boundElementIds are stale
if (!doesNeedUpdate(linearElement, bindableElement)) {
@@ -580,9 +581,11 @@ export const fixBindingsAfterDuplication = (
});
// Update the linear elements
- (sceneElements.filter(({ id }) =>
- allBoundElementIds.has(id),
- ) as ExcalidrawLinearElement[]).forEach((element) => {
+ (
+ sceneElements.filter(({ id }) =>
+ allBoundElementIds.has(id),
+ ) as ExcalidrawLinearElement[]
+ ).forEach((element) => {
const { startBinding, endBinding } = element;
mutateElement(element, {
startBinding: newBindingAfterDuplication(
@@ -642,17 +645,17 @@ export const fixBindingsAfterDeletion = (
});
}
});
- (sceneElements.filter(({ id }) =>
- boundElementIds.has(id),
- ) as ExcalidrawLinearElement[]).forEach(
- (element: ExcalidrawLinearElement) => {
- const { startBinding, endBinding } = element;
- mutateElement(element, {
- startBinding: newBindingAfterDeletion(startBinding, deletedElementIds),
- endBinding: newBindingAfterDeletion(endBinding, deletedElementIds),
- });
- },
- );
+ (
+ sceneElements.filter(({ id }) =>
+ boundElementIds.has(id),
+ ) as ExcalidrawLinearElement[]
+ ).forEach((element: ExcalidrawLinearElement) => {
+ const { startBinding, endBinding } = element;
+ mutateElement(element, {
+ startBinding: newBindingAfterDeletion(startBinding, deletedElementIds),
+ endBinding: newBindingAfterDeletion(endBinding, deletedElementIds),
+ });
+ });
};
const newBindingAfterDeletion = (
diff --git ORI/excalidraw/src/element/linearElementEditor.ts ALT/excalidraw/src/element/linearElementEditor.ts
index 50eb930..11d205e 100644
--- ORI/excalidraw/src/element/linearElementEditor.ts
+++ ALT/excalidraw/src/element/linearElementEditor.ts
@@ -150,9 +150,8 @@ export class LinearElementEditor {
)
: null;
binding = {
- [activePointIndex === 0
- ? "startBindingElement"
- : "endBindingElement"]: bindingElement,
+ [activePointIndex === 0 ? "startBindingElement" : "endBindingElement"]:
+ bindingElement,
};
}
return {
@@ -236,10 +235,8 @@ export class LinearElementEditor {
// from the end points of the `linearElement` - this is to allow disabling
// binding (which needs to happen at the point the user finishes moving
// the point).
- const {
- startBindingElement,
- endBindingElement,
- } = appState.editingLinearElement;
+ const { startBindingElement, endBindingElement } =
+ appState.editingLinearElement;
if (isBindingEnabled(appState) && isBindingElement(element)) {
bindOrUnbindLinearElement(
element,
diff --git ORI/excalidraw/src/element/resizeElements.ts ALT/excalidraw/src/element/resizeElements.ts
index b8a1a65..6279978 100644
--- ORI/excalidraw/src/element/resizeElements.ts
+++ ALT/excalidraw/src/element/resizeElements.ts
@@ -461,16 +461,12 @@ export const resizeSingleElement = (
}
}
- const [
- newBoundsX1,
- newBoundsY1,
- newBoundsX2,
- newBoundsY2,
- ] = getResizedElementAbsoluteCoords(
- stateAtResizeStart,
- eleNewWidth,
- eleNewHeight,
- );
+ const [newBoundsX1, newBoundsY1, newBoundsX2, newBoundsY2] =
+ getResizedElementAbsoluteCoords(
+ stateAtResizeStart,
+ eleNewWidth,
+ eleNewHeight,
+ );
const newBoundsWidth = newBoundsX2 - newBoundsX1;
const newBoundsHeight = newBoundsY2 - newBoundsY1;
diff --git ORI/excalidraw/src/element/resizeTest.ts ALT/excalidraw/src/element/resizeTest.ts
index 3a794e2..dbdab5a 100644
--- ORI/excalidraw/src/element/resizeTest.ts
+++ ALT/excalidraw/src/element/resizeTest.ts
@@ -36,10 +36,8 @@ export const resizeTest = (
return false;
}
- const {
- rotation: rotationTransformHandle,
- ...transformHandles
- } = getTransformHandles(element, zoom, pointerType);
+ const { rotation: rotationTransformHandle, ...transformHandles } =
+ getTransformHandles(element, zoom, pointerType);
if (
rotationTransformHandle &&
@@ -49,9 +47,8 @@ export const resizeTest = (
}
const filter = Object.keys(transformHandles).filter((key) => {
- const transformHandle = transformHandles[
- key as Exclude<TransformHandleType, "rotation">
- ]!;
+ const transformHandle =
+ transformHandles[key as Exclude<TransformHandleType, "rotation">]!;
if (!transformHandle) {
return false;
}
@@ -105,9 +102,8 @@ export const getTransformHandleTypeFromCoords = (
);
const found = Object.keys(transformHandles).find((key) => {
- const transformHandle = transformHandles[
- key as Exclude<TransformHandleType, "rotation">
- ]!;
+ const transformHandle =
+ transformHandles[key as Exclude<TransformHandleType, "rotation">]!;
return (
transformHandle &&
isInsideTransformHandle(transformHandle, scenePointerX, scenePointerY)
diff --git ORI/excalidraw/src/excalidraw-app/collab/CollabWrapper.tsx ALT/excalidraw/src/excalidraw-app/collab/CollabWrapper.tsx
index de87184..c7c828c 100644
--- ORI/excalidraw/src/excalidraw-app/collab/CollabWrapper.tsx
+++ ALT/excalidraw/src/excalidraw-app/collab/CollabWrapper.tsx
@@ -324,12 +324,8 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
);
break;
case "MOUSE_LOCATION": {
- const {
- pointer,
- button,
- username,
- selectedElementIds,
- } = decryptedData.payload;
+ const { pointer, button, username, selectedElementIds } =
+ decryptedData.payload;
const socketId: SocketUpdateDataSource["MOUSE_LOCATION"]["payload"]["socketId"] =
decryptedData.payload.socketId ||
// @ts-ignore legacy, see #2094 (#2097)
@@ -516,9 +512,8 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
setCollaborators(sockets: string[]) {
this.setState((state) => {
- const collaborators: InstanceType<
- typeof CollabWrapper
- >["collaborators"] = new Map();
+ const collaborators: InstanceType<typeof CollabWrapper>["collaborators"] =
+ new Map();
for (const socketId of sockets) {
if (this.collaborators.has(socketId)) {
collaborators.set(socketId, this.collaborators.get(socketId)!);
diff --git ORI/excalidraw/src/excalidraw-app/collab/Portal.tsx ALT/excalidraw/src/excalidraw-app/collab/Portal.tsx
index b58cc2b..b086033 100644
--- ORI/excalidraw/src/excalidraw-app/collab/Portal.tsx
+++ ALT/excalidraw/src/excalidraw-app/collab/Portal.tsx
@@ -163,8 +163,8 @@ class Portal {
socketId: this.socket.id,
pointer: payload.pointer,
button: payload.button || "up",
- selectedElementIds: this.collab.excalidrawAPI.getAppState()
- .selectedElementIds,
+ selectedElementIds:
+ this.collab.excalidrawAPI.getAppState().selectedElementIds,
username: this.collab.state.username,
},
};
diff --git ORI/excalidraw/src/excalidraw-app/data/firebase.ts ALT/excalidraw/src/excalidraw-app/data/firebase.ts
index 5714831..9ef26a8 100644
--- ORI/excalidraw/src/excalidraw-app/data/firebase.ts
+++ ALT/excalidraw/src/excalidraw-app/data/firebase.ts
@@ -5,9 +5,8 @@ import { getSceneVersion } from "../../element";
import Portal from "../collab/Portal";
import { restoreElements } from "../../data/restore";
-let firebasePromise: Promise<
- typeof import("firebase/app").default
-> | null = null;
+let firebasePromise: Promise<typeof import("firebase/app").default> | null =
+ null;
const loadFirebase = async () => {
const firebase = (
diff --git ORI/excalidraw/src/excalidraw-app/data/index.ts ALT/excalidraw/src/excalidraw-app/data/index.ts
index 5769d78..e7f8d5e 100644
--- ORI/excalidraw/src/excalidraw-app/data/index.ts
+++ ALT/excalidraw/src/excalidraw-app/data/index.ts
@@ -75,9 +75,10 @@ export type SocketUpdateDataIncoming =
type: "INVALID_RESPONSE";
};
-export type SocketUpdateData = SocketUpdateDataSource[keyof SocketUpdateDataSource] & {
- _brand: "socketUpdateData";
-};
+export type SocketUpdateData =
+ SocketUpdateDataSource[keyof SocketUpdateDataSource] & {
+ _brand: "socketUpdateData";
+ };
const IV_LENGTH_BYTES = 12; // 96 bits
diff --git ORI/excalidraw/src/excalidraw-app/index.tsx ALT/excalidraw/src/excalidraw-app/index.tsx
index 31fbeb8..83dd085 100644
--- ORI/excalidraw/src/excalidraw-app/index.tsx
+++ ALT/excalidraw/src/excalidraw-app/index.tsx
@@ -193,7 +193,8 @@ function ExcalidrawWrapper() {
promise: ResolvablePromise<ImportedDataState | null>;
}>({ promise: null! });
if (!initialStatePromiseRef.current.promise) {
- initialStatePromiseRef.current.promise = resolvablePromise<ImportedDataState | null>();
+ initialStatePromiseRef.current.promise =
+ resolvablePromise<ImportedDataState | null>();
}
useEffect(() => {
@@ -203,10 +204,8 @@ function ExcalidrawWrapper() {
}, VERSION_TIMEOUT);
}, []);
- const [
- excalidrawAPI,
- excalidrawRefCallback,
- ] = useCallbackRefState<ExcalidrawImperativeAPI>();
+ const [excalidrawAPI, excalidrawRefCallback] =
+ useCallbackRefState<ExcalidrawImperativeAPI>();
const collabAPI = useContext(CollabContext)?.api;
diff --git ORI/excalidraw/src/packages/excalidraw/webpack.prod.config.js ALT/excalidraw/src/packages/excalidraw/webpack.prod.config.js
index fa3eaef..e771264 100644
--- ORI/excalidraw/src/packages/excalidraw/webpack.prod.config.js
+++ ALT/excalidraw/src/packages/excalidraw/webpack.prod.config.js
@@ -1,7 +1,7 @@
const path = require("path");
const TerserPlugin = require("terser-webpack-plugin");
-const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
- .BundleAnalyzerPlugin;
+const BundleAnalyzerPlugin =
+ require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
module.exports = {
mode: "production",
diff --git ORI/excalidraw/src/packages/utils.ts ALT/excalidraw/src/packages/utils.ts
index 0f4c1c4..bc39a95 100644
--- ORI/excalidraw/src/packages/utils.ts
+++ ALT/excalidraw/src/packages/utils.ts
@@ -26,11 +26,8 @@ export const exportToCanvas = ({
{ elements, appState },
null,
);
- const {
- exportBackground,
- viewBackgroundColor,
- shouldAddWatermark,
- } = restoredAppState;
+ const { exportBackground, viewBackgroundColor, shouldAddWatermark } =
+ restoredAppState;
return _exportToCanvas(
getNonDeletedElements(restoredElements),
{ ...restoredAppState, offsetTop: 0, offsetLeft: 0 },
diff --git ORI/excalidraw/src/packages/utils/webpack.prod.config.js ALT/excalidraw/src/packages/utils/webpack.prod.config.js
index e9b0b94..2888753 100644
--- ORI/excalidraw/src/packages/utils/webpack.prod.config.js
+++ ALT/excalidraw/src/packages/utils/webpack.prod.config.js
@@ -1,7 +1,7 @@
const webpack = require("webpack");
const path = require("path");
-const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
- .BundleAnalyzerPlugin;
+const BundleAnalyzerPlugin =
+ require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
module.exports = {
mode: "production",
diff --git ORI/excalidraw/src/renderer/renderElement.ts ALT/excalidraw/src/renderer/renderElement.ts
index 89048ba..d982ed4 100644
--- ORI/excalidraw/src/renderer/renderElement.ts
+++ ALT/excalidraw/src/renderer/renderElement.ts
@@ -292,16 +292,8 @@ const generateElementShape = (
}
break;
case "diamond": {
- const [
- topX,
- topY,
- rightX,
- rightY,
- bottomX,
- bottomY,
- leftX,
- leftY,
- ] = getDiamondPoints(element);
+ const [topX, topY, rightX, rightY, bottomX, bottomY, leftX, leftY] =
+ getDiamondPoints(element);
shape = generator.polygon(
[
[topX, topY],
diff --git ORI/excalidraw/src/renderer/renderScene.ts ALT/excalidraw/src/renderer/renderScene.ts
index d96bedc..abd32c0 100644
--- ORI/excalidraw/src/renderer/renderScene.ts
+++ ALT/excalidraw/src/renderer/renderScene.ts
@@ -324,12 +324,8 @@ export const renderScene = (
);
}
if (selectionColors.length) {
- const [
- elementX1,
- elementY1,
- elementX2,
- elementY2,
- ] = getElementAbsoluteCoords(element);
+ const [elementX1, elementY1, elementX2, elementY2] =
+ getElementAbsoluteCoords(element);
acc.push({
angle: element.angle,
elementX1,
@@ -625,14 +621,8 @@ const renderSelectionBorder = (
selectionColors: string[];
},
) => {
- const {
- angle,
- elementX1,
- elementY1,
- elementX2,
- elementY2,
- selectionColors,
- } = elementProperties;
+ const { angle, elementX1, elementY1, elementX2, elementY2, selectionColors } =
+ elementProperties;
const elementWidth = elementX2 - elementX1;
const elementHeight = elementY2 - elementY1;
diff --git ORI/excalidraw/src/scene/scrollbars.ts ALT/excalidraw/src/scene/scrollbars.ts
index 19f3275..c36acde 100644
--- ORI/excalidraw/src/scene/scrollbars.ts
+++ ALT/excalidraw/src/scene/scrollbars.ts
@@ -30,12 +30,8 @@ export const getScrollBars = (
};
}
// This is the bounding box of all the elements
- const [
- elementsMinX,
- elementsMinY,
- elementsMaxX,
- elementsMaxY,
- ] = getCommonBounds(elements);
+ const [elementsMinX, elementsMinY, elementsMaxX, elementsMaxY] =
+ getCommonBounds(elements);
// Apply zoom
const viewportWidthWithZoom = viewportWidth / zoom.value;
diff --git ORI/excalidraw/src/scene/selection.ts ALT/excalidraw/src/scene/selection.ts
index 93a7204..03d7427 100644
--- ORI/excalidraw/src/scene/selection.ts
+++ ALT/excalidraw/src/scene/selection.ts
@@ -9,12 +9,8 @@ export const getElementsWithinSelection = (
elements: readonly NonDeletedExcalidrawElement[],
selection: NonDeletedExcalidrawElement,
) => {
- const [
- selectionX1,
- selectionY1,
- selectionX2,
- selectionY2,
- ] = getElementAbsoluteCoords(selection);
+ const [selectionX1, selectionY1, selectionX2, selectionY2] =
+ getElementAbsoluteCoords(selection);
return elements.filter((element) => {
const [elementX1, elementY1, elementX2, elementY2] = getElementBounds(
element,
diff --git ORI/excalidraw/src/tests/helpers/api.ts ALT/excalidraw/src/tests/helpers/api.ts
index 37e9f08..4438e7e 100644
--- ORI/excalidraw/src/tests/helpers/api.ts
+++ ALT/excalidraw/src/tests/helpers/api.ts
@@ -46,7 +46,7 @@ export class API {
};
static createElement = <
- T extends Exclude<ExcalidrawElement["type"], "selection">
+ T extends Exclude<ExcalidrawElement["type"], "selection">,
>({
type,
id,
diff --git ORI/excalidraw/src/tests/regressionTests.test.tsx ALT/excalidraw/src/tests/regressionTests.test.tsx
index c1c7ccc..c8477c9 100644
--- ORI/excalidraw/src/tests/regressionTests.test.tsx
+++ ALT/excalidraw/src/tests/regressionTests.test.tsx
@@ -1303,14 +1303,10 @@ describe("regression tests", () => {
expect(API.getSelectedElements().length).toBe(2);
- const {
- x: firstElementPrevX,
- y: firstElementPrevY,
- } = API.getSelectedElements()[0];
- const {
- x: secondElementPrevX,
- y: secondElementPrevY,
- } = API.getSelectedElements()[1];
+ const { x: firstElementPrevX, y: firstElementPrevY } =
+ API.getSelectedElements()[0];
+ const { x: secondElementPrevX, y: secondElementPrevY } =
+ API.getSelectedElements()[1];
// drag elements from point on common bounding box that doesn't hit any of the elements
mouse.reset();
diff --git ORI/excalidraw/src/tests/scroll.test.tsx ALT/excalidraw/src/tests/scroll.test.tsx
index d1951a2..033d75e 100644
--- ORI/excalidraw/src/tests/scroll.test.tsx
+++ ALT/excalidraw/src/tests/scroll.test.tsx
@@ -59,6 +59,7 @@ describe("appState", () => {
expect(h.state.scrollX).toBe(WIDTH / 2 - ELEM_WIDTH / 2);
expect(h.state.scrollY).toBe(HEIGHT / 2 - ELEM_HEIGHT / 2);
});
- global.window.HTMLDivElement.prototype.getBoundingClientRect = originalGetBoundingClientRect;
+ global.window.HTMLDivElement.prototype.getBoundingClientRect =
+ originalGetBoundingClientRect;
});
});
diff --git ORI/excalidraw/src/utils.ts ALT/excalidraw/src/utils.ts
index 11959d5..a10da4c 100644
--- ORI/excalidraw/src/utils.ts
+++ ALT/excalidraw/src/utils.ts
@@ -355,7 +355,7 @@ export const resolvablePromise = <T>() => {
* @param func handler taking at most single parameter (event).
*/
export const withBatchedUpdates = <
- TFunction extends ((event: any) => void) | (() => void)
+ TFunction extends ((event: any) => void) | (() => void),
>(
func: Parameters<TFunction>["length"] extends 0 | 1 ? TFunction : never,
) =>
from prettier-regression-testing.
fisker/prettier@v2dot3-witout-10335 VS prettier/[email protected] :: prettier/prettier@5f8bad8
Diff (311 lines)
diff --git ORI/prettier/scripts/release/steps/update-dependents-count.js ALT/prettier/scripts/release/steps/update-dependents-count.js
index 1fb641b..b8e7175 100644
--- ORI/prettier/scripts/release/steps/update-dependents-count.js
+++ ALT/prettier/scripts/release/steps/update-dependents-count.js
@@ -23,9 +23,9 @@ async function update() {
const githubPage = await logPromise(
"Fetching github dependents count",
- fetch(
- "https://github.com/prettier/prettier/network/dependents"
- ).then((response) => response.text())
+ fetch("https://github.com/prettier/prettier/network/dependents").then(
+ (response) => response.text()
+ )
);
const dependentsCountGithub = Number(
githubPage
diff --git ORI/prettier/src/cli/context.js ALT/prettier/src/cli/context.js
index 7b88311..8eaea31 100644
--- ORI/prettier/src/cli/context.js
+++ ALT/prettier/src/cli/context.js
@@ -39,13 +39,11 @@ class Context {
this.logger = logger;
this.stack = [];
- const {
- plugin: plugins,
- "plugin-search-dir": pluginSearchDirs,
- } = parseArgvWithoutPlugins(rawArguments, logger, [
- "plugin",
- "plugin-search-dir",
- ]);
+ const { plugin: plugins, "plugin-search-dir": pluginSearchDirs } =
+ parseArgvWithoutPlugins(rawArguments, logger, [
+ "plugin",
+ "plugin-search-dir",
+ ]);
this.pushContextPlugins(plugins, pluginSearchDirs);
diff --git ORI/prettier/src/language-html/conditional-comment.js ALT/prettier/src/language-html/conditional-comment.js
index 0bb2ce4..7cccab4 100644
--- ORI/prettier/src/language-html/conditional-comment.js
+++ ALT/prettier/src/language-html/conditional-comment.js
@@ -7,7 +7,8 @@ const {
// https://css-tricks.com/how-to-create-an-ie-only-stylesheet
// <!--[if ... ]> ... <![endif]-->
-const IE_CONDITIONAL_START_END_COMMENT_REGEX = /^(\[if([^\]]*?)]>)([\S\s]*?)<!\s*\[endif]$/;
+const IE_CONDITIONAL_START_END_COMMENT_REGEX =
+ /^(\[if([^\]]*?)]>)([\S\s]*?)<!\s*\[endif]$/;
// <!--[if ... ]><!-->
const IE_CONDITIONAL_START_COMMENT_REGEX = /^\[if([^\]]*?)]><!$/;
// <!--<![endif]-->
diff --git ORI/prettier/src/language-html/print-preprocess.js ALT/prettier/src/language-html/print-preprocess.js
index 9280f8f..041db5c 100644
--- ORI/prettier/src/language-html/print-preprocess.js
+++ ALT/prettier/src/language-html/print-preprocess.js
@@ -337,11 +337,8 @@ function extractWhitespaces(ast /*, options*/) {
const localChildren = [];
- const {
- leadingWhitespace,
- text,
- trailingWhitespace,
- } = getLeadingAndTrailingHtmlWhitespace(child.value);
+ const { leadingWhitespace, text, trailingWhitespace } =
+ getLeadingAndTrailingHtmlWhitespace(child.value);
if (leadingWhitespace) {
localChildren.push({ type: TYPE_WHITESPACE });
diff --git ORI/prettier/src/language-html/syntax-vue.js ALT/prettier/src/language-html/syntax-vue.js
index 897808d..b4f0ce1 100644
--- ORI/prettier/src/language-html/syntax-vue.js
+++ ALT/prettier/src/language-html/syntax-vue.js
@@ -75,7 +75,8 @@ function isVueEventBindingExpression(eventBindingValue) {
// arrow function or anonymous function
const fnExpRE = /^([\w$]+|\([^)]*?\))\s*=>|^function\s*\(/;
// simple member expression chain (a, a.b, a['b'], a["b"], a[0], a[b])
- const simplePathRE = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/;
+ const simplePathRE =
+ /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/;
// https://github.com/vuejs/vue/blob/v2.5.17/src/compiler/helpers.js#L104
const value = eventBindingValue.trim();
diff --git ORI/prettier/src/language-js/comments.js ALT/prettier/src/language-js/comments.js
index cc2767f..b0366e8 100644
--- ORI/prettier/src/language-js/comments.js
+++ ALT/prettier/src/language-js/comments.js
@@ -585,10 +585,11 @@ function handleLastFunctionArgComments({
locEnd(getLast(parameters))
);
}
- const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
- text,
- locEnd(enclosingNode.id)
- );
+ const functionParamLeftParenIndex =
+ getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
+ text,
+ locEnd(enclosingNode.id)
+ );
return (
functionParamLeftParenIndex !== false &&
getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
diff --git ORI/prettier/src/language-js/parse-postprocess.js ALT/prettier/src/language-js/parse-postprocess.js
index 6d95b38..fd97535 100644
--- ORI/prettier/src/language-js/parse-postprocess.js
+++ ALT/prettier/src/language-js/parse-postprocess.js
@@ -12,10 +12,8 @@ function postprocess(ast, options) {
// Invalid decorators are removed since `@typescript-eslint/typescript-estree` v4
// https://github.com/typescript-eslint/typescript-eslint/pull/2375
if (options.parser === "typescript" && options.originalText.includes("@")) {
- const {
- esTreeNodeToTSNodeMap,
- tsNodeToESTreeNodeMap,
- } = options.tsParseResult;
+ const { esTreeNodeToTSNodeMap, tsNodeToESTreeNodeMap } =
+ options.tsParseResult;
ast = visitNode(ast, (node) => {
const tsNode = esTreeNodeToTSNodeMap.get(node);
if (!tsNode) {
diff --git ORI/prettier/src/language-js/parser-babel.js ALT/prettier/src/language-js/parser-babel.js
index 0d503c8..869100d 100644
--- ORI/prettier/src/language-js/parser-babel.js
+++ ALT/prettier/src/language-js/parser-babel.js
@@ -68,10 +68,8 @@ function isFlowFile(text, options) {
text = text.slice(shebang.length);
}
- const firstNonSpaceNonCommentCharacterIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(
- text,
- 0
- );
+ const firstNonSpaceNonCommentCharacterIndex =
+ getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, 0);
if (firstNonSpaceNonCommentCharacterIndex !== false) {
text = text.slice(0, firstNonSpaceNonCommentCharacterIndex);
@@ -120,8 +118,8 @@ function createParse(parseMethod, ...optionsCombinations) {
}
const { result: ast, error } = tryCombinations(
- ...combinations.map((options) => () =>
- parseWithOptions(parseMethod, text, options)
+ ...combinations.map(
+ (options) => () => parseWithOptions(parseMethod, text, options)
)
);
diff --git ORI/prettier/src/language-markdown/constants.evaluate.js ALT/prettier/src/language-markdown/constants.evaluate.js
index 1b9ab9d..45c799f 100644
--- ORI/prettier/src/language-markdown/constants.evaluate.js
+++ ALT/prettier/src/language-markdown/constants.evaluate.js
@@ -27,7 +27,8 @@ const kPattern = unicodeRegex({ Script: ["Hangul"] })
.toString();
// http://spec.commonmark.org/0.25/#ascii-punctuation-character
-const asciiPunctuationCharset = /* prettier-ignore */ regexpUtil.charset(
+const asciiPunctuationCharset =
+ /* prettier-ignore */ regexpUtil.charset(
"!", '"', "#", "$", "%", "&", "'", "(", ")", "*",
"+", ",", "-", ".", "/", ":", ";", "<", "=", ">",
"?", "@", "[", "\\", "]", "^", "_", "`", "{", "|",
diff --git ORI/prettier/src/language-markdown/utils.js ALT/prettier/src/language-markdown/utils.js
index de21b4e..4b7d260 100644
--- ORI/prettier/src/language-markdown/utils.js
+++ ALT/prettier/src/language-markdown/utils.js
@@ -51,9 +51,13 @@ function splitText(text, options) {
/** @type {Array<{ type: "whitespace", value: " " | "\n" | "" } | { type: "word", value: string }>} */
const nodes = [];
- const tokens = (options.proseWrap === "preserve"
- ? text
- : text.replace(new RegExp(`(${cjkPattern})\n(${cjkPattern})`, "g"), "$1$2")
+ const tokens = (
+ options.proseWrap === "preserve"
+ ? text
+ : text.replace(
+ new RegExp(`(${cjkPattern})\n(${cjkPattern})`, "g"),
+ "$1$2"
+ )
).split(/([\t\n ]+)/);
for (const [index, token] of tokens.entries()) {
// whitespace
diff --git ORI/prettier/src/main/comments.js ALT/prettier/src/main/comments.js
index 17e6523..edd8452 100644
--- ORI/prettier/src/main/comments.js
+++ ALT/prettier/src/main/comments.js
@@ -313,10 +313,8 @@ function isOwnLineComment(text, options, decoratedComments, commentIndex) {
if (precedingNode) {
// Find first comment on the same line
for (let index = commentIndex - 1; index >= 0; index--) {
- const {
- comment,
- precedingNode: currentCommentPrecedingNode,
- } = decoratedComments[index];
+ const { comment, precedingNode: currentCommentPrecedingNode } =
+ decoratedComments[index];
if (
currentCommentPrecedingNode !== precedingNode ||
!isAllEmptyAndNoLineBreak(text.slice(locEnd(comment), start))
@@ -342,10 +340,8 @@ function isEndOfLineComment(text, options, decoratedComments, commentIndex) {
index < decoratedComments.length;
index++
) {
- const {
- comment,
- followingNode: currentCommentFollowingNode,
- } = decoratedComments[index];
+ const { comment, followingNode: currentCommentFollowingNode } =
+ decoratedComments[index];
if (
currentCommentFollowingNode !== followingNode ||
!isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment)))
diff --git ORI/prettier/tests_integration/__tests__/infer-parser.js ALT/prettier/tests_integration/__tests__/infer-parser.js
index 5e27a6b..88ea300 100644
--- ORI/prettier/tests_integration/__tests__/infer-parser.js
+++ ALT/prettier/tests_integration/__tests__/infer-parser.js
@@ -163,11 +163,9 @@ describe("--write and --list-different with unknown path and no parser", () => {
});
describe("multiple files", () => {
- runPrettier("cli/infer-parser/", [
- "--list-different",
- "--write",
- "*",
- ]).test({ status: 0 });
+ runPrettier("cli/infer-parser/", ["--list-different", "--write", "*"]).test(
+ { status: 0 }
+ );
});
});
diff --git ORI/prettier/tests_integration/__tests__/line-suffix-boundary.js ALT/prettier/tests_integration/__tests__/line-suffix-boundary.js
index a420c56..8622a9b 100644
--- ORI/prettier/tests_integration/__tests__/line-suffix-boundary.js
+++ ALT/prettier/tests_integration/__tests__/line-suffix-boundary.js
@@ -3,14 +3,8 @@
/** @type {import('prettier')} */
const prettier = require("prettier-local");
-const {
- group,
- indent,
- line,
- lineSuffix,
- lineSuffixBoundary,
- softline,
-} = prettier.doc.builders;
+const { group, indent, line, lineSuffix, lineSuffixBoundary, softline } =
+ prettier.doc.builders;
const printDoc = require("../printDoc");
diff --git ORI/prettier/website/README.md ALT/prettier/website/README.md
index 1be538c..a410312 100644
--- ORI/prettier/website/README.md
+++ ALT/prettier/website/README.md
@@ -57,7 +57,6 @@ previous: doc0 # previous doc on sidebar for navigation
next: doc2 # next doc on the sidebar for navigation
# don’t include next if this is the last doc; don’t include previous if first doc
---
-
```
The docs from `docs/` are published to `https://prettier.io/docs/en/next/` and are considered to be the docs of the next (not yet released) version of Prettier. When a release happens, the docs from `docs/` are copied to the `website/versioned_docs/version-stable` directory, whose content is published to `https://prettier.io/docs/en`.
@@ -71,7 +70,6 @@ title: Blog Post Title
author: Author Name
authorURL: http://github.com/author # (or some other link)
---
-
```
In the blog post, you should include a line `<!--truncate-->`. This determines under which point text will be ignored when generating the preview of your blog post. Blog posts should have the file name format: `yyyy-mm-dd-your-file-name.md`.
diff --git ORI/prettier/website/pages/playground-redirect.html ALT/prettier/website/pages/playground-redirect.html
index e8bc4a4..f03a9a5 100644
--- ORI/prettier/website/pages/playground-redirect.html
+++ ALT/prettier/website/pages/playground-redirect.html
@@ -16,9 +16,10 @@
/>
</p>
<script>
- const match = /^https:\/\/github\.com\/prettier\/prettier\/pull\/(\d+)/.exec(
- document.referrer
- );
+ const match =
+ /^https:\/\/github\.com\/prettier\/prettier\/pull\/(\d+)/.exec(
+ document.referrer
+ );
if (match != null) {
const [, /* url */ pr] = match;
location.replace(
diff --git ORI/prettier/website/playground/util.js ALT/prettier/website/playground/util.js
index 96edd8e..32b9bae 100644
--- ORI/prettier/website/playground/util.js
+++ ALT/prettier/website/playground/util.js
@@ -53,9 +53,11 @@ export function getCodemirrorMode(parser) {
}
const astAutoFold = {
- estree: /^\s*"(loc|start|end|tokens|leadingComments|trailingComments|innerComments)":/,
+ estree:
+ /^\s*"(loc|start|end|tokens|leadingComments|trailingComments|innerComments)":/,
postcss: /^\s*"(source|input|raws|file)":/,
- html: /^\s*"(sourceSpan|valueSpan|nameSpan|startSourceSpan|endSourceSpan|tagDefinition)":/,
+ html:
+ /^\s*"(sourceSpan|valueSpan|nameSpan|startSourceSpan|endSourceSpan|tagDefinition)":/,
mdast: /^\s*"position":/,
yaml: /^\s*"position":/,
glimmer: /^\s*"loc":/,
from prettier-regression-testing.
fisker/prettier@v2dot3-witout-10335 VS prettier/[email protected] :: typescript-eslint/typescript-eslint@d0d7186
Diff (3466 lines)
diff --git ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts
index bc26d9d..c38a870 100644
--- ORI/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts
+++ ALT/typescript-eslint/packages/eslint-plugin-internal/src/rules/plugin-test-formatting.ts
@@ -55,9 +55,8 @@ function getExpectedIndentForNode(
sourceCodeLines: string[],
): number {
const lineIdx = node.loc.start.line - 1;
- const indent = START_OF_LINE_WHITESPACE_MATCHER.exec(
- sourceCodeLines[lineIdx],
- )![1];
+ const indent =
+ START_OF_LINE_WHITESPACE_MATCHER.exec(sourceCodeLines[lineIdx])![1];
return indent.length;
}
function doIndent(line: string, indent: number): string {
@@ -333,9 +332,8 @@ export default createRule<Options, MessageIds>({
// +2 because we expect the string contents are indented one level
const expectedIndent = parentIndent + 2;
- const firstLineIndent = START_OF_LINE_WHITESPACE_MATCHER.exec(
- lines[0],
- )![1];
+ const firstLineIndent =
+ START_OF_LINE_WHITESPACE_MATCHER.exec(lines[0])![1];
const requiresIndent = firstLineIndent.length > 0;
if (requiresIndent) {
if (firstLineIndent.length !== expectedIndent) {
@@ -488,7 +486,8 @@ export default createRule<Options, MessageIds>({
return {
// valid
- 'CallExpression > ObjectExpression > Property[key.name = "valid"] > ArrayExpression': checkValidTest,
+ 'CallExpression > ObjectExpression > Property[key.name = "valid"] > ArrayExpression':
+ checkValidTest,
// invalid - errors
[invalidTestsSelectorPath.join(' > ')]: checkInvalidTest,
// invalid - suggestions
@@ -502,7 +501,8 @@ export default createRule<Options, MessageIds>({
AST_NODE_TYPES.ObjectExpression,
].join(' > ')]: checkInvalidTest,
// special case for our batchedSingleLineTests utility
- 'CallExpression[callee.name = "batchedSingleLineTests"] > ObjectExpression': checkInvalidTest,
+ 'CallExpression[callee.name = "batchedSingleLineTests"] > ObjectExpression':
+ checkInvalidTest,
};
},
});
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/ban-ts-comment.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/ban-ts-comment.ts
index 7c2f237..4bf17c2 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/ban-ts-comment.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/ban-ts-comment.ts
@@ -102,8 +102,10 @@ export default util.createRule<[Options], MessageIds>({
The regex used are taken from the ones used in the official TypeScript repo -
https://github.com/microsoft/TypeScript/blob/master/src/compiler/scanner.ts#L281-L289
*/
- const commentDirectiveRegExSingleLine = /^\/*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/;
- const commentDirectiveRegExMultiLine = /^\s*(?:\/|\*)*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/;
+ const commentDirectiveRegExSingleLine =
+ /^\/*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/;
+ const commentDirectiveRegExMultiLine =
+ /^\s*(?:\/|\*)*\s*@ts-(expect-error|ignore|check|nocheck)(.*)/;
const sourceCode = context.getSourceCode();
return {
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/ban-tslint-comment.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/ban-tslint-comment.ts
index 4521fcb..37dfefd 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/ban-tslint-comment.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/ban-tslint-comment.ts
@@ -3,7 +3,8 @@ import * as util from '../util';
// tslint regex
// https://github.com/palantir/tslint/blob/95d9d958833fd9dc0002d18cbe34db20d0fbf437/src/enableDisableRules.ts#L32
-const ENABLE_DISABLE_REGEX = /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/;
+const ENABLE_DISABLE_REGEX =
+ /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/;
const toText = (
text: string,
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/brace-style.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/brace-style.ts
index 7107bdf..b1915bc 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/brace-style.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/brace-style.ts
@@ -26,10 +26,8 @@ export default createRule<Options, MessageIds>({
},
defaultOptions: ['1tbs'],
create(context) {
- const [
- style,
- { allowSingleLine } = { allowSingleLine: false },
- ] = context.options;
+ const [style, { allowSingleLine } = { allowSingleLine: false }] =
+ context.options;
const isAllmanStyle = style === 'allman';
const sourceCode = context.getSourceCode();
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts
index 6a30672..77355b5 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/consistent-type-imports.ts
@@ -254,9 +254,10 @@ export default util.createRule<Options, MessageIds>({
const isTypeImport = report.node.importKind === 'type';
// we have a mixed type/value import, so we need to split them out into multiple exports
- const importNames = (isTypeImport
- ? report.valueSpecifiers
- : report.typeSpecifiers
+ const importNames = (
+ isTypeImport
+ ? report.valueSpecifiers
+ : report.typeSpecifiers
).map(specifier => `"${specifier.local.name}"`);
const message = ((): {
@@ -342,9 +343,7 @@ export default util.createRule<Options, MessageIds>({
: {}),
};
- function classifySpecifier(
- node: TSESTree.ImportDeclaration,
- ): {
+ function classifySpecifier(node: TSESTree.ImportDeclaration): {
defaultSpecifier: TSESTree.ImportDefaultSpecifier | null;
namespaceSpecifier: TSESTree.ImportNamespaceSpecifier | null;
namedSpecifiers: TSESTree.ImportSpecifier[];
@@ -358,10 +357,11 @@ export default util.createRule<Options, MessageIds>({
(specifier): specifier is TSESTree.ImportNamespaceSpecifier =>
specifier.type === AST_NODE_TYPES.ImportNamespaceSpecifier,
) ?? null;
- const namedSpecifiers: TSESTree.ImportSpecifier[] = node.specifiers.filter(
- (specifier): specifier is TSESTree.ImportSpecifier =>
- specifier.type === AST_NODE_TYPES.ImportSpecifier,
- );
+ const namedSpecifiers: TSESTree.ImportSpecifier[] =
+ node.specifiers.filter(
+ (specifier): specifier is TSESTree.ImportSpecifier =>
+ specifier.type === AST_NODE_TYPES.ImportSpecifier,
+ );
return {
defaultSpecifier,
namespaceSpecifier,
@@ -526,11 +526,8 @@ export default util.createRule<Options, MessageIds>({
): IterableIterator<TSESLint.RuleFix> {
const { node } = report;
- const {
- defaultSpecifier,
- namespaceSpecifier,
- namedSpecifiers,
- } = classifySpecifier(node);
+ const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } =
+ classifySpecifier(node);
if (namespaceSpecifier && !defaultSpecifier) {
// e.g.
@@ -737,11 +734,8 @@ export default util.createRule<Options, MessageIds>({
): IterableIterator<TSESLint.RuleFix> {
const { node } = report;
- const {
- defaultSpecifier,
- namespaceSpecifier,
- namedSpecifiers,
- } = classifySpecifier(node);
+ const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } =
+ classifySpecifier(node);
if (namespaceSpecifier) {
// e.g.
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/dot-notation.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/dot-notation.ts
index 2c9dd9f..b2b980c 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/dot-notation.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/dot-notation.ts
@@ -78,8 +78,8 @@ export default createRule<Options, MessageIds>({
const objectSymbol = typeChecker.getSymbolAtLocation(
parserServices.esTreeNodeToTSNodeMap.get(node.property),
);
- const modifierKind = objectSymbol?.getDeclarations()?.[0]
- ?.modifiers?.[0].kind;
+ const modifierKind =
+ objectSymbol?.getDeclarations()?.[0]?.modifiers?.[0].kind;
if (
(allowPrivateClassPropertyAccess &&
modifierKind == ts.SyntaxKind.PrivateKeyword) ||
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/indent.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/indent.ts
index 9ac6a15..5c74968 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/indent.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/indent.ts
@@ -241,10 +241,9 @@ export default util.createRule<Options, MessageIds>({
// transform it to an ObjectExpression
return rules['ObjectExpression, ObjectPattern']({
type: AST_NODE_TYPES.ObjectExpression,
- properties: (node.members as (
- | TSESTree.TSEnumMember
- | TSESTree.TypeElement
- )[]).map(
+ properties: (
+ node.members as (TSESTree.TSEnumMember | TSESTree.TypeElement)[]
+ ).map(
member =>
TSPropertySignatureToProperty(member) as TSESTree.Property,
),
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/method-signature-style.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/method-signature-style.ts
index 54e68b2..4775a1f 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/method-signature-style.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/method-signature-style.ts
@@ -130,12 +130,13 @@ export default util.createRule<Options, MessageIds>({
? parent.members
: [];
- const duplicatedKeyMethodNodes: TSESTree.TSMethodSignature[] = members.filter(
- (element): element is TSESTree.TSMethodSignature =>
- element.type === AST_NODE_TYPES.TSMethodSignature &&
- element !== methodNode &&
- getMethodKey(element) === getMethodKey(methodNode),
- );
+ const duplicatedKeyMethodNodes: TSESTree.TSMethodSignature[] =
+ members.filter(
+ (element): element is TSESTree.TSMethodSignature =>
+ element.type === AST_NODE_TYPES.TSMethodSignature &&
+ element !== methodNode &&
+ getMethodKey(element) === getMethodKey(methodNode),
+ );
const isParentModule = isNodeParentModuleDeclaration(methodNode);
if (duplicatedKeyMethodNodes.length > 0) {
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts
index b58edd9..f507f37 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-extra-non-null-assertion.ts
@@ -32,8 +32,10 @@ export default util.createRule({
return {
'TSNonNullExpression > TSNonNullExpression': checkExtraNonNullAssertion,
- 'MemberExpression[optional = true] > TSNonNullExpression.object': checkExtraNonNullAssertion,
- 'CallExpression[optional = true] > TSNonNullExpression.callee': checkExtraNonNullAssertion,
+ 'MemberExpression[optional = true] > TSNonNullExpression.object':
+ checkExtraNonNullAssertion,
+ 'CallExpression[optional = true] > TSNonNullExpression.callee':
+ checkExtraNonNullAssertion,
};
},
});
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-inferrable-types.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-inferrable-types.ts
index d6b6538..110bda4 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-inferrable-types.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-inferrable-types.ts
@@ -242,12 +242,14 @@ export default util.createRule<Options, MessageIds>({
if (ignoreParameters || !node.params) {
return;
}
- (node.params.filter(
- param =>
- param.type === AST_NODE_TYPES.AssignmentPattern &&
- param.left &&
- param.right,
- ) as TSESTree.AssignmentPattern[]).forEach(param => {
+ (
+ node.params.filter(
+ param =>
+ param.type === AST_NODE_TYPES.AssignmentPattern &&
+ param.left &&
+ param.right,
+ ) as TSESTree.AssignmentPattern[]
+ ).forEach(param => {
reportInferrableType(param, param.left.typeAnnotation, param.right);
});
}
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-magic-numbers.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-magic-numbers.ts
index 0cb4133..1f45a48 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-magic-numbers.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-magic-numbers.ts
@@ -84,9 +84,8 @@ export default util.createRule<Options, MessageIds>({
return;
}
- let fullNumberNode:
- | TSESTree.Literal
- | TSESTree.UnaryExpression = node;
+ let fullNumberNode: TSESTree.Literal | TSESTree.UnaryExpression =
+ node;
let raw = node.raw;
if (
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts
index fa67859..adbee1e 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-redeclare.ts
@@ -64,9 +64,7 @@ export default util.createRule<Options, MessageIds>({
AST_NODE_TYPES.FunctionDeclaration,
]);
- function* iterateDeclarations(
- variable: TSESLint.Scope.Variable,
- ): Generator<
+ function* iterateDeclarations(variable: TSESLint.Scope.Variable): Generator<
{
type: 'builtin' | 'syntax' | 'comment';
node?: TSESTree.Identifier | TSESTree.Comment;
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts
index aee4963..fcf11f3 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts
@@ -443,9 +443,9 @@ export default createRule<Options, MessageId>({
// (Value to complexity ratio is dubious however)
}
// Otherwise just do type analysis on the function as a whole.
- const returnTypes = getCallSignaturesOfType(
- getNodeType(callback),
- ).map(sig => sig.getReturnType());
+ const returnTypes = getCallSignaturesOfType(getNodeType(callback)).map(
+ sig => sig.getReturnType(),
+ );
/* istanbul ignore if */ if (returnTypes.length === 0) {
// Not a callable function
return;
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts
index 395bbfd..014b2c2 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-qualifier.ts
@@ -170,12 +170,16 @@ export default util.createRule({
return {
TSModuleDeclaration: enterDeclaration,
TSEnumDeclaration: enterDeclaration,
- 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]': enterDeclaration,
- 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]': enterDeclaration,
+ 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]':
+ enterDeclaration,
+ 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]':
+ enterDeclaration,
'TSModuleDeclaration:exit': exitDeclaration,
'TSEnumDeclaration:exit': exitDeclaration,
- 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]:exit': exitDeclaration,
- 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]:exit': exitDeclaration,
+ 'ExportNamedDeclaration[declaration.type="TSModuleDeclaration"]:exit':
+ exitDeclaration,
+ 'ExportNamedDeclaration[declaration.type="TSEnumDeclaration"]:exit':
+ exitDeclaration,
TSQualifiedName(node: TSESTree.TSQualifiedName): void {
visitNamespaceAccess(node, node.left, node.right);
},
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts
index b326c75..1228464 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-unsafe-member-access.ts
@@ -72,7 +72,8 @@ export default util.createRule({
return {
// ignore MemberExpression if it's parent is TSClassImplements or TSInterfaceHeritage
- ':not(TSClassImplements, TSInterfaceHeritage) > MemberExpression': checkMemberExpression,
+ ':not(TSClassImplements, TSInterfaceHeritage) > MemberExpression':
+ checkMemberExpression,
'MemberExpression[computed = true] > *.property'(
node: TSESTree.Expression,
): void {
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-use-before-define.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-use-before-define.ts
index 2b0bb32..5968086 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/no-use-before-define.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-use-before-define.ts
@@ -5,7 +5,8 @@ import {
} from '@typescript-eslint/experimental-utils';
import * as util from '../util';
-const SENTINEL_TYPE = /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/;
+const SENTINEL_TYPE =
+ /^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/;
/**
* Parses a given value as options.
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/object-curly-spacing.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/object-curly-spacing.ts
index 7416124..566be44 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/object-curly-spacing.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/object-curly-spacing.ts
@@ -170,8 +170,8 @@ export default createRule<Options, MessageIds>({
): void {
if (isTokenOnSameLine(first, second)) {
const firstSpaced = sourceCode.isSpaceBetween!(first, second);
- const secondType = sourceCode.getNodeByRangeIndex(second.range[0])!
- .type;
+ const secondType =
+ sourceCode.getNodeByRangeIndex(second.range[0])!.type;
const openingCurlyBraceMustBeSpaced =
options.arraysInObjectsException &&
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-includes.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-includes.ts
index f49b538..d21b088 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-includes.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-includes.ts
@@ -134,10 +134,11 @@ export default createRule({
].join(', ')](node: TSESTree.MemberExpression): void {
// Check if the comparison is equivalent to `includes()`.
const callNode = node.parent as TSESTree.CallExpression;
- const compareNode = (callNode.parent?.type ===
- AST_NODE_TYPES.ChainExpression
- ? callNode.parent.parent
- : callNode.parent) as TSESTree.BinaryExpression;
+ const compareNode = (
+ callNode.parent?.type === AST_NODE_TYPES.ChainExpression
+ ? callNode.parent.parent
+ : callNode.parent
+ ) as TSESTree.BinaryExpression;
const negative = isNegativeCheck(compareNode);
if (!negative && !isPositiveCheck(compareNode)) {
return;
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts
index cd886a9..0e15bf8 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/prefer-optional-chain.ts
@@ -65,10 +65,12 @@ export default util.createRule({
| TSESTree.MemberExpression,
): void {
// selector guarantees this cast
- const initialExpression = (initialIdentifierOrNotEqualsExpr.parent
- ?.type === AST_NODE_TYPES.ChainExpression
- ? initialIdentifierOrNotEqualsExpr.parent.parent
- : initialIdentifierOrNotEqualsExpr.parent) as TSESTree.LogicalExpression;
+ const initialExpression = (
+ initialIdentifierOrNotEqualsExpr.parent?.type ===
+ AST_NODE_TYPES.ChainExpression
+ ? initialIdentifierOrNotEqualsExpr.parent.parent
+ : initialIdentifierOrNotEqualsExpr.parent
+ ) as TSESTree.LogicalExpression;
if (initialExpression.left !== initialIdentifierOrNotEqualsExpr) {
// the node(identifier or member expression) is not the deepest left node
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/semi.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/semi.ts
index 9c18d0e..eccc264 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/semi.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/semi.ts
@@ -36,7 +36,8 @@ export default util.createRule<Options, MessageIds>({
],
create(context) {
const rules = baseRule.create(context);
- const checkForSemicolon = rules.ExpressionStatement as TSESLint.RuleFunction<TSESTree.Node>;
+ const checkForSemicolon =
+ rules.ExpressionStatement as TSESLint.RuleFunction<TSESTree.Node>;
/*
The following nodes are handled by the member-delimiter-style rule
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/rules/triple-slash-reference.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/triple-slash-reference.ts
index 08c3ad6..525febe 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/rules/triple-slash-reference.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/rules/triple-slash-reference.ts
@@ -94,7 +94,8 @@ export default util.createRule<Options, MessageIds>({
return;
}
programNode = node;
- const referenceRegExp = /^\/\s*<reference\s*(types|path|lib)\s*=\s*["|'](.*)["|']/;
+ const referenceRegExp =
+ /^\/\s*<reference\s*(types|path|lib)\s*=\s*["|'](.*)["|']/;
const commentsBefore = sourceCode.getCommentsBefore(programNode);
commentsBefore.forEach(comment => {
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/util/collectUnusedVariables.ts ALT/typescript-eslint/packages/eslint-plugin/src/util/collectUnusedVariables.ts
index 19aaf33..b36d07e 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/util/collectUnusedVariables.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/util/collectUnusedVariables.ts
@@ -9,7 +9,7 @@ import * as util from '.';
class UnusedVarsVisitor<
TMessageIds extends string,
- TOptions extends readonly unknown[]
+ TOptions extends readonly unknown[],
> extends Visitor {
private static readonly RESULTS_CACHE = new WeakMap<
TSESTree.Program,
@@ -32,7 +32,7 @@ class UnusedVarsVisitor<
public static collectUnusedVariables<
TMessageIds extends string,
- TOptions extends readonly unknown[]
+ TOptions extends readonly unknown[],
>(
context: TSESLint.RuleContext<TMessageIds, TOptions>,
): ReadonlySet<TSESLint.Scope.Variable> {
@@ -747,7 +747,7 @@ function isUsedVariable(variable: TSESLint.Scope.Variable): boolean {
*/
function collectUnusedVariables<
TMessageIds extends string,
- TOptions extends readonly unknown[]
+ TOptions extends readonly unknown[],
>(
context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,
): ReadonlySet<TSESLint.Scope.Variable> {
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/util/index.ts ALT/typescript-eslint/packages/eslint-plugin/src/util/index.ts
index e7bb535..825a441 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/util/index.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/util/index.ts
@@ -14,15 +14,10 @@ export * from './requiresQuoting';
export * from './types';
// this is done for convenience - saves migrating all of the old rules
-const {
- applyDefault,
- deepMerge,
- isObjectNotArray,
- getParserServices,
-} = ESLintUtils;
-type InferMessageIdsTypeFromRule<
- T
-> = ESLintUtils.InferMessageIdsTypeFromRule<T>;
+const { applyDefault, deepMerge, isObjectNotArray, getParserServices } =
+ ESLintUtils;
+type InferMessageIdsTypeFromRule<T> =
+ ESLintUtils.InferMessageIdsTypeFromRule<T>;
type InferOptionsTypeFromRule<T> = ESLintUtils.InferOptionsTypeFromRule<T>;
export {
diff --git ORI/typescript-eslint/packages/eslint-plugin/src/util/misc.ts ALT/typescript-eslint/packages/eslint-plugin/src/util/misc.ts
index 2e6c471..e7e0991 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/util/misc.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/util/misc.ts
@@ -91,11 +91,11 @@ function getNameFromMember(
type ExcludeKeys<
TObj extends Record<string, unknown>,
- TKeys extends keyof TObj
+ TKeys extends keyof TObj,
> = { [k in Exclude<keyof TObj, TKeys>]: TObj[k] };
type RequireKeys<
TObj extends Record<string, unknown>,
- TKeys extends keyof TObj
+ TKeys extends keyof TObj,
> = ExcludeKeys<TObj, TKeys> & { [k in TKeys]-?: Exclude<TObj[k], undefined> };
function getEnumNames<T extends string>(myEnum: Record<T, unknown>): T[] {
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/docs.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/docs.test.ts
index 103caeb..d67ff88 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/docs.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/docs.test.ts
@@ -137,9 +137,10 @@ describe('Validating README.md', () => {
for (const [ruleName, rule] of notDeprecated) {
describe(`Checking rule ${ruleName}`, () => {
- const ruleRow: string[] | undefined = (rule.meta.docs?.extendsBaseRule
- ? rulesTables.extension.cells
- : rulesTables.base.cells
+ const ruleRow: string[] | undefined = (
+ rule.meta.docs?.extendsBaseRule
+ ? rulesTables.extension.cells
+ : rulesTables.base.cells
).find(row => row[0].includes(`/${ruleName}.md`));
if (!ruleRow) {
// rule is in the wrong table, the first two tests will catch this, so no point in creating noise;
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
index 5134d59..30887f6 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
@@ -5097,14 +5097,12 @@ type Foo = {
],
};
-const sortedWithGroupingDefaultOption: TSESLint.RunTests<
- MessageIds,
- Options
-> = {
- valid: [
- // default option + interface + default order + alphabetically
- {
- code: `
+const sortedWithGroupingDefaultOption: TSESLint.RunTests<MessageIds, Options> =
+ {
+ valid: [
+ // default option + interface + default order + alphabetically
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5121,14 +5119,14 @@ interface Foo {
() : Baz;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + interface + custom order + alphabetically
- {
- code: `
+ // default option + interface + custom order + alphabetically
+ {
+ code: `
interface Foo {
new () : Bar;
@@ -5144,19 +5142,19 @@ interface Foo {
() : Baz;
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'method', 'field'],
- order: 'alphabetically',
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'method', 'field'],
+ order: 'alphabetically',
+ },
},
- },
- ],
- },
+ ],
+ },
- // default option + type literal + default order + alphabetically
- {
- code: `
+ // default option + type literal + default order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5173,14 +5171,14 @@ type Foo = {
() : Baz;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + type literal + custom order + alphabetically
- {
- code: `
+ // default option + type literal + custom order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5197,19 +5195,19 @@ type Foo = {
() : Baz;
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'method', 'field'],
- order: 'alphabetically',
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'method', 'field'],
+ order: 'alphabetically',
+ },
},
- },
- ],
- },
+ ],
+ },
- // default option + class + default order + alphabetically
- {
- code: `
+ // default option + class + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5222,13 +5220,13 @@ class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
- // default option + class + decorators + default order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
+ // default option + class + decorators + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5245,14 +5243,14 @@ class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + class + custom order + alphabetically
- {
- code: `
+ // default option + class + custom order + alphabetically
+ {
+ code: `
class Foo {
constructor() {}
@@ -5265,19 +5263,19 @@ class Foo {
private static c: string = "";
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
+ },
},
- },
- ],
- },
+ ],
+ },
- // default option + class expression + default order + alphabetically
- {
- code: `
+ // default option + class expression + default order + alphabetically
+ {
+ code: `
const foo = class Foo {
public static a: string;
protected static b: string = "";
@@ -5290,14 +5288,14 @@ const foo = class Foo {
constructor() {}
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // default option + class expression + custom order + alphabetically
- {
- code: `
+ // default option + class expression + custom order + alphabetically
+ {
+ code: `
const foo = class Foo {
constructor() {}
@@ -5310,20 +5308,20 @@ const foo = class Foo {
private static c: string = "";
}
`,
- options: [
- {
- default: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
- },
- },
- ],
- },
- ],
- invalid: [
- // default option + interface + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ {
+ default: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
+ },
+ },
+ ],
+ },
+ ],
+ invalid: [
+ // default option + interface + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5340,23 +5338,23 @@ interface Foo {
new () : Bar;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'new',
- rank: 'method',
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'new',
+ rank: 'method',
+ },
},
- },
- ],
- },
+ ],
+ },
- // default option + type literal + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ // default option + type literal + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5373,23 +5371,23 @@ type Foo = {
new () : Bar;
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'new',
- rank: 'method',
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'new',
+ rank: 'method',
+ },
},
- },
- ],
- },
+ ],
+ },
- // default option + class + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ // default option + class + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
public static c: string = "";
public static b: string = "";
@@ -5400,23 +5398,23 @@ class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
+ },
},
- },
- ],
- },
+ ],
+ },
- // default option + class expression + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ // default option + class expression + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
const foo = class Foo {
public static c: string = "";
public static b: string = "";
@@ -5427,22 +5425,22 @@ const foo = class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
- },
- ],
- },
- // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
+ },
+ },
+ ],
+ },
+ // default option + class + decorators + custom order + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
@Dec() a1: string;
@Dec()
@@ -5459,47 +5457,45 @@ class Foo {
@Dec() d(): void
}
`,
- options: [
- {
- default: {
- memberTypes: [
- 'decorated-field',
- 'field',
- 'constructor',
- 'decorated-method',
- ],
- order: 'alphabetically',
- },
- },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'b1',
- rank: 'constructor',
- },
- },
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'b2',
- rank: 'constructor',
- },
- },
- ],
- },
- ],
-};
-
-const sortedWithGroupingClassesOption: TSESLint.RunTests<
- MessageIds,
- Options
-> = {
- valid: [
- // classes option + interface + alphabetically --> Default order applies
- {
- code: `
+ options: [
+ {
+ default: {
+ memberTypes: [
+ 'decorated-field',
+ 'field',
+ 'constructor',
+ 'decorated-method',
+ ],
+ order: 'alphabetically',
+ },
+ },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'b1',
+ rank: 'constructor',
+ },
+ },
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'b2',
+ rank: 'constructor',
+ },
+ },
+ ],
+ },
+ ],
+ };
+
+const sortedWithGroupingClassesOption: TSESLint.RunTests<MessageIds, Options> =
+ {
+ valid: [
+ // classes option + interface + alphabetically --> Default order applies
+ {
+ code: `
interface Foo {
[a: string] : number;
@@ -5516,12 +5512,12 @@ interface Foo {
() : Baz;
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
- // classes option + type literal + alphabetically --> Default order applies
- {
- code: `
+ // classes option + type literal + alphabetically --> Default order applies
+ {
+ code: `
type Foo = {
[a: string] : number;
@@ -5538,12 +5534,12 @@ type Foo = {
() : Baz;
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
- // classes option + class + default order + alphabetically
- {
- code: `
+ // classes option + class + default order + alphabetically
+ {
+ code: `
class Foo {
public static a: string;
protected static b: string = "";
@@ -5556,14 +5552,14 @@ class Foo {
constructor() {}
}
`,
- options: [
- { classes: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- },
+ options: [
+ { classes: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ },
- // classes option + class + custom order + alphabetically
- {
- code: `
+ // classes option + class + custom order + alphabetically
+ {
+ code: `
class Foo {
constructor() {}
@@ -5576,19 +5572,19 @@ class Foo {
private static c: string = "";
}
`,
- options: [
- {
- classes: {
- memberTypes: ['constructor', 'instance-field', 'static-field'],
- order: 'alphabetically',
+ options: [
+ {
+ classes: {
+ memberTypes: ['constructor', 'instance-field', 'static-field'],
+ order: 'alphabetically',
+ },
},
- },
- ],
- },
+ ],
+ },
- // classes option + class expression + alphabetically --> Default order applies
- {
- code: `
+ // classes option + class expression + alphabetically --> Default order applies
+ {
+ code: `
const foo = class Foo {
public static a: string;
protected static b: string = "";
@@ -5601,13 +5597,13 @@ const foo = class Foo {
constructor() {}
}
`,
- options: [{ classes: { order: 'alphabetically' } }],
- },
- ],
- invalid: [
- // default option + class + wrong order within group and wrong group order + alphabetically
- {
- code: `
+ options: [{ classes: { order: 'alphabetically' } }],
+ },
+ ],
+ invalid: [
+ // default option + class + wrong order within group and wrong group order + alphabetically
+ {
+ code: `
class Foo {
public static c: string = "";
public static b: string = "";
@@ -5618,21 +5614,21 @@ class Foo {
public d: string = "";
}
`,
- options: [
- { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
- ],
- errors: [
- {
- messageId: 'incorrectGroupOrder',
- data: {
- name: 'd',
- rank: 'public constructor',
- },
- },
- ],
- },
- ],
-};
+ options: [
+ { default: { memberTypes: defaultOrder, order: 'alphabetically' } },
+ ],
+ errors: [
+ {
+ messageId: 'incorrectGroupOrder',
+ data: {
+ name: 'd',
+ rank: 'public constructor',
+ },
+ },
+ ],
+ },
+ ],
+ };
const sortedWithGroupingClassExpressionsOption: TSESLint.RunTests<
MessageIds,
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts
index 2694fdb..7bd776e 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts
@@ -368,831 +368,835 @@ interface Garply4 {
options: [{ ignoreRestArgs: true }],
},
],
- invalid: ([
- {
- code: 'const number: any = 1',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 15,
- },
- ],
- },
- {
- code: 'function generic(): any {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 21,
- },
- ],
- },
- {
- code: 'function generic(): Array<any> {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 27,
- },
- ],
- },
- {
- code: 'function generic(): any[] {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 21,
- },
- ],
- },
- {
- code: 'function generic(param: Array<any>): number {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 31,
- },
- ],
- },
- {
- code: 'function generic(param: any[]): number {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 25,
- },
- ],
- },
- {
- code: 'function generic(param: Array<any>): Array<any> {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 31,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: 'function generic(param: Array<unknown>): Array<any> {}',
- },
- {
- messageId: 'suggestNever',
- output: 'function generic(param: Array<never>): Array<any> {}',
- },
- ],
- },
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 44,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: 'function generic(param: Array<any>): Array<unknown> {}',
- },
- {
- messageId: 'suggestNever',
- output: 'function generic(param: Array<any>): Array<never> {}',
- },
- ],
- },
- ],
- },
- {
- code: 'function generic(): Array<Array<any>> {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 33,
- },
- ],
- },
- {
- code: 'function generic(): Array<any[]> {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 27,
- },
- ],
- },
- {
- code: `
+ invalid: (
+ [
+ {
+ code: 'const number: any = 1',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 15,
+ },
+ ],
+ },
+ {
+ code: 'function generic(): any {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 21,
+ },
+ ],
+ },
+ {
+ code: 'function generic(): Array<any> {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 27,
+ },
+ ],
+ },
+ {
+ code: 'function generic(): any[] {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 21,
+ },
+ ],
+ },
+ {
+ code: 'function generic(param: Array<any>): number {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 31,
+ },
+ ],
+ },
+ {
+ code: 'function generic(param: any[]): number {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 25,
+ },
+ ],
+ },
+ {
+ code: 'function generic(param: Array<any>): Array<any> {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 31,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output:
+ 'function generic(param: Array<unknown>): Array<any> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output: 'function generic(param: Array<never>): Array<any> {}',
+ },
+ ],
+ },
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 44,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output:
+ 'function generic(param: Array<any>): Array<unknown> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output: 'function generic(param: Array<any>): Array<never> {}',
+ },
+ ],
+ },
+ ],
+ },
+ {
+ code: 'function generic(): Array<Array<any>> {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 33,
+ },
+ ],
+ },
+ {
+ code: 'function generic(): Array<any[]> {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 27,
+ },
+ ],
+ },
+ {
+ code: `
class Greeter {
constructor(param: Array<any>) {}
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 30,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 30,
+ },
+ ],
+ },
+ {
+ code: `
class Greeter {
message: any;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 14,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 14,
+ },
+ ],
+ },
+ {
+ code: `
class Greeter {
message: Array<any>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 20,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 20,
+ },
+ ],
+ },
+ {
+ code: `
class Greeter {
message: any[];
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 14,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 14,
+ },
+ ],
+ },
+ {
+ code: `
class Greeter {
message: Array<Array<any>>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 26,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 26,
+ },
+ ],
+ },
+ {
+ code: `
class Greeter {
message: Array<any[]>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 20,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 20,
+ },
+ ],
+ },
+ {
+ code: `
interface Greeter {
message: any;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 14,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 14,
+ },
+ ],
+ },
+ {
+ code: `
interface Greeter {
message: Array<any>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 20,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 20,
+ },
+ ],
+ },
+ {
+ code: `
interface Greeter {
message: any[];
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 14,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 14,
+ },
+ ],
+ },
+ {
+ code: `
interface Greeter {
message: Array<Array<any>>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 26,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 26,
+ },
+ ],
+ },
+ {
+ code: `
interface Greeter {
message: Array<any[]>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 20,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 20,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: any;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 14,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 14,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: Array<any>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 20,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 20,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: any[];
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 14,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 14,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: Array<Array<any>>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 26,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 26,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: Array<any[]>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 20,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 20,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string | any;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 23,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 23,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string | Array<any>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 29,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 29,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string | any[];
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 23,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 23,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string | Array<Array<any>>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 35,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 35,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string | Array<any[]>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 29,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 29,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string & any;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 23,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 23,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string & Array<any>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 29,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 29,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string & any[];
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 23,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 23,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string & Array<Array<any>>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 35,
- },
- ],
- },
- {
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 35,
+ },
+ ],
+ },
+ {
+ code: `
type obj = {
message: string & Array<any[]>;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 29,
- },
- ],
- },
- {
- code: 'class Foo<t = any> extends Bar<any> {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 15,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: 'class Foo<t = unknown> extends Bar<any> {}',
- },
- {
- messageId: 'suggestNever',
- output: 'class Foo<t = never> extends Bar<any> {}',
- },
- ],
- },
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 32,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: 'class Foo<t = any> extends Bar<unknown> {}',
- },
- {
- messageId: 'suggestNever',
- output: 'class Foo<t = any> extends Bar<never> {}',
- },
- ],
- },
- ],
- },
- {
- code: 'abstract class Foo<t = any> extends Bar<any> {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 24,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: 'abstract class Foo<t = unknown> extends Bar<any> {}',
- },
- {
- messageId: 'suggestNever',
- output: 'abstract class Foo<t = never> extends Bar<any> {}',
- },
- ],
- },
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 41,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: 'abstract class Foo<t = any> extends Bar<unknown> {}',
- },
- {
- messageId: 'suggestNever',
- output: 'abstract class Foo<t = any> extends Bar<never> {}',
- },
- ],
- },
- ],
- },
- {
- code: 'abstract class Foo<t = any> implements Bar<any>, Baz<any> {}',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 24,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output:
- 'abstract class Foo<t = unknown> implements Bar<any>, Baz<any> {}',
- },
- {
- messageId: 'suggestNever',
- output:
- 'abstract class Foo<t = never> implements Bar<any>, Baz<any> {}',
- },
- ],
- },
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 44,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output:
- 'abstract class Foo<t = any> implements Bar<unknown>, Baz<any> {}',
- },
- {
- messageId: 'suggestNever',
- output:
- 'abstract class Foo<t = any> implements Bar<never>, Baz<any> {}',
- },
- ],
- },
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 54,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output:
- 'abstract class Foo<t = any> implements Bar<any>, Baz<unknown> {}',
- },
- {
- messageId: 'suggestNever',
- output:
- 'abstract class Foo<t = any> implements Bar<any>, Baz<never> {}',
- },
- ],
- },
- ],
- },
- {
- code: 'new Foo<any>()',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 9,
- },
- ],
- },
- {
- code: 'Foo<any>()',
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 5,
- },
- ],
- },
- {
- // https://github.com/typescript-eslint/typescript-eslint/issues/64
- code: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 29,
+ },
+ ],
+ },
+ {
+ code: 'class Foo<t = any> extends Bar<any> {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 15,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output: 'class Foo<t = unknown> extends Bar<any> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output: 'class Foo<t = never> extends Bar<any> {}',
+ },
+ ],
+ },
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 32,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output: 'class Foo<t = any> extends Bar<unknown> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output: 'class Foo<t = any> extends Bar<never> {}',
+ },
+ ],
+ },
+ ],
+ },
+ {
+ code: 'abstract class Foo<t = any> extends Bar<any> {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 24,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output: 'abstract class Foo<t = unknown> extends Bar<any> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output: 'abstract class Foo<t = never> extends Bar<any> {}',
+ },
+ ],
+ },
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 41,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output: 'abstract class Foo<t = any> extends Bar<unknown> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output: 'abstract class Foo<t = any> extends Bar<never> {}',
+ },
+ ],
+ },
+ ],
+ },
+ {
+ code: 'abstract class Foo<t = any> implements Bar<any>, Baz<any> {}',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 24,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output:
+ 'abstract class Foo<t = unknown> implements Bar<any>, Baz<any> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output:
+ 'abstract class Foo<t = never> implements Bar<any>, Baz<any> {}',
+ },
+ ],
+ },
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 44,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output:
+ 'abstract class Foo<t = any> implements Bar<unknown>, Baz<any> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output:
+ 'abstract class Foo<t = any> implements Bar<never>, Baz<any> {}',
+ },
+ ],
+ },
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 54,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output:
+ 'abstract class Foo<t = any> implements Bar<any>, Baz<unknown> {}',
+ },
+ {
+ messageId: 'suggestNever',
+ output:
+ 'abstract class Foo<t = any> implements Bar<any>, Baz<never> {}',
+ },
+ ],
+ },
+ ],
+ },
+ {
+ code: 'new Foo<any>()',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 9,
+ },
+ ],
+ },
+ {
+ code: 'Foo<any>()',
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 5,
+ },
+ ],
+ },
+ {
+ // https://github.com/typescript-eslint/typescript-eslint/issues/64
+ code: `
function test<T extends Partial<any>>() {}
const test = <T extends Partial<any>>() => {};
`.trimRight(),
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 2,
- column: 33,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: `
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 2,
+ column: 33,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output: `
function test<T extends Partial<unknown>>() {}
const test = <T extends Partial<any>>() => {};
`.trimRight(),
- },
- {
- messageId: 'suggestNever',
- output: `
+ },
+ {
+ messageId: 'suggestNever',
+ output: `
function test<T extends Partial<never>>() {}
const test = <T extends Partial<any>>() => {};
`.trimRight(),
- },
- ],
- },
- {
- messageId: 'unexpectedAny',
- line: 3,
- column: 33,
- suggestions: [
- {
- messageId: 'suggestUnknown',
- output: `
+ },
+ ],
+ },
+ {
+ messageId: 'unexpectedAny',
+ line: 3,
+ column: 33,
+ suggestions: [
+ {
+ messageId: 'suggestUnknown',
+ output: `
function test<T extends Partial<any>>() {}
const test = <T extends Partial<unknown>>() => {};
`.trimRight(),
- },
- {
- messageId: 'suggestNever',
- output: `
+ },
+ {
+ messageId: 'suggestNever',
+ output: `
function test<T extends Partial<any>>() {}
const test = <T extends Partial<never>>() => {};
`.trimRight(),
- },
- ],
- },
- ],
- },
- {
- // https://github.com/eslint/typescript-eslint-parser/issues/397
- code: `
+ },
+ ],
+ },
+ ],
+ },
+ {
+ // https://github.com/eslint/typescript-eslint-parser/issues/397
+ code: `
function foo(a: number, ...rest: any[]): void {
return;
}
`,
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 2,
- column: 42,
- },
- ],
- },
- {
- code: 'type Any = any;',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 12,
- },
- ],
- },
- {
- code: 'function foo5(...args: any) {}',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 24,
- },
- ],
- },
- {
- code: 'const bar5 = function (...args: any) {}',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 33,
- },
- ],
- },
- {
- code: 'const baz5 = (...args: any) => {}',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 24,
- },
- ],
- },
- {
- code: 'interface Qux5 { (...args: any): void; }',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 28,
- },
- ],
- },
- {
- code: 'function quux5(fn: (...args: any) => void): void {}',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 30,
- },
- ],
- },
- {
- code: 'function quuz5(): ((...args: any) => void) {}',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 30,
- },
- ],
- },
- {
- code: 'type Fred5 = (...args: any) => void;',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 24,
- },
- ],
- },
- {
- code: 'type Corge5 = new (...args: any) => void;',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 29,
- },
- ],
- },
- {
- code: 'interface Grault5 { new (...args: any): void; }',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 35,
- },
- ],
- },
- {
- code: 'interface Garply5 { f(...args: any): void; }',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 32,
- },
- ],
- },
- {
- code: 'declare function waldo5(...args: any): void;',
- options: [{ ignoreRestArgs: true }],
- errors: [
- {
- messageId: 'unexpectedAny',
- line: 1,
- column: 34,
- },
- ],
- },
- ] as InvalidTestCase[]).reduce<InvalidTestCase[]>((acc, testCase) => {
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 2,
+ column: 42,
+ },
+ ],
+ },
+ {
+ code: 'type Any = any;',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 12,
+ },
+ ],
+ },
+ {
+ code: 'function foo5(...args: any) {}',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 24,
+ },
+ ],
+ },
+ {
+ code: 'const bar5 = function (...args: any) {}',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 33,
+ },
+ ],
+ },
+ {
+ code: 'const baz5 = (...args: any) => {}',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 24,
+ },
+ ],
+ },
+ {
+ code: 'interface Qux5 { (...args: any): void; }',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 28,
+ },
+ ],
+ },
+ {
+ code: 'function quux5(fn: (...args: any) => void): void {}',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 30,
+ },
+ ],
+ },
+ {
+ code: 'function quuz5(): ((...args: any) => void) {}',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 30,
+ },
+ ],
+ },
+ {
+ code: 'type Fred5 = (...args: any) => void;',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 24,
+ },
+ ],
+ },
+ {
+ code: 'type Corge5 = new (...args: any) => void;',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 29,
+ },
+ ],
+ },
+ {
+ code: 'interface Grault5 { new (...args: any): void; }',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 35,
+ },
+ ],
+ },
+ {
+ code: 'interface Garply5 { f(...args: any): void; }',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 32,
+ },
+ ],
+ },
+ {
+ code: 'declare function waldo5(...args: any): void;',
+ options: [{ ignoreRestArgs: true }],
+ errors: [
+ {
+ messageId: 'unexpectedAny',
+ line: 1,
+ column: 34,
+ },
+ ],
+ },
+ ] as InvalidTestCase[]
+ ).reduce<InvalidTestCase[]>((acc, testCase) => {
const suggestions = (code: string): SuggestionOutput[] => [
{
messageId: 'suggestUnknown',
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts
index 0f7bb14..61caf07 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts
@@ -72,27 +72,25 @@ const testCases = [
const validTestCases = flatten(
testCases.map(c => c.code.map(code => `const a = ${code}`)),
);
-const invalidTestCases: TSESLint.InvalidTestCase<
- MessageIds,
- Options
->[] = flatten(
- testCases.map(cas =>
- cas.code.map(code => ({
- code: `const a: ${cas.type} = ${code}`,
- output: `const a = ${code}`,
- errors: [
- {
- messageId: 'noInferrableType',
- data: {
- type: cas.type,
+const invalidTestCases: TSESLint.InvalidTestCase<MessageIds, Options>[] =
+ flatten(
+ testCases.map(cas =>
+ cas.code.map(code => ({
+ code: `const a: ${cas.type} = ${code}`,
+ output: `const a = ${code}`,
+ errors: [
+ {
+ messageId: 'noInferrableType',
+ data: {
+ type: cas.type,
+ },
+ line: 1,
+ column: 7,
},
- line: 1,
- column: 7,
- },
- ],
- })),
- ),
-);
+ ],
+ })),
+ ),
+ );
const ruleTester = new RuleTester({
parser: '@typescript-eslint/parser',
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts
index c093498..67b9d22 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts
@@ -21,7 +21,7 @@ const ruleTester = new RuleTester({
const hasExport = /^export/m;
// const hasImport = /^import .+? from ['"]/m;
function makeExternalModule<
- T extends ValidTestCase<Options> | InvalidTestCase<MessageIds, Options>
+ T extends ValidTestCase<Options> | InvalidTestCase<MessageIds, Options>,
>(tests: T[]): T[] {
return tests.map(t => {
if (!hasExport.test(t.code)) {
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts
index 0cef897..aefb7cd 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts
@@ -1069,13 +1069,13 @@ function addOptional<TOptions extends Readonly<unknown[]>>(
): TSESLint.ValidTestCase<TOptions>[];
function addOptional<
TMessageIds extends string,
- TOptions extends Readonly<unknown[]>
+ TOptions extends Readonly<unknown[]>,
>(
cases: TSESLint.InvalidTestCase<TMessageIds, TOptions>[],
): TSESLint.InvalidTestCase<TMessageIds, TOptions>[];
function addOptional<
TMessageIds extends string,
- TOptions extends Readonly<unknown[]>
+ TOptions extends Readonly<unknown[]>,
>(
cases: (Case<TMessageIds, TOptions> | string)[],
): Case<TMessageIds, TOptions>[] {
diff --git ORI/typescript-eslint/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts
index efe1fe9..2a28119 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tests/util/isUnsafeAssignment.test.ts
@@ -8,9 +8,11 @@ import { isUnsafeAssignment } from '../../src/util/types';
describe('isUnsafeAssignment', () => {
const rootDir = getFixturesRootDir();
- function getTypes(
- code: string,
- ): { sender: ts.Type; receiver: ts.Type; checker: ts.TypeChecker } {
+ function getTypes(code: string): {
+ sender: ts.Type;
+ receiver: ts.Type;
+ checker: ts.TypeChecker;
+ } {
const { ast, services } = parseForESLint(code, {
project: './tsconfig.json',
filePath: path.join(rootDir, 'file.ts'),
diff --git ORI/typescript-eslint/packages/eslint-plugin/tools/generate-configs.ts ALT/typescript-eslint/packages/eslint-plugin/tools/generate-configs.ts
index e78808a..ed84f28 100644
--- ORI/typescript-eslint/packages/eslint-plugin/tools/generate-configs.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/tools/generate-configs.ts
@@ -49,10 +49,8 @@ const BASE_RULES_TO_BE_OVERRIDDEN = new Map(
);
const EXTENDS = ['./configs/base', './configs/eslint-recommended'];
-const ruleEntries: [
- string,
- TSESLint.RuleModule<string, unknown[]>,
-][] = Object.entries(rules).sort((a, b) => a[0].localeCompare(b[0]));
+const ruleEntries: [string, TSESLint.RuleModule<string, unknown[]>][] =
+ Object.entries(rules).sort((a, b) => a[0].localeCompare(b[0]));
/**
* Helper function reduces records to key - value pairs.
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts ALT/typescript-eslint/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts
index cbf8377..e88a731 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ast-utils/eslint-utils/predicates.ts
@@ -47,7 +47,7 @@ const isCommentToken = eslintUtils.isCommentToken as (
token: TSESTree.Token | TSESTree.Comment,
) => token is TSESTree.Comment;
const isNotCommentToken = eslintUtils.isNotCommentToken as <
- T extends TSESTree.Token | TSESTree.Comment
+ T extends TSESTree.Token | TSESTree.Comment,
>(
token: T,
) => token is Exclude<T, TSESTree.Comment>;
diff --git ORI/typescript-eslint/packages/experimental-utils/src/eslint-utils/RuleCreator.ts ALT/typescript-eslint/packages/experimental-utils/src/eslint-utils/RuleCreator.ts
index ca1cfb3..f02b758 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/eslint-utils/RuleCreator.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/eslint-utils/RuleCreator.ts
@@ -19,7 +19,7 @@ function RuleCreator(urlCreator: (ruleName: string) => string) {
return function createRule<
TOptions extends readonly unknown[],
TMessageIds extends string,
- TRuleListener extends RuleListener = RuleListener
+ TRuleListener extends RuleListener = RuleListener,
>({
name,
meta,
diff --git ORI/typescript-eslint/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts ALT/typescript-eslint/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts
index 6ed25e4..29a5667 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/eslint-utils/batchedSingleLineTests.ts
@@ -24,13 +24,13 @@ function batchedSingleLineTests<TOptions extends Readonly<unknown[]>>(
*/
function batchedSingleLineTests<
TMessageIds extends string,
- TOptions extends Readonly<unknown[]>
+ TOptions extends Readonly<unknown[]>,
>(
test: InvalidTestCase<TMessageIds, TOptions>,
): InvalidTestCase<TMessageIds, TOptions>[];
function batchedSingleLineTests<
TMessageIds extends string,
- TOptions extends Readonly<unknown[]>
+ TOptions extends Readonly<unknown[]>,
>(
options: ValidTestCase<TOptions> | InvalidTestCase<TMessageIds, TOptions>,
): (ValidTestCase<TOptions> | InvalidTestCase<TMessageIds, TOptions>)[] {
diff --git ORI/typescript-eslint/packages/experimental-utils/src/eslint-utils/getParserServices.ts ALT/typescript-eslint/packages/experimental-utils/src/eslint-utils/getParserServices.ts
index 925d497..27ad579 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/eslint-utils/getParserServices.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/eslint-utils/getParserServices.ts
@@ -9,7 +9,7 @@ const ERROR_MESSAGE =
*/
function getParserServices<
TMessageIds extends string,
- TOptions extends readonly unknown[]
+ TOptions extends readonly unknown[],
>(
context: Readonly<TSESLint.RuleContext<TMessageIds, TOptions>>,
allowWithoutFullTypeInformation = false,
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Definition.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Definition.ts
index 15c69bb..1999c4f 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Definition.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Definition.ts
@@ -27,13 +27,14 @@ const Definition = ESLintDefinition as DefinitionConstructor;
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface ParameterDefinition extends Definition {}
-const ParameterDefinition = ESLintParameterDefinition as DefinitionConstructor & {
- new (
- name: TSESTree.Node,
- node: TSESTree.Node,
- index?: number | null,
- rest?: boolean,
- ): ParameterDefinition;
-};
+const ParameterDefinition =
+ ESLintParameterDefinition as DefinitionConstructor & {
+ new (
+ name: TSESTree.Node,
+ node: TSESTree.Node,
+ index?: number | null,
+ rest?: boolean,
+ ): ParameterDefinition;
+ };
export { Definition, ParameterDefinition };
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Scope.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Scope.ts
index 49f1e11..9b2c711 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Scope.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Scope.ts
@@ -142,8 +142,9 @@ const ModuleScope = ESLintModuleScope as ScopeConstructor &
ScopeChildConstructorWithUpperScope<ModuleScope>;
interface FunctionExpressionNameScope extends Scope {}
-const FunctionExpressionNameScope = ESLintFunctionExpressionNameScope as ScopeConstructor &
- ScopeChildConstructorWithUpperScope<FunctionExpressionNameScope>;
+const FunctionExpressionNameScope =
+ ESLintFunctionExpressionNameScope as ScopeConstructor &
+ ScopeChildConstructorWithUpperScope<FunctionExpressionNameScope>;
interface CatchScope extends Scope {}
const CatchScope = ESLintCatchScope as ScopeConstructor &
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/CLIEngine.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/CLIEngine.ts
index fec56c1..dfcc234 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/CLIEngine.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/CLIEngine.ts
@@ -71,7 +71,7 @@ declare class CLIEngineBase {
TMessageIds extends string = string,
TOptions extends readonly unknown[] = unknown[],
// for extending base rules
- TRuleListener extends RuleListener = RuleListener
+ TRuleListener extends RuleListener = RuleListener,
>(): Map<string, RuleModule<TMessageIds, TOptions, TRuleListener>>;
////////////////////
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/Rule.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/Rule.ts
index d74af83..076b173 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/Rule.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/Rule.ts
@@ -115,9 +115,8 @@ interface RuleFixer {
type ReportFixFunction = (
fixer: RuleFixer,
) => null | RuleFix | RuleFix[] | IterableIterator<RuleFix>;
-type ReportSuggestionArray<
- TMessageIds extends string
-> = ReportDescriptorBase<TMessageIds>[];
+type ReportSuggestionArray<TMessageIds extends string> =
+ ReportDescriptorBase<TMessageIds>[];
interface ReportDescriptorBase<TMessageIds extends string> {
/**
@@ -162,14 +161,13 @@ interface ReportDescriptorLocOnly {
*/
loc: Readonly<TSESTree.SourceLocation> | Readonly<TSESTree.LineAndColumnData>;
}
-type ReportDescriptor<
- TMessageIds extends string
-> = ReportDescriptorWithSuggestion<TMessageIds> &
- (ReportDescriptorNodeOptionalLoc | ReportDescriptorLocOnly);
+type ReportDescriptor<TMessageIds extends string> =
+ ReportDescriptorWithSuggestion<TMessageIds> &
+ (ReportDescriptorNodeOptionalLoc | ReportDescriptorLocOnly);
interface RuleContext<
TMessageIds extends string,
- TOptions extends readonly unknown[]
+ TOptions extends readonly unknown[],
> {
/**
* The rule ID.
@@ -412,7 +410,7 @@ interface RuleModule<
TMessageIds extends string,
TOptions extends readonly unknown[],
// for extending base rules
- TRuleListener extends RuleListener = RuleListener
+ TRuleListener extends RuleListener = RuleListener,
> {
/**
* Metadata about the rule
@@ -430,7 +428,7 @@ type RuleCreateFunction<
TMessageIds extends string = never,
TOptions extends readonly unknown[] = unknown[],
// for extending base rules
- TRuleListener extends RuleListener = RuleListener
+ TRuleListener extends RuleListener = RuleListener,
> = (context: Readonly<RuleContext<TMessageIds, TOptions>>) => TRuleListener;
export {
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/RuleTester.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/RuleTester.ts
index 652567f..e237586 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/RuleTester.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/RuleTester.ts
@@ -59,7 +59,7 @@ interface SuggestionOutput<TMessageIds extends string> {
interface InvalidTestCase<
TMessageIds extends string,
- TOptions extends Readonly<unknown[]>
+ TOptions extends Readonly<unknown[]>,
> extends ValidTestCase<TOptions> {
/**
* Expected errors.
@@ -111,7 +111,7 @@ interface TestCaseError<TMessageIds extends string> {
interface RunTests<
TMessageIds extends string,
- TOptions extends Readonly<unknown[]>
+ TOptions extends Readonly<unknown[]>,
> {
// RuleTester.run also accepts strings for valid cases
readonly valid: readonly (ValidTestCase<TOptions> | string)[];
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/Scope.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/Scope.ts
index 6907e22..bc3db01 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/Scope.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/Scope.ts
@@ -19,7 +19,8 @@ namespace Scope {
export type CatchClauseDefinition = scopeManager.CatchClauseDefinition;
export type ClassNameDefinition = scopeManager.ClassNameDefinition;
export type FunctionNameDefinition = scopeManager.FunctionNameDefinition;
- export type ImplicitGlobalVariableDefinition = scopeManager.ImplicitGlobalVariableDefinition;
+ export type ImplicitGlobalVariableDefinition =
+ scopeManager.ImplicitGlobalVariableDefinition;
export type ImportBindingDefinition = scopeManager.ImportBindingDefinition;
export type ParameterDefinition = scopeManager.ParameterDefinition;
export type TSEnumMemberDefinition = scopeManager.TSEnumMemberDefinition;
@@ -34,7 +35,8 @@ namespace Scope {
export type ClassScope = scopeManager.ClassScope;
export type ConditionalTypeScope = scopeManager.ConditionalTypeScope;
export type ForScope = scopeManager.ForScope;
- export type FunctionExpressionNameScope = scopeManager.FunctionExpressionNameScope;
+ export type FunctionExpressionNameScope =
+ scopeManager.FunctionExpressionNameScope;
export type FunctionScope = scopeManager.FunctionScope;
export type FunctionTypeScope = scopeManager.FunctionTypeScope;
export type GlobalScope = scopeManager.GlobalScope;
diff --git ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/SourceCode.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/SourceCode.ts
index 888892d..49bca54 100644
--- ORI/typescript-eslint/packages/experimental-utils/src/ts-eslint/SourceCode.ts
+++ ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/SourceCode.ts
@@ -250,9 +250,10 @@ declare class SourceCodeBase extends TokenStore {
* @param node The AST node to get the comments for.
* @returns An object containing a leading and trailing array of comments indexed by their position.
*/
- getComments(
- node: TSESTree.Node,
- ): { leading: TSESTree.Comment[]; trailing: TSESTree.Comment[] };
+ getComments(node: TSESTree.Node): {
+ leading: TSESTree.Comment[];
+ trailing: TSESTree.Comment[];
+ };
/**
* Converts a (line, column) pair into a range index.
* @param loc A line/column location
diff --git ORI/typescript-eslint/packages/scope-manager/src/definition/DefinitionBase.ts ALT/typescript-eslint/packages/scope-manager/src/definition/DefinitionBase.ts
index ed25a72..7147ebc 100644
--- ORI/typescript-eslint/packages/scope-manager/src/definition/DefinitionBase.ts
+++ ALT/typescript-eslint/packages/scope-manager/src/definition/DefinitionBase.ts
@@ -8,7 +8,7 @@ abstract class DefinitionBase<
TType extends DefinitionType,
TNode extends TSESTree.Node,
TParent extends TSESTree.Node | null,
- TName extends TSESTree.Node = TSESTree.BindingName
+ TName extends TSESTree.Node = TSESTree.BindingName,
> {
/**
* A unique ID for this instance - primarily used to help debugging and testing
diff --git ORI/typescript-eslint/packages/scope-manager/src/scope/ScopeBase.ts ALT/typescript-eslint/packages/scope-manager/src/scope/ScopeBase.ts
index 04f38e8..90e2c0f 100644
--- ORI/typescript-eslint/packages/scope-manager/src/scope/ScopeBase.ts
+++ ALT/typescript-eslint/packages/scope-manager/src/scope/ScopeBase.ts
@@ -137,7 +137,7 @@ type AnyScope = ScopeBase<ScopeType, TSESTree.Node, Scope | null>;
abstract class ScopeBase<
TType extends ScopeType,
TBlock extends TSESTree.Node,
- TUpper extends Scope | null
+ TUpper extends Scope | null,
> {
/**
* A unique ID for this instance - primarily used to help debugging and testing
diff --git ORI/typescript-eslint/packages/scope-manager/tests/util/getSpecificNode.ts ALT/typescript-eslint/packages/scope-manager/tests/util/getSpecificNode.ts
index d20ab14..8f04f4a 100644
--- ORI/typescript-eslint/packages/scope-manager/tests/util/getSpecificNode.ts
+++ ALT/typescript-eslint/packages/scope-manager/tests/util/getSpecificNode.ts
@@ -3,11 +3,11 @@ import { simpleTraverse } from '@typescript-eslint/typescript-estree';
function getSpecificNode<
TSelector extends AST_NODE_TYPES,
- TNode extends Extract<TSESTree.Node, { type: TSelector }>
+ TNode extends Extract<TSESTree.Node, { type: TSelector }>,
>(ast: TSESTree.Node, selector: TSelector): TNode;
function getSpecificNode<
TSelector extends AST_NODE_TYPES,
- TNode extends Extract<TSESTree.Node, { type: TSelector }>
+ TNode extends Extract<TSESTree.Node, { type: TSelector }>,
>(
ast: TSESTree.Node,
selector: TSelector,
@@ -16,7 +16,7 @@ function getSpecificNode<
function getSpecificNode<
TSelector extends AST_NODE_TYPES,
TNode extends Extract<TSESTree.Node, { type: TSelector }>,
- TReturnType extends TSESTree.Node
+ TReturnType extends TSESTree.Node,
>(
ast: TSESTree.Node,
selector: TSelector,
diff --git ORI/typescript-eslint/packages/typescript-estree/src/convert.ts ALT/typescript-eslint/packages/typescript-estree/src/convert.ts
index 0c0b552..456564d 100644
--- ORI/typescript-eslint/packages/typescript-estree/src/convert.ts
+++ ALT/typescript-eslint/packages/typescript-estree/src/convert.ts
@@ -868,9 +868,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
// check for exports
@@ -1092,9 +1093,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ method.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
this.fixParentLocation(method, method.typeParameters.range);
}
@@ -1199,9 +1201,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ constructor.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
this.fixParentLocation(constructor, constructor.typeParameters.range);
}
@@ -1256,9 +1259,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
return result;
}
@@ -1354,9 +1358,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
return result;
}
@@ -1558,17 +1563,19 @@ export class Converter {
}
if (superClass.types[0]?.typeArguments) {
- result.superTypeParameters = this.convertTypeArgumentsToTypeParameters(
- superClass.types[0].typeArguments,
- superClass.types[0],
- );
+ result.superTypeParameters =
+ this.convertTypeArgumentsToTypeParameters(
+ superClass.types[0].typeArguments,
+ superClass.types[0],
+ );
}
}
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
if (implementsClause) {
@@ -2330,9 +2337,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
// check for exports
@@ -2360,9 +2368,10 @@ export class Converter {
}
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
const accessibility = getTSNodeAccessibility(node);
@@ -2441,9 +2450,10 @@ export class Converter {
result.returnType = this.convertTypeAnnotation(node.type, node);
}
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
return result;
}
@@ -2470,9 +2480,10 @@ export class Converter {
}
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
return result;
}
@@ -2510,9 +2521,10 @@ export class Converter {
});
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
if (interfaceHeritageClauses.length > 0) {
diff --git ORI/typescript-eslint/packages/typescript-estree/src/parser-options.ts ALT/typescript-eslint/packages/typescript-estree/src/parser-options.ts
index 36ca3f8..a3758ff 100644
--- ORI/typescript-eslint/packages/typescript-estree/src/parser-options.ts
+++ ALT/typescript-eslint/packages/typescript-estree/src/parser-options.ts
@@ -191,7 +191,7 @@ export interface ParserWeakMap<TKey, TValueBase> {
}
export interface ParserWeakMapESTreeToTSNode<
- TKey extends TSESTree.Node = TSESTree.Node
+ TKey extends TSESTree.Node = TSESTree.Node,
> {
get<TKeyBase extends TKey>(key: TKeyBase): TSESTreeToTSNode<TKeyBase>;
has(key: unknown): boolean;
diff --git ORI/typescript-eslint/packages/typescript-estree/tests/lib/parse.test.ts ALT/typescript-eslint/packages/typescript-estree/tests/lib/parse.test.ts
index 33b3936..d4acba1 100644
--- ORI/typescript-eslint/packages/typescript-estree/tests/lib/parse.test.ts
+++ ALT/typescript-eslint/packages/typescript-estree/tests/lib/parse.test.ts
@@ -492,24 +492,23 @@ describe('parseAndGenerateServices', () => {
tsconfigRootDir: PROJECT_DIR,
project: './tsconfig.json',
};
- const testParse = (
- filePath: string,
- extraFileExtensions: string[] = ['.vue'],
- ) => (): void => {
- try {
- parser.parseAndGenerateServices(code, {
- ...config,
- extraFileExtensions,
- filePath: join(PROJECT_DIR, filePath),
- });
- } catch (error) {
- /**
- * Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/`
- */
- error.message = error.message.replace(/\\(?!["])/gm, '/');
- throw error;
- }
- };
+ const testParse =
+ (filePath: string, extraFileExtensions: string[] = ['.vue']) =>
+ (): void => {
+ try {
+ parser.parseAndGenerateServices(code, {
+ ...config,
+ extraFileExtensions,
+ filePath: join(PROJECT_DIR, filePath),
+ });
+ } catch (error) {
+ /**
+ * Aligns paths between environments, node for windows uses `\`, for linux and mac uses `/`
+ */
+ error.message = error.message.replace(/\\(?!["])/gm, '/');
+ throw error;
+ }
+ };
describe('project includes', () => {
it("doesn't error for matched files", () => {
@@ -647,16 +646,18 @@ describe('parseAndGenerateServices', () => {
project: './**/tsconfig.json',
};
- const testParse = (
- filePath: 'ignoreme' | 'includeme',
- projectFolderIgnoreList?: TSESTreeOptions['projectFolderIgnoreList'],
- ) => (): void => {
- parser.parseAndGenerateServices(code, {
- ...config,
- projectFolderIgnoreList,
- filePath: join(PROJECT_DIR, filePath, './file.ts'),
- });
- };
+ const testParse =
+ (
+ filePath: 'ignoreme' | 'includeme',
+ projectFolderIgnoreList?: TSESTreeOptions['projectFolderIgnoreList'],
+ ) =>
+ (): void => {
+ parser.parseAndGenerateServices(code, {
+ ...config,
+ projectFolderIgnoreList,
+ filePath: join(PROJECT_DIR, filePath, './file.ts'),
+ });
+ };
it('ignores nothing when given nothing', () => {
expect(testParse('ignoreme')).not.toThrow();
diff --git ORI/typescript-eslint/packages/typescript-estree/tests/lib/semanticInfo.test.ts ALT/typescript-eslint/packages/typescript-estree/tests/lib/semanticInfo.test.ts
index 36726ac..ed7c05c 100644
--- ORI/typescript-eslint/packages/typescript-estree/tests/lib/semanticInfo.test.ts
+++ ALT/typescript-eslint/packages/typescript-estree/tests/lib/semanticInfo.test.ts
@@ -149,19 +149,20 @@ describe('semanticInfo', () => {
);
expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap');
- const binaryExpression = (parseResult.ast
- .body[0] as TSESTree.VariableDeclaration).declarations[0].init!;
+ const binaryExpression = (
+ parseResult.ast.body[0] as TSESTree.VariableDeclaration
+ ).declarations[0].init!;
const tsBinaryExpression = parseResult.services.esTreeNodeToTSNodeMap.get(
binaryExpression,
);
expect(tsBinaryExpression.kind).toEqual(ts.SyntaxKind.BinaryExpression);
- const computedPropertyString = ((parseResult.ast
- .body[1] as TSESTree.ClassDeclaration).body
- .body[0] as TSESTree.ClassProperty).key;
- const tsComputedPropertyString = parseResult.services.esTreeNodeToTSNodeMap.get(
- computedPropertyString,
- );
+ const computedPropertyString = (
+ (parseResult.ast.body[1] as TSESTree.ClassDeclaration).body
+ .body[0] as TSESTree.ClassProperty
+ ).key;
+ const tsComputedPropertyString =
+ parseResult.services.esTreeNodeToTSNodeMap.get(computedPropertyString);
expect(tsComputedPropertyString.kind).toEqual(ts.SyntaxKind.StringLiteral);
});
@@ -178,10 +179,12 @@ describe('semanticInfo', () => {
// get array node (ast shape validated by snapshot)
// node is defined in other file than the parsed one
- const arrayBoundName = (((parseResult.ast
- .body[1] as TSESTree.ExpressionStatement)
- .expression as TSESTree.CallExpression)
- .callee as TSESTree.MemberExpression).object as TSESTree.Identifier;
+ const arrayBoundName = (
+ (
+ (parseResult.ast.body[1] as TSESTree.ExpressionStatement)
+ .expression as TSESTree.CallExpression
+ ).callee as TSESTree.MemberExpression
+ ).object as TSESTree.Identifier;
expect(arrayBoundName.name).toBe('arr');
expect(parseResult).toHaveProperty('services.esTreeNodeToTSNodeMap');
diff --git ORI/typescript-eslint/tools/generate-contributors.ts ALT/typescript-eslint/tools/generate-contributors.ts
index 38c3690..6bb908b 100644
--- ORI/typescript-eslint/tools/generate-contributors.ts
+++ ALT/typescript-eslint/tools/generate-contributors.ts
@@ -42,9 +42,8 @@ async function* fetchUsers(page = 1): AsyncIterableIterator<Contributor[]> {
const response = await fetch(`${contributorsApiUrl}&page=${page}`, {
method: 'GET',
});
- const contributors:
- | Contributor[]
- | { message: string } = await response.json();
+ const contributors: Contributor[] | { message: string } =
+ await response.json();
if (!Array.isArray(contributors)) {
throw new Error(contributors.message);
from prettier-regression-testing.
fisker/prettier@v2dot3-witout-10335 VS prettier/[email protected] :: vega/vega-lite@2dff36f
Diff (223 lines)
diff --git ORI/vega-lite/src/axis.ts ALT/vega-lite/src/axis.ts
index 31c80e9..0a5c6eb 100644
--- ORI/vega-lite/src/axis.ts
+++ ALT/vega-lite/src/axis.ts
@@ -281,9 +281,8 @@ export type ConditionalAxisLabelAlign<ES extends ExprRef | SignalRef = ExprRef |
Align | null,
ES
>;
-export type ConditionalAxisLabelBaseline<
- ES extends ExprRef | SignalRef = ExprRef | SignalRef
-> = ConditionalAxisProperty<TextBaseline | null, ES>;
+export type ConditionalAxisLabelBaseline<ES extends ExprRef | SignalRef = ExprRef | SignalRef> =
+ ConditionalAxisProperty<TextBaseline | null, ES>;
export type ConditionalAxisColor<ES extends ExprRef | SignalRef = ExprRef | SignalRef> = ConditionalAxisProperty<
Color | null,
ES
@@ -293,12 +292,10 @@ export type ConditionalAxisString<ES extends ExprRef | SignalRef = ExprRef | Sig
ES
>;
-export type ConditionalAxisLabelFontStyle<
- ES extends ExprRef | SignalRef = ExprRef | SignalRef
-> = ConditionalAxisProperty<FontStyle | null, ES>;
-export type ConditionalAxisLabelFontWeight<
- ES extends ExprRef | SignalRef = ExprRef | SignalRef
-> = ConditionalAxisProperty<FontWeight | null, ES>;
+export type ConditionalAxisLabelFontStyle<ES extends ExprRef | SignalRef = ExprRef | SignalRef> =
+ ConditionalAxisProperty<FontStyle | null, ES>;
+export type ConditionalAxisLabelFontWeight<ES extends ExprRef | SignalRef = ExprRef | SignalRef> =
+ ConditionalAxisProperty<FontWeight | null, ES>;
export type ConditionalAxisNumberArray<ES extends ExprRef | SignalRef = ExprRef | SignalRef> = ConditionalAxisProperty<
number[] | null,
diff --git ORI/vega-lite/src/channeldef.ts ALT/vega-lite/src/channeldef.ts
index 2defd1e..4fe3aec 100644
--- ORI/vega-lite/src/channeldef.ts
+++ ALT/vega-lite/src/channeldef.ts
@@ -150,9 +150,8 @@ export type ConditionalPredicate<CD extends FieldDef<any> | DatumDef | ValueDef<
test: LogicalComposition<Predicate>;
} & CD;
-export type ConditionalParameter<
- CD extends FieldDef<any> | DatumDef | ValueDef<any> | ExprRef | SignalRef
-> = ParameterPredicate & CD;
+export type ConditionalParameter<CD extends FieldDef<any> | DatumDef | ValueDef<any> | ExprRef | SignalRef> =
+ ParameterPredicate & CD;
export function isConditionalParameter<T>(c: Conditional<T>): c is ConditionalParameter<T> {
return c['param'];
@@ -357,11 +356,8 @@ export function isSortableFieldDef<F extends Field>(fieldDef: FieldDef<F>): fiel
return 'sort' in fieldDef;
}
-export type ScaleFieldDef<
- F extends Field,
- T extends Type = StandardType,
- B extends Bin = boolean | BinParams | null
-> = SortableFieldDef<F, T, B> & ScaleMixins;
+export type ScaleFieldDef<F extends Field, T extends Type = StandardType, B extends Bin = boolean | BinParams | null> =
+ SortableFieldDef<F, T, B> & ScaleMixins;
export interface ScaleMixins {
/**
diff --git ORI/vega-lite/src/compile/header/assemble.ts ALT/vega-lite/src/compile/header/assemble.ts
index f3a8737..0d36178 100644
--- ORI/vega-lite/src/compile/header/assemble.ts
+++ ALT/vega-lite/src/compile/header/assemble.ts
@@ -40,12 +40,11 @@ export function assembleTitleGroup(model: Model, channel: FacetChannel) {
? model.component.layoutHeaders[channel].facetFieldDef
: undefined;
- const {titleAnchor, titleAngle: ta, titleOrient} = getHeaderProperties(
- ['titleAnchor', 'titleAngle', 'titleOrient'],
- facetFieldDef.header,
- config,
- channel
- );
+ const {
+ titleAnchor,
+ titleAngle: ta,
+ titleOrient
+ } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel);
const headerChannel = getHeaderChannel(channel, titleOrient);
const titleAngle = normalizeAngle(ta);
diff --git ORI/vega-lite/src/compile/mark/encode/position-range.ts ALT/vega-lite/src/compile/mark/encode/position-range.ts
index 3e56093..14a3b39 100644
--- ORI/vega-lite/src/compile/mark/encode/position-range.ts
+++ ALT/vega-lite/src/compile/mark/encode/position-range.ts
@@ -121,13 +121,14 @@ function pointPosition2OrSize(
}) ||
position2orSize(channel, config[mark]) ||
position2orSize(channel, config.mark) || {
- [vgChannel]: pointPositionDefaultRef({
- model,
- defaultPos,
- channel,
- scaleName,
- scale
- })()
+ [vgChannel]:
+ pointPositionDefaultRef({
+ model,
+ defaultPos,
+ channel,
+ scaleName,
+ scale
+ })()
}
);
}
diff --git ORI/vega-lite/src/compositemark/boxplot.ts ALT/vega-lite/src/compositemark/boxplot.ts
index d6bea65..8fbedcd 100644
--- ORI/vega-lite/src/compositemark/boxplot.ts
+++ ALT/vega-lite/src/compositemark/boxplot.ts
@@ -399,10 +399,13 @@ function boxParams(
oldEncodingWithoutContinuousAxis
);
- const {bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis} = extractTransformsFromEncoding(
- filteredEncoding,
- config
- );
+ const {
+ bins,
+ timeUnits,
+ aggregate,
+ groupby,
+ encoding: encodingWithoutContinuousAxis
+ } = extractTransformsFromEncoding(filteredEncoding, config);
const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical';
const boxOrient: Orientation = orient;
diff --git ORI/vega-lite/src/compositemark/errorbar.ts ALT/vega-lite/src/compositemark/errorbar.ts
index 094573f..52d41fe 100644
--- ORI/vega-lite/src/compositemark/errorbar.ts
+++ ALT/vega-lite/src/compositemark/errorbar.ts
@@ -360,21 +360,17 @@ export function errorBarParams<
continuousAxis
} = compositeMarkContinuousAxis(spec, orient, compositeMark);
- const {
- errorBarSpecificAggregate,
- postAggregateCalculates,
- tooltipSummary,
- tooltipTitleWithFieldName
- } = errorBarAggregationAndCalculation(
- markDef,
- continuousAxisChannelDef,
- continuousAxisChannelDef2,
- continuousAxisChannelDefError,
- continuousAxisChannelDefError2,
- inputType,
- compositeMark,
- config
- );
+ const {errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName} =
+ errorBarAggregationAndCalculation(
+ markDef,
+ continuousAxisChannelDef,
+ continuousAxisChannelDef2,
+ continuousAxisChannelDefError,
+ continuousAxisChannelDefError2,
+ inputType,
+ compositeMark,
+ config
+ );
const {
[continuousAxis]: oldContinuousAxisChannelDef,
diff --git ORI/vega-lite/src/scale.ts ALT/vega-lite/src/scale.ts
index 74a49f8..76d2de5 100644
--- ORI/vega-lite/src/scale.ts
+++ ALT/vega-lite/src/scale.ts
@@ -685,15 +685,8 @@ const SCALE_PROPERTY_INDEX: Flag<keyof Scale<any>> = {
export const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX);
-const {
- type,
- domain,
- range,
- rangeMax,
- rangeMin,
- scheme,
- ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX
-} = SCALE_PROPERTY_INDEX;
+const {type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX} =
+ SCALE_PROPERTY_INDEX;
export const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);
diff --git ORI/vega-lite/src/spec/facet.ts ALT/vega-lite/src/spec/facet.ts
index 807bf0b..dd28e83 100644
--- ORI/vega-lite/src/spec/facet.ts
+++ ALT/vega-lite/src/spec/facet.ts
@@ -36,10 +36,8 @@ export interface FacetFieldDef<F extends Field, ES extends ExprRef | SignalRef =
sort?: SortArray | SortOrder | EncodingSortField<F> | null;
}
-export type FacetEncodingFieldDef<
- F extends Field,
- ES extends ExprRef | SignalRef = ExprRef | SignalRef
-> = FacetFieldDef<F, ES> & GenericCompositionLayoutWithColumns;
+export type FacetEncodingFieldDef<F extends Field, ES extends ExprRef | SignalRef = ExprRef | SignalRef> =
+ FacetFieldDef<F, ES> & GenericCompositionLayoutWithColumns;
export interface RowColumnEncodingFieldDef<F extends Field, ES extends ExprRef | SignalRef>
extends FacetFieldDef<F, ES> {
diff --git ORI/vega-lite/src/title.ts ALT/vega-lite/src/title.ts
index 377bdbb..b376c85 100644
--- ORI/vega-lite/src/title.ts
+++ ALT/vega-lite/src/title.ts
@@ -62,9 +62,7 @@ export interface TitleParams<ES extends ExprRef | SignalRef> extends TitleBase<E
subtitle?: Text;
}
-export function extractTitleConfig(
- titleConfig: TitleConfig<SignalRef>
-): {
+export function extractTitleConfig(titleConfig: TitleConfig<SignalRef>): {
titleMarkConfig: MarkConfig<SignalRef>;
subtitleMarkConfig: MarkConfig<SignalRef>;
nonMark: BaseTitleNoValueRefs<SignalRef>;
from prettier-regression-testing.
Related Issues (20)
- v3 HOT 23
- for 12349 HOT 5
- For #12359 and #12362 HOT 8
- Regression testing for 2.6 HOT 3
- For 12563 HOT 6
- 2.7 HOT 2
- compact multiline imports HOT 8
- for 13532 (Fix unstable embedded template literals) HOT 4
- misc tests HOT 38
- for 11103 (Break multiline parenthesized logical expression) HOT 8
- for 13621 (Fix template literal indention) HOT 4
- for 13735 (Print `ChainExpression`) HOT 8
- v2.8.0 HOT 5
- 2.8.1 HOT 2
- Misc tests HOT 52
- v3 HOT 23
- 15447 HOT 26
- 3.1 HOT 34
- 3.2 HOT 2
- 15909 & 15993 HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-regression-testing.