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

Feature request: ignore abbreviations #167

Closed
soc221b opened this issue Oct 17, 2023 · 6 comments
Closed

Feature request: ignore abbreviations #167

soc221b opened this issue Oct 17, 2023 · 6 comments
Assignees
Labels

Comments

@soc221b
Copy link

soc221b commented Oct 17, 2023

I'm wondering if this is useful to anyone else 🤔:

ls:
  packages/*/{src,__tests__}:
    .js: kebab-case
    .ts: camelCase | PascalCase
    .d.ts: camelCase
    .spec.ts: camelCase | PascalCase
    .mock.ts: camelCase

ignore:
  - node_modules
+
+ abbr:
+  - HTTP
+  - SMS

Thank you~

@loeffel-io
Copy link
Owner

Hey @iendeavor, could you please provide more context

thank you

@soc221b
Copy link
Author

soc221b commented Oct 19, 2023

Hi, @loeffel-io
Thanks for your quick reply.

For example, we might have some files containing the abbreviation "SMS", but it violates the PascalCase rule:

ls:
  .ts: PascalCase
path/
│
└─ to/
  │
  ├─ EmailService.ts # valid
  │
  └─ SMSService.ts # invalid

@loeffel-io
Copy link
Owner

loeffel-io commented Oct 19, 2023

Hey @iendeavor

for this you can use the regex rule and allow only specific values or the negative of them with something like

ls:
    to:
         .ts: regex:(Email|Foo|Bla)Service # allow EmailService, FooService, BlaService

the negative could be this, but this isn't supported by re2 and go

ls:
    to:
         .ts: regex:(?!HTTP|SMS).*Service # do not allow HTTPService, SMSService

for this a not_regex rule could make sense

@loeffel-io loeffel-io self-assigned this Oct 19, 2023
@soc221b
Copy link
Author

soc221b commented Oct 19, 2023

Yes, this makes sense for the example mentioned earlier, but we might have any name anywhere in the filename, and we also want to validate it based on specific rules, like:

Example 1: https://github.com/facebook/react-native/tree/6e42c98aa3423cfbc389e4fe877b5c6b559c8a81/packages/community-cli-plugin/src/commands/bundle

ls:
  .js: camelCase
../
│
└─ bundle/
  │
  ├─ assetCatalogIOS.js
  │
  ├─ getAssetDestPathIOS.js
  │
  └─ __tests__/
    │
    └─ getAssetDestPathIOS-test.js

Example 2: https://github.com/apple/swift/tree/main/lib/AST

ls:
  .cpp: PascalCase
../
│
├─ AST/
│ │
│ ├─ ASTScope.cpp
│ │
│ ├─ ASTScopePrinting.cpp
│ │
│ └─ ASTScopeSourceRange.cpp
│
└─ RemoteAST/
  │
  └─ RemoteAST.cpp

@loeffel-io
Copy link
Owner

loeffel-io commented Oct 19, 2023

what about

ls:
    to:
         .ts: regex:(Email|Foo|Bla)Service | camelCase # allow EmailService, FooService, BlaService and all camelCase

filenames like getAssetDestPathIOS-test.js are an anti pattern imo

@loeffel-io
Copy link
Owner

Closing this for now - please let me know if you have any further questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants