Skip to content
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

feat(eslint-plugin): add meta.docs.recommended setting for strict config options #8364

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented Feb 4, 2024

PR Checklist

Overview

The gist of the changes are in the first two commits:

  • 43943d2: Pipes through a TOptions through meta.docs's RuleMetaDataDocs type to allow a RuleRecommendationAcrossConfigs interface.
  • daa3513: Updates the generate:configs script to handle those options

Note that this is not a breaking change:

  • Existing values for meta.docs.recommended will still work, as the type is now a more permissive union
  • strict* configs explicitly indicate they can be modified as non-breaking changes

Sending as reference for triaging #7318.

@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.

Copy link

netlify bot commented Feb 4, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 0e8aafa
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/65f6e0fbe3b73a00085fe80c
😎 Deploy Preview https://deploy-preview-8364--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 96 (🟢 up 3 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.23%. Comparing base (994812b) to head (0e8aafa).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8364      +/-   ##
==========================================
- Coverage   88.02%   87.23%   -0.79%     
==========================================
  Files         401      251     -150     
  Lines       13934    12334    -1600     
  Branches     4087     3881     -206     
==========================================
- Hits        12265    10760    -1505     
+ Misses       1370     1305      -65     
+ Partials      299      269      -30     
Flag Coverage Δ
unittest 87.23% <ø> (-0.79%) ⬇️

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

Files Coverage Δ
packages/eslint-plugin/src/rules/ban-ts-comment.ts 97.29% <ø> (ø)
...es/eslint-plugin/src/rules/no-floating-promises.ts 100.00% <ø> (ø)
.../eslint-plugin/src/rules/restrict-plus-operands.ts 100.00% <ø> (ø)
...-plugin/src/rules/restrict-template-expressions.ts 100.00% <ø> (ø)
packages/utils/src/eslint-utils/RuleCreator.ts 75.00% <ø> (ø)

... and 150 files with indirect coverage changes

@JoshuaKGoldberg
Copy link
Member Author

I don't know why linting is failing in Nx Cloud but not for me locally. From https://github.com/typescript-eslint/typescript-eslint/actions/runs/8159357644/job/22303718471?pr=8364:

❌ > nx run eslint-plugin-internal:lint
  
  
  Linting "eslint-plugin-internal"...
  
   >  NX   _
  
     Occurred while linting /home/runner/work/typescript-eslint/typescript-eslint/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts:12
     Rule: "@typescript-eslint/internal/plugin-test-formatting"
  
  AtomicsWaitError: _
  Occurred while linting /home/runner/work/typescript-eslint/typescript-eslint/packages/eslint-plugin-internal/tests/rules/no-typescript-estree.test.ts:12
  Rule: "@typescript-eslint/internal/plugin-test-formatting"
      at _Lock.lock (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/make-synchronized/index.cjs:128:11)
      at request (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/make-synchronized/index.cjs:161:8)
      at #sendActionToWorker (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/make-synchronized/index.cjs:218:61)
      at ThreadsWorker.sendAction (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/make-synchronized/index.cjs:177:36)
      at _Synchronizer.apply (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/make-synchronized/index.cjs:297:25)
      at Module.<anonymous> (/home/runner/work/typescript-eslint/typescript-eslint/node_modules/make-synchronized/index.cjs:303:40)
      at prettierFormat (/home/runner/work/typescript-eslint/typescript-eslint/packages/eslint-plugin-internal/dist/rules/plugin-test-formatting.js:127:22)
      at checkLiteral (/home/runner/work/typescript-eslint/typescript-eslint/packages/eslint-plugin-internal/dist/rules/plugin-test-formatting.js:177:32)
      at checkExpression (/home/runner/work/typescript-eslint/typescript-eslint/packages/eslint-plugin-internal/dist/rules/plugin-test-formatting.js:162:21)
      at checkValidTest (/home/runner/work/typescript-eslint/typescript-eslint/packages/eslint-plugin-internal/dist/rules/plugin-test-formatting.js:[364](https://github.com/typescript-eslint/typescript-eslint/actions/runs/8159357644/job/22303718471?pr=8364#step:5:399):25)
 >  NX   Nx Cloud: Cache miss 6517040724990785659.

cc @JamesHenry

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review March 5, 2024 16:32
@bradzacher
Copy link
Member

@JoshuaKGoldberg thats the same intermittent thing I mentioned on discord the other day. It's something to do with the combination of nx + @prettier/sync, I think?

@JoshuaKGoldberg
Copy link
Member Author

That sounds plausible to me!

bradzacher
bradzacher previously approved these changes Mar 16, 2024
Comment on lines +11 to +16
export interface RuleRecommendationAcrossConfigs<
Options extends readonly unknown[],
> {
recommended: true;
strict: Partial<Options>;
}
Copy link
Member

Choose a reason for hiding this comment

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

🤔 Part of me doesn't like that we're leaking our internal documentation implementation details into our public types.

I wonder if there's a way for us to privatise these types to avoid leaking them to users?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would be nice. I don't know though 😞 and it's already there.

Copy link
Member Author

Choose a reason for hiding this comment

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

Filed #8695.

@bradzacher bradzacher added the 1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready label Mar 16, 2024
allowAny: false,
allowBoolean: false,
allowNullish: false,
allowNumber: false,
Copy link
Contributor

@llllvvuu llllvvuu Mar 19, 2024

Choose a reason for hiding this comment

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

Is allowNumber: false intended? If so, should this doc be updated?

This rule reports on values used in a template literal string that aren't strings, numbers, or BigInts, optionally allowing other data types that provide useful stringification results.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you think there's a small typo in the docs like that, we'd welcome a PR :) thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval PR that a maintainer has LGTM'd - any maintainer can merge this when ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configs: Allow strict configs to have more strict options than recommended?
3 participants