@entva/styleguide 0.0.0 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -77
- package/package.json +29 -6
- package/.github/workflows/ci.yml +0 -14
- package/css/README.md +0 -385
- package/css/packages/stylelint/LICENSE +0 -21
- package/css/packages/stylelint/README.md +0 -27
- package/css/packages/stylelint/eslint.config.js +0 -3
- package/css/packages/stylelint/index.js +0 -84
- package/css/packages/stylelint/package-lock.json +0 -4042
- package/css/packages/stylelint/package.json +0 -42
- package/html/README.md +0 -98
- package/javascript/README.md +0 -3255
- package/javascript/packages/eslint-base/LICENSE +0 -21
- package/javascript/packages/eslint-base/README.md +0 -27
- package/javascript/packages/eslint-base/eslint.config.js +0 -3
- package/javascript/packages/eslint-base/index.js +0 -1084
- package/javascript/packages/eslint-base/package-lock.json +0 -2653
- package/javascript/packages/eslint-base/package.json +0 -36
- package/javascript/packages/eslint-react/LICENSE +0 -21
- package/javascript/packages/eslint-react/README.md +0 -27
- package/javascript/packages/eslint-react/eslint.config.js +0 -3
- package/javascript/packages/eslint-react/index.js +0 -526
- package/javascript/packages/eslint-react/package-lock.json +0 -3035
- package/javascript/packages/eslint-react/package.json +0 -42
- package/react/README.md +0 -726
- package/scripts/for-each-package +0 -12
- package/test/css.js +0 -36
- package/test/index.js +0 -7
- package/test/js.js +0 -35
- package/test/utils.js +0 -63
- package/tooling/packages/biome/LICENSE +0 -21
- package/tooling/packages/biome/README.md +0 -27
- package/tooling/packages/biome/package-lock.json +0 -183
- package/tooling/packages/biome/package.json +0 -38
- package/tsconfig.json +0 -31
- package/typescript/README.md +0 -66
- package/typescript/packages/eslint-typescript-base/LICENSE +0 -21
- package/typescript/packages/eslint-typescript-base/README.md +0 -27
- package/typescript/packages/eslint-typescript-base/eslint.config.js +0 -3
- package/typescript/packages/eslint-typescript-base/index.js +0 -272
- package/typescript/packages/eslint-typescript-base/package-lock.json +0 -3215
- package/typescript/packages/eslint-typescript-base/package.json +0 -41
- package/typescript/packages/eslint-typescript-base/tsconfig.json +0 -30
- package/typescript/packages/eslint-typescript-react/LICENSE +0 -21
- package/typescript/packages/eslint-typescript-react/README.md +0 -27
- package/typescript/packages/eslint-typescript-react/eslint.config.js +0 -3
- package/typescript/packages/eslint-typescript-react/index.js +0 -75
- package/typescript/packages/eslint-typescript-react/package-lock.json +0 -3630
- package/typescript/packages/eslint-typescript-react/package.json +0 -41
- package/typescript/packages/eslint-typescript-react/tsconfig.json +0 -30
- /package/{tooling/packages/biome/biome.json → biome.json} +0 -0
package/README.md
CHANGED
|
@@ -1,88 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# eslint-config-entva-typescript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Shareable entva typescript styleguide config for eslint.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Extends [`eslint-config-airbnb-typescript`](https://github.com/iamturns/eslint-config-airbnb-typescript).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- [TypeScript](typescript/README.md)
|
|
9
|
-
- [React](react/README.md)
|
|
10
|
-
- [CSS](css/README.md)
|
|
11
|
-
- [HTML](html/README.md)
|
|
7
|
+
A shareable config to enforce entva styleguide: https://github.com/entva/styleguide
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
To see the rules that this config uses, please read the [config itself](./index.js).
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
## Installation
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- [Maximum Line Length](#maximum-line-length)
|
|
20
|
-
- [Blank Lines](#blank-lines)
|
|
21
|
-
- [Trailing Whitespace](#trailing-whitespace)
|
|
22
|
-
- [Encoding](#encoding)
|
|
23
|
-
- [Naming Conventions](#naming-conventions)
|
|
24
|
-
- [Annotations](#annotations)
|
|
25
|
-
|
|
26
|
-
## Tabs or Spaces?
|
|
27
|
-
|
|
28
|
-
Use **spaces only**, with **2 spaces** per indentation level. Never mix tabs and spaces.
|
|
29
|
-
|
|
30
|
-
**[⬆ back to top](#table-of-contents)**
|
|
31
|
-
|
|
32
|
-
## Maximum Line Length
|
|
33
|
-
|
|
34
|
-
Limit all lines to a maximum of 100 characters. Going over the limit is tolerated, but frowned upon. Please try to avoid it.
|
|
35
|
-
|
|
36
|
-
**[⬆ back to top](#table-of-contents)**
|
|
37
|
-
|
|
38
|
-
## Blank Lines
|
|
39
|
-
|
|
40
|
-
Separate top-level function and class definitions with a single blank line.
|
|
41
|
-
|
|
42
|
-
Separate method definitions inside of a class with a single blank line.
|
|
43
|
-
|
|
44
|
-
Use a single blank line within the bodies of methods or functions in cases where this improves readability (e.g., for the purpose of delineating logical sections).
|
|
45
|
-
|
|
46
|
-
**[⬆ back to top](#table-of-contents)**
|
|
47
|
-
|
|
48
|
-
## Trailing Whitespace
|
|
49
|
-
|
|
50
|
-
Do not leave trailing whitespaces. Use plugins to highlight that for you.
|
|
51
|
-
|
|
52
|
-
## Encoding
|
|
53
|
-
|
|
54
|
-
UTF-8 is the source file encoding.
|
|
55
|
-
|
|
56
|
-
**[⬆ back to top](#table-of-contents)**
|
|
57
|
-
|
|
58
|
-
## Annotations
|
|
59
|
-
|
|
60
|
-
Use annotations when necessary to describe a specific action that must be taken against the indicated block of code.
|
|
61
|
-
|
|
62
|
-
Write the annotation on the line immediately above the code that the annotation is describing.
|
|
63
|
-
|
|
64
|
-
The annotation keyword should be followed by a colon and a space, and a descriptive note.
|
|
65
|
-
|
|
66
|
-
```javascript
|
|
67
|
-
// FIXME: The client's current state should *not* affect payload processing.
|
|
68
|
-
resetClientState();
|
|
69
|
-
processPayload();
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
If multiple lines are required by the description, indent subsequent lines to match the text offset:
|
|
73
|
-
|
|
74
|
-
```javascript
|
|
75
|
-
// TODO: Ensure that the value returned by this call falls within a certain
|
|
76
|
-
// range, or throw an exception.
|
|
77
|
-
analyze();
|
|
13
|
+
```bash
|
|
14
|
+
npm install eslint-config-entva-typescript --save-dev
|
|
78
15
|
```
|
|
79
16
|
|
|
80
|
-
|
|
17
|
+
## Usage
|
|
81
18
|
|
|
82
|
-
|
|
83
|
-
- `FIXME`: describe broken code that must be fixed
|
|
84
|
-
- `REVIEW`: describe code that should be reviewed to confirm implementation
|
|
19
|
+
If you've installed `eslint-config-entva-typescript` locally within your project, just set your `eslint` config to:
|
|
85
20
|
|
|
86
|
-
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"extends": "eslint-config-entva-typescript"
|
|
24
|
+
}
|
|
25
|
+
```
|
|
87
26
|
|
|
88
|
-
|
|
27
|
+
## [MIT License](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entva/styleguide",
|
|
3
|
+
"description": "Shareable styleguide config for biome",
|
|
3
4
|
"author": "Max Degterev <max@degterev.me>",
|
|
4
|
-
"version": "0.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"readmeFilename": "README.md",
|
|
7
|
-
"repository":
|
|
8
|
-
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/entva/styleguide"
|
|
10
|
+
},
|
|
11
|
+
"bugs": "https://github.com/entva/styleguide/issues",
|
|
12
|
+
"version": "2.30.0",
|
|
13
|
+
"keywords": [
|
|
14
|
+
"linter",
|
|
15
|
+
"config",
|
|
16
|
+
"eslint",
|
|
17
|
+
"biome",
|
|
18
|
+
"styleguide",
|
|
19
|
+
"typescript"
|
|
20
|
+
],
|
|
21
|
+
"files": [
|
|
22
|
+
"biome.json"
|
|
23
|
+
],
|
|
9
24
|
"type": "module",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./biome": "./biome.json"
|
|
27
|
+
},
|
|
10
28
|
"scripts": {
|
|
11
|
-
"
|
|
12
|
-
"test": "
|
|
13
|
-
|
|
29
|
+
"reinstall": "rm -rf node_modules package-lock.json && npm install",
|
|
30
|
+
"test": "echo \"Not supported by Biome\" && exit 0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@biomejs/biome": "^2.1.4"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@biomejs/biome": "^2.x.x"
|
|
14
37
|
}
|
|
15
38
|
}
|
package/.github/workflows/ci.yml
DELETED
package/css/README.md
DELETED
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
# CSS / Sass / CSS Modules / CSS in JS Styleguide
|
|
2
|
-
|
|
3
|
-
*A mostly reasonable approach to CSS*
|
|
4
|
-
|
|
5
|
-
When you don't know if you can use a certain way of styling, see [https://caniuse.com](https://caniuse.com) to check. Sass language reference: [https://sass-lang.com/](https://sass-lang.com/). What are CSS Modules: [CSS Modules documentation](https://github.com/css-modules/css-modules). Same rules apply for CSS in JS (Styled Components, Emotion) as well.
|
|
6
|
-
|
|
7
|
-
## Table of Contents
|
|
8
|
-
|
|
9
|
-
1. [Terminology](#terminology)
|
|
10
|
-
- [Rule Declaration](#rule-declaration)
|
|
11
|
-
- [Selectors](#selectors)
|
|
12
|
-
- [Properties](#properties)
|
|
13
|
-
1. [CSS](#css)
|
|
14
|
-
- [Formatting](#formatting)
|
|
15
|
-
- [Comments](#comments)
|
|
16
|
-
- [ID Selectors](#id-selectors)
|
|
17
|
-
1. [Sass](#sass)
|
|
18
|
-
- [Syntax](#syntax)
|
|
19
|
-
- [Ordering](#ordering-of-property-declarations)
|
|
20
|
-
- [Variables](#variables)
|
|
21
|
-
- [Mixins](#mixins)
|
|
22
|
-
- [Extend directive](#extend-directive)
|
|
23
|
-
- [Nested selectors](#nested-selectors)
|
|
24
|
-
- [Naming conventions](#naming-conventions)
|
|
25
|
-
- [Units](#units)
|
|
26
|
-
- [Vendor Prefixes](#vendor-prefixes)
|
|
27
|
-
- [Strings](#strings)
|
|
28
|
-
- [Numbers](#numbers)
|
|
29
|
-
- [Calculations](#calculations)
|
|
30
|
-
- [Colors](#colors)
|
|
31
|
-
- [Imports](#imports)
|
|
32
|
-
- [Extend](#extend)
|
|
33
|
-
- [Functions](#functions)
|
|
34
|
-
1. [CSS Modules](#css-modules)
|
|
35
|
-
|
|
36
|
-
## Terminology
|
|
37
|
-
|
|
38
|
-
### Rule declaration
|
|
39
|
-
|
|
40
|
-
A “rule declaration” is the name given to a selector (or a group of selectors) with an accompanying group of properties. Here's an example:
|
|
41
|
-
|
|
42
|
-
```css
|
|
43
|
-
.listing {
|
|
44
|
-
font-size: 18px;
|
|
45
|
-
line-height: 1.2;
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Selectors
|
|
50
|
-
|
|
51
|
-
In a rule declaration, “selectors” are the bits that determine which elements in the DOM tree will be styled by the defined properties. Selectors can match HTML elements, as well as an element's class, ID, or any of its attributes. Here are some examples of selectors:
|
|
52
|
-
|
|
53
|
-
```css
|
|
54
|
-
.my-element-class {
|
|
55
|
-
/* ... */
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
[aria-hidden] {
|
|
59
|
-
/* ... */
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Properties
|
|
64
|
-
|
|
65
|
-
Finally, properties are what give the selected elements of a rule declaration their style. Properties are key-value pairs, and a rule declaration can contain one or more property declarations. Property declarations look like this:
|
|
66
|
-
|
|
67
|
-
```css
|
|
68
|
-
/* some selector */ {
|
|
69
|
-
background: #f1f1f1;
|
|
70
|
-
color: #333;
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**[⬆ back to top](#table-of-contents)**
|
|
75
|
-
|
|
76
|
-
## CSS
|
|
77
|
-
|
|
78
|
-
### Formatting
|
|
79
|
-
|
|
80
|
-
* Use soft tabs (2 spaces) for indentation.
|
|
81
|
-
* Use camelCase in class names (see [CSS Modules](#css-modules)).
|
|
82
|
-
- Use dashes outside of CSS modules
|
|
83
|
-
* Do not use ID selectors.
|
|
84
|
-
* When using multiple selectors in a rule declaration, give each selector its own line.
|
|
85
|
-
* Put a space before the opening brace `{` in rule declarations.
|
|
86
|
-
* In properties, put a space after, but not before, the `:` character.
|
|
87
|
-
* Put closing braces `}` of rule declarations on a new line.
|
|
88
|
-
* Put blank lines between rule declarations.
|
|
89
|
-
|
|
90
|
-
**Bad**
|
|
91
|
-
|
|
92
|
-
```css
|
|
93
|
-
.avatar{
|
|
94
|
-
border-radius:50%;
|
|
95
|
-
border:2px solid white; }
|
|
96
|
-
.no, .nope, .not_good {
|
|
97
|
-
// ...
|
|
98
|
-
}
|
|
99
|
-
#lol-no {
|
|
100
|
-
// ...
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Good**
|
|
105
|
-
|
|
106
|
-
```css
|
|
107
|
-
.avatar {
|
|
108
|
-
border-radius: 50%;
|
|
109
|
-
border: 2px solid white;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.one,
|
|
113
|
-
.selector,
|
|
114
|
-
.per-line {
|
|
115
|
-
// ...
|
|
116
|
-
}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### Comments
|
|
120
|
-
|
|
121
|
-
* Prefer line comments (`//` in Sass-land) to block comments.
|
|
122
|
-
* Prefer comments on their own line. Avoid end-of-line comments.
|
|
123
|
-
* Write detailed comments for code that isn't self-documenting:
|
|
124
|
-
- Uses of z-index
|
|
125
|
-
- Compatibility or browser-specific hacks
|
|
126
|
-
|
|
127
|
-
### ID selectors
|
|
128
|
-
|
|
129
|
-
While it is possible to select elements by ID in CSS, it should generally be considered an anti-pattern. ID selectors introduce an unnecessarily high level of [specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity) to your rule declarations and they are not reusable.
|
|
130
|
-
|
|
131
|
-
For more on this subject, read [CSS Wizardry's article](http://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/) on dealing with specificity.
|
|
132
|
-
|
|
133
|
-
**[⬆ back to top](#table-of-contents)**
|
|
134
|
-
|
|
135
|
-
## Sass
|
|
136
|
-
|
|
137
|
-
### Syntax
|
|
138
|
-
|
|
139
|
-
* Use the `.scss` syntax, never the original `.sass` syntax
|
|
140
|
-
* Order your regular CSS and `@include` declarations logically (see below)
|
|
141
|
-
|
|
142
|
-
### Ordering of property declarations
|
|
143
|
-
|
|
144
|
-
1. Property declarations
|
|
145
|
-
|
|
146
|
-
List all standard property declarations, anything that isn't an `@include` or a nested selector.
|
|
147
|
-
|
|
148
|
-
```scss
|
|
149
|
-
.btn-green {
|
|
150
|
-
background: green;
|
|
151
|
-
font-weight: bold;
|
|
152
|
-
// ...
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
2. `@include` declarations
|
|
157
|
-
|
|
158
|
-
Grouping `@include`s at the beginning makes it easier to read the entire selector and allows to override parts of the mixin.
|
|
159
|
-
|
|
160
|
-
```scss
|
|
161
|
-
.btn-green {
|
|
162
|
-
@include transition(background 0.5s ease);
|
|
163
|
-
// ...
|
|
164
|
-
background: green;
|
|
165
|
-
font-weight: bold;
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
3. Nested selectors
|
|
170
|
-
|
|
171
|
-
Nested selectors, _if necessary_, go last, and nothing goes after them. Add whitespace between your rule declarations and nested selectors, as well as between adjacent nested selectors. Apply the same guidelines as above to your nested selectors.
|
|
172
|
-
|
|
173
|
-
```scss
|
|
174
|
-
.btn {
|
|
175
|
-
@include transition(background 0.5s ease);
|
|
176
|
-
|
|
177
|
-
background: green;
|
|
178
|
-
font-weight: bold;
|
|
179
|
-
|
|
180
|
-
.icon {
|
|
181
|
-
margin-right: 10px;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Variables
|
|
187
|
-
|
|
188
|
-
Prefer camelCased variable names (e.g. `$myVariable`) over snake_cased variable names. It is acceptable to prefix variable names that are intended to be used only within the same file with an underscore (e.g. `$_myVariable`).
|
|
189
|
-
|
|
190
|
-
### Mixins
|
|
191
|
-
|
|
192
|
-
Mixins should be used to DRY up your code, add clarity, or abstract complexity - in much the same way as well-named functions. Mixins that accept no arguments can be useful for this, but note that if you are not compressing your payload (e.g. gzip), this may contribute to unnecessary code duplication in the resulting styles.
|
|
193
|
-
|
|
194
|
-
### Extend directive
|
|
195
|
-
|
|
196
|
-
`@extend` should be avoided because it has unintuitive and potentially dangerous behavior, especially when used with nested selectors. Even extending top-level placeholder selectors can cause problems if the order of selectors ends up changing later (e.g. if they are in other files and the order the files are loaded shifts). Gzipping should handle most of the savings you would have gained by using `@extend`, and you can DRY up your stylesheets nicely with mixins.
|
|
197
|
-
|
|
198
|
-
### Nested selectors
|
|
199
|
-
|
|
200
|
-
**Do not nest selectors more than three levels deep!**
|
|
201
|
-
|
|
202
|
-
```scss
|
|
203
|
-
.page-container {
|
|
204
|
-
.content {
|
|
205
|
-
.profile {
|
|
206
|
-
// STOP!
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
When selectors become this long, you're likely writing CSS that is:
|
|
213
|
-
|
|
214
|
-
* Strongly coupled to the HTML (fragile) *—OR—*
|
|
215
|
-
* Overly specific (powerful) *—OR—*
|
|
216
|
-
* Not reusable
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
Again: **never nest ID selectors!**
|
|
220
|
-
|
|
221
|
-
If you must use an ID selector in the first place (and you should really try not to), they should never be nested. If you find yourself doing this, you need to revisit your markup, or figure out why such strong specificity is needed. If you are writing well formed HTML and CSS, you should **never** need to do this.
|
|
222
|
-
|
|
223
|
-
### Units
|
|
224
|
-
|
|
225
|
-
Use `px` for `font-size`, because it offers absolute control over text. Additionally, unit-less `line-height` is preferred because it does not inherit a percentage value of its parent element, but instead is based on a multiplier of the `font-size`.
|
|
226
|
-
|
|
227
|
-
When dealing with 0 omit units.
|
|
228
|
-
|
|
229
|
-
```scss
|
|
230
|
-
// bad
|
|
231
|
-
$length: 0em;
|
|
232
|
-
|
|
233
|
-
// good
|
|
234
|
-
$length: 0;
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Vendor Prefixes
|
|
238
|
-
Use autoprefixer instead of writing your own
|
|
239
|
-
|
|
240
|
-
```scss
|
|
241
|
-
// bad
|
|
242
|
-
-webkit-border-radius: 4px;
|
|
243
|
-
-moz-border-radius: 4px;
|
|
244
|
-
border-radius: 4px;
|
|
245
|
-
|
|
246
|
-
// good
|
|
247
|
-
border-radius: 4px;
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### Strings
|
|
251
|
-
|
|
252
|
-
URLs and font names should be quoted. Use single quotes (`''`) and not double quotes (`"`).
|
|
253
|
-
|
|
254
|
-
```scss
|
|
255
|
-
// bad
|
|
256
|
-
$fonts: "Helvetica Neue Light", "Helvetica", "Arial", sans-serif;
|
|
257
|
-
|
|
258
|
-
// bad
|
|
259
|
-
$fonts: Helvetica Neue Light, Helvetica, Arial, sans-serif;
|
|
260
|
-
|
|
261
|
-
// good
|
|
262
|
-
$fonts: 'Helvetica Neue Light', 'Helvetica', 'Arial', sans-serif;
|
|
263
|
-
|
|
264
|
-
// good
|
|
265
|
-
.foo {
|
|
266
|
-
background-image: url('/images/kittens.jpg');
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// bad
|
|
270
|
-
.foo {
|
|
271
|
-
background-image: url(/images/kittens.jpg);
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
### Numbers
|
|
276
|
-
|
|
277
|
-
Drop trailing and leading zeros before a decimal value when you can:
|
|
278
|
-
|
|
279
|
-
```scss
|
|
280
|
-
// bad
|
|
281
|
-
.foo {
|
|
282
|
-
padding: 2.0em;
|
|
283
|
-
opacity: 0.5;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// good
|
|
287
|
-
.foo {
|
|
288
|
-
padding: 2em;
|
|
289
|
-
opacity: .5;
|
|
290
|
-
}
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### Calculations
|
|
294
|
-
|
|
295
|
-
Top-level numeric calculations should always be wrapped in parentheses.
|
|
296
|
-
|
|
297
|
-
```scss
|
|
298
|
-
// bad
|
|
299
|
-
.foo {
|
|
300
|
-
width: 100% / 3;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// good
|
|
304
|
-
.foo {
|
|
305
|
-
width: (100% / 3);
|
|
306
|
-
}
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### Colors
|
|
310
|
-
|
|
311
|
-
In order to make colors as simple as they can be, respect the following order of preference for color formats:
|
|
312
|
-
|
|
313
|
-
1. Hexadecimal notation. Preferably lowercase and shortened when possible
|
|
314
|
-
2. RGB notation
|
|
315
|
-
|
|
316
|
-
When using HSL or RGB notation, always add a single space after a comma (,) and no space between parentheses ((, )) and content.
|
|
317
|
-
|
|
318
|
-
```scss
|
|
319
|
-
// bad
|
|
320
|
-
.foo {
|
|
321
|
-
color: red;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// bad
|
|
325
|
-
.foo {
|
|
326
|
-
color: #ff0000;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// bad
|
|
330
|
-
.foo {
|
|
331
|
-
color: rgba( 0,0,0,0.1 );
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// good
|
|
335
|
-
.foo {
|
|
336
|
-
color: #f00;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// good
|
|
340
|
-
.foo {
|
|
341
|
-
color: rgba(0, 0, 0, .1);
|
|
342
|
-
}
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
### Functions
|
|
346
|
-
|
|
347
|
-
We prefer using mixins over functions. If a function is absolutely necessary, document where it is used and why it wasn't possible to create a mixin.
|
|
348
|
-
|
|
349
|
-
**[⬆ back to top](#table-of-contents)**
|
|
350
|
-
|
|
351
|
-
## CSS Modules
|
|
352
|
-
|
|
353
|
-
- Prefer using CSS Modules over global css code
|
|
354
|
-
- Use camelCase for class names
|
|
355
|
-
- Use simple class and variable names since both are scoped to the module
|
|
356
|
-
- Always use `.module.css` or `.module.scss` extension
|
|
357
|
-
- Do not expect any scss variables or mixins to be defined. You have to import them yourself.
|
|
358
|
-
- Use Sass whenever possible over similar CSS module functionality (composition, variables, import)
|
|
359
|
-
- CSS or Sass specific rules still apply (CSS Modules rules take precedence)
|
|
360
|
-
|
|
361
|
-
```scss
|
|
362
|
-
// bad
|
|
363
|
-
.foo-bar {
|
|
364
|
-
color: red;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
// good
|
|
368
|
-
.fooBar {
|
|
369
|
-
color: red;
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
```jsx
|
|
374
|
-
import styles from "./foo.module.scss"
|
|
375
|
-
|
|
376
|
-
// ...
|
|
377
|
-
|
|
378
|
-
// bad
|
|
379
|
-
return <div className={styles['foo-bar']}>
|
|
380
|
-
|
|
381
|
-
// good
|
|
382
|
-
return <div className={styles.fooBar}>
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
**[⬆ back to top](#table-of-contents)**
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) Maxim Degterev <max@degterev.me> (https://max.degterev.me)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# stylelint-config-entva
|
|
2
|
-
|
|
3
|
-
> Shareable entva styleguide config for stylelint.
|
|
4
|
-
|
|
5
|
-
Extends [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard).
|
|
6
|
-
|
|
7
|
-
A shareable config to enforce entva styleguide: https://github.com/entva/styleguide
|
|
8
|
-
|
|
9
|
-
To see the rules that this config uses, please read the [config itself](./index.js).
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install stylelint-config-entva --save-dev
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
If you've installed `stylelint-config-entva` locally within your project, just set your `stylelint` config to:
|
|
20
|
-
|
|
21
|
-
```json
|
|
22
|
-
{
|
|
23
|
-
"extends": "stylelint-config-entva"
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## [MIT License](LICENSE)
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
extends: 'stylelint-config-standard-scss',
|
|
3
|
-
plugins: [
|
|
4
|
-
'stylelint-order',
|
|
5
|
-
],
|
|
6
|
-
rules: {
|
|
7
|
-
'at-rule-empty-line-before': ['always', {
|
|
8
|
-
except: [
|
|
9
|
-
'blockless-after-same-name-blockless',
|
|
10
|
-
'first-nested',
|
|
11
|
-
],
|
|
12
|
-
ignore: ['after-comment'],
|
|
13
|
-
ignoreAtRules: ['if', 'else'],
|
|
14
|
-
}],
|
|
15
|
-
|
|
16
|
-
'at-rule-no-unknown': null,
|
|
17
|
-
'at-rule-disallowed-list': ['extend'],
|
|
18
|
-
|
|
19
|
-
'color-named': 'never',
|
|
20
|
-
|
|
21
|
-
'declaration-empty-line-before': null,
|
|
22
|
-
|
|
23
|
-
'function-name-case': 'lower',
|
|
24
|
-
|
|
25
|
-
'max-nesting-depth': [3, { ignoreAtRules: ['media'] }],
|
|
26
|
-
// 'number-leading-zero': 'never',
|
|
27
|
-
'no-descending-specificity': null,
|
|
28
|
-
|
|
29
|
-
'selector-max-id': 0,
|
|
30
|
-
'selector-class-pattern': '^[a-zA-Z]+(-[\\w-]+)?$',
|
|
31
|
-
|
|
32
|
-
'scss/at-rule-no-unknown': true,
|
|
33
|
-
'scss/at-function-parentheses-space-before': 'never',
|
|
34
|
-
'scss/at-else-if-parentheses-space-before': 'never',
|
|
35
|
-
'scss/at-function-pattern': '^[a-z0-9_\\-]+$',
|
|
36
|
-
'scss/at-mixin-argumentless-call-parentheses': 'never',
|
|
37
|
-
'scss/at-mixin-pattern': '^[a-z0-9_\\-]+$',
|
|
38
|
-
'scss/comment-no-loud': true,
|
|
39
|
-
'scss/declaration-nested-properties': 'never',
|
|
40
|
-
'scss/dollar-variable-pattern': '^[a-z0-9_\\-]+$',
|
|
41
|
-
'scss/percent-placeholder-pattern': '^we-are-not-using-placeholders-at-this-time$',
|
|
42
|
-
'scss/at-import-partial-extension': null, // needed for node-sass-glob-importer to work
|
|
43
|
-
'scss/comment-no-empty': null,
|
|
44
|
-
|
|
45
|
-
'order/order': [
|
|
46
|
-
'dollar-variables',
|
|
47
|
-
'custom-properties',
|
|
48
|
-
{
|
|
49
|
-
type: 'at-rule',
|
|
50
|
-
name: 'include',
|
|
51
|
-
},
|
|
52
|
-
'declarations',
|
|
53
|
-
'rules',
|
|
54
|
-
{
|
|
55
|
-
type: 'at-rule',
|
|
56
|
-
name: 'keyframes',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
'selector-pseudo-class-no-unknown': [
|
|
60
|
-
true,
|
|
61
|
-
{
|
|
62
|
-
ignorePseudoClasses: [
|
|
63
|
-
'export',
|
|
64
|
-
'import',
|
|
65
|
-
'global',
|
|
66
|
-
'local',
|
|
67
|
-
'external',
|
|
68
|
-
],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
'selector-type-no-unknown': [
|
|
72
|
-
true,
|
|
73
|
-
{
|
|
74
|
-
ignoreTypes: ['from'],
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
'property-no-unknown': [
|
|
78
|
-
true,
|
|
79
|
-
{
|
|
80
|
-
ignoreSelectors: [':export', /^:import/],
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
};
|