Giter Site home page Giter Site logo

Comments (4)

draffensperger avatar draffensperger commented on June 23, 2024

Class and interfaces files should be UpperCamelCase.

Yes - this is the class-name rule that is already enforced in the packages via gts

Singleton files should be name like what they export (usually camelCase).
I like this though I'm not sure how to
Files with multiple exports should be kebab-case with a description of the group of exports they represent.

I'm fine with enforcing camelCase for filenames. The TS book style guide concurs and the TypeScript repo itself uses it. We can enforce that via the file-name-casing rule. Google uses snake_case.ts internally for TS filenames and folders, which is where OpenCensus got it I believe, but snakeCase seems to be more of the community standard so we should go with that.

We should be able to use the export-name rule to enforce this from the tslint-microsoft-contrib repo, which only enforces the rule for files with single exports, and use reviewer judgment to make sure multi-export filenames have good names.

I'm not sure what the standard is for folders, but I would use the as the above (kebab-case in this proposal).

The TypeScript repo itself seems to use camelCase for folders, which would make it consistent with file names, but I'm fine with kebab-case for folders. I think camelCase feels a bit more Window-y and snake_case a bit more Unix-y, but modern systems can handle both.

from opentelemetry-js.

mayurkale22 avatar mayurkale22 commented on June 23, 2024

Yes - this is the class-name rule that is already enforced in the packages via gts

+1

What should be the TSLint rule for name of the test files? (either index.test.ts or test-index.ts or test_index.ts)

from opentelemetry-js.

rochdev avatar rochdev commented on June 23, 2024

@draffensperger I'm not sure your suggestions are the same as what I described above. Let me provide a few examples of what I meant just to make sure.

Class example: Entry.ts
Singleton/function example: randomBytes.ts
Utilities example: some-util.ts
Folder example: /distributed-context/

This makes it easy to know what is the content of the file. The most important part is the files where the file name matches the export. I don't have a strong opinion for folders or utilities names. kebab-case and snake_case are easier to read, but camelCase would be more consistent.

Is this something these TSLint rules can handle? If not I'm fine to revisit this with something that can be enforced as it will make standardizing this easier.

from opentelemetry-js.

legendecas avatar legendecas commented on June 23, 2024

I believe our code bases are following such rules and this issue can be closed.

from opentelemetry-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.