-
Notifications
You must be signed in to change notification settings - Fork 184
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
JS-54 Add rule S7060 Modules should not import themselves #4810
Conversation
36ee97b
to
7fffc10
Compare
7fffc10
to
8fa51ed
Compare
8fa51ed
to
ddf0e77
Compare
return; | ||
} | ||
const { node } = reportDescriptor; | ||
let suggestion: Rule.SuggestionReportDescriptor | undefined; |
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.
Do you think we could turn the suggestion
variable into an array that we would initialize to an empty array? By doing so, we could
- make it constant,
- push to it a quick fix only if possible, and
- avoid the ternary expression that conditionally injects the quickfix.
I am not entirely sure, but this should work since the suggest
property of the report expects an array. We would report an empty array of suggestions if no quickfix applies.
|
||
// DO NOT EDIT! This file is autogenerated by "npm run generate-meta" | ||
|
||
export const meta = { |
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.
cc @victor-diez-sonarsource because I am not sure.
- Since the rule provides a quickfix, should the rule metadata include the key-value
fixable: 'code'
? - Do we need to update the eslint-plugin README to include an entry for this new rule
no-self-import
? If yes, how?
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.
- Yes, it should.
npm run generate-meta
should put that field in themeta.ts
file if the rspec contains thequickfix === 'covered'
attribute. Link - Yes, that is part of also of the
generate-meta
script. You will see that it callscd packages/jsts/src/rules && npm run eslint-docs
, which updates the README 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.
Thanks 👍
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.
LGTM!
@@ -215,6 +215,7 @@ SonarJS rules for ESLint to help developers produce [Clean Code](https://www.son | |||
| [no-same-argument-assert](https://sonarsource.github.io/rspec/#/rspec/S5863/javascript) | Assertions should not be given twice the same argument | ✅ | | | | | | | |||
| [no-same-line-conditional](https://sonarsource.github.io/rspec/#/rspec/S3972/javascript) | Conditionals should start on new lines | ✅ | | 🔧 | 💡 | | | | |||
| [no-self-compare](https://sonarsource.github.io/rspec/#/rspec/S6679/javascript) | "Number.isNaN()" should be used to check for "NaN" value | ✅ | | 🔧 | 💡 | | | | |||
| [no-self-import](https://sonarsource.github.io/rspec/#/rspec/S7060/javascript) | Module should not import itself | ✅ | | | 💡 | | | |
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.
| [no-self-import](https://sonarsource.github.io/rspec/#/rspec/S7060/javascript) | Module should not import itself | ✅ | | | 💡 | | | | |
| [no-self-import](https://sonarsource.github.io/rspec/#/rspec/S7060/javascript) | Module should not import itself | ✅ | | 🔧 | 💡 | | | |
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.
actually not - this rule doesn't provide the fix
, it's a bug in metadata generation
Quality Gate failedFailed conditions |
Fix JS-54