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

Implement Pascal Case for Erc20Permit and Erc721Permit #40

Merged
merged 4 commits into from
May 3, 2024

Conversation

jordan-ae
Copy link
Contributor

… naming conventions

Resolves #39

Copy link
Contributor

github-actions bot commented Apr 19, 2024

Lines Statements Branches Functions
Coverage: 80%
80% (4/5) 100% (0/0) 66.66% (2/3)

JUnit

Tests Skipped Failures Errors Time
1 0 💤 0 ❌ 0 🔥 2.74s ⏱️
Coverage Report (80%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files8010066.6680 
   main.ts8010066.66809

Copy link
Member

@0x4007 0x4007 left a comment

Choose a reason for hiding this comment

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

You also should not change any other files.

.eslintrc Outdated Show resolved Hide resolved
@jordan-ae
Copy link
Contributor Author

You also should not change any other files.

@0x4007 The other modifications were made my running the linters. If you check the changes you'll see the linters just added spaces where it seemed necessary and all that. I can revert the changes if they will cause any issues though.

@gentlementlegen
Copy link
Member

There actually already is a rule for PascalCase interfaces, no need to create a new one. The thing is that rule enforces Pascal Case but not strictly meaning you can chain uppercase letters.

If we want to prevent this we can use StrictPascalCase. Maybe it would be a good idea to use it everywhere @0x4007 ?
See also: https://typescript-eslint.io/rules/naming-convention/#format-options

@0x4007
Copy link
Member

0x4007 commented Apr 21, 2024

That rule seems to only check for the first character being capitalized according to the docs. I think a regex that looks for three or more consecutive capitalized letters should be flagged as an error

@gentlementlegen
Copy link
Member

StrictPascalCase will enforce no more that one capital letter inside the name, regardless of the position. Example:
image
Quoting the docs: "consecutive capitals are not allowed (i.e. myId is valid, but myID is not)."

@0x4007
Copy link
Member

0x4007 commented Apr 21, 2024

I think let's use strictpascalcase then!

@gentlementlegen
Copy link
Member

@0x4007 Shall this be applied to other elements too, like variables etc? There is the same version for camel case called StrictCamelCase.

@0x4007
Copy link
Member

0x4007 commented Apr 22, 2024

Yes let's apply this across all identifiers.

@jordan-ae
Copy link
Contributor Author

@0x4007, @gentlementlegen I've added StrictPascalCase to the eslint rules. They'll be a couple of errors in certain files due to the new eslint configuration which I haven't changed because of this comment. I'd love to clean up the files though!

You also should not change any other files.

I also suggest we create a pre-commit hook. By doing so we can ensure no errors go into the repository and enforce code style. The pre-commit hook will run only on staged files to avoid slow and irrelevant processes.

@0x4007
Copy link
Member

0x4007 commented Apr 23, 2024

We have lint-staged for this purpose but perhaps it's not configured correctly.

@jordan-ae
Copy link
Contributor Author

We have lint-staged for this purpose but perhaps it's not configured correctly.

Okay I'll take sometime to look into that too

@jordan-ae
Copy link
Contributor Author

@gentlementlegen please can you review? Thanks

@gentlementlegen gentlementlegen self-requested a review April 25, 2024 10:48
@ubiquity-os-deployer
Copy link

ubiquity-os-deployer bot commented Apr 25, 2024

Copy link
Member

@gentlementlegen gentlementlegen left a comment

Choose a reason for hiding this comment

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

I am fine with the changes per se, but the changes outside of .eslintrc don't seem directly related to this PR but to your own IDE settings.

@jordan-ae
Copy link
Contributor Author

Hey @0x4007 I've undone all the changes not related to the issue. This should be ready to go now!

.eslintrc Outdated Show resolved Hide resolved
@gentlementlegen gentlementlegen self-requested a review May 2, 2024 08:04
Copy link
Member

@gentlementlegen gentlementlegen left a comment

Choose a reason for hiding this comment

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

Do not make changes that would change the behavior of the configuration. We just need StrictPascalCase and strictCamelCase over the PascalCase and camelCase respectively.

@jordan-ae
Copy link
Contributor Author

jordan-ae commented May 2, 2024

I think let's use strictpascalcase then!I

I thought we were going full in on StrictPascalCase 😬

@0x4007 0x4007 merged commit bad8429 into ubiquity:development May 3, 2024
5 checks passed
@ubiquibot ubiquibot bot mentioned this pull request May 3, 2024
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.

Three Letter Linter
3 participants