-
Notifications
You must be signed in to change notification settings - Fork 573
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
chore upgrade ESLint to latest 8.x and migrate to Flat Config #2311
Conversation
3ca1e22
to
8f99fdc
Compare
}, | ||
}, | ||
|
||
rules: { |
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.
rules
are exactly the same as before, thankfully so this part of the config "upgrade" was a straightforward lift-and-shift ..
packages/client/src/client/App/Trades/TradesGrid/components/ComparatorSelect.tsx
Show resolved
Hide resolved
packages/client/src/client/App/Trades/TradesState/filterState/dateFilterState.ts
Show resolved
Hide resolved
(auto-deploy) A deployment has been created for this Pull Request Preview linksAs part of the code review process, please ensure that you test against the following
PerformancePlease ensure that this PR does not degrade the performance of the UI. We should maintain a performance score of 95+. |
packages/client/eslint.config.js
Outdated
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier", |
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.
does this make eslint play nice with prettier? Is this to be able to use prettier as the formatter in vscode?
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.
yeah, Ignacio did the detail work on this, but that's the idea - prettier for layout, lint for correctness - and I am 100% behind that decision / philosophy - there's a good article on the different ways you can go with this.
eslint-config-prettier
is the option for doing formatting separately (presume it just switches stuff off)
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.
now the extra config negating eslint rules no longer necessary, it seems, as stylistic rules have been deprecated in these recent versions of the linting packages .. happy days 🙂
bf897a5
to
d252a32
Compare
d252a32
to
df72dbe
Compare
df72dbe
to
6125019
Compare
"lint:cache": "npm run lint -- --cache", | ||
"_format": "prettier README.md \"src/**/*.{js,jsx,ts,tsx,json,md}\" \"e2e/**/*.ts\"", | ||
"_format": "prettier README.md src e2e", |
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.
same for prettier, less complicated .. just check everything that the tool understands
@@ -139,7 +140,7 @@ export const Tooltip = ({ svgRef }: { svgRef: RefObject<SVGSVGElement> }) => { | |||
svg.removeEventListener("pointermove", onMove) | |||
svg.removeEventListener("pointerleave", onLeave) | |||
} | |||
}, [svgRef]) | |||
}, [svgRef, tooltipDivRef]) |
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.
first of a handful of corrected hooks, with the new eslint plugin
? useCreditDealerById(acceptedDealerId) | ||
: undefined | ||
)?.name ?? "Unknown Dealer" | ||
const dealerName = useDealerNameById(acceptedDealerId) |
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.
significant change .. tidied this up properly this time, the hook/stream can deal with the missing dealer!
@@ -83,8 +83,4 @@ const ThemeStorageSwitch = ({ | |||
) | |||
} | |||
|
|||
ThemeStorageSwitch.defaultProps = { |
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.
wot? defaultProps? .. what decade are we in? 😁
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.
thanks to updated rules, this popped up ..
@@ -1,5 +1,4 @@ | |||
import { act, fireEvent, render, screen } from "@testing-library/react" | |||
import userEvent from "@testing-library/user-event" |
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.
simple unused var rule, now applied to tests, as it should be
@@ -141,7 +141,6 @@ function interopOverride( | |||
clientIdentity: OpenFin.ClientIdentity, | |||
) { | |||
// use accessor syntax for this.getClientState as it is not a public inherited method from InteropBroker | |||
// eslint-disable-next-line @typescript-eslint/dot-notation |
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.
briefly upgraded to eslint v9, and this showed up all the unused disable directives .. which was nice of it (I think you can do that with eslint config in < v9, as we won't be upgrading for a while, given the plugin ecosystem state ..
react, | ||
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks | ||
// compat with ESLint v9, see https://github.com/facebook/react/issues/28313 | ||
"react-hooks": hooks, |
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.
added hooks plugin .. not FlatConfig-ready, so cannot just add config as tseslint
above (this is the future model) ... just a few transgressions to fix
"simple-import-sort/exports": "error", | ||
|
||
// as hooks plugin does not play well with Flat Config right now, do this | ||
...hooks.configs.recommended.rules, |
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.
hooks - manually spread rules alongside our custom rules .. bit messy, but works
ESLint:
npx @eslint/migrate-config .eslintrc.yml
)Prettier