Conversation
781032c to
4b70a76
Compare
8a60d1a to
7b2ae6b
Compare
d27c817 to
e760a1a
Compare
|
@goosewobbler think this looks good. just to be clear, this just puts the rules in place but doesnt run them or enforce anything yet? |
|
@mholtzman that's correct. The original plan was to merge fixes into this branch but I think smaller PRs is better. I just removed the pre-commit hook so we can merge this and see the output on running the lint script. The config changes a fair bit in #1346 but that's fine and I think that PR is close too, just need to resolve the noop and the other remaining issues which I listed here. We can then follow up with the other items in the TODO above as separate PRs, one by one. The rules will be enforced when we enable the pre-commit hook. |
Socket Security Pull Request Report👍 No new dependency issues detected in pull request Pull request report summary
Bot CommandsTo ignore an alert, reply with a comment starting with Ignoring: Powered by socket.dev |
|
@SocketSecurity ignore [email protected] |
mholtzman
left a comment
There was a problem hiding this comment.
this lgtm, just a couple minor nits
eslint.config.mjs
Outdated
| languageOptions: { | ||
| globals: { | ||
| ...globals.browser, | ||
| process: true, |
There was a problem hiding this comment.
do we want process to be available globally in all browser type files? seems like this might be a good case for one-of exceptions in individual files if we have any
There was a problem hiding this comment.
I think it's available everywhere in the renderer process though
https://www.electronjs.org/docs/latest/api/process#sandbox
There was a problem hiding this comment.
this isn't a global, it's Electron's process object which gets imported from the Electron library like import { process } from 'electron'
There was a problem hiding this comment.
I was sure that some renderer files have a global, anyway I'll try the exception route and put what I find here
There was a problem hiding this comment.
we must be doing something to inject this value somewhere, though I'm not sure where. when I try to print process.env to the console it shows undefined, but process.env.NODE_ENV shows "development". are we somehow mapping this?
There was a problem hiding this comment.
think it's due to bullet point #4 here: https://en.parceljs.org/env.html#%F0%9F%8C%B3-environment-variables
Co-authored-by: goosewobbler <[email protected]>
Follow-up to #1310 with reduced scope and improved config, cutting the number of issues by ~75%. Most issues to fix are things like unused vars. I believe this is a nice balance between fixing low-risk, low-hanging fruit and having a good base to build on - as we rewrite bits of Frame and convert more of the codebase to TS we can gradually enable more rules, remove exemptions and generally tighten things up.
Enabling ESLint in VS Code
Install the ESLint extension, switch it to the pre-release version (they are slow with official releases it seems) and add the following config to your
.vscode/settings.jsonin the Frame repo you want to lint:These config items shouldn't be required when ESLint v9 is released and when Eslint supports
eslint.config.mjs, see the following issues for context:eslint/eslint#16580
microsoft/vscode-eslint#1518
Config & Plugins
As per previous PR, but reduced.
@typescript-eslint/eslint-plugin- flags TS issues, especially around type safety (basic config used for now)eslint-plugin-jest- flags antipatterns in our tests (rules disabled for now)eslint-plugin-react- flags antipatterns in React usageeslint-plugin-react-hooks- flags misuse of hooks in Reacteslint-plugin-testing-library- flags issue & provides tips aroundtesting-libraryusage - all issues fixed by #1334Future work (tickets to be added to maintenance scope)
@typescript-eslint/recommended-requiring-type-checking(address issues - refactoring likely, requires stricter use of TS)eslint-plugin-react&eslint-plugin-react-hooksfor TSX (when we start using TS in renderer)eslint-plugin-import(imports - blocked by flat config support - tracked in [Feature Request] Support new ESLint flat config import-js/eslint-plugin-import#2556)eslint-plugin-comments(keeps track of eslint comment usage - abandoned, eventually will move to eslint-community org)eslint-plugin-n(node - lifeboat from abandonedeslint-plugin-node, eventually...maybe another year...will be unforked)eslint-plugin-promise(promises)eslint-plugin-jsx-a11y(jsx accessibility)eslint-plugin-security(node security)eslint-plugin-markdown(markdown, useful if we end up expanding our repo docs)eslint-plugin-sonarjs(bugs & suspicious patterns)eslint-plugin-unicorn(misc rules)TODO (* can be punted to a follow-up in order to reduce PR size)
.eslintrcsupport will be removed in Eslint v9).jsxextension in all files using it - Parcel should ensure this just works (tm)