Skip to content
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

Update usage of Stylelint, although without moving to v16 #4608

Merged
merged 7 commits into from
Mar 22, 2024
Merged

Conversation

zglicz
Copy link
Contributor

@zglicz zglicz commented Mar 21, 2024

Improves #4481

After an initial investigation, turns out Styleint requires esmodules and is incompatible with CommonJs. Let us for now improve the usage of the plugins, as this would also be enforced in the new version of Stylelint - https://github.com/stylelint/stylelint/blob/46f5eaa7c464b56df1a37e516e21d0c64d5058e5/types/stylelint/index.d.ts#L252

@@ -22,6 +22,9 @@ sonarjs-*
# Visual Studio
.vs/

# VS Code
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing VSCode, as if one wants to run Sonar with Connected-Mode the .vscode/settings.json would be different.

"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"sonarlint.connectedMode.project": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a key "connectionId" that links to a sonarqube instance

*/
private defineRules() {
for (const key in rules) {
stylelint.rules[key] = rules[key];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we change the internals of styleline, which is impossible in the next version.

@@ -22,7 +22,7 @@
import * as stylelint from 'stylelint';
import { parse } from 'postcss';

const ruleName = 'no-commented-code';
const ruleName = 'sonar/no-commented-code';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving a comment, that calling styelint.createPlugin doesn't actually register a plugin it only returns an object in a proper format. To correctly introduce a plugin, we need to add plugins as an option to the linter (as we now do in wrapper.ts)

Copy link
Contributor

@vdiez vdiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod bot assigned zglicz and unassigned vdiez Mar 22, 2024
@zglicz zglicz merged commit bb85e46 into master Mar 22, 2024
16 checks passed
@zglicz zglicz deleted the i4481 branch March 22, 2024 15:05
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.

2 participants