Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Commit ef7104a

Browse files
authored
feat(infrastructure): Add new test for style-lint during Travis-CI and local builds. (#27)
1 parent 301dbf1 commit ef7104a

File tree

3 files changed

+1094
-366
lines changed

3 files changed

+1094
-366
lines changed

.stylelint-config.yaml

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
extends: stylelint-config-standard
2+
ignoreFiles:
3+
- node_modules/**/*
4+
plugins:
5+
- stylelint-selector-bem-pattern
6+
- stylelint-scss
7+
- stylelint-order
8+
rules:
9+
# Follow best practices
10+
font-family-name-quotes: always-where-recommended
11+
# http://stackoverflow.com/questions/2168855/is-quoting-the-value-of-url-really-necessary
12+
function-url-quotes: never
13+
# https://www.w3.org/TR/selectors/#attribute-selectors
14+
# http://stackoverflow.com/q/3851091
15+
selector-attribute-quotes: always
16+
# Double-quotes are our convention throughout our codebase within (S)CSS. They also reflect how
17+
# attribute strings are normally quoted within the DOM.
18+
string-quotes: double
19+
# https://github.com/sasstools/sass-lint/blob/develop/lib/config/property-sort-orders/smacss.yml
20+
order/properties-order:
21+
- display
22+
- position
23+
- top
24+
- right
25+
- bottom
26+
- left
27+
28+
- flex
29+
- flex-basis
30+
- flex-direction
31+
- flex-flow
32+
- flex-grow
33+
- flex-shrink
34+
- flex-wrap
35+
- align-content
36+
- align-items
37+
- align-self
38+
- justify-content
39+
- order
40+
41+
- width
42+
- min-width
43+
- max-width
44+
45+
- height
46+
- min-height
47+
- max-height
48+
49+
- margin
50+
- margin-top
51+
- margin-right
52+
- margin-bottom
53+
- margin-left
54+
55+
- padding
56+
- padding-top
57+
- padding-right
58+
- padding-bottom
59+
- padding-left
60+
61+
- float
62+
- clear
63+
64+
- columns
65+
- column-gap
66+
- column-fill
67+
- column-rule
68+
- column-span
69+
- column-count
70+
- column-width
71+
72+
- transform
73+
- transform-box
74+
- transform-origin
75+
- transform-style
76+
77+
- transition
78+
- transition-delay
79+
- transition-duration
80+
- transition-property
81+
- transition-timing-function
82+
83+
# Border
84+
85+
- border
86+
- border-top
87+
- border-right
88+
- border-bottom
89+
- border-left
90+
- border-width
91+
- border-top-width
92+
- border-right-width
93+
- border-bottom-width
94+
- border-left-width
95+
96+
- border-style
97+
- border-top-style
98+
- border-right-style
99+
- border-bottom-style
100+
- border-left-style
101+
102+
- border-radius
103+
- border-top-left-radius
104+
- border-top-right-radius
105+
- border-bottom-left-radius
106+
- border-bottom-right-radius
107+
108+
- border-color
109+
- border-top-color
110+
- border-right-color
111+
- border-bottom-color
112+
- border-left-color
113+
114+
- outline
115+
- outline-color
116+
- outline-offset
117+
- outline-style
118+
- outline-width
119+
120+
# Background
121+
122+
- background
123+
- background-attachment
124+
- background-clip
125+
- background-color
126+
- background-image
127+
- background-repeat
128+
- background-position
129+
- background-size
130+
131+
# Text
132+
133+
- color
134+
135+
- font
136+
- font-family
137+
- font-size
138+
- font-smoothing
139+
- font-style
140+
- font-variant
141+
- font-weight
142+
143+
- letter-spacing
144+
- line-height
145+
- list-style
146+
147+
- text-align
148+
- text-decoration
149+
- text-indent
150+
- text-overflow
151+
- text-rendering
152+
- text-shadow
153+
- text-transform
154+
- text-wrap
155+
156+
- white-space
157+
- word-spacing
158+
159+
# Other
160+
161+
- border-collapse
162+
- border-spacing
163+
- box-shadow
164+
- caption-side
165+
- content
166+
- cursor
167+
- empty-cells
168+
- opacity
169+
- overflow
170+
- quotes
171+
- speak
172+
- table-layout
173+
- vertical-align
174+
- visibility
175+
- z-index
176+
declaration-property-unit-whitelist:
177+
font-size:
178+
- "rem"
179+
- "px"
180+
# The following prefix rules are enabled since we use autoprefixer
181+
at-rule-no-vendor-prefix: true
182+
media-feature-name-no-vendor-prefix: true
183+
selector-no-vendor-prefix: true
184+
value-no-vendor-prefix: true
185+
# Usually if you're nesting past 3 levels deep there's a problem
186+
max-nesting-depth: 3
187+
# Because we adhere to BEM we can limit the amount of necessary compound selectors. Most should
188+
# just be 1 level selector. However, modifiers can introduce an additional compound selector.
189+
# Futhermore, generic qualifying selectors (e.g. `[dir="rtl"]`) can introduce yet another level.
190+
selector-max-compound-selectors: 4
191+
# For specificity: disallow IDs (0). Allow for complex combinations of classes, pseudo-classes,
192+
# attribute modifiers based on selector-max-compound-selectors, plus an addition for
193+
# pseudo-classes (4). Allow for pseudo-elements (1).
194+
selector-max-specificity: 0,4,1
195+
# Disallow "@extend" in scss.
196+
# http://csswizardry.com/2016/02/mixins-better-for-performance/
197+
# http://vanseodesign.com/css/sass-mixin-or-extend/
198+
# Besides performance, @extend actually *changes* the selector precedence by creating a compound
199+
# selector, which can lead to ambiguous results.
200+
at-rule-blacklist:
201+
- extend
202+
# Extremely useful for typos, and anything emergent can be ignored by this rule
203+
property-no-unknown:
204+
- true
205+
- ignoreProperties:
206+
- contain
207+
# There is no reason that a specific ID would be needed for UI components
208+
selector-no-id: true
209+
# Qualifying types are not needed when using a naming system like BEM
210+
selector-no-qualifying-type: true
211+
# Styles for components should never need the universal selector.
212+
selector-no-universal: true
213+
# Names are more semantic than numbers
214+
font-weight-notation: named-where-possible
215+
# http://www.paulirish.com/2010/the-protocol-relative-url/
216+
function-url-no-scheme-relative: true
217+
# TODO: and FIXME: warnings are super useful because they remind us that we should address these
218+
# within our codebase
219+
comment-word-blacklist:
220+
-
221+
- /^TODO:/
222+
- /^FIXME:/
223+
- severity: warning
224+
# Part of google's style guide
225+
number-leading-zero: never
226+
227+
# We use Harry Roberts' BEM dialect as our preferred way to format classes.
228+
# See: http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/
229+
# See: https://github.com/postcss/postcss-bem-linter/blob/c59db3f/lib/preset-patterns.js#L39
230+
plugin/selector-bem-pattern:
231+
componentName: ^[a-z]+(?:-[a-z]+)*$
232+
# <namespace>-<block>__<element>*--<modifier>*[<attribute>]*
233+
componentSelectors: ^\.mdc?-{componentName}(?:__[a-z]+(?:-[a-z]+)*)*(?:--[a-z]+(?:-[a-z]+)*)*(?:\[.+\])*$
234+
ignoreSelectors:
235+
- ^fieldset
236+
- ^\[aria\-disabled=(?:.+)\]
237+
238+
# SCSS naming patterns, just like our CSS conventions above.
239+
# (note for $-vars we use a leading underscore for "private" variables)
240+
scss/dollar-variable-pattern:
241+
- ^_?mdc-.+
242+
-
243+
ignore: local
244+
scss/at-function-pattern: ^mdc-.+
245+
scss/at-mixin-pattern: ^mdc-.+
246+
# Prevents unneeded nesting selectors
247+
scss/selector-no-redundant-nesting-selector: true
248+
# Since leading underscores are not needed, they can be omitted
249+
scss/at-import-no-partial-leading-underscore: true
250+
# Since mixins are explicit (`@include`) and parens are unnecessary for argumentless mixins, they
251+
# can be omitted.
252+
scss/at-mixin-no-argumentless-call-parentheses: true

0 commit comments

Comments
 (0)