scss_beautifier 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +32 -0
- data/LICENSE.txt +21 -0
- data/README.md +31 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/data/default_config.yml +49 -0
- data/data/pseudo_elements.txt +97 -0
- data/exe/scss-beautify +6 -0
- data/lib/scss_beautifier.rb +35 -0
- data/lib/scss_beautifier/cli.rb +20 -0
- data/lib/scss_beautifier/config.rb +21 -0
- data/lib/scss_beautifier/convert.rb +31 -0
- data/lib/scss_beautifier/formatters/bang_format.rb +21 -0
- data/lib/scss_beautifier/formatters/border_zero.rb +22 -0
- data/lib/scss_beautifier/formatters/color.rb +24 -0
- data/lib/scss_beautifier/formatters/comment.rb +17 -0
- data/lib/scss_beautifier/formatters/debug.rb +8 -0
- data/lib/scss_beautifier/formatters/declaration_order.rb +23 -0
- data/lib/scss_beautifier/formatters/empty_rule.rb +19 -0
- data/lib/scss_beautifier/formatters/leading_zero.rb +12 -0
- data/lib/scss_beautifier/formatters/name_format.rb +45 -0
- data/lib/scss_beautifier/formatters/property_sort_order.rb +23 -0
- data/lib/scss_beautifier/formatters/pseudo_element.rb +20 -0
- data/lib/scss_beautifier/formatters/qualifying_element.rb +14 -0
- data/lib/scss_beautifier/formatters/selector.rb +8 -0
- data/lib/scss_beautifier/formatters/shorthand.rb +112 -0
- data/lib/scss_beautifier/formatters/string_quotes.rb +33 -0
- data/lib/scss_beautifier/formatters/trailing_zero.rb +24 -0
- data/lib/scss_beautifier/options.rb +94 -0
- data/lib/scss_beautifier/version.rb +3 -0
- data/scss_beautifier.gemspec +28 -0
- data/tmp/bang.scss +3 -0
- data/tmp/border0.scss +3 -0
- data/tmp/colorkeyword.scss +3 -0
- data/tmp/colorshort.scss +3 -0
- data/tmp/comments.scss +5 -0
- data/tmp/debug.scss +4 -0
- data/tmp/declarationorder.scss +31 -0
- data/tmp/dump.mdown +63 -0
- data/tmp/elseplacement.scss +18 -0
- data/tmp/empty.scss +3 -0
- data/tmp/leadingzero.scss +17 -0
- data/tmp/nameformat.scss +30 -0
- data/tmp/pm.scss +228 -0
- data/tmp/pm2.scss +235 -0
- data/tmp/propertysortorder.scss +19 -0
- data/tmp/pseudoelement.scss +13 -0
- data/tmp/qualifyingelement.scss +23 -0
- data/tmp/selectors.scss +3 -0
- data/tmp/shorthand.scss +15 -0
- data/tmp/string_quotes.scss +12 -0
- data/tmp/test.scss +1 -0
- data/tmp/test2.scss +35 -0
- data/tmp/trailing_zero.scss +15 -0
- metadata +176 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
require "optparse"
|
2
|
+
|
3
|
+
module Lintrunner
|
4
|
+
class Options
|
5
|
+
|
6
|
+
attr_reader :options
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@options = {}
|
10
|
+
@option_parser = OptionParser.new do |opts|
|
11
|
+
add_banner(opts)
|
12
|
+
add_config_option(opts)
|
13
|
+
add_context_option(opts)
|
14
|
+
add_include_path_option(opts)
|
15
|
+
add_reporter_option(opts)
|
16
|
+
add_ignore_option(opts)
|
17
|
+
add_colorize_option(opts)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def parse(args)
|
22
|
+
@option_parser.parse!(args)
|
23
|
+
add_defaults
|
24
|
+
options[:path] = args.first if args.first
|
25
|
+
options
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def add_defaults
|
31
|
+
options[:config] ||= ".lintrunner_config"
|
32
|
+
options[:context] ||= Dir.pwd
|
33
|
+
options[:include_paths] = Array(options[:include_paths]) << options[:context]
|
34
|
+
options[:include_paths].uniq!
|
35
|
+
options[:reporter] ||= "text"
|
36
|
+
options[:path] = Dir.pwd
|
37
|
+
options[:ignore] ||= []
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_banner(opts)
|
41
|
+
opts.banner = unindent(<<-BANNER)
|
42
|
+
Run multiple linters with various runners
|
43
|
+
Usage: #{opts.program_name} [options] [path]
|
44
|
+
BANNER
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_config_option(opts)
|
48
|
+
message = "the configuration file for lintrunner (default: .lintrunner_config)"
|
49
|
+
opts.on("-c", "--config config", message, String) do |config|
|
50
|
+
self.options[:config] = config
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_context_option(opts)
|
55
|
+
message = "the path on which lintrunner will execute in (default: current path)"
|
56
|
+
opts.on("-x", "--context path", message, String) do |path|
|
57
|
+
self.options[:context] = Pathname.new(path).realpath.to_s
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_include_path_option(opts)
|
62
|
+
message = "the paths to add to load paths (the context is in the load path)"
|
63
|
+
opts.on("--include_path path1,...", message, Array) do |paths|
|
64
|
+
self.options[:include_paths] = paths
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_reporter_option(opts)
|
69
|
+
message = "the reporter that lintrunner uses to report results"
|
70
|
+
opts.on("--reporter reporter", message, String) do |reporter|
|
71
|
+
self.options[:reporter] = reporter
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def add_ignore_option(opts)
|
76
|
+
message = "the messages to ignore for this lintrunner execution"
|
77
|
+
opts.on("--ignore messages", message, Array) do |messages|
|
78
|
+
self.options[:ignore] = messages
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def add_colorize_option(opts)
|
83
|
+
message = "force colorized setting for output"
|
84
|
+
opts.on("--colorize", "--[no-]colorize", message) do |bool|
|
85
|
+
Rainbow.enabled = bool
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def unindent(str)
|
90
|
+
str.gsub(/^#{str.scan(/^[ ]+(?=\S)/).min}/, "")
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'scss_beautifier/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "scss_beautifier"
|
8
|
+
spec.version = SCSSBeautifier::VERSION
|
9
|
+
spec.authors = ["Ivan Tse", "Joe Natalzia"]
|
10
|
+
spec.email = ["ivan.tse1@gmail.com", "jnatalzia@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Beautify your SCSS code}
|
13
|
+
spec.description = %q{Transforms SCSS code to have consistent formatting}
|
14
|
+
spec.homepage = "https://github.com/paperlesspost/scss-beautifier"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "sass", "~> 3.4"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
end
|
data/tmp/bang.scss
ADDED
data/tmp/border0.scss
ADDED
data/tmp/colorshort.scss
ADDED
data/tmp/comments.scss
ADDED
data/tmp/debug.scss
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
.declaration-order {
|
2
|
+
color: $brown;
|
3
|
+
font-size: 15px;
|
4
|
+
|
5
|
+
@include breakpoint($fullscreen);
|
6
|
+
@include box-shadow(10px);
|
7
|
+
|
8
|
+
@extend %placeholder;
|
9
|
+
|
10
|
+
.rule {
|
11
|
+
color: $charcoal;
|
12
|
+
|
13
|
+
@extend %placeholder;
|
14
|
+
@extend %placeholder-2;
|
15
|
+
|
16
|
+
.nested-one-more {
|
17
|
+
@include box-shadow(10px);
|
18
|
+
|
19
|
+
color: $brown;
|
20
|
+
font-size: 15px;
|
21
|
+
|
22
|
+
@include breakpoint($fullscreen);
|
23
|
+
|
24
|
+
@extend %placeholder;
|
25
|
+
}
|
26
|
+
|
27
|
+
transition: transform .5s ease;
|
28
|
+
}
|
29
|
+
|
30
|
+
@extend %something;
|
31
|
+
}
|
data/tmp/dump.mdown
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
BangFormat
|
2
|
+
BorderZero
|
3
|
+
Comment
|
4
|
+
DebugStatement
|
5
|
+
EmptyRule
|
6
|
+
ColorKeyword
|
7
|
+
HexLength
|
8
|
+
HexNotation
|
9
|
+
SingleLinePerSelector
|
10
|
+
DeclarationOrder
|
11
|
+
ElsePlacement
|
12
|
+
LeadingZero
|
13
|
+
NameFormat ?
|
14
|
+
PropertySortOrder # TODO - Respect custom ordering rules
|
15
|
+
PseudoElement
|
16
|
+
QualifyingElement
|
17
|
+
Shorthand
|
18
|
+
StringQuotes
|
19
|
+
TrailingZero
|
20
|
+
|
21
|
+
|
22
|
+
UnnecessaryMantissa
|
23
|
+
UnnecessaryParentReference
|
24
|
+
UrlFormat
|
25
|
+
UrlQuotes
|
26
|
+
ZeroUnit
|
27
|
+
ImportPath
|
28
|
+
PropertySpelling
|
29
|
+
SelectorFormat
|
30
|
+
PrivateNamingConvention ?
|
31
|
+
SpaceAfterComment
|
32
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/attribute-quotes.md
|
33
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/brace-style.md - interesting (allow single line?)
|
34
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/class-name-format.md
|
35
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/empty-args.md
|
36
|
+
|
37
|
+
whoa never seen these rules
|
38
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/force-attribute-nesting.md
|
39
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/force-element-nesting.md
|
40
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/force-pseudo-nesting.md
|
41
|
+
|
42
|
+
Are these the same as NameFormat ?
|
43
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/function-name-format.md
|
44
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/id-name-format.md
|
45
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/mixin-name-format.md
|
46
|
+
|
47
|
+
https://github.com/sasstools/sass-lint/blob/master/docs/rules/no-warn.md
|
48
|
+
|
49
|
+
|
50
|
+
EmptyLineBetweenBlocks
|
51
|
+
SpaceAroundOperator
|
52
|
+
Indentation
|
53
|
+
FinalNewline
|
54
|
+
SingleLinePerProperty
|
55
|
+
SpaceAfterComma
|
56
|
+
SpaceAfterPropertyColon
|
57
|
+
SpaceAfterPropertyName
|
58
|
+
SpaceAfterVariableColon
|
59
|
+
SpaceAfterVariableName
|
60
|
+
SpaceBeforeBrace
|
61
|
+
SpaceBetweenParens
|
62
|
+
TrailingSemicolon
|
63
|
+
TrailingWhitespace
|
data/tmp/empty.scss
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
.test {
|
2
|
+
margin: 0.5em;
|
3
|
+
padding: .25em;
|
4
|
+
padding: 1em 2em 0.5em 2em;
|
5
|
+
|
6
|
+
.test2 {
|
7
|
+
margin: 0.5em;
|
8
|
+
padding: .25em;
|
9
|
+
padding: 1em 2em 0.5em 2em;
|
10
|
+
}
|
11
|
+
|
12
|
+
@include breakpoint($full) {
|
13
|
+
margin: 0.5em;
|
14
|
+
padding: .25em;
|
15
|
+
padding: 1em 2em 0.5em 2em;
|
16
|
+
}
|
17
|
+
}
|
data/tmp/nameformat.scss
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
@mixin myMixin1() {
|
2
|
+
color: $black;
|
3
|
+
}
|
4
|
+
|
5
|
+
@mixin my-mixin2() {
|
6
|
+
color: $black;
|
7
|
+
}
|
8
|
+
|
9
|
+
$someVar1: 'test';
|
10
|
+
$some-var2: 'test';
|
11
|
+
|
12
|
+
%placeholderOne1 {
|
13
|
+
color: $black;
|
14
|
+
}
|
15
|
+
|
16
|
+
%placeholder-one2 {
|
17
|
+
color: $black;
|
18
|
+
}
|
19
|
+
|
20
|
+
@function testFunc1($c) {
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
@function test-func2($c) {
|
25
|
+
|
26
|
+
}
|
27
|
+
|
28
|
+
@function test_func3($c) {
|
29
|
+
|
30
|
+
}
|
data/tmp/pm.scss
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
// override styles for typeahead
|
2
|
+
ul.private-message-dropdown-menu {
|
3
|
+
border: none;
|
4
|
+
display: none;
|
5
|
+
list-style-position: outside;
|
6
|
+
list-style: none;
|
7
|
+
overflow-y: auto;
|
8
|
+
padding: 0 0 5px 0;
|
9
|
+
position: absolute;
|
10
|
+
width: 100%;
|
11
|
+
z-index: 1000;
|
12
|
+
@include calc( height, '100% - 350px');
|
13
|
+
@include scrollbar($alto, rgba(0, 0, 0, 0));
|
14
|
+
|
15
|
+
li {
|
16
|
+
cursor: pointer;
|
17
|
+
border-bottom: 1px solid $alto;
|
18
|
+
display: list-item;
|
19
|
+
margin: 0;
|
20
|
+
overflow: hidden;
|
21
|
+
padding: 12px;
|
22
|
+
|
23
|
+
a {
|
24
|
+
color: $charcoal;
|
25
|
+
font-size: 16px;
|
26
|
+
|
27
|
+
strong {
|
28
|
+
font-weight: normal;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
&.active {
|
33
|
+
background-color: $alabaster;
|
34
|
+
|
35
|
+
a {
|
36
|
+
color: $driftwood;
|
37
|
+
text-decoration: none;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
// Private message write a message form
|
44
|
+
.write-a-message-form {
|
45
|
+
background: $white;
|
46
|
+
bottom: 20px;
|
47
|
+
position: absolute;
|
48
|
+
@include calc( width, '100% - 40px');
|
49
|
+
}
|
50
|
+
|
51
|
+
// Private Message pane that holds the conversation (right pane)
|
52
|
+
.conversation {
|
53
|
+
padding-bottom: 90px;
|
54
|
+
position: relative;
|
55
|
+
|
56
|
+
// Each message
|
57
|
+
.convo {
|
58
|
+
font-size: 16px;
|
59
|
+
padding: 15px 20px;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
// Private message conversation list (right pane)
|
64
|
+
.private_messages {
|
65
|
+
overflow-x: hidden!important;
|
66
|
+
overflow-y: scroll !important;
|
67
|
+
padding: 30px 0 0 0;
|
68
|
+
@include calc( height, '100% - 192px');
|
69
|
+
@include scrollbar($alto, rgba(0, 0, 0, 0));
|
70
|
+
|
71
|
+
&::-webkit-scrollbar-thumb {
|
72
|
+
border: 0;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
// Private message conversation list div (left pane)
|
77
|
+
.conversation-list-wrapper {
|
78
|
+
@include scrollbar($alto, rgba(0, 0, 0, 0));
|
79
|
+
}
|
80
|
+
|
81
|
+
// The date dividers in Private message conversation
|
82
|
+
.divider {
|
83
|
+
text-align: center ! important;
|
84
|
+
|
85
|
+
.divider-time {
|
86
|
+
background: $white;
|
87
|
+
color: $silver;
|
88
|
+
font-size: 14px;
|
89
|
+
margin: 0 auto;
|
90
|
+
position: relative;
|
91
|
+
width: 150px;
|
92
|
+
z-index: 1;
|
93
|
+
}
|
94
|
+
|
95
|
+
.divider__fade{
|
96
|
+
border: none;
|
97
|
+
height: auto;
|
98
|
+
position: relative;
|
99
|
+
|
100
|
+
&:after{
|
101
|
+
bottom: 7px;
|
102
|
+
content: "";
|
103
|
+
height: 1px;
|
104
|
+
left: 0;
|
105
|
+
position: absolute;
|
106
|
+
right: 0px;
|
107
|
+
@include background-image(linear-gradient(left, transparent -6%, $alto, transparent 110%));
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
// CTA when user is logged out and trying to view PM page
|
113
|
+
.blocked-cta {
|
114
|
+
font-size: 1.30em;
|
115
|
+
margin: 20px 0;
|
116
|
+
text-align: center;
|
117
|
+
|
118
|
+
a:active,
|
119
|
+
a:link,
|
120
|
+
a:hover,
|
121
|
+
a:visited {
|
122
|
+
color: $driftwood;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
// Host reciever name is special
|
127
|
+
.host .receiver-name {
|
128
|
+
color: $driftwood;
|
129
|
+
}
|
130
|
+
|
131
|
+
// state of the partner
|
132
|
+
.state {
|
133
|
+
font-style: italic;
|
134
|
+
margin-left: 5px;
|
135
|
+
text-transform: capitalize;
|
136
|
+
|
137
|
+
&.state-attending {
|
138
|
+
color: $light_green;
|
139
|
+
}
|
140
|
+
|
141
|
+
&.state-regrets {
|
142
|
+
color: $cornflower;
|
143
|
+
}
|
144
|
+
|
145
|
+
&.state-added,
|
146
|
+
&.state-new,
|
147
|
+
&.state-opened,
|
148
|
+
&.state-registered,
|
149
|
+
&.state-undeliverable {
|
150
|
+
color: $white;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
.pvt-msg__submit {
|
155
|
+
float: right;
|
156
|
+
margin-top: 10px;
|
157
|
+
}
|
158
|
+
|
159
|
+
// Write a message form that pertains to a particuliar guest (as opposed to New Recipient view)
|
160
|
+
.guest-message-form {
|
161
|
+
margin: 0;
|
162
|
+
|
163
|
+
span {
|
164
|
+
display: inline-block;
|
165
|
+
font-size: 16px;
|
166
|
+
position: absolute;
|
167
|
+
vertical-align: top;
|
168
|
+
}
|
169
|
+
|
170
|
+
.search-icon {
|
171
|
+
position: absolute;
|
172
|
+
right: 30px;
|
173
|
+
|
174
|
+
.svg-search {
|
175
|
+
fill: $alto;
|
176
|
+
height: 18px;
|
177
|
+
width: 18px;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
textarea {
|
182
|
+
overflow-y: hidden;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
// Search for name input
|
187
|
+
.new-recipient {
|
188
|
+
border: 0;
|
189
|
+
border-bottom: 1px solid $alto;
|
190
|
+
font-size: 16px;
|
191
|
+
height: 40px;
|
192
|
+
line-height: 1em;
|
193
|
+
margin-top: 0;
|
194
|
+
padding: 0 0 19px 30px;
|
195
|
+
width: 100%;
|
196
|
+
@include input-placeholder {
|
197
|
+
padding: 0 0 0 1px;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
// override for signup/login modals
|
202
|
+
.ui-modal .pane {
|
203
|
+
padding: 0;
|
204
|
+
}
|
205
|
+
|
206
|
+
@include breakpoint($fullscreen) {
|
207
|
+
|
208
|
+
// Private message write a message form
|
209
|
+
.write-a-message-form {
|
210
|
+
width: 400px;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
|
214
|
+
.pvt-msg__header-name {
|
215
|
+
border-bottom: solid 4px transparent;
|
216
|
+
color: $charcoal;
|
217
|
+
display: block;
|
218
|
+
font-size: 13px;
|
219
|
+
letter-spacing: 0.15em;
|
220
|
+
line-height: 1.5em;
|
221
|
+
margin: 25px auto 0;
|
222
|
+
min-height: 38px;
|
223
|
+
padding: 0 7px 18px;
|
224
|
+
position: relative;
|
225
|
+
text-transform: uppercase;
|
226
|
+
width: 70%;
|
227
|
+
word-wrap: break-word;
|
228
|
+
}
|