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(useFilenamingConvention): add the match option #4321

Merged
merged 1 commit into from
Oct 19, 2024

Conversation

Conaclos
Copy link
Member

@Conaclos Conaclos commented Oct 17, 2024

Summary

Close #4105

This PR implements a new option named match that allows validating a filename thanks to a regular expression.
Similarly to useNamingConvention, we rely on the RestrictedRegex type that allow to use a common subset of patterns between JS and Rust regexes.

If the regex captures strings then:

  • the first capture is considered as the name of the file
  • the second captures is considered as the extensions of the file (dot separated).
  • Following captures are ignored.

For example, given the regular expression %?(.+?)\.(.+) and the filename %index.d.ts,
the filename matches the regular expression with two captures: index and d.ts.
The name index and the extensions d, ts are then checked against the filenameCases option.

Test Plan

I added new tests.

@github-actions github-actions bot added A-CLI Area: CLI A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Oct 17, 2024
@Conaclos Conaclos requested review from a team October 17, 2024 14:14
@ematipico ematipico added the S-Merge for next minor Status: the PR should be merged in the next minor label Oct 17, 2024
Copy link

codspeed-hq bot commented Oct 17, 2024

CodSpeed Performance Report

Merging #4321 will not alter performance

Comparing conaclos/useFilenamingConvention-matching (97d59ba) with main (1c60340)

Summary

✅ 101 untouched benchmarks

@Conaclos Conaclos changed the base branch from main to next October 18, 2024 09:59
@Conaclos Conaclos changed the base branch from next to main October 18, 2024 10:18
@Conaclos Conaclos force-pushed the conaclos/useFilenamingConvention-matching branch 3 times, most recently from b5702b4 to 8ddd9aa Compare October 19, 2024 13:35
@github-actions github-actions bot added A-Core Area: core A-Project Area: project A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools A-LSP Area: language server protocol L-CSS Language: CSS A-Diagnostic Area: diagnostocis A-Changelog Area: changelog labels Oct 19, 2024
@Conaclos Conaclos force-pushed the conaclos/useFilenamingConvention-matching branch from 8ddd9aa to 0792d78 Compare October 19, 2024 13:39
@github-actions github-actions bot removed A-Parser Area: parser A-Tooling Area: internal tools A-Diagnostic Area: diagnostocis labels Oct 19, 2024
@Conaclos Conaclos force-pushed the conaclos/useFilenamingConvention-matching branch from 0792d78 to 97d59ba Compare October 19, 2024 13:40
@github-actions github-actions bot removed A-Core Area: core A-Project Area: project A-Formatter Area: formatter A-LSP Area: language server protocol labels Oct 19, 2024
@github-actions github-actions bot removed the L-CSS Language: CSS label Oct 19, 2024
@Conaclos Conaclos merged commit 8081745 into main Oct 19, 2024
11 checks passed
@Conaclos Conaclos deleted the conaclos/useFilenamingConvention-matching branch October 19, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-CLI Area: CLI A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Merge for next minor Status: the PR should be merged in the next minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💅 useFilenamingConvention errors on files starting with non-letter, a $ for example
2 participants