Comments (2)
run #10222
from prettier-regression-testing.
prettier/prettier#10222 VS prettier/prettier@main
- babel/babel@b63be94
- vuejs/eslint-plugin-vue@cc9c140
- excalidraw/excalidraw@1973ae9
- prettier/prettier@2c1b8f6
- typescript-eslint/typescript-eslint@7b701a3
diff --git ORI/babel/packages/babel-core/src/config/config-chain.js ALT/babel/packages/babel-core/src/config/config-chain.js
index 350111a1a..6e586eeaf 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 298843e2d..fde98cfd3 100644
--- ORI/babel/packages/babel-core/src/config/files/plugins.js
+++ ALT/babel/packages/babel-core/src/config/files/plugins.js
@@ -14,8 +14,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 27caf3bcc..529d6606d 100644
--- ORI/babel/packages/babel-core/src/config/validation/options.js
+++ ALT/babel/packages/babel-core/src/config/validation/options.js
@@ -369,10 +369,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 aca84e1e4..8734534cc 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 d715b6386..a8aed41cc 100644
--- ORI/babel/packages/babel-core/test/api.js
+++ ALT/babel/packages/babel-core/test/api.js
@@ -308,9 +308,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/config-chain.js ALT/babel/packages/babel-core/test/config-chain.js
index 8de2bc99d..4b3c1d10b 100644
--- ORI/babel/packages/babel-core/test/config-chain.js
+++ ALT/babel/packages/babel-core/test/config-chain.js
@@ -94,7 +94,8 @@ async function loadOptionsAsyncInSpawedProcess({ filename, cwd }) {
},
);
- 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/fields.js ALT/babel/packages/babel-helper-create-class-features-plugin/src/fields.js
index aca3cfa75..08fb1f6e0 100644
--- ORI/babel/packages/babel-helper-create-class-features-plugin/src/fields.js
+++ ALT/babel/packages/babel-helper-create-class-features-plugin/src/fields.js
@@ -200,14 +200,8 @@ const privateNameHandlerSpec = {
get(member) {
const { classRef, privateNamesMap, file } = this;
const { name } = member.node.property.id;
- const {
- id,
- static: isStatic,
- method: isMethod,
- methodId,
- getId,
- setId,
- } = privateNamesMap.get(name);
+ const { id, static: isStatic, method: isMethod, methodId, getId, setId } =
+ privateNamesMap.get(name);
const isAccessor = getId || setId;
if (isStatic) {
@@ -264,13 +258,8 @@ const privateNameHandlerSpec = {
set(member, value) {
const { classRef, privateNamesMap, file } = this;
const { name } = member.node.property.id;
- const {
- id,
- static: isStatic,
- method: isMethod,
- setId,
- getId,
- } = privateNamesMap.get(name);
+ const { id, static: isStatic, method: isMethod, setId, getId } =
+ privateNamesMap.get(name);
const isAccessor = getId || setId;
if (isStatic) {
diff --git ORI/babel/packages/babel-helper-module-transforms/src/index.js ALT/babel/packages/babel-helper-module-transforms/src/index.js
index c1aff14c1..77b6845c0 100644
--- ORI/babel/packages/babel-helper-module-transforms/src/index.js
+++ ALT/babel/packages/babel-helper-module-transforms/src/index.js
@@ -214,10 +214,8 @@ const buildReexportsFromMeta = (
true,
);
} else {
- NAMESPACE_IMPORT = NAMESPACE_IMPORT = t.memberExpression(
- t.cloneNode(namespace),
- t.identifier(importName),
- );
+ NAMESPACE_IMPORT = NAMESPACE_IMPORT =
+ t.memberExpression(t.cloneNode(namespace), t.identifier(importName));
}
const astNodes = {
EXPORTS: meta.exportName,
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 4f31fd926..706d84efc 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 5827e5154..a1b0e5824 100644
--- ORI/babel/packages/babel-parser/src/parser/statement.js
+++ ALT/babel/packages/babel-parser/src/parser/statement.js
@@ -316,9 +316,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]);
@@ -331,9 +330,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);
@@ -2010,9 +2008,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.js ALT/babel/packages/babel-parser/src/plugins/flow.js
index 0e00291fc..db810370f 100644
--- ORI/babel/packages/babel-parser/src/plugins/flow.js
+++ ALT/babel/packages/babel-parser/src/plugins/flow.js
@@ -2962,7 +2962,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/tokenizer/context.js ALT/babel/packages/babel-parser/src/tokenizer/context.js
index 5581e6b05..942f83b82 100644
--- ORI/babel/packages/babel-parser/src/tokenizer/context.js
+++ ALT/babel/packages/babel-parser/src/tokenizer/context.js
@@ -49,19 +49,23 @@ export const types: {
// When `=>` is eaten, the context update of `yield` is executed, however,
// `this.prodParam` still has `[Yield]` production because it is not yet updated
-tt.parenR.updateContext = tt.braceR.updateContext = function () {
- if (this.state.context.length === 1) {
- this.state.exprAllowed = true;
- return;
- }
+tt.parenR.updateContext = tt.braceR.updateContext =
+ function () {
+ if (this.state.context.length === 1) {
+ this.state.exprAllowed = true;
+ return;
+ }
- let out = this.state.context.pop();
- if (out === types.braceStatement && this.curContext().token === "function") {
- out = this.state.context.pop();
- }
+ let out = this.state.context.pop();
+ if (
+ out === types.braceStatement &&
+ this.curContext().token === "function"
+ ) {
+ out = this.state.context.pop();
+ }
- this.state.exprAllowed = !out.isExpr;
-};
+ this.state.exprAllowed = !out.isExpr;
+ };
tt.name.updateContext = function (prevType) {
let allowed = false;
@@ -110,24 +114,25 @@ tt.incDec.updateContext = function () {
// tokExprAllowed stays unchanged
};
-tt._function.updateContext = tt._class.updateContext = function (prevType) {
- if (
- prevType.beforeExpr &&
- prevType !== tt.semi &&
- prevType !== tt._else &&
- !(prevType === tt._return && this.hasPrecedingLineBreak()) &&
- !(
- (prevType === tt.colon || prevType === tt.braceL) &&
- this.curContext() === types.b_stat
- )
- ) {
- this.state.context.push(types.functionExpression);
- } else {
- this.state.context.push(types.functionStatement);
- }
+tt._function.updateContext = tt._class.updateContext =
+ function (prevType) {
+ if (
+ prevType.beforeExpr &&
+ prevType !== tt.semi &&
+ prevType !== tt._else &&
+ !(prevType === tt._return && this.hasPrecedingLineBreak()) &&
+ !(
+ (prevType === tt.colon || prevType === tt.braceL) &&
+ this.curContext() === types.b_stat
+ )
+ ) {
+ this.state.context.push(types.functionExpression);
+ } else {
+ this.state.context.push(types.functionStatement);
+ }
- this.state.exprAllowed = false;
-};
+ this.state.exprAllowed = false;
+ };
tt.backQuote.updateContext = function () {
if (this.curContext() === types.template) {
diff --git ORI/babel/packages/babel-parser/src/types.js ALT/babel/packages/babel-parser/src/types.js
index d5a28729d..b75520a79 100644
--- ORI/babel/packages/babel-parser/src/types.js
+++ ALT/babel/packages/babel-parser/src/types.js
@@ -1137,9 +1137,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 34198840e..e19a77552 100644
--- ORI/babel/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js
+++ ALT/babel/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js
@@ -48,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 e1f9b7d51..387e2634c 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
@@ -357,11 +357,8 @@ export default declare((api, opts) => {
path.isObjectPattern(),
);
- const [
- impureComputedPropertyDeclarators,
- argument,
- callExpression,
- ] = createObjectSpread(objectPatternPath, file, ref);
+ const [impureComputedPropertyDeclarators, argument, callExpression] =
+ createObjectSpread(objectPatternPath, file, ref);
if (loose) {
removeUnusedExcludedKeys(objectPatternPath);
@@ -440,11 +437,8 @@ export default declare((api, opts) => {
]),
);
- const [
- impureComputedPropertyDeclarators,
- argument,
- callExpression,
- ] = createObjectSpread(leftPath, file, t.identifier(refName));
+ const [impureComputedPropertyDeclarators, argument, callExpression] =
+ createObjectSpread(leftPath, file, t.identifier(refName));
if (impureComputedPropertyDeclarators.length > 0) {
nodes.push(
diff --git ORI/babel/packages/babel-plugin-transform-destructuring/src/index.js ALT/babel/packages/babel-plugin-transform-destructuring/src/index.js
index cca55d21b..47dbd1ed3 100644
--- ORI/babel/packages/babel-plugin-transform-destructuring/src/index.js
+++ ALT/babel/packages/babel-plugin-transform-destructuring/src/index.js
@@ -4,11 +4,8 @@ import { types as t } from "@babel/core";
export default declare((api, options) => {
api.assertVersion(7);
- const {
- loose = false,
- useBuiltIns = false,
- allowArrayLike = false,
- } = options;
+ const { loose = false, useBuiltIns = false, allowArrayLike = false } =
+ options;
if (typeof loose !== "boolean") {
throw new Error(`.loose must be a boolean or undefined`);
@@ -296,10 +293,11 @@ export default declare((api, options) => {
const name = this.scope.generateUidIdentifierBasedOnNode(key);
this.nodes.push(this.buildVariableDeclaration(name, key));
if (!copiedPattern) {
- copiedPattern = pattern = {
- ...pattern,
- properties: pattern.properties.slice(),
- };
+ copiedPattern = pattern =
+ {
+ ...pattern,
+ properties: pattern.properties.slice(),
+ };
}
copiedPattern.properties[i] = {
...copiedPattern.properties[i],
diff --git ORI/babel/packages/babel-plugin-transform-parameters/src/params.js ALT/babel/packages/babel-plugin-transform-parameters/src/params.js
index 4608a225a..60989c943 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-plugin-transform-runtime/scripts/build-dist.js ALT/babel/packages/babel-plugin-transform-runtime/scripts/build-dist.js
index 1cdbf6491..2d944d58c 100644
--- ORI/babel/packages/babel-plugin-transform-runtime/scripts/build-dist.js
+++ ALT/babel/packages/babel-plugin-transform-runtime/scripts/build-dist.js
@@ -10,8 +10,10 @@ const t = require("@babel/types");
const transformRuntime = require("../");
const runtimeVersion = require("@babel/runtime/package.json").version;
-const corejs2Definitions = require("../lib/runtime-corejs2-definitions").default();
-const corejs3Definitions = require("../lib/runtime-corejs3-definitions").default();
+const corejs2Definitions =
+ require("../lib/runtime-corejs2-definitions").default();
+const corejs3Definitions =
+ require("../lib/runtime-corejs3-definitions").default();
function outputFile(filePath, data) {
fs.mkdirSync(path.dirname(filePath), { recursive: true });
diff --git ORI/babel/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js ALT/babel/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js
index 0cd423af1..37370a9b6 100644
--- ORI/babel/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js
+++ ALT/babel/packages/babel-preset-env/src/polyfills/corejs3/usage-plugin.js
@@ -39,13 +39,14 @@ const corejs3PolyfillsWithoutProposals = Object.keys(corejs3Polyfills)
return memo;
}, {});
-const corejs3PolyfillsWithShippedProposals = (corejs3ShippedProposalsList: string[]).reduce(
- (memo, key) => {
- memo[key] = corejs3Polyfills[key];
- return memo;
- },
- { ...corejs3PolyfillsWithoutProposals },
-);
+const corejs3PolyfillsWithShippedProposals =
+ (corejs3ShippedProposalsList: string[]).reduce(
+ (memo, key) => {
+ memo[key] = corejs3Polyfills[key];
+ return memo;
+ },
+ { ...corejs3PolyfillsWithoutProposals },
+ );
export default function (
_: any,
diff --git ORI/babel/packages/babel-preset-env/test/get-option-specific-excludes.spec.js ALT/babel/packages/babel-preset-env/test/get-option-specific-excludes.spec.js
index ea0cd6950..1b9d8c7db 100644
--- ORI/babel/packages/babel-preset-env/test/get-option-specific-excludes.spec.js
+++ ALT/babel/packages/babel-preset-env/test/get-option-specific-excludes.spec.js
@@ -1,7 +1,7 @@
"use strict";
-const getOptionSpecificExcludesFor = require("../lib/get-option-specific-excludes")
- .default;
+const getOptionSpecificExcludesFor =
+ require("../lib/get-option-specific-excludes").default;
describe("defaults", () => {
describe("getOptionSpecificExcludesFor", () => {
diff --git ORI/babel/packages/babel-preset-env/test/get-platform-specific-default.spec.js ALT/babel/packages/babel-preset-env/test/get-platform-specific-default.spec.js
index 1958a7fa6..9b3541292 100644
--- ORI/babel/packages/babel-preset-env/test/get-platform-specific-default.spec.js
+++ ALT/babel/packages/babel-preset-env/test/get-platform-specific-default.spec.js
@@ -1,17 +1,16 @@
"use strict";
-const getCoreJS2PlatformSpecificDefaultFor = require("../lib/polyfills/corejs2/get-platform-specific-default")
- .default;
+const getCoreJS2PlatformSpecificDefaultFor =
+ require("../lib/polyfills/corejs2/get-platform-specific-default").default;
describe("defaults", () => {
describe("getCoreJS2PlatformSpecificDefaultFor", () => {
it("should return web polyfills for non-`node` platform", () => {
- const defaultWebIncludesForChromeAndNode = getCoreJS2PlatformSpecificDefaultFor(
- {
+ const defaultWebIncludesForChromeAndNode =
+ getCoreJS2PlatformSpecificDefaultFor({
chrome: "63",
node: "8",
- },
- );
+ });
expect(defaultWebIncludesForChromeAndNode).toEqual([
"web.timers",
"web.immediate",
@@ -20,11 +19,10 @@ describe("defaults", () => {
});
it("shouldn't return web polyfills for node platform", () => {
- const defaultWebIncludesForChromeAndNode = getCoreJS2PlatformSpecificDefaultFor(
- {
+ const defaultWebIncludesForChromeAndNode =
+ getCoreJS2PlatformSpecificDefaultFor({
node: "8",
- },
- );
+ });
expect(defaultWebIncludesForChromeAndNode).toBeNull();
});
});
diff --git ORI/babel/packages/babel-preset-env/test/index.spec.js ALT/babel/packages/babel-preset-env/test/index.spec.js
index 291bb26c7..e6a2d00c6 100644
--- ORI/babel/packages/babel-preset-env/test/index.spec.js
+++ ALT/babel/packages/babel-preset-env/test/index.spec.js
@@ -1,18 +1,18 @@
"use strict";
const babelPresetEnv = require("../lib/index");
-const addCoreJS2UsagePlugin = require("../lib/polyfills/corejs2/usage-plugin")
- .default;
-const addCoreJS3UsagePlugin = require("../lib/polyfills/corejs3/usage-plugin")
- .default;
-const addRegeneratorUsagePlugin = require("../lib/polyfills/regenerator/usage-plugin")
- .default;
-const replaceCoreJS2EntryPlugin = require("../lib/polyfills/corejs2/entry-plugin")
- .default;
-const replaceCoreJS3EntryPlugin = require("../lib/polyfills/corejs3/entry-plugin")
- .default;
-const removeRegeneratorEntryPlugin = require("../lib/polyfills/regenerator/entry-plugin")
- .default;
+const addCoreJS2UsagePlugin =
+ require("../lib/polyfills/corejs2/usage-plugin").default;
+const addCoreJS3UsagePlugin =
+ require("../lib/polyfills/corejs3/usage-plugin").default;
+const addRegeneratorUsagePlugin =
+ require("../lib/polyfills/regenerator/usage-plugin").default;
+const replaceCoreJS2EntryPlugin =
+ require("../lib/polyfills/corejs2/entry-plugin").default;
+const replaceCoreJS3EntryPlugin =
+ require("../lib/polyfills/corejs3/entry-plugin").default;
+const removeRegeneratorEntryPlugin =
+ require("../lib/polyfills/regenerator/entry-plugin").default;
const transformations = require("../lib/module-transformations").default;
const compatData = require("@babel/compat-data/plugins");
diff --git ORI/babel/packages/babel-register/src/index.js ALT/babel/packages/babel-register/src/index.js
index aea88df53..d9fefa1c4 100644
--- ORI/babel/packages/babel-register/src/index.js
+++ ALT/babel/packages/babel-register/src/index.js
@@ -4,9 +4,10 @@
* from a compiled Babel import.
*/
-exports = module.exports = function (...args) {
- return register(...args);
-};
+exports = module.exports =
+ function (...args) {
+ return register(...args);
+ };
exports.__esModule = true;
const node = require("./nodeWrapper");
diff --git ORI/babel/packages/babel-standalone/src/generated/plugins.js ALT/babel/packages/babel-standalone/src/generated/plugins.js
index 889f6a494..01a0ae395 100644
--- ORI/babel/packages/babel-standalone/src/generated/plugins.js
+++ ALT/babel/packages/babel-standalone/src/generated/plugins.js
@@ -259,7 +259,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,
diff --git ORI/babel/packages/babel-template/test/index.js ALT/babel/packages/babel-template/test/index.js
index 7b893d7e4..63b821b0d 100644
--- ORI/babel/packages/babel-template/test/index.js
+++ ALT/babel/packages/babel-template/test/index.js
@@ -43,11 +43,12 @@ describe("@babel/template", function () {
describe("string-based", () => {
it("should handle replacing values from an object", () => {
const value = t.stringLiteral("some string value");
- const result = template(`
+ const result =
+ template(`
if (SOME_VAR === "") {}
`)({
- SOME_VAR: value,
- });
+ SOME_VAR: value,
+ });
expect(result.type).toBe("IfStatement");
expect(result.test.type).toBe("BinaryExpression");
@@ -56,7 +57,8 @@ describe("@babel/template", function () {
it("should handle replacing values given an array", () => {
const value = t.stringLiteral("some string value");
- const result = template(`
+ const result =
+ template(`
if ($0 === "") {}
`)([value]);
@@ -66,7 +68,8 @@ describe("@babel/template", function () {
});
it("should handle replacing values with null to remove them", () => {
- const result = template(`
+ const result =
+ template(`
callee(ARG);
`)({ ARG: null });
@@ -76,7 +79,8 @@ describe("@babel/template", function () {
});
it("should handle replacing values that are string content", () => {
- const result = template(`
+ const result =
+ template(`
("ARG");
`)({ ARG: "some new content" });
@@ -88,7 +92,8 @@ describe("@babel/template", function () {
it("should automatically clone nodes if they are injected twice", () => {
const id = t.identifier("someIdent");
- const result = template(`
+ const result =
+ template(`
ID;
ID;
`)({ ID: id });
@@ -277,23 +282,26 @@ describe("@babel/template", function () {
describe(".syntacticPlaceholders", () => {
it("works in function body", () => {
- const output = template(`function f() %%A%%`)({
- A: t.blockStatement([]),
- });
+ const output =
+ template(`function f() %%A%%`)({
+ A: t.blockStatement([]),
+ });
expect(generator(output).code).toMatchInlineSnapshot(`"function f() {}"`);
});
it("works in class body", () => {
- const output = template(`class C %%A%%`)({
- A: t.classBody([]),
- });
+ const output =
+ template(`class C %%A%%`)({
+ A: t.classBody([]),
+ });
expect(generator(output).code).toMatchInlineSnapshot(`"class C {}"`);
});
it("replaces lowercase names", () => {
- const output = template(`%%foo%%`)({
- foo: t.numericLiteral(1),
- });
+ const output =
+ template(`%%foo%%`)({
+ foo: t.numericLiteral(1),
+ });
expect(generator(output).code).toMatchInlineSnapshot(`"1;"`);
});
@@ -372,23 +380,26 @@ describe("@babel/template", function () {
describe("undefined", () => {
it("allows placeholders", () => {
- const output = template(`%%FOO%%`)({
- FOO: t.numericLiteral(1),
- });
+ const output =
+ template(`%%FOO%%`)({
+ FOO: t.numericLiteral(1),
+ });
expect(generator(output).code).toMatchInlineSnapshot(`"1;"`);
});
it("replaces identifiers", () => {
- const output = template(`FOO`)({
- FOO: t.numericLiteral(1),
- });
+ const output =
+ template(`FOO`)({
+ FOO: t.numericLiteral(1),
+ });
expect(generator(output).code).toMatchInlineSnapshot(`"1;"`);
});
it("doesn't mix placeholder styles", () => {
- const output = template(`FOO + %%FOO%%`)({
- FOO: t.numericLiteral(1),
- });
+ const output =
+ template(`FOO + %%FOO%%`)({
+ FOO: t.numericLiteral(1),
+ });
expect(generator(output).code).toMatchInlineSnapshot(`"FOO + 1;"`);
});
});
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/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-side-effects-in-computed-properties.js ALT/eslint-plugin-vue/lib/rules/no-side-effects-in-computed-properties.js
index 7c0639b..3d2d8f0 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,16 +104,17 @@ module.exports = {
}
const targetBody = scopeStack.body
- const computedProperty = /** @type {ComponentComputedProperty[]} */ (computedPropertiesMap.get(
- vueNode
- )).find((cp) => {
- return (
- cp.value &&
- node.loc.start.line >= cp.value.loc.start.line &&
- node.loc.end.line <= cp.value.loc.end.line &&
- targetBody === cp.value
- )
- })
+ const computedProperty =
+ /** @type {ComponentComputedProperty[]} */ (computedPropertiesMap.get(
+ vueNode
+ )).find((cp) => {
+ return (
+ cp.value &&
+ node.loc.start.line >= cp.value.loc.start.line &&
+ node.loc.end.line <= cp.value.loc.end.line &&
+ targetBody === cp.value
+ )
+ })
if (computedProperty) {
if (!utils.isThis(node, context)) {
return
diff --git ORI/eslint-plugin-vue/lib/rules/no-useless-mustaches.js ALT/eslint-plugin-vue/lib/rules/no-useless-mustaches.js
index b8a2057..709617e 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 01549ca..c2440da 100644
--- ORI/eslint-plugin-vue/lib/rules/no-useless-v-bind.js
+++ ALT/eslint-plugin-vue/lib/rules/no-useless-v-bind.js
@@ -144,7 +144,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..aac0924 100644
--- ORI/eslint-plugin-vue/lib/rules/require-explicit-emits.js
+++ ALT/eslint-plugin-vue/lib/rules/require-explicit-emits.js
@@ -451,14 +451,10 @@ 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,10 @@ 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/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 1ce2748..ba59c6e 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-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..3f9f548 100644
--- ORI/eslint-plugin-vue/lib/utils/indent-common.js
+++ ALT/eslint-plugin-vue/lib/utils/indent-common.js
@@ -1078,9 +1078,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.
@@ -1464,8 +1463,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 */
@@ -1739,10 +1738,11 @@ 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,
@@ -1777,10 +1777,11 @@ module.exports.defineVisitor = function create(
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)))
diff --git ORI/eslint-plugin-vue/lib/utils/index.js ALT/eslint-plugin-vue/lib/utils/index.js
index 0bcf801..460f3d4 100644
--- ORI/eslint-plugin-vue/lib/utils/index.js
+++ ALT/eslint-plugin-vue/lib/utils/index.js
@@ -838,11 +838,12 @@ 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 +871,14 @@ 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,
diff --git ORI/prettier/scripts/release/steps/update-dependents-count.js ALT/prettier/scripts/release/steps/update-dependents-count.js
index 1fb641bb6..b8e717537 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/language-html/conditional-comment.js ALT/prettier/src/language-html/conditional-comment.js
index 228076446..f93551f98 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 896d72bcd..600947b77 100644
--- ORI/prettier/src/language-html/print-preprocess.js
+++ ALT/prettier/src/language-html/print-preprocess.js
@@ -336,11 +336,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 0ce5bb005..48bc66d47 100644
--- ORI/prettier/src/language-html/syntax-vue.js
+++ ALT/prettier/src/language-html/syntax-vue.js
@@ -79,7 +79,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 e4e0caa09..d34fa03ce 100644
--- ORI/prettier/src/language-js/comments.js
+++ ALT/prettier/src/language-js/comments.js
@@ -588,10 +588,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 be9dcd9dd..d74e063cc 100644
--- ORI/prettier/src/language-js/parse-postprocess.js
+++ ALT/prettier/src/language-js/parse-postprocess.js
@@ -21,10 +21,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 dad0eded4..b9f3282f7 100644
--- ORI/prettier/src/language-js/parser-babel.js
+++ ALT/prettier/src/language-js/parser-babel.js
@@ -62,10 +62,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);
diff --git ORI/prettier/src/language-markdown/constants.evaluate.js ALT/prettier/src/language-markdown/constants.evaluate.js
index 1b9ab9d09..45c799f9e 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/main/ast-to-doc.js ALT/prettier/src/main/ast-to-doc.js
index 369e6fc50..3d5a5fec0 100644
--- ORI/prettier/src/main/ast-to-doc.js
+++ ALT/prettier/src/main/ast-to-doc.js
@@ -86,12 +86,8 @@ function printAstToDoc(ast, options, alignmentSize = 0) {
}
function printPrettierIgnoredNode(node, options) {
- const {
- originalText,
- [Symbol.for("comments")]: comments,
- locStart,
- locEnd,
- } = options;
+ const { originalText, [Symbol.for("comments")]: comments, locStart, locEnd } =
+ options;
const start = locStart(node);
const end = locEnd(node);
diff --git ORI/prettier/src/main/comments.js ALT/prettier/src/main/comments.js
index 3903278c3..8dec303a2 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 5e27a6b09..88ea30065 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 a420c561f..8622a9bce 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/pages/playground-redirect.html ALT/prettier/website/pages/playground-redirect.html
index e8bc4a40f..f03a9a573 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 b41bde90e..8a22a34df 100644
--- ORI/prettier/website/playground/util.js
+++ ALT/prettier/website/playground/util.js
@@ -55,7 +55,8 @@ export function getCodemirrorMode(parser) {
const astAutoFold = {
estree: /^\s*"(loc|start|end)":/,
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":/,
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 bc26d9d9..c38a8702 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 7c2f237c..4bf17c25 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 4521fcb1..37dfefd3 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 7107bdf4..b1915bcb 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 666ddc04..096deaff 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
@@ -309,10 +309,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,
@@ -477,11 +478,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.
@@ -688,11 +686,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 2c9dd9f2..b2b980cd 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/method-signature-style.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/method-signature-style.ts
index 54e68b2c..4775a1fe 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 b58edd99..f507f372 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-magic-numbers.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-magic-numbers.ts
index 0cb41337..1f45a489 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-unnecessary-condition.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/no-unnecessary-condition.ts
index aee4963a..fcf11f3f 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 395bbfdc..014b2c22 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 b326c754..12284640 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 2b0bb32c..59680863 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 581e7ac1..01721d44 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/semi.ts ALT/typescript-eslint/packages/eslint-plugin/src/rules/semi.ts
index 9c18d0e3..eccc264e 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 08c3ad62..525febe2 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/index.ts ALT/typescript-eslint/packages/eslint-plugin/src/util/index.ts
index 315eec9c..fe531fec 100644
--- ORI/typescript-eslint/packages/eslint-plugin/src/util/index.ts
+++ ALT/typescript-eslint/packages/eslint-plugin/src/util/index.ts
@@ -12,15 +12,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/tests/rules/member-ordering.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/member-ordering.test.ts
index 21fca6e6..855e13a0 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-inferrable-types.test.ts ALT/typescript-eslint/packages/eslint-plugin/tests/rules/no-inferrable-types.test.ts
index dd7d8cf4..61caf073 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/tools/generate-configs.ts ALT/typescript-eslint/packages/eslint-plugin/tools/generate-configs.ts
index e78808aa..ed84f286 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/ts-eslint-scope/Definition.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint-scope/Definition.ts
index 15c69bbf..1999c4f4 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 49f1e11c..9b2c711d 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/Rule.ts ALT/typescript-eslint/packages/experimental-utils/src/ts-eslint/Rule.ts
index e9502e0b..076b1731 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,10 +161,9 @@ 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,
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 6907e229..bc3db012 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/typescript-estree/src/convert.ts ALT/typescript-eslint/packages/typescript-estree/src/convert.ts
index 90f50b19..43bfd6ba 100644
--- ORI/typescript-eslint/packages/typescript-estree/src/convert.ts
+++ ALT/typescript-eslint/packages/typescript-estree/src/convert.ts
@@ -846,9 +846,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
// check for exports
@@ -1070,9 +1071,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);
}
@@ -1177,9 +1179,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);
}
@@ -1234,9 +1237,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
return result;
}
@@ -1332,9 +1336,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
return result;
}
@@ -1439,10 +1444,11 @@ export class Converter {
let result: TSESTree.RestElement | TSESTree.AssignmentPattern;
if (node.dotDotDotToken) {
- parameter = result = this.createNode<TSESTree.RestElement>(node, {
- type: AST_NODE_TYPES.RestElement,
- argument: this.convertChild(node.name),
- });
+ parameter = result =
+ this.createNode<TSESTree.RestElement>(node, {
+ type: AST_NODE_TYPES.RestElement,
+ argument: this.convertChild(node.name),
+ });
} else if (node.initializer) {
parameter = this.convertChild(node.name) as TSESTree.BindingName;
result = this.createNode<TSESTree.AssignmentPattern>(node, {
@@ -1536,17 +1542,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) {
@@ -2313,9 +2321,10 @@ export class Converter {
// Process typeParameters
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
// check for exports
@@ -2343,9 +2352,10 @@ export class Converter {
}
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
const accessibility = getTSNodeAccessibility(node);
@@ -2449,9 +2459,10 @@ export class Converter {
}
if (node.typeParameters) {
- result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(
- node.typeParameters,
- );
+ result.typeParameters =
+ this.convertTSTypeParametersToTypeParametersDeclaration(
+ node.typeParameters,
+ );
}
return result;
@@ -2490,9 +2501,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/tests/lib/semanticInfo.test.ts ALT/typescript-eslint/packages/typescript-estree/tests/lib/semanticInfo.test.ts
index 36726ac1..9ce5ca68 100644
--- ORI/typescript-eslint/packages/typescript-estree/tests/lib/semanticInfo.test.ts
+++ ALT/typescript-eslint/packages/typescript-estree/tests/lib/semanticInfo.test.ts
@@ -159,9 +159,8 @@ describe('semanticInfo', () => {
const computedPropertyString = ((parseResult.ast
.body[1] as TSESTree.ClassDeclaration).body
.body[0] as TSESTree.ClassProperty).key;
- const tsComputedPropertyString = parseResult.services.esTreeNodeToTSNodeMap.get(
- computedPropertyString,
- );
+ const tsComputedPropertyString =
+ parseResult.services.esTreeNodeToTSNodeMap.get(computedPropertyString);
expect(tsComputedPropertyString.kind).toEqual(ts.SyntaxKind.StringLiteral);
});
diff --git ORI/typescript-eslint/tools/generate-contributors.ts ALT/typescript-eslint/tools/generate-contributors.ts
index 38c3690c..6bb908b3 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.
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.