Skip to content

chore: enable jsx-a11y, react, and react-hooks ESLint plugins internally #4197

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

Merged
merged 6 commits into from
Nov 28, 2021

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Nov 21, 2021

PR Checklist

Overview

Adds some linting rules that'll help catch things with the more advanced website contents.

Also fixes #4200 by necessity.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @JoshuaKGoldberg!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. As a thank you, your profile/company logo will be added to our main README which receives thousands of unique visitors per day.

@netlify
Copy link

netlify bot commented Nov 21, 2021

✔️ Deploy Preview for typescript-eslint ready!

🔨 Explore the source changes: 34a2aee

🔍 Inspect the deploy log: https://app.netlify.com/sites/typescript-eslint/deploys/61a12e403155a70007c5cec5

😎 Browse the preview: https://deploy-preview-4197--typescript-eslint.netlify.app

@codecov
Copy link

codecov bot commented Nov 21, 2021

Codecov Report

Merging #4197 (34a2aee) into main (2e2ff5d) will decrease coverage by 0.02%.
The diff coverage is 68.75%.

@@            Coverage Diff             @@
##             main    #4197      +/-   ##
==========================================
- Coverage   92.76%   92.73%   -0.03%     
==========================================
  Files         332      335       +3     
  Lines       11524    11541      +17     
  Branches     3285     3288       +3     
==========================================
+ Hits        10690    10703      +13     
- Misses        361      364       +3     
- Partials      473      474       +1     
Flag Coverage Δ
unittest 92.73% <68.75%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/eslint-plugin/src/rules/prefer-for-of.ts 90.00% <ø> (ø)
packages/scope-manager/src/scope/ScopeBase.ts 91.01% <ø> (ø)
packages/scope-manager/src/ScopeManager.ts 74.39% <33.33%> (-1.56%) ⬇️
...es/eslint-plugin/src/rules/no-duplicate-imports.ts 95.34% <50.00%> (-0.21%) ⬇️
packages/eslint-plugin/src/rules/array-type.ts 97.18% <75.00%> (-1.33%) ⬇️
...s/scope-manager/src/scope/ClassStaticBlockScope.ts 75.00% <75.00%> (ø)
packages/eslint-plugin/src/rules/ban-types.ts 100.00% <100.00%> (ø)
...experimental-utils/src/eslint-utils/RuleCreator.ts 80.00% <100.00%> (ø)
packages/scope-manager/src/scope/ScopeType.ts 100.00% <100.00%> (ø)
packages/visitor-keys/src/visitor-keys.ts 100.00% <0.00%> (ø)
... and 1 more

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as draft November 21, 2021 16:56
@JoshuaKGoldberg
Copy link
Member Author

Fun, we're starting to run out of memory in CI:

$ eslint . --ext .js,.jsx,.ts,.tsx
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I can confirm locally errors do get logged for the website with the introduced plugins:

C:\Code\win\typescript-eslint\packages\website\src\pages\index.tsx
  113:5   error  React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render
       react-hooks/rules-of-hooks
  115:9   error  Unexpected console statement
       no-console

@JoshuaKGoldberg
Copy link
Member Author

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review November 21, 2021 17:54
@armano2
Copy link
Collaborator

armano2 commented Nov 22, 2021

q: maybe its a good time to split up linting and updating this command to?

"lint": "nx run-many --target=lint --all",

@@ -126,8 +126,6 @@ function Sponsors(props: {
title: string;
className?: string;
}): JSX.Element {
// TODO this seems like a ts-eslint problem: JSON types are not resolved
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is... interesting. Didn't test it locally, but is that basically just because we used a local ESLint config instead of the global one? Is this actually a valid bug though that we can't resolve JSON types?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I haven't dug in too deep. It's better now 🤷

It would be nice to know but I don't quite have the time to poke too closely, heh.

@bradzacher bradzacher added the repo maintenance things to do with maintenance of the repo, and not with code/docs label Nov 23, 2021
@bradzacher
Copy link
Member

The "proper" fix would be to add a .eslintrc.js to each package which lists parserOptions.project pointing at the package's tsconfig, then using eg nx to run each package in isolation.

If we had a better CLI - we could split it up automatically #4183 😛

Increasing memory limit is a good way to work around this for now.

@JoshuaKGoldberg
Copy link
Member Author

I've got a lot of things in the air this week so I'll just merge this for now & file a followup issue for the lint splitups.

@bradzacher bradzacher disabled auto-merge November 28, 2021 17:45
@bradzacher
Copy link
Member

automerge unfortunately requires all signals pass AND the branch is up to date it's a really finicky feature tbh.
esp with how flaky codecov can be. sadface

@bradzacher bradzacher merged commit 4a5380d into typescript-eslint:main Nov 28, 2021
@JoshuaKGoldberg JoshuaKGoldberg deleted the lint-jsx-react branch November 28, 2021 17:54
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
repo maintenance things to do with maintenance of the repo, and not with code/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running out of memory in repo CI lint tasks
4 participants