-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Add stylelint plugin to validate polaris custom properties #4804
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b2b54e7
fix: WIP Polaris token validation
aaronccasanova 1ab455f
Enhance custom-properties-allowed-list plugin
aaronccasanova 8e9ce45
updated README with additional docs and run instructions
0e7ce6c
reverting TextContainer.scss will followup with fixes in separate PR
e531fde
fix: Update error message
aaronccasanova db613dd
docs: Update README
aaronccasanova 098d2bc
fix: Update plugin to use postcss-value-parser
aaronccasanova 79e358e
docs: Update README
aaronccasanova 5e2c85b
Merge branch 'v8.0.0-major' of https://github.com/Shopify/polaris-rea…
aaronccasanova 1f795f9
Improve custom-properties-allowed-list plugin
aaronccasanova 333a25a
fix: Remove unused npm script
aaronccasanova 5563716
fix: Move Stylelint config and plugins out of 'scripts' directory
aaronccasanova 587c7e6
fix: Revert tsconfig changes
aaronccasanova 023e6d3
fix: Update all failing custom properties
aaronccasanova 0b7a56c
fix: Move Stylelint config to .stylelintrc.js
aaronccasanova b007140
fix: Formatting errors
aaronccasanova 810e797
fix: Cast custom properties objects to React.CSSProperties
aaronccasanova 1cbf188
fix: Revert vscode settings changes
aaronccasanova 9a3e1f4
docs: Simplify README link
aaronccasanova d504e5c
docs: Fix typo in unreleased-v8
aaronccasanova 6fc6590
Merge branch 'v8.0.0-major' of https://github.com/Shopify/polaris-rea…
aaronccasanova 5f2552b
Merge branch 'v9.0.0-major' of https://github.com/Shopify/polaris-rea…
aaronccasanova 48d1c5b
fix: Update box-shadow tokens
aaronccasanova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,4 @@ node_modules | |
| /examples | ||
| /build | ||
| /build-internal | ||
|
|
||
| index.esnext | ||
| index.js | ||
| index.mjs | ||
| /src/styles/polaris-tokens | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,3 @@ node_modules | |
| .DS_Store | ||
| *.scss.d.ts | ||
| .idea | ||
|
|
||
| index.esnext | ||
| index.js | ||
| index.mjs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,4 @@ node_modules | |
| /build | ||
| /build-internal | ||
|
|
||
| /package.json | ||
|
|
||
| index.esnext | ||
| index.js | ||
| index.mjs | ||
| /package.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| const path = require('path'); | ||
|
|
||
| const {tokenList} = require('./build/cjs/token-list'); | ||
|
|
||
| /** | ||
| * Allowed custom property names in Polaris component styles. | ||
| */ | ||
| const polarisComponentCustomProperties = /--pc-.+/; | ||
|
|
||
| module.exports = { | ||
| extends: ['@shopify/stylelint-plugin/prettier'], | ||
| plugins: [ | ||
| path.join(__dirname, './stylelint/plugins/custom-properties-allowed-list'), | ||
| ], | ||
| rules: { | ||
| '@shopify/custom-properties-allowed-list': { | ||
| allowedProperties: [ | ||
| '--polaris-version-number', | ||
| polarisComponentCustomProperties, | ||
| ], | ||
| allowedValues: { | ||
| '/.+/': [polarisComponentCustomProperties, ...tokenList], | ||
| }, | ||
| }, | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
As discussed, we should spin setting
rootEntrypoints: falseand removing the references to root levelindex.*files in the various ignore files (asrootEntrypoints: falsemeans those files no longer gets generated) into a separate PR that targets main.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.
Sound good 👍 I created this issue for tracking #4807