You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by "Mindslayer001 (via GitHub)" <gi...@apache.org> on 2024/12/31 07:35:38 UTC

[I] Add linting step to make ui for consistent code quality [incubator-answer]

Mindslayer001 opened a new issue, #1219:
URL: https://github.com/apache/incubator-answer/issues/1219

   ## Problem
   
   While building the UI using the `make ui` command, the following sequence of commands is run:
   
   ```
   @cd ui && pnpm pre-install && pnpm build && cd -
   ```
   
   
   During development, we ran into an issue where linting was not done consistently. Specifically, I ran `npm run lint`, but other developers didn't, which made it harder to find and fix the issue, especially with [Issue #1217](#1217).
   
   ## Suggested Solution
   
   To improve consistency and avoid future confusion, we should add the `npm run lint` step to the `make ui` process. This will ensure linting is always run as part of the build process.
   
   ### Proposed Update:
   ```makefile
   ui:
       @cd ui && pnpm pre-install && pnpm build && npm run lint && cd -
   ```
   
   This ensures that linting is always performed after building the UI, maintaining consistent code quality across all developers.
   
   ## Alternatives Considered
   
   - **CI/CD Pipeline Linting**: Ensure linting is mandatory in the CI/CD pipeline to catch any linting issues before deployment.
   - **Pre-commit Hooks**: Use pre-commit hooks (e.g., Husky) to enforce linting before every commit, ensuring developers don’t forget to lint locally.
   
   ## Impact
   
   Adding this change will:
   - Ensure consistent linting across all developers.
   - Prevent hard-to-find bugs related to inconsistent code quality.
   - Make the development process smoother and more predictable.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add linting step to make ui for consistent code quality [incubator-answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on issue #1219:
URL: https://github.com/apache/incubator-answer/issues/1219#issuecomment-2566212835

   It is meaningless to add lint in the build phase, because the build product will be compressed, and it is meaningful in the development and submission phase.
   
   At the beginning, we ran lint through husky's pre-commit phase during the submission phase, so as to ensure the agreed code style. Later, the verification was canceled due to some other reasons.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add linting step to make ui for consistent code quality [incubator-answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on issue #1219:
URL: https://github.com/apache/incubator-answer/issues/1219#issuecomment-2566236364

   You can first withdraw this solution from the previous PR and submit a separate PR, so that it will not affect the submission of the previous PR.
   
   I need to think again about how to add lint verification scheme when submitting code, because the method you mentioned above is not a standard solution, or see if other people in the community have better methods.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add linting step to make ui for consistent code quality [incubator-answer]

Posted by "Mindslayer001 (via GitHub)" <gi...@apache.org>.
Mindslayer001 commented on issue #1219:
URL: https://github.com/apache/incubator-answer/issues/1219#issuecomment-2566210115

   I want to solve this issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add linting step to make ui for consistent code quality [incubator-answer]

Posted by "Mindslayer001 (via GitHub)" <gi...@apache.org>.
Mindslayer001 commented on issue #1219:
URL: https://github.com/apache/incubator-answer/issues/1219#issuecomment-2566255135

   @shuashuai  ok
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add linting step to make ui for consistent code quality [incubator-answer]

Posted by "Mindslayer001 (via GitHub)" <gi...@apache.org>.
Mindslayer001 commented on issue #1219:
URL: https://github.com/apache/incubator-answer/issues/1219#issuecomment-2566219954

   @shuashuai Thanks for the feedback! I understand that linting in the build phase may not be as useful since the build product is compressed.
   
   However, adding linting to the build process ensures it's always run, even if developers forget to do it manually. I agree that Husky pre-commit linting is a good approach. Another idea could be to apply linting in the npm run start command, so it's automatically run during development without relying on developers to remember it.
   
   What do you think?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add linting step to make ui for consistent code quality [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai closed issue #1219: Add linting step to make ui for consistent code quality
URL: https://github.com/apache/answer/issues/1219


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@answer.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org