-
Notifications
You must be signed in to change notification settings - Fork 105
add rule GCI777 #415
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
base: main
Are you sure you want to change the base?
add rule GCI777 #415
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| == Why is this an issue? | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this file should not be commited |
||
|
|
||
| Using single quotes for string literals that do **not** require interpolation is more efficient. Double quotes (and backticks) can trigger additional parsing logic to check for variable interpolation, even if none is present. | ||
|
|
||
| [source,js,data-diff-id="2",data-diff-type="noncompliant"] | ||
| ---- | ||
| const message = "Hello world"; | ||
| ---- | ||
|
|
||
| [source,js,data-diff-id="2",data-diff-type="compliant"] | ||
| ---- | ||
| const message = 'Hello world'; | ||
| ---- | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "title": "Avoid using resource hungry libs", | ||
| "type": "CODE_SMELL", | ||
| "status": "ready", | ||
| "remediation": { | ||
| "func": "Constant\/Issue", | ||
| "constantCost": "1h" | ||
| }, | ||
| "tags": [ | ||
| "bad-practice", | ||
| "eco-design", | ||
| "performance", | ||
| "creedengo" | ||
| ], | ||
| "defaultSeverity": "Minor" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| == Why is this an issue? | ||
|
|
||
| Avoid imports of known resource-hungry or deprecated libraries and suggest lighter alternatives. | ||
|
|
||
| This rule flags any import, require or dynamic import of libraries listed in the project's deprecation dictionary (`moment`, `iconsax`, etc.), because these libraries | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this rule depends on specifics libraries, the rule should list the dependencies that are concerned or add an external link to them |
||
| 1. Inflate your bundle size | ||
| 2. Slow parsing & compilation | ||
| 3. Often lack tree-shaking support | ||
| 4. May be unmaintained | ||
|
|
||
| [source,js,data-diff-id="2",data-diff-type="noncompliant"] | ||
| ---- | ||
| import moment from "moment"; | ||
| const age = moment().diff(birthday, "years"); | ||
| ---- | ||
|
|
||
| [source,js,data-diff-id="2",data-diff-type="compliant"] | ||
| ---- | ||
| import differenceInYears from "date-fns/differenceInYears"; | ||
| const age = differenceInYears(new Date(), birthday); | ||
| ---- | ||
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.
Could you update the ID and the URL to your PR and the text