Skip to content

Commit

Permalink
WIP ESLint React rules
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Apr 3, 2019
1 parent 825126d commit 6783c16
Show file tree
Hide file tree
Showing 9 changed files with 498 additions and 419 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -35,6 +35,7 @@
"eslint-plugin-eslint-comments": "^3.1.1",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-jest": "^22.4.1",
"eslint-plugin-jsx-a11y": "^6.2.1",
"eslint-plugin-react": "^7.12.4",
"jest": "^23.6.0",
"prop-types": "^15.7.2",
Expand Down
6 changes: 5 additions & 1 deletion test/.eslintrc.js
Expand Up @@ -4,5 +4,9 @@ module.exports = {
extends: [
'@overlookmotel/eslint-config-jest',
'@overlookmotel/eslint-config-react'
]
],
rules: {
'react/no-multi-comp': ['off'],
'react/jsx-filename-extension': ['error', {extensions: ['.jsx', '.test.js']}]
}
};
48 changes: 24 additions & 24 deletions test/context.test.js
Expand Up @@ -77,7 +77,7 @@ function tests(makeContext) {
itRenders('single boundary', async ({render}) => {
const e = (
<Provider value="val">
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<Consumer>{ctx => ctx}</Consumer>
</Suspense>
</Provider>
Expand All @@ -90,9 +90,9 @@ function tests(makeContext) {
itRenders('multiple boundaries', async ({render}) => {
const e = (
<Provider value="val">
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<Suspense fallback={<Fallback />}>
<Suspense fallback={<Fallback />}>
<Consumer>{ctx => ctx}</Consumer>
</Suspense>
</Suspense>
Expand All @@ -119,7 +119,7 @@ function tests(makeContext) {
<Provider value="val">
<Provider2 value="val2">
<Provider3 value="val3">
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<div><Consumer>{ctx => ctx}</Consumer></div>
<div><Consumer2>{ctx => ctx}</Consumer2></div>
<div><Consumer3>{ctx => ctx}</Consumer3></div>
Expand All @@ -146,9 +146,9 @@ function tests(makeContext) {
<Provider value="val">
<Provider2 value="val2">
<Provider3 value="val3">
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<Suspense fallback={<Fallback />}>
<Suspense fallback={<Fallback />}>
<div><Consumer>{ctx => ctx}</Consumer></div>
<div><Consumer2>{ctx => ctx}</Consumer2></div>
<div><Consumer3>{ctx => ctx}</Consumer3></div>
Expand Down Expand Up @@ -178,15 +178,15 @@ function tests(makeContext) {
let Lazy, Lazy2, Lazy3;
beforeEach(() => {
Lazy = lazy(() => <Consumer>{ctx => ctx}</Consumer>);
Lazy2 = lazy(() => <Lazy/>);
Lazy3 = lazy(() => <Lazy2/>);
Lazy2 = lazy(() => <Lazy />);
Lazy3 = lazy(() => <Lazy2 />);
});

itRenders('single lazy component', async ({render}) => {
const e = (
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<Provider value="val">
<Lazy/>
<Lazy />
</Provider>
</Suspense>
);
Expand All @@ -197,9 +197,9 @@ function tests(makeContext) {

itRenders('multiple lazy components', async ({render}) => {
const e = (
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<Provider value="val">
<Lazy3/>
<Lazy3 />
</Provider>
</Suspense>
);
Expand All @@ -224,18 +224,18 @@ function tests(makeContext) {
<div><Consumer3>{ctx => ctx}</Consumer3></div>
</div>
));
Lazy2 = lazy(() => <Lazy/>);
Lazy3 = lazy(() => <Lazy2/>);
Lazy2 = lazy(() => <Lazy />);
Lazy3 = lazy(() => <Lazy2 />);
});

itRenders('single lazy component', async ({render, openTag}) => {
const e = (
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<div>
<Provider value="val">
<Provider2 value="val2">
<Provider3 value="val3">
<Lazy/>
<Lazy />
</Provider3>
</Provider2>
</Provider>
Expand All @@ -257,12 +257,12 @@ function tests(makeContext) {

itRenders('multiple lazy components', async ({render, openTag}) => {
const e = (
<Suspense fallback={<Fallback/>}>
<Suspense fallback={<Fallback />}>
<div>
<Provider value="val">
<Provider2 value="val2">
<Provider3 value="val3">
<Lazy3/>
<Lazy3 />
</Provider3>
</Provider2>
</Provider>
Expand Down Expand Up @@ -300,7 +300,7 @@ function tests(makeContext) {
const e = (
<Provider value="val">
<Suspense fallback={fallback}>
<Lazy/>
<Lazy />
</Suspense>
</Provider>
);
Expand All @@ -314,7 +314,7 @@ function tests(makeContext) {
<Provider value="val">
<Suspense fallback={fallback}>
<Provider value="valx">
<Lazy/>
<Lazy />
</Provider>
</Suspense>
</Provider>
Expand Down Expand Up @@ -349,7 +349,7 @@ function tests(makeContext) {
<Provider2 value="val2">
<Provider3 value="val3">
<Suspense fallback={fallback}>
<Lazy/>
<Lazy />
</Suspense>
</Provider3>
</Provider2>
Expand Down Expand Up @@ -379,7 +379,7 @@ function tests(makeContext) {
<Provider value="valx">
<Provider2 value="val2x">
<Provider3 value="val3x">
<Lazy/>
<Lazy />
</Provider3>
</Provider2>
</Provider>
Expand Down

0 comments on commit 6783c16

Please sign in to comment.