-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added Camelcase Linters, complexity and max-params and code changes accordingly #137
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThis update introduces stricter coding standards in the project by enforcing new ESLint rules for complexity, maximum parameters, and camelcase usage across various JavaScript files. It also updates the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
yarn.lock
is excluded by!**/*.lock
Files selected for processing (13)
- .eslintrc.js (2 hunks)
- package.json (1 hunks)
- seeders/02_addresses.js (1 hunks)
- seeders/03_stores.js (1 hunks)
- seeders/04_supplier.js (1 hunks)
- seeders/05_supplier_products.js (1 hunks)
- seeders/06_store_products.js (1 hunks)
- seeders/07_purchased_products.js (1 hunks)
- seeders/08_users.js (1 hunks)
- server/database/index.js (1 hunks)
- server/database/tests/index.test.js (1 hunks)
- server/gql/models/addresses/index.js (1 hunks)
- server/utils/testUtils/mockData.js (1 hunks)
Files skipped from review due to trivial changes (12)
- package.json
- seeders/02_addresses.js
- seeders/03_stores.js
- seeders/04_supplier.js
- seeders/05_supplier_products.js
- seeders/06_store_products.js
- seeders/07_purchased_products.js
- seeders/08_users.js
- server/database/index.js
- server/database/tests/index.test.js
- server/gql/models/addresses/index.js
- server/utils/testUtils/mockData.js
Additional comments not posted (2)
.eslintrc.js (2)
36-36
: Themax-params
rule is set to limit functions to a maximum of five parameters, which should help in maintaining cleaner and more manageable function signatures.Verification successful
The verification process confirms that there are no functions in the JavaScript codebase that exceed the five-parameter limit set by the
max-params
rule in.eslintrc.js
. This ensures compliance with the ESLint configuration aimed at maintaining cleaner and more manageable function signatures.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that no functions exceed five parameters. # Test: Search for functions with more than five parameters. Expect: No occurrences. ast-grep --lang javascript --pattern $'function $_($_, $_, $_, $_, $_, $_) { $$$ }'Length of output: 84
37-37
: Thecomplexity
rule is appropriately set to a threshold of 10, which is a standard practice to ensure functions are not overly complex.
@@ -23,7 +23,7 @@ module.exports = { | |||
'key-spacing': [2, { beforeColon: false, afterColon: true }], | |||
'arrow-parens': ['error', 'as-needed'], | |||
'arrow-body-style': [2, 'as-needed'], | |||
|
|||
camelcase: ['error', { properties: 'always', ignoreImports: false }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Several files in the codebase still use non-camelCase property names, which conflicts with the newly configured camelcase
rule in .eslintrc.js
. Here are some of the files that need attention:
webpack.server.config.js
seeders/08_users.js
server/utils/token.js
server/utils/testUtils/mockData.js
server/utils/tests/migrateUtils.test.js
server/utils/testUtils/index.js
seeders/06_store_products.js
seeders/07_purchased_products.js
seeders/03_stores.js
seeders/05_supplier_products.js
server/tests/index.test.js
server/index.js
server/middleware/gqlAuth/constants.js
server/utils/testUtils/dbConfig.js
server/database/models/store_products.js
server/database/models/suppliers.js
server/database/models/supplier_products.js
server/database/models/stores.js
server/database/models/purchased_products.js
server/database/models/products.js
server/database/models/index.js
server/database/models/addresses.js
server/gql/models/tests/supplierProducts/query.test.js
server/gql/models/tests/supplierProducts/mutation.test.js
server/database/models/users.js
server/gql/models/tests/purchasedProducts/query.test.js
server/gql/models/tests/purchasedProducts/mutation.test.js
server/gql/models/tests/products/query.test.js
seeders/04_supplier.js
server/gql/models/addresses/index.js
server/gql/models/aggregate/tests/purchasedProductsUtils.test.js
server/gql/models/aggregate/purchasedProductsUtils.js
server/gql/models/aggregate/tests/index.test.js
server/gql/models/aggregate/index.js
server/gql/models/tests/storeProducts/query.test.js
server/gql/models/tests/storeProducts/mutation.test.js
Please review and refactor these files to comply with the ESLint camelcase
rule to avoid linting errors.
Analysis chain
The camelcase
rule is correctly configured to enforce camelCase naming for all properties and includes checks on imports. Ensure that this change is reflected across the entire codebase to avoid linting errors.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that all properties in JavaScript files adhere to camelCase naming convention.
# Test: Search for non-camelCase property names. Expect: No occurrences.
rg --type js --pcre2 '[a-z]+(_[a-z]+)+' --files-with-matches
Length of output: 1461
###Description
<title>Table</title> <style> table { border-collapse: collapse; width: 100%; } th, td { border: 1px solid black; padding: 8px; text-align: left; } th { background-color: #f2f2f2; } </style>In this Pr I have added following linters
Related Links
Description
Steps to Reproduce / Test
Checklist
yarn test
passesGIF's
Summary by CodeRabbit
New Features
sqlite3
package to enhance database interactions and stability.Refactor
Style