ParamNames dictionary object is declared in const.es6. Its key-value pairs are almost sorted in a dictionary order of keys, except for a few keys like FEEDBACK_QUESTION_EDITTEXT, FEEDBACK_QUESTION_EDITTYPE, etc. We can rearrange these pairs to their proper position to maintain the dictionary order. This makes it easy for devs to search what they are looking for.
Updated based on [this comment] by @damithc (https://github.com/TEAMMATES/teammates/issues/7706#issuecomment-314080758)
In const.es6, add a comment to explain that the sort order follows that of Const.java
I believe @LiHaoTan has something to say about this :)
I would like to take this issue,
Well, I think this issue may not be so simple. This is because Const.ParamNames in Const.es6 is a copy of Const.ParamNames in Const.java, albeit a subset.
Const.ParamNames has some form of logical ordering to the constants and it's probably better to keep it that way. However, in Const.es6 since it is a subset it may not appear to be as obvious.
The bigger problem though is keeping the constants from the frontend and backend in sync, and the current approach (copy pasting the constants from the backend to frontend) is error prone.
One possible approach will be to have a Const.json where both the frontend and backend read from but I'm not quite sure it is a good approach.
Some investigation will probably need to be done as to decide the approach to take.
@LiHaoTan In that case, shall we just add a comment in the .es6 file for now to explain why it is ordered that way, until we tackle the real issue separately?
@damithc yes I think we should.
@damithc yes I think we should.
Description updated accordingly. @LiHaoTan can create an issue to fix the root cause?
Issue to address root cause here: #7731
Hello, I am new to open source. I would like to work on this issue, but I can't find the const.es6 file.
Please direct me. :)
Search for const.js
@tshradheya Thanks for the quick reply. What I need to do here is add a comment in const.js about it's sort order as mentioned in the comment above, right ?
Most helpful comment
Issue to address root cause here: #7731