Skip to content

Commit 9223526

Browse files
authored
Merge pull request react-grid-layout#1633 from react-grid-layout/chore/deps-lint
Update devDependencies and add PR lint action
2 parents f43802a + 42a5cab commit 9223526

File tree

6 files changed

+1186
-999
lines changed

6 files changed

+1186
-999
lines changed

.eslintrc.json

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,36 @@
33
"parser": "@babel/eslint-parser",
44
"plugins": [
55
"react",
6-
"flowtype"
6+
"flowtype",
7+
"unicorn"
78
],
89
"extends": [
910
"eslint:recommended",
1011
"plugin:react/recommended",
1112
"plugin:flowtype/recommended"
1213
],
1314
"rules": {
14-
"no-console": 0,
15-
"no-use-before-define": [2, "nofunc"],
16-
"no-unused-vars": [1, {
17-
"argsIgnorePattern": "^(e|_.*)$",
18-
"vars": "local",
19-
"varsIgnorePattern": "(debug|^_)"
20-
}],
21-
"prefer-const": 2,
22-
"react/jsx-boolean-value": [2, "always"]
15+
"no-console": "off",
16+
"no-use-before-define": [
17+
"error",
18+
"nofunc"
19+
],
20+
"no-unused-vars": [
21+
"warn",
22+
{
23+
"argsIgnorePattern": "^(e|_.*)$",
24+
"vars": "local",
25+
"varsIgnorePattern": "(debug|^_)"
26+
}
27+
],
28+
"prefer-const": "error",
29+
"react/jsx-boolean-value": [
30+
"error",
31+
"always"
32+
],
33+
"unicorn/better-regex": "warn",
34+
"unicorn/expiring-todo-comments": "error",
35+
"unicorn/no-abusive-eslint-disable": "error"
2336
},
2437
"env": {
2538
"browser": true,
@@ -31,4 +44,4 @@
3144
"version": "detect"
3245
}
3346
}
34-
}
47+
}

.github/workflows/lint.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint
2+
3+
on:
4+
# Trigger the workflow on push or pull request,
5+
# but only for the main branch
6+
push:
7+
branches:
8+
- main
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
run-linters:
15+
name: Run linters
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Check out Git repository
20+
uses: actions/checkout@v2
21+
22+
- name: Set up Node.js
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: 14
26+
27+
- name: Install Node.js dependencies
28+
run: yarn
29+
30+
- name: Run linters
31+
uses: wearerequired/lint-action@v1
32+
with:
33+
eslint: true
34+
35+
# Flow is not supported by lint-action, so we run it raw
36+
- name: Run Flow
37+
run: yarn flow

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ export function synchronizeLayoutWithChildren(
705705
} else {
706706
if (!isProduction && child.props._grid) {
707707
console.warn(
708-
"`_grid` properties on children have been deprecated as of React 15.2. " + // eslint-disable-line
708+
"`_grid` properties on children have been deprecated as of React 15.2. " +
709709
"Please use `data-grid` or add your properties directly to the `layout`."
710710
);
711711
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"eslint-plugin-flowtype": "^5.9.0",
6565
"eslint-plugin-mocha": "^9.0.0",
6666
"eslint-plugin-react": "^7.24.0",
67+
"eslint-plugin-unicorn": "^39.0.0",
6768
"exports-loader": "^3.0.0",
6869
"flow-bin": "^0.158.0",
6970
"husky": "^7.0.2",

test/spec/utils-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe("validateLayout", () => {
8080
// $FlowFixMe: dynamic check
8181
{ i: "2", x: 1, y: 2, w: 1 }
8282
]);
83-
}).toThrowError(/layout\[1\]\.h must be a number!/i);
83+
}).toThrowError(/layout\[1]\.h must be a number!/i);
8484
});
8585
});
8686

0 commit comments

Comments
 (0)