eser 2.1.9 → 3.0.0-rc.1

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.
Files changed (37) hide show
  1. package/deno.json +6 -0
  2. package/deno.lock +41 -0
  3. package/hizli-api.js +90 -0
  4. package/main.js +5 -0
  5. package/mod.js +3 -0
  6. package/mod_test.js +5 -0
  7. package/package.json +8 -37
  8. package/.editorconfig +0 -14
  9. package/.gitattributes +0 -11
  10. package/.github/FUNDING.yml +0 -5
  11. package/LICENSE +0 -22
  12. package/README.md +0 -3794
  13. package/css-in-javascript/README.md +0 -432
  14. package/linters/.eslintrc +0 -6
  15. package/linters/.markdownlint.json +0 -154
  16. package/packages/eslint-config-eser/.editorconfig +0 -14
  17. package/packages/eslint-config-eser/.eslintrc +0 -3
  18. package/packages/eslint-config-eser/README.md +0 -19
  19. package/packages/eslint-config-eser/index.js +0 -20
  20. package/packages/eslint-config-eser/package.json +0 -49
  21. package/packages/eslint-config-eser/rules/best-practices.js +0 -381
  22. package/packages/eslint-config-eser/rules/errors.js +0 -146
  23. package/packages/eslint-config-eser/rules/es6.js +0 -203
  24. package/packages/eslint-config-eser/rules/imports.js +0 -291
  25. package/packages/eslint-config-eser/rules/node.js +0 -43
  26. package/packages/eslint-config-eser/rules/strict.js +0 -5
  27. package/packages/eslint-config-eser/rules/style.js +0 -597
  28. package/packages/eslint-config-eser/rules/variables.js +0 -53
  29. package/packages/eslint-config-eser-react/.editorconfig +0 -14
  30. package/packages/eslint-config-eser-react/.eslintrc +0 -3
  31. package/packages/eslint-config-eser-react/README.md +0 -19
  32. package/packages/eslint-config-eser-react/index.js +0 -11
  33. package/packages/eslint-config-eser-react/package.json +0 -59
  34. package/packages/eslint-config-eser-react/rules/react-a11y.js +0 -275
  35. package/packages/eslint-config-eser-react/rules/react-hooks.js +0 -21
  36. package/packages/eslint-config-eser-react/rules/react.js +0 -600
  37. package/react/README.md +0 -717
@@ -1,432 +0,0 @@
1
- # [Eser: CSS-in-JavaScript Style Guide](https://github.com/eserozvataf/eser)
2
-
3
- *A mostly reasonable approach to CSS-in-JavaScript*
4
-
5
- ## Table of Contents
6
-
7
- 1. [Naming](#naming)
8
- 1. [Ordering](#ordering)
9
- 1. [Nesting](#nesting)
10
- 1. [Inline](#inline)
11
- 1. [Themes](#themes)
12
-
13
- ## Naming
14
-
15
- - Use camelCase for object keys (i.e. "selectors").
16
-
17
- > Why? We access these keys as properties on the `styles` object in the component, so it is most convenient to use camelCase.
18
-
19
- ```js
20
- // bad
21
- {
22
- 'bermuda-triangle': {
23
- display: 'none',
24
- },
25
- }
26
-
27
- // good
28
- {
29
- bermudaTriangle: {
30
- display: 'none',
31
- },
32
- }
33
- ```
34
-
35
- - Use an underscore for modifiers to other styles.
36
-
37
- > Why? Similar to BEM, this naming convention makes it clear that the styles are intended to modify the element preceded by the underscore. Underscores do not need to be quoted, so they are preferred over other characters, such as dashes.
38
-
39
- ```js
40
- // bad
41
- {
42
- bruceBanner: {
43
- color: 'pink',
44
- transition: 'color 10s',
45
- },
46
-
47
- bruceBannerTheHulk: {
48
- color: 'green',
49
- },
50
- }
51
-
52
- // good
53
- {
54
- bruceBanner: {
55
- color: 'pink',
56
- transition: 'color 10s',
57
- },
58
-
59
- bruceBanner_theHulk: {
60
- color: 'green',
61
- },
62
- }
63
- ```
64
-
65
- - Use `selectorName_fallback` for sets of fallback styles.
66
-
67
- > Why? Similar to modifiers, keeping the naming consistent helps reveal the relationship of these styles to the styles that override them in more adequate browsers.
68
-
69
- ```js
70
- // bad
71
- {
72
- muscles: {
73
- display: 'flex',
74
- },
75
-
76
- muscles_sadBears: {
77
- width: '100%',
78
- },
79
- }
80
-
81
- // good
82
- {
83
- muscles: {
84
- display: 'flex',
85
- },
86
-
87
- muscles_fallback: {
88
- width: '100%',
89
- },
90
- }
91
- ```
92
-
93
- - Use a separate selector for sets of fallback styles.
94
-
95
- > Why? Keeping fallback styles contained in a separate object clarifies their purpose, which improves readability.
96
-
97
- ```js
98
- // bad
99
- {
100
- muscles: {
101
- display: 'flex',
102
- },
103
-
104
- left: {
105
- flexGrow: 1,
106
- display: 'inline-block',
107
- },
108
-
109
- right: {
110
- display: 'inline-block',
111
- },
112
- }
113
-
114
- // good
115
- {
116
- muscles: {
117
- display: 'flex',
118
- },
119
-
120
- left: {
121
- flexGrow: 1,
122
- },
123
-
124
- left_fallback: {
125
- display: 'inline-block',
126
- },
127
-
128
- right_fallback: {
129
- display: 'inline-block',
130
- },
131
- }
132
- ```
133
-
134
- - Use device-agnostic names (e.g. "small", "medium", and "large") to name media query breakpoints.
135
-
136
- > Why? Commonly used names like "phone", "tablet", and "desktop" do not match the characteristics of the devices in the real world. Using these names sets the wrong expectations.
137
-
138
- ```js
139
- // bad
140
- const breakpoints = {
141
- mobile: '@media (max-width: 639px)',
142
- tablet: '@media (max-width: 1047px)',
143
- desktop: '@media (min-width: 1048px)',
144
- };
145
-
146
- // good
147
- const breakpoints = {
148
- small: '@media (max-width: 639px)',
149
- medium: '@media (max-width: 1047px)',
150
- large: '@media (min-width: 1048px)',
151
- };
152
- ```
153
-
154
- ## Ordering
155
-
156
- - Define styles after the component.
157
-
158
- > Why? We use a higher-order component to theme our styles, which is naturally used after the component definition. Passing the styles object directly to this function reduces indirection.
159
-
160
- ```jsx
161
- // bad
162
- const styles = {
163
- container: {
164
- display: 'inline-block',
165
- },
166
- };
167
-
168
- function MyComponent({ styles }) {
169
- return (
170
- <div {...css(styles.container)}>
171
- Never doubt that a small group of thoughtful, committed citizens can
172
- change the world. Indeed, it’s the only thing that ever has.
173
- </div>
174
- );
175
- }
176
-
177
- export default withStyles(() => styles)(MyComponent);
178
-
179
- // good
180
- function MyComponent({ styles }) {
181
- return (
182
- <div {...css(styles.container)}>
183
- Never doubt that a small group of thoughtful, committed citizens can
184
- change the world. Indeed, it’s the only thing that ever has.
185
- </div>
186
- );
187
- }
188
-
189
- export default withStyles(() => ({
190
- container: {
191
- display: 'inline-block',
192
- },
193
- }))(MyComponent);
194
- ```
195
-
196
- ## Nesting
197
-
198
- - Leave a blank line between adjacent blocks at the same indentation level.
199
-
200
- > Why? The whitespace improves readability and reduces the likelihood of merge conflicts.
201
-
202
- ```js
203
- // bad
204
- {
205
- bigBang: {
206
- display: 'inline-block',
207
- '::before': {
208
- content: "''",
209
- },
210
- },
211
- universe: {
212
- border: 'none',
213
- },
214
- }
215
-
216
- // good
217
- {
218
- bigBang: {
219
- display: 'inline-block',
220
-
221
- '::before': {
222
- content: "''",
223
- },
224
- },
225
-
226
- universe: {
227
- border: 'none',
228
- },
229
- }
230
- ```
231
-
232
- ## Inline
233
-
234
- - Use inline styles for styles that have a high cardinality (e.g. uses the value of a prop) and not for styles that have a low cardinality.
235
-
236
- > Why? Generating themed stylesheets can be expensive, so they are best for discrete sets of styles.
237
-
238
- ```jsx
239
- // bad
240
- export default function MyComponent({ spacing }) {
241
- return (
242
- <div style={{ display: 'table', margin: spacing }} />
243
- );
244
- }
245
-
246
- // good
247
- function MyComponent({ styles, spacing }) {
248
- return (
249
- <div {...css(styles.periodic, { margin: spacing })} />
250
- );
251
- }
252
- export default withStyles(() => ({
253
- periodic: {
254
- display: 'table',
255
- },
256
- }))(MyComponent);
257
- ```
258
-
259
- ## Themes
260
-
261
- - Use an abstraction layer such as [react-with-styles](https://github.com/airbnb/react-with-styles) that enables theming. *react-with-styles gives us things like `withStyles()`, `ThemedStyleSheet`, and `css()` which are used in some of the examples in this document.*
262
-
263
- > Why? It is useful to have a set of shared variables for styling your components. Using an abstraction layer makes this more convenient. Additionally, this can help prevent your components from being tightly coupled to any particular underlying implementation, which gives you more freedom.
264
-
265
- - Define colors only in themes.
266
-
267
- ```js
268
- // bad
269
- export default withStyles(() => ({
270
- chuckNorris: {
271
- color: '#bada55',
272
- },
273
- }))(MyComponent);
274
-
275
- // good
276
- export default withStyles(({ color }) => ({
277
- chuckNorris: {
278
- color: color.badass,
279
- },
280
- }))(MyComponent);
281
- ```
282
-
283
- - Define fonts only in themes.
284
-
285
- ```js
286
- // bad
287
- export default withStyles(() => ({
288
- towerOfPisa: {
289
- fontStyle: 'italic',
290
- },
291
- }))(MyComponent);
292
-
293
- // good
294
- export default withStyles(({ font }) => ({
295
- towerOfPisa: {
296
- fontStyle: font.italic,
297
- },
298
- }))(MyComponent);
299
- ```
300
-
301
- - Define fonts as sets of related styles.
302
-
303
- ```js
304
- // bad
305
- export default withStyles(() => ({
306
- towerOfPisa: {
307
- fontFamily: 'Italiana, "Times New Roman", serif',
308
- fontSize: '2em',
309
- fontStyle: 'italic',
310
- lineHeight: 1.5,
311
- },
312
- }))(MyComponent);
313
-
314
- // good
315
- export default withStyles(({ font }) => ({
316
- towerOfPisa: {
317
- ...font.italian,
318
- },
319
- }))(MyComponent);
320
- ```
321
-
322
- - Define base grid units in theme (either as a value or a function that takes a multiplier).
323
-
324
- ```js
325
- // bad
326
- export default withStyles(() => ({
327
- rip: {
328
- bottom: '-6912px', // 6 feet
329
- },
330
- }))(MyComponent);
331
-
332
- // good
333
- export default withStyles(({ units }) => ({
334
- rip: {
335
- bottom: units(864), // 6 feet, assuming our unit is 8px
336
- },
337
- }))(MyComponent);
338
-
339
- // good
340
- export default withStyles(({ unit }) => ({
341
- rip: {
342
- bottom: 864 * unit, // 6 feet, assuming our unit is 8px
343
- },
344
- }))(MyComponent);
345
- ```
346
-
347
- - Define media queries only in themes.
348
-
349
- ```js
350
- // bad
351
- export default withStyles(() => ({
352
- container: {
353
- width: '100%',
354
-
355
- '@media (max-width: 1047px)': {
356
- width: '50%',
357
- },
358
- },
359
- }))(MyComponent);
360
-
361
- // good
362
- export default withStyles(({ breakpoint }) => ({
363
- container: {
364
- width: '100%',
365
-
366
- [breakpoint.medium]: {
367
- width: '50%',
368
- },
369
- },
370
- }))(MyComponent);
371
- ```
372
-
373
- - Define tricky fallback properties in themes.
374
-
375
- > Why? Many CSS-in-JavaScript implementations merge style objects together which makes specifying fallbacks for the same property (e.g. `display`) a little tricky. To keep the approach unified, put these fallbacks in the theme.
376
-
377
- ```js
378
- // bad
379
- export default withStyles(() => ({
380
- .muscles {
381
- display: 'flex',
382
- },
383
-
384
- .muscles_fallback {
385
- 'display ': 'table',
386
- },
387
- }))(MyComponent);
388
-
389
- // good
390
- export default withStyles(({ fallbacks }) => ({
391
- .muscles {
392
- display: 'flex',
393
- },
394
-
395
- .muscles_fallback {
396
- [fallbacks.display]: 'table',
397
- },
398
- }))(MyComponent);
399
-
400
- // good
401
- export default withStyles(({ fallback }) => ({
402
- .muscles {
403
- display: 'flex',
404
- },
405
-
406
- .muscles_fallback {
407
- [fallback('display')]: 'table',
408
- },
409
- }))(MyComponent);
410
- ```
411
-
412
- - Create as few custom themes as possible. Many applications may only have one theme.
413
-
414
- - Namespace custom theme settings under a nested object with a unique and descriptive key.
415
-
416
- ```js
417
- // bad
418
- ThemedStyleSheet.registerTheme('mySection', {
419
- mySectionPrimaryColor: 'green',
420
- });
421
-
422
- // good
423
- ThemedStyleSheet.registerTheme('mySection', {
424
- mySection: {
425
- primaryColor: 'green',
426
- },
427
- });
428
- ```
429
-
430
- ---
431
-
432
- CSS puns adapted from [Saijo George](https://saijogeorge.com/css-puns/).
package/linters/.eslintrc DELETED
@@ -1,6 +0,0 @@
1
- // Use this file as a starting point for your project's .eslintrc.
2
- // Copy this file, and add rule overrides as needed.
3
- {
4
- "extends": "eser"
5
- }
6
-
@@ -1,154 +0,0 @@
1
- {
2
- "comment": "Be explicit by listing every available rule. https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md",
3
- "comment": "Note that there will be numeric gaps, not every MD number is implemented in markdownlint.",
4
-
5
- "comment": "MD001: Header levels should only increment by one level at a time.",
6
- "header-increment": true,
7
-
8
- "comment": "MD002: First header should be a top level header.",
9
- "first-header-h1": true,
10
-
11
- "comment": "MD003: Header style: start with hashes.",
12
- "header-style": {
13
- "style": "atx"
14
- },
15
-
16
- "comment": "MD004: Unordered list style",
17
- "ul-style": {
18
- "style": "dash"
19
- },
20
-
21
- "comment": "MD005: Consistent indentation for list items at the same level.",
22
- "list-indent": true,
23
-
24
- "comment": "MD006: Consider starting bulleted lists at the beginning of the line.",
25
- "ul-start-left": false,
26
-
27
- "comment": "MD007: Unordered list indentation: 4 spaces.",
28
- "ul-indent": {
29
- "indent": 4
30
- },
31
-
32
- "comment": "MD009: Disallow trailing spaces!",
33
- "no-trailing-spaces": {
34
- "br_spaces": 0,
35
- "comment": "Empty lines inside list items should not be indented.",
36
- "list_item_empty_lines": false
37
- },
38
-
39
- "comment": "MD010: No hard tabs, not even in code blocks.",
40
- "no-hard-tabs": {
41
- "code_blocks": true
42
- },
43
-
44
- "comment": "MD011: Prevent reversed link syntax",
45
- "no-reversed-links": true,
46
-
47
- "comment": "MD012: Disallow multiple consecutive blank lines.",
48
- "no-multiple-blanks": {
49
- "maximum": 1
50
- },
51
-
52
- "comment": "MD013: Line length",
53
- "line-length": false,
54
-
55
- "comment": "MD014: Disallow use of dollar signs($) before commands without showing output.",
56
- "commands-show-output": true,
57
-
58
- "comment": "MD018: Disallow space after hash on atx style header.",
59
- "no-missing-space-atx": true,
60
-
61
- "comment": "MD019: Disallow multiple spaces after hash on atx style header.",
62
- "no-multiple-space-atx": true,
63
-
64
- "comment": "MD020: No space should be inside hashes on closed atx style header.",
65
- "no-missing-space-closed-atx": true,
66
-
67
- "comment": "MD021: Disallow multiple spaces inside hashes on closed atx style header.",
68
- "no-multiple-space-closed-atx": true,
69
-
70
- "comment": "MD022: Headers should be surrounded by blank lines.",
71
- "comment": "Some headers have preceeding HTML anchors. Unfortunate that we have to disable this, as it otherwise catches a real problem that trips up some Markdown renderers",
72
- "blanks-around-headers": false,
73
-
74
- "comment": "MD023: Headers must start at the beginning of the line.",
75
- "header-start-left": true,
76
-
77
- "comment": "MD024: Disallow multiple headers with the same content.",
78
- "no-duplicate-header": true,
79
-
80
- "comment": "MD025: Disallow multiple top level headers in the same document.",
81
- "comment": "Gotta have a matching closing brace at the end.",
82
- "single-h1": false,
83
-
84
- "comment": "MD026: Disallow trailing punctuation in header.",
85
- "comment": "You must have a semicolon after the ending closing brace.",
86
- "no-trailing-punctuation": {
87
- "punctuation" : ".,:!?"
88
- },
89
- "comment": "MD027: Dissalow multiple spaces after blockquote symbol",
90
- "no-multiple-space-blockquote": true,
91
-
92
- "comment": "MD028: Blank line inside blockquote",
93
- "comment": "Some 'Why?' and 'Why not?' blocks are separated by a blank line",
94
- "no-blanks-blockquote": false,
95
-
96
- "comment": "MD029: Ordered list item prefix",
97
- "ol-prefix": {
98
- "style": "one"
99
- },
100
-
101
- "comment": "MD030: Spaces after list markers",
102
- "list-marker-space": {
103
- "ul_single": 1,
104
- "ol_single": 1,
105
- "ul_multi": 1,
106
- "ol_multi": 1
107
- },
108
-
109
- "comment": "MD031: Fenced code blocks should be surrounded by blank lines",
110
- "blanks-around-fences": true,
111
-
112
- "comment": "MD032: Lists should be surrounded by blank lines",
113
- "comment": "Some lists have preceeding HTML anchors. Unfortunate that we have to disable this, as it otherwise catches a real problem that trips up some Markdown renderers",
114
- "blanks-around-lists": false,
115
-
116
- "comment": "MD033: Disallow inline HTML",
117
- "comment": "HTML is needed for explicit anchors",
118
- "no-inline-html": false,
119
-
120
- "comment": "MD034: No bare URLs should be used",
121
- "no-bare-urls": true,
122
-
123
- "comment": "MD035: Horizontal rule style",
124
- "hr-style": {
125
- "style": "consistent"
126
- },
127
-
128
- "comment": "MD036: Do not use emphasis instead of a header.",
129
- "no-emphasis-as-header": false,
130
-
131
- "comment": "MD037: Disallow spaces inside emphasis markers.",
132
- "no-space-in-emphasis": true,
133
-
134
- "comment": "MD038: Disallow spaces inside code span elements.",
135
- "no-space-in-code": true,
136
-
137
- "comment": "MD039: Disallow spaces inside link text.",
138
- "no-space-in-links": true,
139
-
140
- "comment": "MD040: Fenced code blocks should have a language specified.",
141
- "fenced-code-language": true,
142
-
143
- "comment": "MD041: First line in file should be a top level header.",
144
- "first-line-h1": true,
145
-
146
- "comment": "MD042: No empty links",
147
- "no-empty-links": true,
148
-
149
- "comment": "MD043: Required header structure.",
150
- "required-headers": false,
151
-
152
- "comment": "MD044: Proper names should have the correct capitalization.",
153
- "proper-names": false
154
- }
@@ -1,14 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 4
6
- charset = utf-8
7
- trim_trailing_whitespace = true
8
- insert_final_newline = true
9
- end_of_line = lf
10
- # editorconfig-tools is unable to ignore longs strings or urls
11
- max_line_length = off
12
-
13
- [*.md]
14
- trim_trailing_whitespace = false
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "./index.js"
3
- }
@@ -1,19 +0,0 @@
1
- # [Eser: JavaScript Style Guide](https://github.com/eserozvataf/eser)
2
-
3
- This package consists of ESLint rule definitions for [eser](https://github.com/eserozvataf/eser).
4
-
5
- To use this package, execute:
6
-
7
- ```sh
8
- npm install eslint eslint-plugin-import eslint-config-eser --save-dev
9
- ```
10
-
11
- Then create an `.eslintrc` file:
12
-
13
- ```json
14
- {
15
- "extends": "eser"
16
- }
17
- ```
18
-
19
- See [main repository](https://github.com/eserozvataf/eser) for further details.
@@ -1,20 +0,0 @@
1
- module.exports = {
2
- 'extends': [
3
- './rules/best-practices',
4
- './rules/errors',
5
- './rules/node',
6
- './rules/style',
7
- './rules/variables',
8
- './rules/es6',
9
- './rules/imports',
10
- './rules/strict',
11
- ].map(require.resolve),
12
-
13
- 'parserOptions': {
14
- ecmaVersion: 2018,
15
- sourceType: 'module',
16
- },
17
-
18
- 'rules': {
19
- },
20
- };
@@ -1,49 +0,0 @@
1
- {
2
- "name": "eslint-config-eser",
3
- "version": "2.1.9",
4
- "description": "Eser's ESLint config, following our styleguide",
5
- "main": "index.js",
6
- "scripts": {
7
- "cleanup": "rm -rf yarn.lock node_modules/",
8
- "prelint": "# editorconfig-tools check *",
9
- "lint": "eslint ./",
10
- "lint:fix": "eslint --fix ./",
11
- "test": "",
12
- "test:coverage": ""
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/eserozvataf/eser"
17
- },
18
- "keywords": [
19
- "eslint",
20
- "eslintconfig",
21
- "config",
22
- "eser",
23
- "airbnb",
24
- "javascript",
25
- "styleguide"
26
- ],
27
- "author": "Eser Ozvataf <eser@ozvataf.com> (https://twitter.com/eser)",
28
- "license": "MIT",
29
- "bugs": {
30
- "url": "https://github.com/eserozvataf/eser/issues"
31
- },
32
- "homepage": "https://github.com/eserozvataf/eser",
33
- "dependencies": {
34
- "confusing-browser-globals": "^1.0.9"
35
- },
36
- "devDependencies": {
37
- "editorconfig-tools": "^0.1.1",
38
- "eslint": "^7.4.0",
39
- "eslint-find-rules": "^3.5.0",
40
- "eslint-plugin-import": "^2.22.0"
41
- },
42
- "peerDependencies": {
43
- "eslint": "^7.4.0",
44
- "eslint-plugin-import": "^2.22.0"
45
- },
46
- "engines": {
47
- "node": ">= 6"
48
- }
49
- }