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

Fine tune naming convention rules #92

Closed
onebytegone opened this issue Jul 24, 2023 · 0 comments · Fixed by #93
Closed

Fine tune naming convention rules #92

onebytegone opened this issue Jul 24, 2023 · 0 comments · Fixed by #93
Assignees

Comments

@onebytegone
Copy link
Contributor

This is a follow-up to #89. When starting to integrate the new standards, we came across the following edge cases:

readonly static Class Properties

const GLOBAL_CONST = 'va';

class MyClass {
   public static var_one = 'val';
   public readonly static var_two = 'val';
}

For global constants we require UPPER_CASE. However, for read-only static class properties, we require snake_case. For read-only static class properties, we should probably use UPPER_CASE. This matches our historical PHP practices and clarifies between MyEnum.VarTwo, MyClass.VAR_TWO, and MyClass.var_one.

Class Constructors as Variables and Parameters

const MyClass = require('./MyClass');

function myFunction(superClass: any) {
   const extendedClass = superClass.extends({
      val: true,
   });

   return extendedClass;
}

With the updated naming conventions, we're requiring variables and function parameters be camelCase. However, for global required constructors we allow PascalCase. While it loosens our standards, allowing variables and parameters to be PascalCase will allow us to keep constructors in PascalCase. This will then allow for:

function myFunction(SuperClass: any) {
   const ExtendedClass = SuperClass.extends({
      val: true,
   });

   return ExtendedClass;
}
pbredenberg added a commit to pbredenberg/eslint-config-silvermine that referenced this issue Jul 27, 2023
pbredenberg added a commit to pbredenberg/eslint-config-silvermine that referenced this issue Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants