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

Handle multiline properties & update css list #1106

Merged
merged 4 commits into from
Aug 26, 2017

Conversation

DanPurdy
Copy link
Member

@DanPurdy DanPurdy commented Aug 26, 2017

Fixes issues with the no-misspelled-properties rule. It currently doesn't work very well with multiline properties and only does partial string matches without trying to understand the context which in turn means it would let spelling errors through.

e.g.

.foo {
  colors: ... // would pass because of -moz-border-bottom-COLORS being a real property
}

I've also moved away from our own maintained list of properties to a more coherent, full and more importantly maintained list known-css-properties. Any properties that aren't featured there can either be requested to be added there OR added to the extra properties setting of this rule. This will lead to a lot less frustration with our poorly maintained list.

fixes #1101
fixes #1024
fixes #1045
fixes #951
fixes #805
fixes #720
closes #1062
closes #767

I'll update the vendor prefixes rule on top of this too and then we can removed our properties file.
<DCO 1.1 Signed-off-by: Dan Purdy dan@dpurdy.me>

@DanPurdy DanPurdy self-assigned this Aug 26, 2017
@DanPurdy DanPurdy changed the title 🎨 handle multiline properties & update css list Handle multiline properties & update css list Aug 26, 2017
@DanPurdy DanPurdy force-pushed the feature/update-misspelled-properties branch from ec7e238 to ecc7d1b Compare August 26, 2017 02:11
@sasstools sasstools deleted a comment from coveralls Aug 26, 2017
@sasstools sasstools deleted a comment from coveralls Aug 26, 2017
Copy link
Member

@bgriffith bgriffith left a comment

Choose a reason for hiding this comment

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

Great move to use the maintained list of prop names 👍

}
else {
propList.push({
name: currentProperty.name + PROP_DIVIDER + prop.first('ident').content,
Copy link
Member

Choose a reason for hiding this comment

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

Could abstract this string generation instead of repeating it.

name: currentProperty.name + PROP_DIVIDER + prop.first('ident').content,
line: prop.first().start.line,
col: prop.first().start.column,
propsEncountered: propsEncountered
Copy link
Member

Choose a reason for hiding this comment

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

Wish we were using ES2015 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah... would be good. We can move up soon.

}
// If we have multiline properties
if (fullProperties.length) {
fullProperties.forEach(function (constrProp) {
Copy link
Member

Choose a reason for hiding this comment

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

What does constrProp mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

constructed property... I think 😄

// If we have multiline properties
if (fullProperties.length) {
fullProperties.forEach(function (constrProp) {
// Add the number of propertiy declarations we've already checked here so we can skip them
Copy link
Member

Choose a reason for hiding this comment

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

Typo - ...number of property...

});
}
else {
if (curProperty && curProperty.length > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Could combine the else if and just run with ...curProperty.length)

Copy link
Member Author

Choose a reason for hiding this comment

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

curProperty 'could' technically be undefined here. Would rather leave the check just in case as we don't wanna get length of undefined. Can remove the > 0 though as that's unnecessary

Copy link
Member

Choose a reason for hiding this comment

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

Aye, sorry the > 0 is what I was talking about 👍

@DanPurdy DanPurdy force-pushed the feature/update-misspelled-properties branch from ecc7d1b to 8a7f07e Compare August 26, 2017 23:14
@DanPurdy DanPurdy force-pushed the feature/update-misspelled-properties branch from 8a7f07e to d157eb8 Compare August 26, 2017 23:23
@sasstools sasstools deleted a comment from coveralls Aug 26, 2017
@sasstools sasstools deleted a comment from coveralls Aug 26, 2017
@sasstools sasstools deleted a comment from coveralls Aug 26, 2017
@coveralls
Copy link

coveralls commented Aug 26, 2017

Coverage Status

Coverage decreased (-0.009%) to 97.506% when pulling d157eb8 on feature/update-misspelled-properties into ebbc426 on develop.

@DanPurdy DanPurdy merged commit aefde6e into develop Aug 26, 2017
@DanPurdy DanPurdy deleted the feature/update-misspelled-properties branch August 26, 2017 23:30
@OriR OriR mentioned this pull request Aug 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment