Skip to content

feat(jest,rstest): add padding rules - #2075

Open
elecmonkey wants to merge 1 commit into
mainfrom
feat/test-framework-padding-rules
Open

feat(jest,rstest): add padding rules#2075
elecmonkey wants to merge 1 commit into
mainfrom
feat/test-framework-padding-rules

Conversation

@elecmonkey

@elecmonkey elecmonkey commented Sep 5, 2026

Copy link
Copy Markdown
Member

Summary

Add seven focused padding rules and padding-around-all for both Jest and Rstest.
Share the padding engine while keeping framework-specific API tables, tests, and documentation.

Intentional limitations

  • Namespace-qualified and renamed API calls are not matched because classification follows first-token syntax.
  • Rstest excludes Jest-only aliases and expectTypeOf.

Related Links

Related #476.
Related #935.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Base automatically changed from refactor/test-framework-padding-engine to main September 6, 2026 04:35
@fansenze
fansenze force-pushed the feat/test-framework-padding-rules branch from d7452ac to 0919622 Compare September 6, 2026 04:35
priority = 100
}
return padding.NewRule(padding.Definition{
Name: name, Family: "jest", Priority: priority,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Adding a warning rule can make failing lint pass

Enable these two rules:

rules: {
  'jest/padding-around-before-all-blocks': 'warn',
  'jest/padding-around-before-each-blocks': 'error',
}

Then lint two hooks with no blank line between them:

beforeAll(connect);
beforeEach(reset);
  • Expected: The missing blank line before beforeEach produces an error. Exit code: 1.
  • Actual: Only the beforeAll warning is reported. Exit code: 0.

Turning the first rule off restores the error. In other words, adding a warning rule makes code that previously failed lint pass.

Both rules detect the same missing blank line, but deduplication keeps the warning and drops the error. Rstest has the same problem. Please retain the error when these reports overlap and add a regression test for this configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants