Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(eslint-plugin): [max-params] don't countthis: void parameter#7696

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@StyleShit
Copy link
Contributor

Closes#7538

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@StyleShit!

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 onhttps://opencollective.com/typescript-eslint.

@netlify
Copy link

netlifybot commentedSep 27, 2023
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commitb69113a
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/652e90e056d41c00087fcaed
😎 Deploy Previewhttps://deploy-preview-7696--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 1 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 yourNetlify site configuration.

@nx-cloud
Copy link

nx-cloudbot commentedSep 27, 2023
edited
Loading

☁️ Nx Cloud Report

CI is running/has finished running commands for commitb69113a. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 19 targets

Sent with 💌 fromNxCloud.

Comment on lines 19 to 37
const schema = [
{
type: 'object',
properties: {
maximum: {
type: 'integer',
minimum: 0,
},
max: {
type: 'integer',
minimum: 0,
},
countVoidThis: {
type: 'boolean',
},
},
additionalProperties: false,
},
] as JSONSchema4[];
Copy link
ContributorAuthor

@StyleShitStyleShitSep 27, 2023
edited
Loading

Choose a reason for hiding this comment

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

for some reason, I can't getdeepMerge to work properly here.

I've tried adding these lines to add support for array overrides, but I'm not sure why it doesn't work:

 if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) {   // object type   acc[key] = deepMerge(firstValue, secondValue);+ } else if (Array.isArray(firstValue)) {+   // array type+   acc[key] = Object.values(+     deepMerge({ ...firstValue }, { ...(secondValue as ObjectLike) }),+   );  } else {   // value type   acc[key] = secondValue; }

seems to work fine when isolated though:
https://tsplay.dev/wX1GLN


Anyway... I should've probably still hard-coded the values here since I don't support passing only a number like the base rule does (maybe I should?)

Base schema:
https://github.com/eslint/eslint/blob/main/lib/rules/max-params.js#L30-L53

Choose a reason for hiding this comment

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

Extended rules generally directly go offcontext.options, is that what you're looking for?

const[style,{ allowSingleLine}={allowSingleLine:false}]=
// eslint-disable-next-line no-restricted-syntax -- Use raw options for extended rules.
context.options;

Copy link
ContributorAuthor

@StyleShitStyleShitOct 16, 2023
edited
Loading

Choose a reason for hiding this comment

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

Nope, I'm talking aboutbaseRule.meta.schema.
I had some issues when trying to add an option to the base schema, the deepMerge function seems to break it.
Is it OK to keep it hard-coded instead of extending the original schema in runtime?

hasSuggestions:baseRule.meta.hasSuggestions,
schema:baseRule.meta.schema,
},

Choose a reason for hiding this comment

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

Ah got it - yeah this is fine. Base rules don't change often and many others already hard-code it (e.g.dot-notation). Thanks for asking!

@StyleShitStyleShit marked this pull request as ready for reviewSeptember 27, 2023 18:00
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Looks great to me! Nice and straightforward, I like it. 🙂

Left a couple of suggestions - what do you think?

Comment on lines 19 to 37
const schema = [
{
type: 'object',
properties: {
maximum: {
type: 'integer',
minimum: 0,
},
max: {
type: 'integer',
minimum: 0,
},
countVoidThis: {
type: 'boolean',
},
},
additionalProperties: false,
},
] as JSONSchema4[];

Choose a reason for hiding this comment

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

Extended rules generally directly go offcontext.options, is that what you're looking for?

const[style,{ allowSingleLine}={allowSingleLine:false}]=
// eslint-disable-next-line no-restricted-syntax -- Use raw options for extended rules.
context.options;

@JoshuaKGoldbergJoshuaKGoldberg added the awaiting responseIssues waiting for a reply from the OP or another party labelOct 13, 2023
@github-actionsgithub-actionsbot removed the awaiting responseIssues waiting for a reply from the OP or another party labelOct 16, 2023
Comment on lines 19 to 37
const schema = [
{
type: 'object',
properties: {
maximum: {
type: 'integer',
minimum: 0,
},
max: {
type: 'integer',
minimum: 0,
},
countVoidThis: {
type: 'boolean',
},
},
additionalProperties: false,
},
] as JSONSchema4[];

Choose a reason for hiding this comment

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

Ah got it - yeah this is fine. Base rules don't change often and many others already hard-code it (e.g.dot-notation). Thanks for asking!

JoshuaKGoldberg
JoshuaKGoldberg previously approved these changesOct 17, 2023
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for iterating on this! Great work 🚀

Just a couple of small things that I can touch up before merging.

Woman at computer saying 'oh, hell yes'

StyleShit reacted with heart emoji
Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
@JoshuaKGoldbergJoshuaKGoldberg merged commit6398d3f intotypescript-eslint:mainOct 17, 2023
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsOct 25, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Base rule extension: [max-params] don't count this: void

2 participants

@StyleShit@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp