question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apply the new naming convention to remaining directories.

See original GitHub issue

The new naming convention needs to be applied to the remaining directories.

The naming follows a general pattern:

  • The filename is divided into three parts (four for spec files). The first part is the name of the functionality, the second part is the type of functionality and the third part is the file extension. The third part in case of spec files become the word “spec” and the extension becomes the fourth part.

  • The different parts of the filename are joined by periods.

  • If the first part of the name has multiple words then the words are joined by kebab-case, with all the letters being small.

  • For eg if there is a directive file which houses a directive named stateResponses. Then the name of the file would be state-responses.directive.ts

Types of functionality.

  • Directives: A directive’s name must end with “.directive.ts” For example, if the name of a directive is ‘stateResponses’ then the name of the file must be “state-responses.directive.ts”.

  • Controllers: A controller’s name must end with “.controller.ts” For example, if the name of a directive is ‘StoryEditor’ then the name of the file must be “story-editor.controller.ts”.

  • Filters: A filter’s name must end with “.filter.ts” For example, if the name of a filter is ‘formatTimer’ then the name of the file must be “format-timer.filter.ts”.

  • Services: A service’s name must end with “.service.ts” For example, if the name of a service is ‘ExplorationDataService’ then the name of the file must be “exploration-data.service.ts”.

  • Constants: The constants of a page are to be kept in a single file. The file should be named name-of-the-page.constants.ts. Any new constant that needs to be added should be added to this file only and this constants.ts file should be required in the file which uses the constant.

  • HTML files: There are three types of HTML files:-

    1. Mainpage: These are the pages which act as a starting point of the page. These pages are directly called from the backend. The names of these HTML files must end with “.mainpage.html”. For example, the main page of the exploration editor page would be named exploration-editor-page.mainpage.html.

    2. Directive: These are the HTML files which are served by the directive files. These are the HTML files that appear in the ‘templateUrl’ of the directive. These must have their names ending with “.directive.html”. For example, the progress nav directive would be named progress-nav.directive.html.

    3. Template: These are the shared HTML files which are required by various other functions like modals, jinja templating, etc. These names are to end with “.template.html”

  • Script files: These are the TS files which are for the sole purpose of importing the required TS files for the HTML file. Such files are to end with “.scripts.ts”. For example if a file get-started.mainpage.html needs a script file then the file would be named “get-started.scripts.ts”

Note: The root directory for the frontend file is located here: oppia/core/templates/dev/head

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:40 (38 by maintainers)

github_iconTop GitHub Comments

1reaction
DubeySandeepcommented, Oct 10, 2019

@RafayGhafoor, I found that your PR for the /extension part of this issue is already merged, so I’ve updated the issue description accordingly. Thanks! 😃

0reactions
bansalnitishcommented, Nov 22, 2019

Yes sure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

3 Best Practices for File Naming Conventions - The Motley Fool
1. Simplifies management ... When you have a clutter of files in a folder with no naming convention, it's impossible to easily identify...
Read more >
File Naming Conventions: simple rules save time and effort
The simple rules apply equally to electronic and physical files and folders. They provide assurance that the correct item is retrieved and cannot...
Read more >
File Naming Conventions - HURIDOCS
A file naming convention is a systematic method for naming files that will make them easier to retrieve later. A consistent and descriptive...
Read more >
Best Practices for File Naming - Records Express
Adopting good file naming conventions can help ensure that files will work with different operating systems and disk formats, ...
Read more >
Naming Folders, Pages, and Files - Campus WCMS Help
Every folder that is published must have a page in with the page name "index." These pages can have their own Display Name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found