Skip to content

Commit 556eceb

Browse files
committed
chore(dev): fix lint/prettier flows
1 parent ee87a83 commit 556eceb

14 files changed

+119
-108
lines changed

.babelrc.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// @flow
22

3-
const es6Compat = process.env.BABEL_ES_COMPAT === "6" || process.env.NODE_ENV === "test";
3+
const es6Compat =
4+
process.env.BABEL_ES_COMPAT === "6" || process.env.NODE_ENV === "test";
45

56
module.exports = {
67
presets: [
78
[
89
"@babel/preset-env",
910
{
1011
targets: es6Compat ? "maintained node versions" : "> 0.25%, not dead"
11-
},
12+
}
1213
],
1314
"@babel/react",
1415
"@babel/preset-flow"

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
node_modules/**/*
2+
build
3+
dist
4+
flow-typed

.eslintrc.json

+4-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
{
22
"root": true,
33
"parser": "@babel/eslint-parser",
4-
"plugins": [
5-
"react",
6-
"flowtype",
7-
"unicorn"
8-
],
4+
"plugins": ["react", "flowtype", "unicorn"],
95
"extends": [
106
"eslint:recommended",
117
"plugin:react/recommended",
128
"plugin:flowtype/recommended"
139
],
1410
"rules": {
1511
"no-console": "off",
16-
"no-use-before-define": [
17-
"error",
18-
"nofunc"
19-
],
12+
"no-use-before-define": ["error", "nofunc"],
2013
"no-unused-vars": [
2114
"warn",
2215
{
@@ -26,10 +19,7 @@
2619
}
2720
],
2821
"prefer-const": "error",
29-
"react/jsx-boolean-value": [
30-
"error",
31-
"always"
32-
],
22+
"react/jsx-boolean-value": ["error", "always"],
3323
"unicorn/better-regex": "warn",
3424
"unicorn/expiring-todo-comments": "error",
3525
"unicorn/no-abusive-eslint-disable": "error"
@@ -44,4 +34,4 @@
4434
"version": "detect"
4535
}
4636
}
47-
}
37+
}

.github/changelog-configuration.json

+33-39
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,35 @@
11
{
2-
"categories": [
3-
{
4-
"title": "## 🚀 Features",
5-
"labels": ["feature"]
6-
},
7-
{
8-
"title": "## 🐛 Fixes",
9-
"labels": ["fix"]
10-
},
11-
{
12-
"title": "## 🧪 Tests",
13-
"labels": ["test"]
14-
}
15-
],
16-
"ignore_labels": [
17-
"ignore_changelog"
18-
],
19-
"sort": "ASC",
20-
"template": "${{CHANGELOG}}\n\n<details open>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>",
21-
"pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}",
22-
"empty_template": "- no changes",
23-
"label_extractor": [
24-
{
25-
"pattern": "\\[Issue\\]",
26-
"on_property": "title",
27-
"method": "match"
28-
}
29-
],
30-
"transformers": [
31-
],
32-
"max_tags_to_fetch": 200,
33-
"max_pull_requests": 200,
34-
"max_back_track_time_days": 365,
35-
"exclude_merge_branches": [
36-
],
37-
"tag_resolver": {
2+
"categories": [
3+
{
4+
"title": "## 🚀 Features",
5+
"labels": ["feature"]
386
},
39-
"base_branches": [
40-
]
41-
}
7+
{
8+
"title": "## 🐛 Fixes",
9+
"labels": ["fix"]
10+
},
11+
{
12+
"title": "## 🧪 Tests",
13+
"labels": ["test"]
14+
}
15+
],
16+
"ignore_labels": ["ignore_changelog"],
17+
"sort": "ASC",
18+
"template": "${{CHANGELOG}}\n\n<details open>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>",
19+
"pr_template": "- ${{TITLE}}\n - PR: #${{NUMBER}}",
20+
"empty_template": "- no changes",
21+
"label_extractor": [
22+
{
23+
"pattern": "\\[Issue\\]",
24+
"on_property": "title",
25+
"method": "match"
26+
}
27+
],
28+
"transformers": [],
29+
"max_tags_to_fetch": 200,
30+
"max_pull_requests": 200,
31+
"max_back_track_time_days": 365,
32+
"exclude_merge_branches": [],
33+
"tag_resolver": {},
34+
"base_branches": []
35+
}

.github/labeler.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ infrastructure:
2626
- .travis.yml
2727
- build.sh
2828
- package.json
29-
- webpack*
29+
- webpack*

.github/workflows/changelog.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: 'changelog'
1+
name: "changelog"
22
on:
33
push:
44
tags:
5-
- '*'
5+
- "*"
66

77
jobs:
88
release:
@@ -27,4 +27,4 @@ jobs:
2727
release_name: ${{ github.ref }}
2828
body: ${{steps.github_release.outputs.changelog}}
2929
env:
30-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/gh-pages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build and Deploy to GitHub Pages
22
on:
33
push:
44
tags:
5-
- '*'
5+
- "*"
66
jobs:
77
build-and-deploy:
88
runs-on: ubuntu-latest

.github/workflows/label.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Pull request labeler
33
on:
44
schedule:
5-
- cron: '*/5 * * * *'
5+
- cron: "*/5 * * * *"
66
jobs:
77
labeler:
88
runs-on: ubuntu-latest

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535

3636
# Flow is not supported by lint-action, so we run it raw
3737
- name: Run Flow
38-
run: yarn flow
38+
run: yarn flow

.github/workflows/stale.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: "Close stale issues and PRs"
22
on:
33
schedule:
4-
- cron: "0 0,6,12,18 * * *"
4+
- cron: "0 0,6,12,18 * * *"
55

66
jobs:
77
stale:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/stale@v1
11-
with:
12-
repo-token: ${{ secrets.GITHUB_TOKEN }}
13-
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 7 days'
14-
stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 7 days'
15-
stale-pr-label: 'stale'
16-
exempt-pr-label: 'stale'
17-
days-before-stale: 90
18-
days-before-close: 30
19-
operations-per-run: 30
10+
- uses: actions/stale@v1
11+
with:
12+
repo-token: ${{ secrets.GITHUB_TOKEN }}
13+
stale-issue-message: "This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 7 days"
14+
stale-pr-message: "This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 7 days"
15+
stale-pr-label: "stale"
16+
exempt-pr-label: "stale"
17+
days-before-stale: 90
18+
days-before-close: 30
19+
operations-per-run: 30

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dist/
22
examples/
3+
__mocks__/

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ view-example:
4848
# FIXME flow is usually global
4949
lint:
5050
@$(BIN)/flow
51-
@$(BIN)/eslint --ext .js,.jsx $(LIB) $(TEST)
51+
@$(BIN)/eslint --ext .js,.jsx
5252

5353
test:
5454
env NODE_ENV=test $(BIN)/jest

test/dev-hook.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import 'react-hot-loader';
2-
import { hot } from 'react-hot-loader/root';
3-
import DevLayout from './examples/0-showcase.jsx';
4-
import makeLayout from './test-hook';
1+
import "react-hot-loader";
2+
import { hot } from "react-hot-loader/root";
3+
import DevLayout from "./examples/0-showcase.jsx";
4+
import makeLayout from "./test-hook";
55

66
const Layout = makeLayout(DevLayout);
77

test/spec/lifecycle-test.js

+52-30
Original file line numberDiff line numberDiff line change
@@ -37,60 +37,82 @@ describe("Lifecycle tests", function () {
3737
expect(wrapper).toMatchSnapshot();
3838
});
3939

40-
describe('data-grid', () => {
40+
describe("data-grid", () => {
4141
it("Creates layout based on properties", async function () {
4242
const wrapper = mount(
43-
<ReactGridLayout className="layout" cols={12} rowHeight={30} width={1200}>
44-
<div key="a" data-grid={{x: 0, y: 0, w: 1, h: 2, static: true}}>a</div>
45-
<div key="b" data-grid={{x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4}}>b</div>
46-
<div key="c" data-grid={{x: 4, y: 0, w: 1, h: 2}}>c</div>
43+
<ReactGridLayout
44+
className="layout"
45+
cols={12}
46+
rowHeight={30}
47+
width={1200}
48+
>
49+
<div key="a" data-grid={{ x: 0, y: 0, w: 1, h: 2, static: true }}>
50+
a
51+
</div>
52+
<div
53+
key="b"
54+
data-grid={{ x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 }}
55+
>
56+
b
57+
</div>
58+
<div key="c" data-grid={{ x: 4, y: 0, w: 1, h: 2 }}>
59+
c
60+
</div>
4761
</ReactGridLayout>
4862
);
4963
expect(wrapper).toMatchSnapshot();
5064
expect(wrapper.state().layout).toMatchObject([
5165
{
52-
"h": 2,
53-
"i": "a",
54-
"static": true,
55-
"w": 1,
56-
"x": 0,
57-
"y": 0,
66+
h: 2,
67+
i: "a",
68+
static: true,
69+
w: 1,
70+
x: 0,
71+
y: 0
5872
},
5973
{
60-
"h": 2,
61-
"i": "b",
62-
"static": false,
63-
"w": 3,
64-
"x": 1,
65-
"y": 0,
74+
h: 2,
75+
i: "b",
76+
static: false,
77+
w: 3,
78+
x: 1,
79+
y: 0
6680
},
6781
{
68-
"h": 2,
69-
"i": "c",
70-
"static": false,
71-
"w": 1,
72-
"x": 4,
73-
"y": 0,
74-
},
82+
h: 2,
83+
i: "c",
84+
static: false,
85+
w: 1,
86+
x: 4,
87+
y: 0
88+
}
7589
]);
7690
});
7791

7892
it("Null items in list", async function () {
7993
const wrapper = mount(
80-
// $FlowIgnore
81-
<ReactGridLayout className="layout" cols={12} rowHeight={30} width={1200}>
82-
<div key="a" data-grid={{x: 0, y: 0, w: 1, h: 2, static: true}}>a</div>
94+
<ReactGridLayout
95+
className="layout"
96+
cols={12}
97+
rowHeight={30}
98+
width={1200}
99+
// $FlowIgnore
100+
>
101+
<div key="a" data-grid={{ x: 0, y: 0, w: 1, h: 2, static: true }}>
102+
a
103+
</div>
83104
{false}
84105
{null}
85-
<div key="c" data-grid={{x: 4, y: 0, w: 1, h: 2}}>c</div>
106+
<div key="c" data-grid={{ x: 4, y: 0, w: 1, h: 2 }}>
107+
c
108+
</div>
86109
</ReactGridLayout>
87110
);
88111

89112
expect(wrapper).toMatchSnapshot();
90113
expect(wrapper.state().layout).toHaveLength(2); // Only two truthy items
91114
});
92-
})
93-
115+
});
94116

95117
describe("WidthProvider", () => {
96118
it("Renders with WidthProvider", async function () {

0 commit comments

Comments
 (0)