-
Notifications
You must be signed in to change notification settings - Fork 6
Feature 2232 eslint integration #2235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import globals from "globals"; | ||
| import reactHooksPlugin from "eslint-plugin-react-hooks"; | ||
| import reactPlugin from "eslint-plugin-react"; | ||
| import vitestPlugin from "eslint-plugin-vitest"; | ||
|
|
||
| export default [ | ||
| { | ||
| files: ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| ecmaFeatures: { | ||
| jsx: true | ||
| } | ||
| }, | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| ...vitestPlugin.environments.env.globals, | ||
| HttpResponse: false, | ||
| snapshot: false, | ||
| waitForSnapshot: false, | ||
| } | ||
| }, | ||
| plugins: { | ||
| react: reactPlugin, | ||
| 'react-hooks': reactHooksPlugin, | ||
| vitest: vitestPlugin | ||
| }, | ||
| rules: { | ||
| // Override default rules here. | ||
| 'react-hooks/exhaustive-deps': 'warn', | ||
| ...vitestPlugin.configs.recommended.rules, | ||
| 'vitest/expect-expect': 'off', | ||
| } | ||
| } | ||
| ]; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,7 +51,8 @@ | |
| "build-storybook": "storybook build", | ||
| "build": "vite build", | ||
| "coverage": "vitest run --coverage --watch=false", | ||
| "format": "prettier --write 'src/**/*.{css,html,js,jsx}'", | ||
| "format": "prettier --write 'src/**/*.{css,html,js,jsx,ts,tsx}'", | ||
| "lint": "eslint --fix --quiet", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New script to run ESLint. |
||
| "serve": "vite preview", | ||
| "start": "vite", | ||
| "storybook": "storybook dev -p 6006", | ||
|
|
@@ -85,6 +86,11 @@ | |
| "@testing-library/user-event": "^14.5.2", | ||
| "@vitejs/plugin-react-swc": "^3.6.0", | ||
| "@vitest/coverage-v8": "^1.4.0", | ||
| "eslint": "^9.1.1", | ||
| "eslint-plugin-react": "^7.34.1", | ||
| "eslint-plugin-react-hooks": "^4.6.0", | ||
| "eslint-plugin-vitest": "^0.5.4", | ||
| "globals": "^15.0.0", | ||
| "happy-dom": "^14.3.9", | ||
| "jest-fetch-mock": "^3.0.3", | ||
| "jsdom": "^24.0.0", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -364,9 +364,9 @@ const ReviewPeriods = ({ onPeriodSelected, mode }) => { | |
| ) : periods.length > 0 ? ( | ||
| periods | ||
| .sort((a, b) => { | ||
| return !!a.open === !!b.open | ||
| return Boolean(a.open) === Boolean(b.open) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint likes this better. |
||
| ? ('' + a.name).localeCompare(b.name) | ||
| : !!a.open | ||
| : Boolean(a.open) | ||
| ? -1 | ||
| : 1; | ||
| }) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,41 +2,35 @@ import React from 'react'; | |
| import renderer from 'react-test-renderer'; | ||
| import SkeletonLoader from './SkeletonLoader'; | ||
|
|
||
| it("renders correctly when 'team' is passed as prop ", () => { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint removed the extra space at the ends of these description strings. |
||
| it("renders correctly when 'team' is passed as prop", () => { | ||
| const component = renderer.create(<SkeletonLoader type="team" />); | ||
| expect(component.toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it("renders correctly when 'guild' is passed as prop ", () => { | ||
| it("renders correctly when 'guild' is passed as prop", () => { | ||
| const component = renderer.create(<SkeletonLoader type="guild" />); | ||
| expect(component.toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it("renders correctly when 'people' is passed as prop ", () => { | ||
| it("renders correctly when 'people' is passed as prop", () => { | ||
| const component = renderer.create(<SkeletonLoader type="people" />); | ||
| expect(component.toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it("renders correctly when 'feedback_requests' is passed as prop ", () => { | ||
| it("renders correctly when 'feedback_requests' is passed as prop", () => { | ||
| const component = renderer.create( | ||
| <SkeletonLoader type="feedback_requests" /> | ||
| ); | ||
| expect(component.toJSON()).toMatchSnapshot(); | ||
| }); | ||
|
|
||
| it("renders correctly when 'feedback_requests' is passed as prop ", () => { | ||
| it("renders correctly when 'received_requests' is passed as prop", () => { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous description string was repeated several times. |
||
| const component = renderer.create( | ||
| <SkeletonLoader type="received_requests" /> | ||
| ); | ||
| expect(component.toJSON()).toMatchSnapshot(); | ||
| }); | ||
| it("renders correctly when 'feedback_requests' is passed as prop ", () => { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a duplicate test. |
||
| const component = renderer.create( | ||
| <SkeletonLoader type="received_requests" /> | ||
| ); | ||
| expect(component.toJSON()).toMatchSnapshot(); | ||
| }); | ||
| it("renders correctly when 'feedback_requests' is passed as prop ", () => { | ||
| it("renders correctly when 'view_feedback_requests' is passed as prop", () => { | ||
| const component = renderer.create( | ||
| <SkeletonLoader type="view_feedback_responses" /> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
|
||
| exports[`renders correctly when 'feedback_requests' is passed as prop 1`] = ` | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This snapshot file was updated to match the test updates. |
||
| exports[`renders correctly when 'feedback_requests' is passed as prop 1`] = ` | ||
| <div | ||
| className="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root css-12qqhfb-MuiPaper-root-MuiCard-root" | ||
| style={ | ||
|
|
@@ -103,78 +103,7 @@ exports[`renders correctly when 'feedback_requests' is passed as prop 1`] = ` | |
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'feedback_requests' is passed as prop 2`] = ` | ||
| <div | ||
| className="MuiBox-root css-1lads1q" | ||
| > | ||
| <span | ||
| className="MuiSkeleton-root MuiSkeleton-rectangular MuiSkeleton-pulse css-153n0d3-MuiSkeleton-root" | ||
| style={ | ||
| { | ||
| "height": "2.7rem", | ||
| "width": "100%", | ||
| } | ||
| } | ||
| /> | ||
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'feedback_requests' is passed as prop 3`] = ` | ||
| <div | ||
| className="MuiBox-root css-1lads1q" | ||
| > | ||
| <span | ||
| className="MuiSkeleton-root MuiSkeleton-rectangular MuiSkeleton-pulse css-153n0d3-MuiSkeleton-root" | ||
| style={ | ||
| { | ||
| "height": "2.7rem", | ||
| "width": "100%", | ||
| } | ||
| } | ||
| /> | ||
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'feedback_requests' is passed as prop 4`] = ` | ||
| <div | ||
| className="MuiBox-root css-0" | ||
| > | ||
| <span | ||
| className="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse makeStyles-smallMargin-2 css-1e1x4vv-MuiSkeleton-root" | ||
| style={ | ||
| { | ||
| "height": 40, | ||
| "marginBottom": "1em", | ||
| "width": "50vw", | ||
| } | ||
| } | ||
| /> | ||
| <div | ||
| className="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root css-12qqhfb-MuiPaper-root-MuiCard-root" | ||
| width={100} | ||
| > | ||
| <div | ||
| className="MuiCardContent-root makeStyles-noTopBottomPadding-1 css-46bh2p-MuiCardContent-root" | ||
| > | ||
| <div | ||
| className="MuiBox-root css-1lads1q" | ||
| > | ||
| <span | ||
| className="MuiSkeleton-root MuiSkeleton-rectangular MuiSkeleton-pulse css-153n0d3-MuiSkeleton-root" | ||
| style={ | ||
| { | ||
| "height": "8vh", | ||
| "width": "100%", | ||
| } | ||
| } | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'guild' is passed as prop 1`] = ` | ||
| exports[`renders correctly when 'guild' is passed as prop 1`] = ` | ||
| <div | ||
| className="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root SkeletonLoader-card css-12qqhfb-MuiPaper-root-MuiCard-root" | ||
| > | ||
|
|
@@ -249,7 +178,7 @@ exports[`renders correctly when 'guild' is passed as prop 1`] = ` | |
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'people' is passed as prop 1`] = ` | ||
| exports[`renders correctly when 'people' is passed as prop 1`] = ` | ||
| <div | ||
| className="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root SkeletonLoader-card css-12qqhfb-MuiPaper-root-MuiCard-root" | ||
| > | ||
|
|
@@ -312,7 +241,23 @@ exports[`renders correctly when 'people' is passed as prop 1`] = ` | |
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'team' is passed as prop 1`] = ` | ||
| exports[`renders correctly when 'received_requests' is passed as prop 1`] = ` | ||
| <div | ||
| className="MuiBox-root css-1lads1q" | ||
| > | ||
| <span | ||
| className="MuiSkeleton-root MuiSkeleton-rectangular MuiSkeleton-pulse css-153n0d3-MuiSkeleton-root" | ||
| style={ | ||
| { | ||
| "height": "2.7rem", | ||
| "width": "100%", | ||
| } | ||
| } | ||
| /> | ||
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'team' is passed as prop 1`] = ` | ||
| <div | ||
| className="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root SkeletonLoader-card css-12qqhfb-MuiPaper-root-MuiCard-root" | ||
| > | ||
|
|
@@ -386,3 +331,42 @@ exports[`renders correctly when 'team' is passed as prop 1`] = ` | |
| </div> | ||
| </div> | ||
| `; | ||
|
|
||
| exports[`renders correctly when 'view_feedback_requests' is passed as prop 1`] = ` | ||
| <div | ||
| className="MuiBox-root css-0" | ||
| > | ||
| <span | ||
| className="MuiSkeleton-root MuiSkeleton-text MuiSkeleton-pulse makeStyles-smallMargin-2 css-1e1x4vv-MuiSkeleton-root" | ||
| style={ | ||
| { | ||
| "height": 40, | ||
| "marginBottom": "1em", | ||
| "width": "50vw", | ||
| } | ||
| } | ||
| /> | ||
| <div | ||
| className="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation1 MuiCard-root css-12qqhfb-MuiPaper-root-MuiCard-root" | ||
| width={100} | ||
| > | ||
| <div | ||
| className="MuiCardContent-root makeStyles-noTopBottomPadding-1 css-46bh2p-MuiCardContent-root" | ||
| > | ||
| <div | ||
| className="MuiBox-root css-1lads1q" | ||
| > | ||
| <span | ||
| className="MuiSkeleton-root MuiSkeleton-rectangular MuiSkeleton-pulse css-153n0d3-MuiSkeleton-root" | ||
| style={ | ||
| { | ||
| "height": "8vh", | ||
| "width": "100%", | ||
| } | ||
| } | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| `; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took a few hours to arrive at this config!