Skip to content

Commit

Permalink
feat: use @babel/code-frame for result.source
Browse files Browse the repository at this point in the history
BREAKING CHANGE: output and onComplete args result.source is now formatted with @babel/code-frame
  • Loading branch information
AriPerkkio committed Jan 31, 2021
1 parent ba151e3 commit e28c06d
Show file tree
Hide file tree
Showing 9 changed files with 424 additions and 499 deletions.
102 changes: 42 additions & 60 deletions docs/comparison-results-added.md
Expand Up @@ -7,16 +7,13 @@
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/shared/components/Button/index.jsx#L28-L28)

```jsx
icon: undefined,
iconSize: 18,
disabled: false,
isWorking: false,
onClick: () => {},
};

const Button = forwardRef(
({ children, variant, icon, iconSize, disabled, isWorking, onClick, ...buttonProps }, ref) => {
const handleClick = () => {
26 | disabled: false,
27 | isWorking: false,
> 28 | onClick: () => {},
| ^^
29 | };
30 |
31 | const Button = forwardRef(
```
## Rule: no-empty-function
Expand All @@ -26,16 +23,13 @@ const Button = forwardRef(
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/shared/components/Input/index.jsx#L21-L21)

```jsx
value: undefined,
icon: undefined,
invalid: false,
filter: undefined,
onChange: () => {},
};
const Input = forwardRef(({ icon, className, filter, onChange, ...inputProps }, ref) => {
const handleChange = event => {
if (!filter || filter.test(event.target.value)) {
19 | invalid: false,
20 | filter: undefined,
> 21 | onChange: () => {},
| ^^
22 | };
23 |
24 | const Input = forwardRef(({ icon, className, filter, onChange, ...inputProps }, ref) => {
```

## Rule: no-empty-function
Expand All @@ -45,16 +39,13 @@ const Input = forwardRef(({ icon, className, filter, onChange, ...inputProps },
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/shared/components/Modal/index.jsx#L29-L29)

```jsx
variant: 'center',
width: 600,
withCloseIcon: true,
isOpen: undefined,
onClose: () => {},
renderLink: () => {},
};
const Modal = ({
className,
27 | withCloseIcon: true,
28 | isOpen: undefined,
> 29 | onClose: () => {},
| ^^
30 | renderLink: () => {},
31 | };
32 |
```

## Rule: no-empty-function
Expand All @@ -64,16 +55,13 @@ const Modal = ({
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/shared/components/Modal/index.jsx#L30-L30)

```jsx
width: 600,
withCloseIcon: true,
isOpen: undefined,
onClose: () => {},
renderLink: () => {},
};
const Modal = ({
className,
testid,
28 | isOpen: undefined,
29 | onClose: () => {},
> 30 | renderLink: () => {},
| ^^
31 | };
32 |
33 | const Modal = ({
```

## Rule: no-empty-function
Expand All @@ -83,16 +71,13 @@ const Modal = ({
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/shared/components/TextEditor/index.jsx#L22-L22)

```jsx
className: undefined,
placeholder: undefined,
defaultValue: undefined,
value: undefined,
onChange: () => {},
getEditor: () => {},
};
const TextEditor = ({
className,
20 | defaultValue: undefined,
21 | value: undefined,
> 22 | onChange: () => {},
| ^^
23 | getEditor: () => {},
24 | };
25 |
```

## Rule: no-empty-function
Expand All @@ -102,14 +87,11 @@ const TextEditor = ({
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/shared/components/TextEditor/index.jsx#L23-L23)

```jsx
placeholder: undefined,
defaultValue: undefined,
value: undefined,
onChange: () => {},
getEditor: () => {},
};
const TextEditor = ({
className,
placeholder,
21 | value: undefined,
22 | onChange: () => {},
> 23 | getEditor: () => {},
| ^^
24 | };
25 |
26 | const TextEditor = ({
```
112 changes: 48 additions & 64 deletions docs/comparison-results-removed.md
Expand Up @@ -7,15 +7,13 @@
- [Link](https://github.com/AriPerkkio/js-framework-playground/blob/HEAD/packages/react/src/components/LoadButton.jsx#L4-L4)

```jsx
import React, { useReducer } from 'react';

const LoadButton = ({ onUserLoad }) => {
const [userIndex, increaseUserIndex] = useReducer(s => s + 1, 1);
const [disabled, toggleDisabled] = useReducer(s => !s, false);

const onClick = () => {
toggleDisabled();
increaseUserIndex();
2 |
3 | const LoadButton = ({ onUserLoad }) => {
> 4 | const [userIndex, increaseUserIndex] = useReducer(s => s + 1, 1);
| ^
5 | const [disabled, toggleDisabled] = useReducer(s => !s, false);
6 |
7 | const onClick = () => {
```
## Rule: id-length
Expand All @@ -25,16 +23,13 @@ const LoadButton = ({ onUserLoad }) => {
- [Link](https://github.com/AriPerkkio/js-framework-playground/blob/HEAD/packages/react/src/components/LoadButton.jsx#L5-L5)
```jsx
import React, { useReducer } from 'react';

const LoadButton = ({ onUserLoad }) => {
const [userIndex, increaseUserIndex] = useReducer(s => s + 1, 1);
const [disabled, toggleDisabled] = useReducer(s => !s, false);

const onClick = () => {
toggleDisabled();
increaseUserIndex();

3 | const LoadButton = ({ onUserLoad }) => {
4 | const [userIndex, increaseUserIndex] = useReducer(s => s + 1, 1);
> 5 | const [disabled, toggleDisabled] = useReducer(s => !s, false);
| ^
6 |
7 | const onClick = () => {
8 | toggleDisabled();
```
## Rule: id-length
Expand All @@ -44,11 +39,12 @@ const LoadButton = ({ onUserLoad }) => {
- [Link](https://github.com/AriPerkkio/js-framework-playground/blob/HEAD/packages/vue/src/main.js#L7-L7)
```js
Vue.config.productionTip = false;

new Vue({
render: h => h(App),
}).$mount('#app');
5 |
6 | new Vue({
> 7 | render: h => h(App),
| ^
8 | }).$mount('#app')
9 |
```
## Rule: id-length
Expand All @@ -58,16 +54,13 @@ new Vue({
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/Project/Board/Lists/List/index.jsx#L72-L72)
```jsx
return issues;
};

const getSortedListIssues = (issues, status) =>
issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);

const formatIssuesCount = (allListIssues, filteredListIssues) => {
if (allListIssues.length !== filteredListIssues.length) {
return `${filteredListIssues.length} of ${allListIssues.length}`;
}
70 |
71 | const getSortedListIssues = (issues, status) =>
> 72 | issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);
| ^
73 |
74 | const formatIssuesCount = (allListIssues, filteredListIssues) => {
75 | if (allListIssues.length !== filteredListIssues.length) {
```
## Rule: id-length
Expand All @@ -77,16 +70,13 @@ const formatIssuesCount = (allListIssues, filteredListIssues) => {
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/Project/Board/Lists/List/index.jsx#L72-L72)
```jsx
return issues;
};

const getSortedListIssues = (issues, status) =>
issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);

const formatIssuesCount = (allListIssues, filteredListIssues) => {
if (allListIssues.length !== filteredListIssues.length) {
return `${filteredListIssues.length} of ${allListIssues.length}`;
}
70 |
71 | const getSortedListIssues = (issues, status) =>
> 72 | issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);
| ^
73 |
74 | const formatIssuesCount = (allListIssues, filteredListIssues) => {
75 | if (allListIssues.length !== filteredListIssues.length) {
```
## Rule: id-length
Expand All @@ -96,16 +86,13 @@ const formatIssuesCount = (allListIssues, filteredListIssues) => {
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/Project/Board/Lists/index.jsx#L93-L93)
```jsx
};
};

const getSortedListIssues = (issues, status) =>
issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);

ProjectBoardLists.propTypes = propTypes;

export default ProjectBoardLists;

91 |
92 | const getSortedListIssues = (issues, status) =>
> 93 | issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);
| ^
94 |
95 | ProjectBoardLists.propTypes = propTypes;
96 |
```
## Rule: id-length
Expand All @@ -115,14 +102,11 @@ export default ProjectBoardLists;
- [Link](https://github.com/oldboyxx/jira_clone/blob/HEAD/client/src/Project/Board/Lists/index.jsx#L93-L93)
```jsx
};
};

const getSortedListIssues = (issues, status) =>
issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);

ProjectBoardLists.propTypes = propTypes;

export default ProjectBoardLists;

91 |
92 | const getSortedListIssues = (issues, status) =>
> 93 | issues.filter(issue => issue.status === status).sort((a, b) => a.listPosition - b.listPosition);
| ^
94 |
95 | ProjectBoardLists.propTypes = propTypes;
96 |
```

0 comments on commit e28c06d

Please sign in to comment.