@penskemediacorp/stylelint-css-algorithms 1.5.1-alpha.0 → 1.24.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Penske Media Corporation
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 all
13
+ 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 THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -41,7 +41,7 @@ In a project's stylelint.config.js, add the following entries to the rules objec
41
41
 
42
42
  ## Future of this plugin
43
43
 
44
- This plugin would potentially be useful with 1) a more generic name, not tied to PMC's naming conventions, and 2) possibly as a rule within the Stylelint repo called `selector-property-whitelist`. In either case, there would be a change to the configuration where the key – which is currently a string of the base naming of a pattern – would be a Regex or a specific selector.
44
+ This plugin would potentially be useful with 1) a more generic name, not tied to PMC's naming conventions, and 2) possibly as a rule within the Stylelint repo called `selector-property-allowlist`. In either case, there would be a change to the configuration where the key – which is currently a string of the base naming of a pattern – would be a Regex or a specific selector.
45
45
 
46
46
  If/when that happens, this plugin may be removed in favor of that, and we will need to update any configuration accordingly.
47
47
 
@@ -0,0 +1,10 @@
1
+ .pmc-a-glue-parent {
2
+ position: relative;
3
+ }
4
+
5
+ .pmc-a-glue {
6
+ top: 0;
7
+ left: 0;
8
+ position: absolute;
9
+ z-index: 2;
10
+ }
@@ -0,0 +1,14 @@
1
+ .a-space-children-horizontal {
2
+ display: flex;
3
+ flex-wrap: wrap;
4
+ }
5
+
6
+ .a-space-children-horizontal>*+* {
7
+ margin-left: 0.5rem;
8
+ margin-left: calc(var(--a-space-children-spacer) * 1rem);
9
+ }
10
+
11
+ .a-space-children-vertical>*+* {
12
+ margin-top: 0.5rem;
13
+ margin-top: calc(var(--a-space-children-spacer) * 1rem);
14
+ }
@@ -0,0 +1,115 @@
1
+ 'use strict';
2
+
3
+ const fs = require( 'fs' );
4
+ const rule = require( '../lib/rule.js' );
5
+
6
+ testRule( rule.rule, {
7
+ ruleName: rule.name,
8
+ skipBasicChecks: true,
9
+ config: {
10
+ 'a-space-children': [ 'margin-top', 'margin-left', 'display', 'flex-wrap', '--a-space-children-spacer' ]
11
+ },
12
+ accept: [
13
+ {
14
+ code: '.a-space-children { margin-top: 0; }',
15
+ description: 'passes with an allowed property'
16
+ }
17
+ ],
18
+ reject: [
19
+ {
20
+ code: '.a-space-children { background: 0; }',
21
+ message: rule.messages.rejected( 'background', 'a-space-children' ),
22
+ description: 'disallows a property missing from allowed properties'
23
+ }
24
+ ]
25
+ });
26
+
27
+ testRule( rule.rule, {
28
+ ruleName: rule.name,
29
+ skipBasicChecks: true,
30
+ config: {
31
+ 'pmc-a-glue': [ 'margin-top' ]
32
+ },
33
+ reject: [
34
+ {
35
+ code: '.pmc-a-glue { background: red; }',
36
+ message: rule.messages.rejected( 'background', 'pmc-a-glue' ),
37
+ description: 'checks with a pmc- namespace'
38
+ }
39
+ ]
40
+ });
41
+
42
+ testRule( rule.rule, {
43
+ ruleName: rule.name,
44
+ skipBasicChecks: true,
45
+ config: {
46
+ 'card': [ 'margin-top' ]
47
+ },
48
+ reject: [
49
+ {
50
+ code: '.card { background: red; }',
51
+ message: rule.messages.rejected( 'background', 'card' ),
52
+ description: 'works with a non a-* namespace'
53
+ }
54
+ ]
55
+ });
56
+
57
+ testRule( rule.rule, {
58
+ ruleName: rule.name,
59
+ skipBasicChecks: true,
60
+ config: {
61
+ 'a-icon': [ 'height', 'width' ]
62
+ },
63
+ accept: [
64
+ {
65
+ code: '.a-icon::before { height: 1rem; }',
66
+ message: rule.messages.rejected( 'background', 'card' ),
67
+ description: 'works with a pseudo-element'
68
+ }
69
+ ],
70
+ reject: [
71
+ {
72
+ code: '.a-icon::before { font-family: 1rem; }',
73
+ message: rule.messages.rejected( 'font-family', 'a-icon' ),
74
+ description: 'works with a pseudo-element'
75
+ }
76
+ ]
77
+ });
78
+
79
+ testRule( rule.rule, {
80
+ ruleName: rule.name,
81
+ skipBasicChecks: true,
82
+ config: {
83
+ 'a-space-children': [ 'margin-left', 'margin-right' ],
84
+ 'pmc-a-glue': [ 'position', 'top', 'left' ]
85
+ },
86
+ reject: [
87
+ {
88
+ code: fs.readFileSync( __dirname + '/__fixture__/a-space-children.css' ).toString(),
89
+ description: 'works with multiple rules',
90
+ message: rule.messages.rejected( 'display', 'a-space-children' ),
91
+ },
92
+ {
93
+ code: fs.readFileSync( __dirname + '/__fixture__/a-glue.css' ).toString(),
94
+ description: 'works with multiple rules',
95
+ message: rule.messages.rejected( 'z-index', 'pmc-a-glue' ),
96
+ }
97
+ ]
98
+ });
99
+
100
+ // Note: this is for a future iteration when this becomes selector-property-whitelist
101
+ // and supports regex in the key.
102
+ // testRule( rule.rule, {
103
+ // ruleName: rule.name,
104
+ // skipBasicChecks: true,
105
+ // config: {
106
+ // '/^.a-space-children.*/': [ 'margin-left', 'margin-right' ]
107
+ // },
108
+ // reject: [
109
+ // {
110
+ // code: fs.readFileSync( __dirname + '/__fixture__/a-space-children.css' ).toString(),
111
+ // description: 'works with regex keys',
112
+ // message: rule.messages.rejected( 'display', 'a-space-children' ),
113
+ // }
114
+ // ]
115
+ // });
package/package.json CHANGED
@@ -1,19 +1,11 @@
1
1
  {
2
2
  "name": "@penskemediacorp/stylelint-css-algorithms",
3
- "version": "1.5.1-alpha.0",
3
+ "version": "1.24.1",
4
4
  "description": "> TODO: description",
5
5
  "author": "laras126 <laras126@gmail.com>",
6
6
  "homepage": "https://github.com/penske-media-corp/pmc-larva#readme",
7
7
  "license": "ISC",
8
8
  "main": "index.js",
9
- "directories": {
10
- "lib": "lib",
11
- "test": "__tests__"
12
- },
13
- "files": [
14
- "lib",
15
- "index.js"
16
- ],
17
9
  "publishConfig": {
18
10
  "access": "public"
19
11
  },
@@ -30,5 +22,5 @@
30
22
  "dependencies": {
31
23
  "stylelint": "^10.1.0"
32
24
  },
33
- "gitHead": "38f092f8c1a25e796ab83c34ee70863a4397a313"
25
+ "gitHead": "dd41bb6e0401d247edc4b4210db962bcdd9155bc"
34
26
  }