kolibri-design-system icon indicating copy to clipboard operation
kolibri-design-system copied to clipboard

Linting Process Does Not Fix Certain Issues Automatically

Open RONAK-AI647 opened this issue 1 year ago • 18 comments

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Lint Tests Passing Locally but Failing in CI/CD Pipeline

What it shows in the terminal- https://github.com/user-attachments/assets/8761f199-63c8-4e01-b70f-f8d2a77aad4d

What it shows in the CICD pipeline: Image

Product

kolibri-design-system

Expected behavior

The linter should fix the introduces changes automatically like removing extra spaces ,semicolons etc.

Actual behavior

The linter does not fix the changes automatically , and remains unaltered.

Steps to reproduce the issue

  1. Make a change that violates a linter rule. For example: 2)Run yarn lint-fix. 3)Check the output and verify whether the expected issues were fixed. 4)Run git status to see if any changes were made to the files.

Environment

Local Environment: Node.js version: 10.x Yarn version: 1.x Operating System: Windows

##Comments This issue has been observed by multiple contributors. Please let me know if additional details or examples are needed.

RONAK-AI647 avatar Nov 19 '24 13:11 RONAK-AI647

@MisRob I raised the issue , would you put some labels ,if it deserves.

RONAK-AI647 avatar Nov 19 '24 13:11 RONAK-AI647

Hi @RONAK-AI647, thank you! I wonder if this could be specific to Windows. I will keep observing with other contributors and perhaps we can see some similarities.

MisRob avatar Nov 19 '24 13:11 MisRob

Related PR https://github.com/learningequality/kolibri-design-system/pull/827

MisRob avatar Nov 19 '24 13:11 MisRob

For reference, @rtibbles noted some of the linting issues may be fixed as soon as we upgrade kolibri-tools

MisRob avatar Nov 20 '24 06:11 MisRob

Please Assign it to me @MisRob

RONAK-AI647 avatar Dec 13 '24 08:12 RONAK-AI647

Thanks @RONAK-AI647 if you have some new insights, you're welcome to look into this - I noticed you resolved it on one of your PRs

MisRob avatar Dec 13 '24 10:12 MisRob

The linting package has now been updated - checking to see if this recurs locally would be helpful. If it is still happening, I think it must be a Windows specific issue.

rtibbles avatar Dec 13 '24 16:12 rtibbles

Hi @RONAK-AI647, I wanted to mention that Learning Equality will be closed from December 23 to January 5.

MisRob avatar Dec 17 '24 17:12 MisRob

I cannot find you in the member's list of learning equality @MisRob ?? I see the contributor tag on ur comments.🧐

RONAK-AI647 avatar Dec 17 '24 18:12 RONAK-AI647

Sorry @RONAK-AI647, you should see me there now. It was just something with membership visibility settings.

MisRob avatar Dec 17 '24 18:12 MisRob

Hello maintainers @rtibbles @MisRob , Upon this issue , as many new contributors face this issue of not able to run "yarn lint-fix" command , and the reason I found out was " the jobs of linting( yarn lint-fix is run on UBUNTU machine " which most of the users miss ( running it on the windows machine . If you all allow , the following are my thoughts which can be done or else we would close this issue.

  1. If certain contributors encounter environment-specific issues, you can test linting on multiple environments (e.g., Windows, macOS, and Ubuntu) by adding matrix builds. 2.Update the dev_docs\01_getting_started.md file , so could it help the new contributors .
  2. Adding a pre-commit hook to run linting automatically before commits. This reduces the chance of contributors missing it.
  3. Otherwise close this issue .

Thank You @AlexVelezLl for guidance .

RONAK-AI647 avatar Dec 23 '24 13:12 RONAK-AI647

The linting package has now been updated - checking to see if this recurs locally would be helpful. If it is still happening, I think it must be a Windows specific issue.

Yes @rtibbles , this is specific to windows latest.

RONAK-AI647 avatar Dec 23 '24 13:12 RONAK-AI647

I think adding a pre-commit hook would be the simplest thing here. In our other repositories we use the Python pre-commit package, but I am guessing we've not added it here because no other Python dependencies are involved.

rtibbles avatar Dec 23 '24 15:12 rtibbles

So if we are not going ahead with Python pre-commit as KDS lack python dependencies , shall we think of node js based pre commit hook system.

RONAK-AI647 avatar Dec 23 '24 17:12 RONAK-AI647

Seems like husky is the main solution out there, seems like we could run the same linting command with that, and keep a purely JS ecosystem for KDS.

https://typicode.github.io/husky/how-to.html

Will happily receive a PR that runs yarn run lint-fix with appropriate arguments to ensure it lints only staged files.

rtibbles avatar Dec 23 '24 17:12 rtibbles

I think the last requirement I put there will be best achieved by using husky in combination with this: https://github.com/lint-staged/lint-staged?tab=readme-ov-file#configuration

rtibbles avatar Dec 26 '24 22:12 rtibbles

@rtibbles Take a look Please , I have raised a PR.

RONAK-AI647 avatar Dec 28 '24 09:12 RONAK-AI647

Hi @RONAK-AI647! Thank you!

We are currently closed for the year and may be slow to respond. Rest assured, we will give your pr a look once we are back fully next year.

Thanks Again!

akolson avatar Dec 30 '24 14:12 akolson