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
Fix false positives for maps in property-no-unknown #5690
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
534cfc7
Fix false positives for maps in property-no-unknown (#5654)
5c01102
Fix false positives for maps in color-no-invalid-hex (#5654)
8bc00f2
Update lib/utils/isStandardSyntaxDeclaration.js
strigefleur 9188cc7
Update lib/utils/__tests__/isStandardSyntaxHexColor.test.js
strigefleur c556605
Update lib/utils/isStandardSyntaxHexColor.js
strigefleur 889e2a2
Update lib/utils/isStandardSyntaxHexColor.js
strigefleur 6225234
Update lib/utils/isStandardSyntaxHexColor.js
strigefleur 6d4076b
Update lib/utils/isStandardSyntaxHexColor.js
strigefleur 9ef1648
Update index.js
jeddy3 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 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,12 @@ | ||
'use strict'; | ||
|
||
const isStandardSyntaxHexColor = require('../isStandardSyntaxHexColor'); | ||
|
||
describe('isStandardSyntaxHexColor', () => { | ||
it('default hex', () => { | ||
expect(isStandardSyntaxHexColor('#000000')).toBeTruthy(); | ||
}); | ||
it('less map usage', () => { | ||
expect(isStandardSyntaxHexColor('#prop[someprop]')).toBeFalsy(); | ||
strigefleur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
}); |
This file contains 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 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,16 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Check whether a hex color is standard | ||
* | ||
* @param {string} property | ||
strigefleur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @returns {boolean} | ||
*/ | ||
module.exports = function (property) { | ||
strigefleur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Less map usage (e.g. .myclass { color: #colors[somecolor]; }) | ||
if (property.includes('[')) { | ||
strigefleur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return false; | ||
} | ||
|
||
return true; | ||
}; |
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.
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.
Let's move this into its own
testRule
case (towards the bottom of the file), which sets the custom syntax topostcss-less
astestRule
without syntax should only include vanilla CSS constructs.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.
👍 Sure, as soon as I have at least some time.