Skip to content

Commit

Permalink
re-format all source code with prettier (#7057)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfirst authored Feb 17, 2023
1 parent aabb2b2 commit 8401bdf
Show file tree
Hide file tree
Showing 95 changed files with 361 additions and 355 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# to use it from the CLI, run `git blame --ignore-revs-file .git-blame-ignore-revs <your-file>`
# alternatively, add it to the config of this project: `git config blame.ignoreRevsFile .git-blame-ignore-revs` then use `git blame` as usual

# re-format all source code with prettier (#6544)
5806f6af42f449d4f4780e86df95b2b1248c6635
# re-format all source code with prettier (#6544)
52196a308de40d0bfbff140ed347ab5713743fac
# upgrade prettier from 1.x to 2.x and re-format all files (#2852)
Expand Down
7 changes: 4 additions & 3 deletions e2e/harmony/dependencies/hoisting.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ describe('pnpm with hoisted node linker, when there is a dependency that has the
// The "once" from the registry doesn't have a dist directory
expect(path.join(helper.fixtures.scopes.localPath, 'node_modules/once/dist')).to.be.a.path();
});
it('should nest the dependency from the registry into the dependent package\'s node_modules', () => {
expect(path.join(helper.fixtures.scopes.localPath, 'node_modules/map-limit/node_modules/once/package.json')).to.be.a.path();
it("should nest the dependency from the registry into the dependent package's node_modules", () => {
expect(
path.join(helper.fixtures.scopes.localPath, 'node_modules/map-limit/node_modules/once/package.json')
).to.be.a.path();
});
});

16 changes: 4 additions & 12 deletions e2e/harmony/dependency-resolver.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,30 +264,22 @@ describe('dependency-resolver extension', function () {
it('should force a newer version of a subdependency using just the dependency name', function () {
// Without the override, is-odd would be 0.1.2
expect(
helper.fixtures.fs.readJsonFile(
'node_modules/.pnpm/[email protected]/node_modules/is-odd/package.json'
).version
helper.fixtures.fs.readJsonFile('node_modules/.pnpm/[email protected]/node_modules/is-odd/package.json').version
).to.eq('1.0.0');
});
it('should force a newer version of a subdependency using the dependency name and version', function () {
expect(
helper.fixtures.fs.readJsonFile(
'node_modules/.pnpm/[email protected]/node_modules/glob/package.json'
).version
helper.fixtures.fs.readJsonFile('node_modules/.pnpm/[email protected]/node_modules/glob/package.json').version
).to.eq('6.0.4');
});
it('should not change the version of the package if the parent package does not match the pattern', function () {
expect(
helper.fixtures.fs.readJsonFile(
'node_modules/.pnpm/[email protected]/node_modules/once/package.json'
).version
helper.fixtures.fs.readJsonFile('node_modules/.pnpm/[email protected]/node_modules/once/package.json').version
).to.eq('1.4.0');
});
it('should change the version of the package if the parent package matches the pattern', function () {
expect(
helper.fixtures.fs.readJsonFile(
'node_modules/.pnpm/[email protected]/node_modules/once/package.json'
).version
helper.fixtures.fs.readJsonFile('node_modules/.pnpm/[email protected]/node_modules/once/package.json').version
).to.eq('1.3.0');
});
});
Expand Down
30 changes: 13 additions & 17 deletions e2e/harmony/install-and-compile.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,24 +143,20 @@ export function comp() {
await npmCiRegistry.init();
npmCiRegistry.configureCiInPackageJsonHarmony();
helper.command.create('react-env', 'custom-react/env1', '-p custom-react/env1');
helper.fixtures.populateEnvMainRuntime(
`custom-react/env1/env1.main.runtime.ts`,
{
envName: 'env1',
dependencies: {
dependencies: {},
devDependencies: {
helper.fixtures.populateEnvMainRuntime(`custom-react/env1/env1.main.runtime.ts`, {
envName: 'env1',
dependencies: {
dependencies: {},
devDependencies: {},
peers: [
{
name: 'react',
supportedRange: '^16.8.0',
version: '16.14.0',
},
peers: [
{
name: 'react',
supportedRange: '^16.8.0',
version: '16.14.0',
},
],
},
}
);
],
},
});
helper.command.install();
helper.command.tagAllComponents();
helper.command.export();
Expand Down
6 changes: 3 additions & 3 deletions scopes/compilation/bundler/bundler.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/
import { Bundler } from './bundler';
import { BundlerContext } from './bundler-context';

type BundlerTransformationMap = ServiceTransformationMap & {
type BundlerTransformationMap = ServiceTransformationMap & {
getBundler?: (context: BundlerContext) => Promise<Bundler>;
}
};
export class BundlerService implements EnvService<any> {
name = 'bundler';

Expand All @@ -15,6 +15,6 @@ export class BundlerService implements EnvService<any> {

return {
getBundler: (context) => preview.getBundler(context)(envContext),
}
};
}
}
4 changes: 2 additions & 2 deletions scopes/compilation/compiler/compiler-env-type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EnvHandler } from "@teambit/envs";
import { Compiler } from "./types";
import { EnvHandler } from '@teambit/envs';
import { Compiler } from './types';

export interface CompilerEnv {
/**
Expand Down
6 changes: 3 additions & 3 deletions scopes/compilation/compiler/compiler.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export type CompilerDescriptor = {
config?: string;
};

type CompilerTransformationMap = ServiceTransformationMap & {
type CompilerTransformationMap = ServiceTransformationMap & {
getCompiler: () => Compiler;
}
};

export class CompilerService implements EnvService<{}, CompilerDescriptor> {
name = 'Compile';
Expand Down Expand Up @@ -42,7 +42,7 @@ export class CompilerService implements EnvService<{}, CompilerDescriptor> {
if (!env?.compiler) return undefined;
return {
getCompiler: () => env.compiler()(context),
}
};
}

getDescriptor(env: EnvDefinition) {
Expand Down
2 changes: 1 addition & 1 deletion scopes/compilation/compiler/compiler.task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ export class CompilerTask implements BuildTask {
const name = options.name || 'compiler-task';
const depResolve = context.getAspect<any>('teambit.dependencies/dependency-resolver');
return new CompilerTask(aspectId, name, options.compiler(context), depResolve);
}
};
}
}
9 changes: 8 additions & 1 deletion scopes/component/component/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ export { ComponentContext, ComponentDescriptorContext, useComponentDescriptor }
export type { ComponentProviderProps, ComponentDescriptorProviderProps } from './ui/context';
export { ComponentProvider, ComponentDescriptorProvider } from './ui/context';
export { componentFields, componentIdFields, componentOverviewFields } from './ui';
export { NavPlugin, ConsumePlugin, CollapsibleMenuNav, MenuNavProps, ComponentMenu, VersionRelatedDropdowns } from './ui/menu';
export {
NavPlugin,
ConsumePlugin,
CollapsibleMenuNav,
MenuNavProps,
ComponentMenu,
VersionRelatedDropdowns,
} from './ui/menu';
export { RegisteredComponentRoute, ComponentUrlParams } from './component.route';
export { ComponentModel, ComponentModelProps } from './ui/component-model';
export { TopBarNav } from './ui/top-bar-nav';
Expand Down
2 changes: 1 addition & 1 deletion scopes/component/component/ui/menu/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { CollapsibleMenuNav, MenuNavProps } from './menu-nav';
export { ComponentMenu, VersionRelatedDropdowns } from './menu';
export type { NavPlugin, OrderedNavigationSlot, ConsumePlugin, ConsumeMethodSlot } from './nav-plugin';
export type { NavPlugin, OrderedNavigationSlot, ConsumePlugin, ConsumeMethodSlot } from './nav-plugin';
2 changes: 1 addition & 1 deletion scopes/component/component/ui/menu/menu.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

.tab {
> div {
color: var(--on-background-color, #2B2B2B);
color: var(--on-background-color, #2b2b2b);
padding: 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion scopes/component/component/ui/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export function VersionRelatedDropdowns({
}: {
component: ComponentModel;
consumeMethods?: ConsumeMethodSlot;
className?: string,
className?: string;
host: string;
}) {
const location = useLocation();
Expand Down
4 changes: 2 additions & 2 deletions scopes/component/dev-files/dev-files.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class DevFilesMain {
config: configuredPatterns,
},
fromSlot.patterns,
fromEnv,
fromEnv
);
return res;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ export class DevFilesMain {
if (!acc[aspectId]) acc[aspectId] = [];
acc[aspectId] = acc[aspectId].concat(pattern);
return acc;
}, {})
}, {});
return envPatternsObject;
}

Expand Down
3 changes: 2 additions & 1 deletion scopes/component/graph/graph-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export class GraphBuilder {
newGraph.setNode(node);
});
graph.edges.forEach((edge) => {
const edgeObj = (edge.attr === 'dependencies' || edge.attr === 'runtime') ? new Dependency('runtime') : new Dependency('dev');
const edgeObj =
edge.attr === 'dependencies' || edge.attr === 'runtime' ? new Dependency('runtime') : new Dependency('dev');
newGraph.setEdge(new Edge(edge.sourceId, edge.targetId, edgeObj));
});
return newGraph;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

.compositionCard {
border: 1px solid var(--border-high-color, #BABEC9);
border: 1px solid var(--border-high-color, #babec9);
border-radius: 8px;
box-sizing: border-box;
width: 100%;
Expand All @@ -16,7 +16,7 @@
visibility: hidden;
}
&:hover {
border-color: var(--border-high-active-color, #8C8F96);
border-color: var(--border-high-active-color, #8c8f96);
.icon {
transition: visibility 300ms, ease-in-out;
visibility: visible;
Expand All @@ -39,7 +39,7 @@
align-items: center;
justify-content: space-between;
font-size: 14px;
border-top: 1px solid var(--border-medium-color, #EDEDED);
border-top: 1px solid var(--border-medium-color, #ededed);
}

.displayName {
Expand All @@ -49,12 +49,10 @@

.link {
text-decoration: none;

font-size: 12px;
color: var(--on-background-medium-color, #707279);
&:hover {
color: var(--primary-color, #6C5CE7);
color: var(--primary-color, #6c5ce7);
}
}


26 changes: 14 additions & 12 deletions scopes/compositions/composition-card/composition-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,20 @@ export function CompositionCard({
return (
<div {...rest} key={composition.identifier} className={classnames(styles.compositionCard, className)}>
<div className={styles.compositionPreview}>
{!isLoading && <ComponentComposition
onLoad={() => setLoading(false)}
onError={() => {
// we need to handle exceptions in ther iframe and what to show here
setLoading(false)
}}
loading="lazy"
className={previewClass}
composition={composition}
component={component}
pubsub={false}
/>}
{!isLoading && (
<ComponentComposition
onLoad={() => setLoading(false)}
onError={() => {
// we need to handle exceptions in ther iframe and what to show here
setLoading(false);
}}
loading="lazy"
className={previewClass}
composition={composition}
component={component}
pubsub={false}
/>
)}
<div className={styles.previewOverlay}>{previewLoading && <PreviewSkeleton />}</div>
</div>
<div className={styles.bottom}>
Expand Down
2 changes: 1 addition & 1 deletion scopes/compositions/composition-card/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { CompositionCard } from './composition-card';
export type { CompositionCardProps } from './composition-card';
export { CompositionCardSkeleton } from './composition-card-skeleton';
export { CompositionCardSkeleton } from './composition-card-skeleton';
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class CompositionsMain {
? env.getCompositionsDevPatterns(component)
: [];
const componentPatterns = componentEnvCompositionsDevPatterns.concat(this.getCompositionFilePattern());
return {name: 'compositions', pattern: componentPatterns};
return { name: 'compositions', pattern: componentPatterns };
}

getDevPatternToRegister() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class CompositionPreviewDefinition implements PreviewDefinition {
return this.renderTemplatePathByEnv(context.env);
}

async renderTemplatePathByEnv(env: Environment): Promise<string | undefined> {
if (env.getMounter && isFunction(env.getMounter)){
async renderTemplatePathByEnv(env: Environment): Promise<string | undefined> {
if (env.getMounter && isFunction(env.getMounter)) {
return env.getMounter();
}
return undefined;
Expand Down
6 changes: 3 additions & 3 deletions scopes/compositions/compositions/compositions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ export function Compositions({ menuBarWidgets, emptyState }: CompositionsProp) {
);

if (!path) return;
if(!path.includes(composition.identifier.toLowerCase())) {
const nextPath = location.pathname.concat(`/${composition.identifier.toLowerCase()}`)
navigate(nextPath)
if (!path.includes(composition.identifier.toLowerCase())) {
const nextPath = location.pathname.concat(`/${composition.identifier.toLowerCase()}`);
navigate(nextPath);
return;
}
navigate(path);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.compositionGallerySkeleton {
color: var(--border-medium-color, #ededed);
font-size: 20px;
color: var(--border-medium-color, #ededed);
font-size: 20px;
}
.title {
margin-bottom: 20px;
margin-bottom: 20px;
}
.compositionGalleryGrid {
display: flex;
cursor: pointer;
align-items: center;
overflow-x: auto;
gap: 24px;
padding-bottom: 12px;
overscroll-behavior-x: contain;
}
display: flex;
cursor: pointer;
align-items: center;
overflow-x: auto;
gap: 24px;
padding-bottom: 12px;
overscroll-behavior-x: contain;
}
Loading

0 comments on commit 8401bdf

Please sign in to comment.