Skip to content

Commit

Permalink
Merge pull request #202 from jeff-phillips-18/apply-prettier
Browse files Browse the repository at this point in the history
chore(prettier): Apply prettier settings to lint
  • Loading branch information
jeff-phillips-18 authored May 29, 2024
2 parents c089767 + 7eae9fd commit 90aa075
Show file tree
Hide file tree
Showing 158 changed files with 2,947 additions and 2,878 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ coverage
.tmp
.eslintcache
generated
*.d.ts
*/css/*.js

# package managers
yarn-error.log
Expand Down
9 changes: 8 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@
"version": "detect"
}
},
"plugins": ["react", "react-hooks", "@typescript-eslint", "patternfly-react"],
"plugins": [
"react",
"react-hooks",
"@typescript-eslint",
"patternfly-react",
"prettier"
],
"rules": {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/array-type": "error",
Expand Down Expand Up @@ -92,6 +98,7 @@
"object-shorthand": "error",
"one-var": ["error", "never"],
"prefer-const": "error",
"prettier/prettier": "error",
"radix": ["error", "as-needed"],
"react/prop-types": 0,
"react/display-name": 0,
Expand Down
7 changes: 2 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ module.exports = {
['@babel/preset-env', { targets: { node: 'current' } }],
['@babel/preset-react', { runtime: 'automatic' }],
'@babel/preset-flow',
'@babel/preset-typescript',
'@babel/preset-typescript'
],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-class-properties',
]
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }], '@babel/plugin-proposal-class-properties']
};
6 changes: 2 additions & 4 deletions fed-mini-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ const path = require('path');

const root = process.cwd();

const sourceFiles = glob
.sync(`${root}/src/*/`)
.map((name) => name.replace(/\/$/, ''));
const sourceFiles = glob.sync(`${root}/src/*/`).map((name) => name.replace(/\/$/, ''));

const indexTypings = glob.sync(`${root}/src/index.d.ts`);

Expand Down Expand Up @@ -34,7 +32,7 @@ async function createPackage(file) {
const esmRelative = path.relative(file.replace('/src', ''), esmSource);
const content = {
main: 'index.js',
module: esmRelative,
module: esmRelative
};
const typings = glob.sync(`${root}/src/${fileName}/*.d.ts`);
const cmds = [];
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ module.exports = {
testEnvironment: 'jsdom',
transformIgnorePatterns: ['node_modules/(?!@patternfly)'],
testPathIgnorePatterns: ['<rootDir>/packages/demo-app-ts/'],
setupFilesAfterEnv: ['<rootDir>/testSetup.ts'],
setupFilesAfterEnv: ['<rootDir>/testSetup.ts']
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"serve:docs": "yarn workspace @patternfly/react-topology docs:serve",
"clean": "yarn workspace @patternfly/react-topology clean",
"lint:js": "eslint . --ext .js,.jsx,.ts,.tsx --color",
"lint:js:fix": "eslint . --ext .js,.jsx,.ts,.tsx --color --fix",
"lint:md": "eslint packages --ext md --no-eslintrc --config .eslintrc-md.json --cache",
"lint:md:fix": "eslint packages --ext md --no-eslintrc --config .eslintrc-md.json --cache --fix",
"lint": "yarn lint:js && yarn lint:md",
"lint:fix": "yarn lint:js:fix && yarn lint:md:fix",
"test": "TZ=EST jest packages",
"test:a11y": "echo skipping a11y tests for now",
"serve:a11y": "yarn workspace @patternfly/react-topology serve:a11y"
Expand Down
47 changes: 22 additions & 25 deletions packages/demo-app-ts/src/Demos.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { PipelineTasksDemo } from './demos/pipelinesDemo/PipelineTasksDemo';
import { PipelineLayoutDemo } from './demos/pipelinesDemo/PipelineLayoutDemo';
import {
PipelineGroupsComplexDemo,
PipelineGroupsDemo
} from './demos/pipelineGroupsDemo/PipelineGroupsDemo';
import { PipelineGroupsComplexDemo, PipelineGroupsDemo } from './demos/pipelineGroupsDemo/PipelineGroupsDemo';
import { Basics } from './demos/Basics';
import { StyleEdges, StyleGroups, StyleLabels, StyleNodes } from './demos/stylesDemo/Styles';
import { Selection } from './demos/Selection';
Expand Down Expand Up @@ -38,7 +35,7 @@ export const Demos: DemoInterface[] = [
id: 'topology-package',
name: 'Topology Package',
componentType: TopologyPackage,
isDefault: true,
isDefault: true
},
{
id: 'pipelines',
Expand All @@ -57,24 +54,24 @@ export const Demos: DemoInterface[] = [
{
id: 'pipelines-groups-layout-demo',
name: 'Pipeline Groups Layout',
componentType: PipelineGroupsDemo,
componentType: PipelineGroupsDemo
},
{
id: 'pipelines-groups-complex-layout-demo',
name: 'Pipeline Groups Complex Layout',
componentType: PipelineGroupsComplexDemo,
},
componentType: PipelineGroupsComplexDemo
}
]
},
{
id: 'status-connectors',
name: 'Status Connectors',
componentType: StatusConnectors,
componentType: StatusConnectors
},
{
id: 'basic',
name: 'Basic',
componentType: Basics,
componentType: Basics
},
{
id: 'styles',
Expand All @@ -83,70 +80,70 @@ export const Demos: DemoInterface[] = [
{
id: 'nodes',
name: 'Nodes',
componentType: StyleNodes,
componentType: StyleNodes
},
{
id: 'labels',
name: 'Labels',
componentType: StyleLabels,
componentType: StyleLabels
},
{
id: 'groups',
name: 'Groups',
componentType: StyleGroups,
componentType: StyleGroups
},
{
id: 'edges',
name: 'Edges',
componentType: StyleEdges,
},
componentType: StyleEdges
}
]
},
{
id: 'selection',
name: 'Selection',
componentType: Selection,
componentType: Selection
},
{
id: 'pan-zoom',
name: 'Pan Zoom',
componentType: PanZoom,
componentType: PanZoom
},
{
id: 'layout',
name: 'Layout',
componentType: Layouts,
componentType: Layouts
},
{
id: 'connectors',
name: 'Connectors',
componentType: Connectors,
componentType: Connectors
},
{
id: 'drag-and-drop',
name: 'Drag and Drop',
componentType: DragAndDrop,
componentType: DragAndDrop
},
{
id: 'shapes',
name: 'Shapes',
componentType: Shapes,
componentType: Shapes
},
{
id: 'context-menus',
name: 'Context Menus',
componentType: ContextMenus,
componentType: ContextMenus
},
{
id: 'complex-group',
name: 'Complex Group',
componentType: ComplexGroup,
componentType: ComplexGroup
},
{
id: 'collapsible-groups',
name: 'Collapsible Groups',
componentType: CollapsibleGroups,
},
componentType: CollapsibleGroups
}
];

export default Demos;
2 changes: 1 addition & 1 deletion packages/demo-app-ts/src/components/CustomCircleNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const CustomCircle: React.FunctionComponent<ShapeProps> = ({ element, className
);
};

const CustomCircleNode: React.FunctionComponent<CustomCircleNodeProps> = props => (
const CustomCircleNode: React.FunctionComponent<CustomCircleNodeProps> = (props) => (
<DemoDefaultNode getCustomShape={() => CustomCircle} {...props} />
);

Expand Down
2 changes: 1 addition & 1 deletion packages/demo-app-ts/src/components/CustomPathNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type CustomPathNodeProps = {
WithCreateConnectorProps &
WithContextMenuProps;

const CustomPathNode: React.FunctionComponent<CustomPathNodeProps> = props => (
const CustomPathNode: React.FunctionComponent<CustomPathNodeProps> = (props) => (
<DemoDefaultNode getCustomShape={() => Path} {...props} />
);

Expand Down
2 changes: 1 addition & 1 deletion packages/demo-app-ts/src/components/CustomPolygonNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type CustomPolygonNodeProps = {
WithCreateConnectorProps &
WithContextMenuProps;

const CustomPolygonNode: React.FunctionComponent<CustomPolygonNodeProps> = props => (
const CustomPolygonNode: React.FunctionComponent<CustomPolygonNodeProps> = (props) => (
<DemoDefaultNode getCustomShape={() => Polygon} {...props} />
);

Expand Down
2 changes: 1 addition & 1 deletion packages/demo-app-ts/src/components/CustomRectNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const CustomRect: React.FunctionComponent<ShapeProps> = observer(({ className })
return <rect className={className} x={0} y={0} width={100} height={20} />;
});

const CustomRectNode: React.FunctionComponent<CustomRectNodeProps> = props => (
const CustomRectNode: React.FunctionComponent<CustomRectNodeProps> = (props) => (
<DemoDefaultNode getCustomShape={() => CustomRect} {...props} />
);

Expand Down
8 changes: 7 additions & 1 deletion packages/demo-app-ts/src/components/DemoDefaultNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ const DemoDefaultNode: React.FunctionComponent<DemoDefaultNodeProps> = ({

return (
<g ref={refs} onClick={onSelect} onContextMenu={onContextMenu}>
<ShapeComponent className={className} element={nodeElement} width={width} height={height} dndDropRef={dndDropRef} />
<ShapeComponent
className={className}
element={nodeElement}
width={width}
height={height}
dndDropRef={dndDropRef}
/>
</g>
);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/demo-app-ts/src/components/GroupHull.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const GroupHull: React.FunctionComponent<GroupHullProps> = ({
return null;
}
const points: PointWithSize[] = [];
nodeChildren.forEach(c => {
nodeChildren.forEach((c) => {
if (c.getNodeShape() === NodeShape.ellipse) {
const { width, height } = c.getBounds();
const { x, y } = c.getBounds().getCenter();
Expand Down
2 changes: 1 addition & 1 deletion packages/demo-app-ts/src/components/MultiEdge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const MultiEdge: React.FunctionComponent<MultiEdgeProps> = ({ element }) => {
element
.getGraph()
.getEdges()
.forEach(e => {
.forEach((e) => {
if (e === element) {
idx = sum;
sum++;
Expand Down
5 changes: 3 additions & 2 deletions packages/demo-app-ts/src/components/shapes/Path.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ const Path: React.FunctionComponent<ShapeProps> = ({ className, width, height, f
<path
className={className}
ref={refs}
d={`M0 0 L${width / 2} ${height / 4} L${width} 0 L${width} ${height} L${width / 2} ${height -
height / 4} L0 ${height} Z`}
d={`M0 0 L${width / 2} ${height / 4} L${width} 0 L${width} ${height} L${width / 2} ${
height - height / 4
} L0 ${height} Z`}
filter={filter}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/demo-app-ts/src/components/shapes/Polygon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Polygon: React.FunctionComponent<ShapeProps> = ({ className, width, height
<polygon
className={className}
ref={dndDropRef}
points={points.map(p => `${p[0]},${p[1]}`).join(' ')}
points={points.map((p) => `${p[0]},${p[1]}`).join(' ')}
filter={filter}
/>
);
Expand Down
Loading

0 comments on commit 90aa075

Please sign in to comment.