Skip to content

Eslint v9 Migration: Foundation stylelint rules migration to eslint v9 (hardcoded rules) #203

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

Open
wants to merge 63 commits into
base: develop
Choose a base branch
from

Conversation

riteshiitbbs007
Copy link
Contributor

@riteshiitbbs007 riteshiitbbs007 commented Jul 2, 2025

This PR migrates stylelint rule**(no-hardcoded-values-slds1/slds2)** to ESLint v9 while ensuring robust support for both stylelint-plugin-slds and eslint-plugin-slds on style files. By default, the CLI now runs both linters on CSS/SCSS/etc. files for maximum coverage and migration safety. All logic is programmatically controlled—no CLI flag required.

Screenshot 2025-07-08 at 1 36 06 PM Screenshot 2025-07-08 at 1 36 30 PM

@riteshiitbbs007 riteshiitbbs007 changed the title Feat stylelint rules migration to eslint v9 (WIP) Feat stylelint rules migration to eslint v9 Jul 2, 2025
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 07:09 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 07:42 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 11:00 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 11:04 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 11:51 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 12:13 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 13:07 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 2, 2025 13:32 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 3, 2025 04:58 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 3, 2025 07:02 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 3, 2025 08:23 Inactive
@sf-nithappu sf-nithappu temporarily deployed to slds-linter-pr-203 July 3, 2025 13:56 Inactive
* using esbuild to bundle shared-util
* Rules metadata moved to shared utils
* cleaning package json before pack and publish for removing slds-shared-utils
@sf-nithappu sf-nithappu added the under review PR review is active and in progress label Jul 21, 2025
@sf-nithappu
Copy link
Contributor

sf-nithappu commented Jul 21, 2025

@riteshiitbbs007
If we can bundle without publishing files from other package in monorepo, what is the need/advantage of move utills to separate folder? We can aswell refer utils from style-lint package and bundle them as part eslint package.

@riteshiitbbs007
Copy link
Contributor Author

riteshiitbbs007 commented Jul 21, 2025

@sf-nithappu I feel this provides a clean architecture which supports ESLint-first future.
I feel transition becomes easy when we start using this, might be a little overhead now but i feel most of the heavy-lifting is taken care of.

// Phase 1: Both platforms use shared utils
stylelint-plugin-slds ← slds-shared-utils -> eslint-plugin-slds

// Phase 2: Gradual stylelint deprecation
(deprecated) stylelint-plugin-slds eslint-plugin-slds -> slds-shared-utils

// Phase 3: ESLint-only future
eslint-plugin-slds -> slds-shared-utils

@sf-nithappu
Copy link
Contributor

@riteshiitbbs007 we can make use of plugin to bundle required files from stylelint plugin in much clearer way with less changes #220

@riteshiitbbs007
Copy link
Contributor Author

riteshiitbbs007 commented Jul 22, 2025

@sf-nithappu I still feel for all files the imports will not be as easy as ruleMetadata here, also won't it bring an additional change when deprecating stylelint to refactor ESLint and bring those code in here?
I still think shared util should be a way forward unless i am not getting the nuances involved with introducing it.
cc: @KishoreNemalipuri

import noHardcodedValuesSlds2 from './v9/rules/no-hardcoded-values-slds2';
import cssPlugin from "@eslint/css";

const rules = {
Copy link
Contributor

Choose a reason for hiding this comment

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

move to new file and export rules object. Helps in implementing internal persona

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sf-nithappu can we do this in a separate PR once this lands?

Copy link
Contributor

Choose a reason for hiding this comment

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

Needed but not necessarily in this PR

"@salesforce-ux/sds-metadata": "^0.2.4"
"@salesforce-ux/sds-metadata": "^0.2.4",
"postcss-value-parser": "^4.2.0",
"slds-shared-utils": "*"
Copy link
Contributor

@sf-nithappu sf-nithappu Jul 22, 2025

Choose a reason for hiding this comment

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

Adding "slds-shared-utils as dependency is not required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sf-nithappu I see, beacuse of Monorepo Workspace Resolution it will work without this but isn't this better to keep for Clarity? Does keeping this pose any issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

No its not. Remove entry or add it under devdependencies. This pkage is need only during dev.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was already removed.

Comment on lines 28 to 29
"prepublishOnly": "clean-pkg-json"
"prepack": "npm pkg delete dependencies.slds-shared-utils",
"postpack": "npm pkg set dependencies.slds-shared-utils='*'",
"prepublishOnly": "npm pkg delete dependencies.slds-shared-utils && clean-pkg-json"
Copy link
Contributor

Choose a reason for hiding this comment

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

revert these lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

300 lines file, can be modularise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Don't Merge Yet under review PR review is active and in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants