Skip to content

[Feat] - Docs Upgrade - Linting and Pre-Commit Hooks - #67

Merged
alabulei1 merged 12 commits into
WasmEdge:mainfrom
adithyaakrishna:feat/upgrade-v1
May 22, 2023
Merged

alabulei1 merged 12 commits into
WasmEdge:mainfrom
adithyaakrishna:feat/upgrade-v1

Conversation

@adithyaakrishna

Copy link
Copy Markdown
Contributor

Description:

  • This PR adds Eslint to Lint .js | .jsx files
  • This PR adds Stylelint to Lint .css | .scss files
  • This PR adds Husky for pre-commit hook config
  • Fixes linting issues in JS and CSS files

Adithya Krishna added 9 commits May 13, 2023 15:21
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
@alabulei1

Copy link
Copy Markdown
Collaborator

@adithyaakrishna There're some conflicts. Can you fix it first?

Signed-off-by: Adithya Krishna <adikrish@redhat.com>
@adithyaakrishna

Copy link
Copy Markdown
Contributor Author

@alabulei1 Done :)

@alabulei1

Copy link
Copy Markdown
Collaborator

flows summarize

alabulei1 commented May 17, 2023 •

Copy link
Copy Markdown
Collaborator

Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR.


Overall, the pull request improves the codebase's documentation and linting. However, there are potentially significant issues and errors that need to be considered before merging. Depending on the severity of the rule sets and plugins used, there may be a significant amount of linting errors and warnings that need to be addressed. Additionally, conflicting code formatting preferences could cause issues. It is also unclear whether the linters being used have been properly configured or tested, which could lead to issues down the line. Finally, assumptions are made about the environment in which the code is being developed, which may not work as expected if the environment is different. On the positive side, there are several beneficial changes made to the codebase, such as the addition of Stylelint for linting CSS files and the implementation of pre-commit hooks using Husky. Overall, while the pull request has many positive aspects, it requires careful consideration and review to ensure successful integration with the existing codebase.

Details

Commit 273c9ea331efefc6376f868fabf0d70f7045b47b

Key Changes:

  • Added a new file .eslintignore, which includes directories and files to be ignored by Eslint.
  • Added a new file .eslintrc.js, which is the Eslint configuration file.
  • Configured Eslint to use the @babel/eslint-parser parser.
  • Configured Eslint to extend several popular rule sets, including "airbnb", "prettier", and "jsx-a11y".
  • Configured Eslint to use several plugins, including "react-hooks" and "regexp".
  • Configured several Eslint rules to suppress warnings and/or errors.
  • Configured Eslint to resolve imports from .js, .jsx, and .json files.

Potential Problems:

  • None of these changes should directly affect the functionality of the codebase, but depending on the severity of the rule sets and plugins used, there may be a significant number of linting errors and warnings generated when this configuration is applied to the code. Presumably, these issues would need to be addressed to merge this pull request.
  • Without knowing what the rest of the Pull Request entails, it's unclear whether these changes represent a complete and/or appropriate overhaul of the documentation configuration.
  • If this documentation-related linting configuration is being applied to a codebase that did not previously have linting enabled, it's possible that many other changes will be required in order to move the entire codebase into compliance with this new setup.

Commit ebba9817a30887337c6009f70689a15ff417c8db

Key changes:

  • Added .prettierignore and .prettierrc files.
  • .prettierignore file contains patterns to ignore certain files and directories.
  • .prettierrc file contains Prettier configuration settings.

Potential problems:

  • None apparent from the patch. However, adding Prettier changes the code formatting of the project. This could cause conflicts with other developers who prefer different formatting styles or create issues when working with existing code. So team members should discuss and agree on using Prettier before applying the patch.

Commit a4d9816c465c4e835cb68f45dd4f6a4e173b9bf2

The patch adds Stylelint to the repository. It also creates a .stylelintignore file to avoid linting files that are not related to CSS. This is a positive change as it will help improve code quality by enforcing a consistent coding style. However, as no lint rules are specified in the patch or in the repository's documentation, there could be concerns regarding the setup and configuration of the linter. Additionally, it is unclear whether the patch passes all unit tests and if it has been reviewed and tested by other developers to ensure its quality.

Commit 35bd7a9264747f722b0fae1ea35d55d85dd1efa2

The patch adds a new file .stylelintrc.js with a set of rules for linting CSS files using Stylelint. The file defines which stylelint configurations to extend and overrides some rules to ignore certain pseudo classes, patterns, and empty lines. There are no immediate potential problems with this patch. However, since it adds a new layer of linting to the project, it could lead to more errors or warnings flagged during the development process. Therefore it will be essential to maintain regular communication with the team to ensure that everyone understands the rules defined in this config file and agrees on the importance of maintaining cleanliness in the project.

Commit c99068adb0a7c49cd87f6a123771120c29a20eac

The key changes in this patch are the addition of a .husky directory with a pre-commit hook and .gitignore file, and a .lintstagedrc.json configuration file. The pre-commit hook invokes the lint-staged command which will execute linters on files that are staged for commit. The .lintstagedrc.json file specifies which linters to run on which file types.

One potential problem with this patch is that it makes assumptions about the environment in which the code is being developed. Specifically, it assumes that husky is being used for git hooks and that npm is being used as the package manager. If the code is being developed in a different environment, these changes may not work as expected. Additionally, it's not clear whether the linters being used have been properly configured or tested, which could lead to issues down the line.

Commit ee0d620d81095e2089cfff38885a0afbbb1e9026

This patch updates the .gitignore file to include the .eslintcache directory. This is a minor change but can help prevent issues related to linting cache files being checked into the repository. No potential problems seem to be present in this change.

Commit 3e2644c233297016adba5d3b2c56528cdf679c41

The patch fixes just one warning in the sidebars.js file. The change is adding a missing comma at the end of the object in the contributeSidebar property.

Potential problems could arise if there are more warnings present in the codebase and if they are not fixed in this pull request. Also, if this patch is part of a larger codebase, there may be conflicts with other pull requests.

Commit 5702279f1f60a97b083309c8e402fd779e66f978

Key changes:

  • Linting issues in the index.js file of the HomepageFeatures component have been fixed.
  • Link import has been moved from the top of the file to where it is used in the index.js file of the HomepageFeatures component.
  • An "id" property has been added to FeatureList's objects and used in the map function in the index.js file of the HomepageFeatures component.
  • Formatting improvements were made in custom.css.

Potential problems:

  • None detected.

Commit ef6e443e817a0b07a1d53756fe79dce2bb9474cc

The patch adds several packages including ESLint, Stylelint, Prettier, and Husky. It also includes updates to the dependencies in package-lock.json. There appear to be no conflicts with the changes and no potential problems are immediately evident. However, it would be worthwhile to review the configuration and implementation of the new packages and make sure they are integrated properly with existing code. It would also be useful to assess if this patch introduces any regressions or performance issues and if any additional testing or optimization is necessary.

Commit f14fbea3bd28a3839d5c4c620b5d438c1768f07f

This patch simply adds a new line at the end of the .prettierrc file. This change is very minimal and should not cause any issues. It is a good practice to have a new line at the end of a configuration file. The code change looks fine from a technical standpoint.

@alabulei1

Copy link
Copy Markdown
Collaborator

Hi @adithyaakrishna,

Thanks. I have two questions:

  1. What do you think about the following comment from ChatGPT? I'm not a JS developer, so I have to ask ChatGPT to help.

However, there is a potential issue: the .prettierrc file does not have a newline at the end of the file, which could cause issues with some tools and editors. This should be fixed before merging the pull request.`

  1. Please fix the conflicts

Adithya Krishna added 2 commits May 17, 2023 11:58
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
Signed-off-by: Adithya Krishna <adikrish@redhat.com>
@adithyaakrishna

Copy link
Copy Markdown
Contributor Author

@alabulei1 Oops! My bad, I missed adding the new line, I have fixed it with the above commit. Thanks for pointing it out :)

and I have fixed the conflicts also 👀

@alabulei1

Copy link
Copy Markdown
Collaborator

So ChatGPT's reviews are right?

@adithyaakrishna

Copy link
Copy Markdown
Contributor Author

@alabulei1 Yes, in this case, it is right. I am not sure about all the cases in the future, but the issue pointed out by ChatGPT is correct here

@adithyaakrishna

adithyaakrishna commented May 17, 2023 •

Copy link
Copy Markdown
Contributor Author

@alabulei1 I really like the pr-summary bot, but I feel sometimes its a bit too long to go through. I checked the repo for the same at, https://github.com/flows-network/github-pr-summary/blob/main/src/github-pr-summary.rs#L187 and I had this idea, what if the body is collapsible for each commit description?

For example, instead of like this,

Commit ef6e443e817a0b07a1d53756fe79dce2bb9474cc

The patch adds several packages including ESLint, Stylelint, Prettier, and Husky. It also includes updates to the dependencies in package-lock.json. There appear to be no conflicts with the changes and no potential problems are immediately evident. However, it would be worthwhile to review the configuration and implementation of the new packages and make sure they are integrated properly with existing code. It would also be useful to assess if this patch introduces any regressions or performance issues and if any additional testing or optimization is necessary.

How does this look?

Commit ef6e443

The patch adds several packages including ESLint, Stylelint, Prettier, and Husky. It also includes updates to the dependencies in package-lock.json. There appear to be no conflicts with the changes and no potential problems are immediately evident. However, it would be worthwhile to review the configuration and implementation of the new packages and make sure they are integrated properly with existing code. It would also be useful to assess if this patch introduces any regressions or performance issues and if any additional testing or optimization is necessary.

@adithyaakrishna

Copy link
Copy Markdown
Contributor Author

This was just a random thought that came to my mind 😶

@alabulei1

alabulei1 commented May 17, 2023 •

Copy link
Copy Markdown
Collaborator

@alabulei1 I really like the pr-summary bot, but I feel sometimes its a bit too long to go through. I checked the repo for the same at, https://github.com/flows-network/github-pr-summary/blob/main/src/github-pr-summary.rs#L187 and I had this idea, what if the body is collapsible for each commit description?

For example, instead of like this,

Commit ef6e443e817a0b07a1d53756fe79dce2bb9474cc

The patch adds several packages including ESLint, Stylelint, Prettier, and Husky. It also includes updates to the dependencies in package-lock.json. There appear to be no conflicts with the changes and no potential problems are immediately evident. However, it would be worthwhile to review the configuration and implementation of the new packages and make sure they are integrated properly with existing code. It would also be useful to assess if this patch introduces any regressions or performance issues and if any additional testing or optimization is necessary.

How does this look?

Commit ef6e443

This format looks great! We can also ask ChatGPT only to give a short summary.

@juntao

juntao commented May 17, 2023

Copy link
Copy Markdown
Member

Hi @adithyaakrishna

The collapsible commit sections look great! Can you raise a PR to the main branch of the bot template repo? https://github.com/flows-network/github-pr-summary

Thanks!

@adithyaakrishna

Copy link
Copy Markdown
Contributor Author

@juntao Yes sure, I will do that :)

@adithyaakrishna

Copy link
Copy Markdown
Contributor Author

@juntao How abt we give the users of the bot an option or param to enable or disable collapsible commit description?

so that, instead of just one format, users customize how they want it and by setting collapsibleCommitDescription=true they will have the new format

@juntao

juntao commented May 18, 2023

Copy link
Copy Markdown
Member

Good idea!

Our current approach is to make the template as simple as possible. If the user wants to make changes, he can change his local copy of the bot source code.

So, let's make it easy to switch between collapsed and expanded commits in the code -- perhaps using variables like MODEL but not expose it as an environment var for the template. Thanks.

@alabulei1
alabulei1 merged commit f7400f5 into WasmEdge:main May 22, 2023
@adithyaakrishna
adithyaakrishna deleted the feat/upgrade-v1 branch May 23, 2023 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants