Skip to content

Commit f466c8c

Browse files
committed
Update ESLint configs and fix warnings/errors
1 parent 7a9170d commit f466c8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+436
-290
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/packages/*/cjs/*.js
2+
/packages/*/esm/*.js
3+
/packages/*/umd/*.js
4+
/website

.eslintrc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"parser": "babel-eslint",
3-
"env": {
4-
"node": true
5-
},
6-
"extends": [
7-
"eslint:recommended"
8-
]
2+
extends: ["react-app"],
3+
rules: {
4+
"import/first": 0
5+
}
96
}

package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"scripts": {
55
"build": "node ./scripts/build.js",
66
"clean": "git clean -e '!/website-deploy-key' -e '!/website-deploy-key.pub' -fdX .",
7+
"lint": "eslint .",
78
"start": "node ./scripts/start.js",
89
"test": "jest --projects ./packages/*/"
910
},
@@ -13,12 +14,18 @@
1314
"@babel/plugin-transform-runtime": "^7.5.5",
1415
"@babel/preset-env": "^7.5.5",
1516
"@babel/preset-react": "^7.0.0",
16-
"babel-eslint": "^10.0.3",
17+
"@typescript-eslint/eslint-plugin": "2.x",
18+
"@typescript-eslint/parser": "2.x",
19+
"babel-eslint": "10.x",
1720
"babel-jest": "^24.9.0",
1821
"babel-plugin-dev-expression": "^0.2.2",
19-
"eslint": "^6.3.0",
20-
"eslint-plugin-import": "^2.18.2",
21-
"eslint-plugin-react": "^7.14.3",
22+
"eslint": "6.x",
23+
"eslint-config-react-app": "^5.0.2",
24+
"eslint-plugin-flowtype": "3.x",
25+
"eslint-plugin-import": "2.x",
26+
"eslint-plugin-jsx-a11y": "6.x",
27+
"eslint-plugin-react": "7.x",
28+
"eslint-plugin-react-hooks": "1.x",
2229
"history": "^4.9.0",
2330
"jest": "^24.9.0",
2431
"jest-circus": "^24.9.0",
Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
{
2-
"parser": "babel-eslint",
3-
"env": {
4-
"browser": true,
5-
"node": true
2+
env: {
3+
browser: true,
4+
commonjs: true
65
},
7-
"plugins": ["import", "react"],
8-
"extends": [
9-
"eslint:recommended",
10-
"plugin:import/errors",
11-
"plugin:react/recommended"
12-
],
13-
"rules": {
14-
"prefer-arrow-callback": 2,
15-
"react/display-name": 0
16-
},
17-
"settings": {
18-
"react": {
19-
"version": "15"
20-
}
6+
rules: {
7+
strict: 0
218
}
229
}

packages/react-router-config/es/matchRoutes.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict";
2-
31
import warnAboutDeprecatedESMImport from "./warnAboutDeprecatedESMImport.js";
42
warnAboutDeprecatedESMImport("matchRoutes");
53

packages/react-router-config/es/renderRoutes.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict";
2-
31
import warnAboutDeprecatedESMImport from "./warnAboutDeprecatedESMImport.js";
42
warnAboutDeprecatedESMImport("renderRoutes");
53

packages/react-router-config/es/warnAboutDeprecatedESMImport.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"use strict";
2-
1+
/* eslint-disable prefer-arrow-callback, no-empty */
32
var printWarning = function() {};
43

54
if (process.env.NODE_ENV !== "production") {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
env: {
3+
commonjs: false
4+
},
5+
rules: {
6+
strict: 2
7+
}
8+
}
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"env": {
3-
"jest": true
2+
env: {
3+
jest: true
44
},
5-
"rules": {
6-
"import/no-unresolved": [2, { "ignore": ["react-router", "react-router-config"] }],
7-
"react/display-name": 0,
8-
"react/prop-types": 0
5+
rules: {
6+
"no-console": 0
97
}
108
}

packages/react-router-config/modules/__tests__/integration-test.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ describe("integration", () => {
88
it("generates the same matches in renderRoutes and matchRoutes", () => {
99
const rendered = [];
1010

11-
const Comp = ({ match, route: { routes } }) => (
12-
rendered.push(match), renderRoutes(routes)
13-
);
11+
function Comp({ match, route: { routes } }) {
12+
rendered.push(match);
13+
return renderRoutes(routes);
14+
}
1415

1516
const routes = [
1617
{
@@ -60,9 +61,10 @@ describe("integration", () => {
6061
it("generates the same matches in renderRoutes and matchRoutes with pathless routes", () => {
6162
const rendered = [];
6263

63-
const Comp = ({ match, route: { routes } }) => (
64-
rendered.push(match), renderRoutes(routes)
65-
);
64+
function Comp({ match, route: { routes } }) {
65+
rendered.push(match);
66+
return renderRoutes(routes);
67+
}
6668

6769
const routes = [
6870
{
@@ -110,9 +112,10 @@ describe("integration", () => {
110112
it("generates the same matches in renderRoutes and matchRoutes with routes using exact", () => {
111113
const rendered = [];
112114

113-
const Comp = ({ match, route: { routes } }) => (
114-
rendered.push(match), renderRoutes(routes)
115-
);
115+
function Comp({ match, route: { routes } }) {
116+
rendered.push(match);
117+
return renderRoutes(routes);
118+
}
116119

117120
const routes = [
118121
// should skip
@@ -144,9 +147,10 @@ describe("integration", () => {
144147
it("generates the same matches in renderRoutes and matchRoutes with routes using exact + strict", () => {
145148
const rendered = [];
146149

147-
const Comp = ({ match, route: { routes } }) => (
148-
rendered.push(match), renderRoutes(routes)
149-
);
150+
function Comp({ match, route: { routes } }) {
151+
rendered.push(match);
152+
return renderRoutes(routes);
153+
}
150154

151155
const routes = [
152156
// should match

0 commit comments

Comments
 (0)