@primer/stylelint-config 0.0.0-20211023235144

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/CHANGELOG.md ADDED
@@ -0,0 +1,196 @@
1
+ # Changelog
2
+
3
+ ## 0.0.0-20211023235144
4
+
5
+ ### Patch Changes
6
+
7
+ - Fake entry to force publishing
8
+
9
+ ## 12.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#161](https://github.com/primer/stylelint-config/pull/161) [`48c4afc`](https://github.com/primer/stylelint-config/commit/48c4afc1913863136d62967653697323f8da57b7) Thanks [@dependabot](https://github.com/apps/dependabot)! - Bump @primer/primitives from 6.1.0 to 7.0.1
14
+
15
+ ## 12.1.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#150](https://github.com/primer/stylelint-config/pull/150) [`4af1647`](https://github.com/primer/stylelint-config/commit/4af16474148d96fba5567068280a9ffe6e7a80ba) Thanks [@jonrohan](https://github.com/jonrohan)! - Making all be first in property order
20
+
21
+ * [#151](https://github.com/primer/stylelint-config/pull/151) [`d7c8b2b`](https://github.com/primer/stylelint-config/commit/d7c8b2b908b113fa14c7637dfced34610a3bcfac) Thanks [@jonrohan](https://github.com/jonrohan)! - Adding [string-quotes](https://stylelint.io/user-guide/rules/list/string-quotes) rule to config
22
+
23
+ ### Patch Changes
24
+
25
+ - [#146](https://github.com/primer/stylelint-config/pull/146) [`214362c`](https://github.com/primer/stylelint-config/commit/214362c0e3c9449a5ff7d3bd047018493043d3c0) Thanks [@dependabot](https://github.com/apps/dependabot)! - Bump @primer/css from 13.2.0 to 16.3.0
26
+
27
+ ## 12.0.1
28
+
29
+ ### Patch Changes
30
+
31
+ - [#132](https://github.com/primer/stylelint-config/pull/132) [`b672367`](https://github.com/primer/stylelint-config/commit/b6723679606bb8d39e75025ae17ace9f1c3e2631) Thanks [@jonrohan](https://github.com/jonrohan)! - Updating no-deprecated-colors plugin for edge cases
32
+
33
+ ## 12.0.0
34
+
35
+ ### Major Changes
36
+
37
+ - [#129](https://github.com/primer/stylelint-config/pull/129) [`653d596`](https://github.com/primer/stylelint-config/commit/653d596072b897b265b093aac4cd5c143e61410e) Thanks [@jonrohan](https://github.com/jonrohan)! - Renaming the package to use org scope. This is a breaking change, you'll need to uninstall `stylelint-config-primer` and reinstall `@primer/stylelint-config`.
38
+
39
+ ### Patch Changes
40
+
41
+ - [#130](https://github.com/primer/stylelint-config/pull/130) [`f495a56`](https://github.com/primer/stylelint-config/commit/f495a563a9e809252630466088eb94177e6c0be4) Thanks [@jonrohan](https://github.com/jonrohan)! - Updating @primer/primitives to 5.0 release candidate
42
+
43
+ ## 11.1.1
44
+
45
+ ### Patch Changes
46
+
47
+ - [`3a4654b`](https://github.com/primer/stylelint-config/commit/3a4654b1b7920d71e1284ff78a3bedff932e66a3) [#111](https://github.com/primer/stylelint-config/pull/111) Thanks [@jonrohan](https://github.com/jonrohan)! - Fixing the primer/colors and primer/borders rules
48
+
49
+ ## 11.1.0
50
+
51
+ ### Minor Changes
52
+
53
+ - [`e83f61c`](https://github.com/primer/stylelint-config/commit/e83f61cef3bf1df1d9420662594040efdcb86c89) [#99](https://github.com/primer/stylelint-config/pull/99) Thanks [@jonrohan](https://github.com/jonrohan)! - Create a `no-deprecated-colors` rule that looks for deprecated css color variables from primer/primitives.
54
+
55
+ ### Patch Changes
56
+
57
+ - [`581f40a`](https://github.com/primer/stylelint-config/commit/581f40a4aacb45db5426b82d4a2434e81eb032e2) [#105](https://github.com/primer/stylelint-config/pull/105) Thanks [@jonrohan](https://github.com/jonrohan)! - Adding reporting to the linter to know how many variables are replaced
58
+
59
+ ## 10.0.1
60
+
61
+ ### Patch Changes
62
+
63
+ - [`aa76171`](https://github.com/primer/stylelint-config/commit/aa76171fc5c9c308fcd9d7f7285c8fbdb2c18a7b) [#90](https://github.com/primer/stylelint-config/pull/90) Thanks [@jonrohan](https://github.com/jonrohan)! - Updating the no-undefined-variables lint for the new color-variables mixin.
64
+
65
+ ## 10.0.0
66
+
67
+ ### Major Changes
68
+
69
+ - [`23a1f15`](https://github.com/primer/stylelint-config/commit/23a1f1599673f2a4f9f28c39da61f42871c05697) [#85](https://github.com/primer/stylelint-config/pull/85) Thanks [@koddsson](https://github.com/koddsson)! - Replace deprecated "blacklist" rules for "dissallow list" rules.
70
+
71
+ See https://stylelint.io/user-guide/rules/at-rule-blacklist and http://stylelint.io/user-guide/rules/declaration-property-value-disallowed-list/
72
+
73
+ ### Patch Changes
74
+
75
+ - [`40d9bb8`](https://github.com/primer/stylelint-config/commit/40d9bb867194ae4335846953b5d8706dc7dc7d79) [#86](https://github.com/primer/stylelint-config/pull/86) Thanks [@koddsson](https://github.com/koddsson)! - Allow rules to optionally display a URL with their message.
76
+
77
+ ## 9.3.3
78
+
79
+ ### Patch Changes
80
+
81
+ - [`a339c69`](https://github.com/primer/stylelint-config/commit/a339c698b9ba7ccd01b8cb773dad7a3a14dd13a1) [#81](https://github.com/primer/stylelint-config/pull/81) Thanks [@BinaryMuse](https://github.com/BinaryMuse)! - Update globby to v11
82
+
83
+ ## 9.3.2
84
+
85
+ ### Patch Changes
86
+
87
+ - [`d18cfbf`](https://github.com/primer/stylelint-config/commit/d18cfbfefc25be6ae38f73132552d2f3c62c4d02) [#79](https://github.com/primer/stylelint-config/pull/79) Thanks [@BinaryMuse](https://github.com/BinaryMuse)! - Add additinal verbose logging to `no-undefined-vars`
88
+
89
+ * [`d18cfbf`](https://github.com/primer/stylelint-config/commit/d18cfbfefc25be6ae38f73132552d2f3c62c4d02) [#79](https://github.com/primer/stylelint-config/pull/79) Thanks [@BinaryMuse](https://github.com/BinaryMuse)! - Fix handling of edge-cases in `no-undefined-vars`
90
+
91
+ - [`bb07673`](https://github.com/primer/stylelint-config/commit/bb076732aa216fcb56e411b8dd7477efc89f7f8a) [#76](https://github.com/primer/stylelint-config/pull/76) Thanks [@BinaryMuse](https://github.com/BinaryMuse)! - Set the default verbose option for `no-scale-colors` to false
92
+
93
+ ## 9.3.1
94
+
95
+ ### Patch Changes
96
+
97
+ - [`df11e2d`](https://github.com/primer/stylelint-config/commit/df11e2d912913346e0499f7eac901cdfcb83f38c) [#74](https://github.com/primer/stylelint-config/pull/74) Thanks [@BinaryMuse](https://github.com/BinaryMuse)! - Add primer/no-scale-colors to the list of exported plugins
98
+
99
+ ## 9.2.1
100
+
101
+ ### :bug: Bug fixes
102
+
103
+ - Fix slow runtime by caching variable definitions in `primer/no-undefined-vars` rule
104
+ - Fix duplicate errors in `primer/no-undefined-vars` rule
105
+
106
+ ## 9.2.0
107
+
108
+ ### :rocket: Enhancements
109
+
110
+ - New `primer/no-undefined-vars` to prohibit usages of undefined CSS variables
111
+
112
+ ## 9.1.0
113
+
114
+ ### :rocket: Enhancements
115
+
116
+ - The `primer/colors`, `primer/borders`, and `primer/box-shadow` rules now allow CSS color variables with the correct functional names (e.g. `var(--color-text-primary)`). #62
117
+
118
+ ## 9.0.0
119
+
120
+ ### :boom: Breaking Change
121
+
122
+ - `primer/variables` is no longer supported; please use the `primer/colors`, `primer/borders`, `primer/box-shadow`, `primer/spacing`, and `primer/typography` rules instead. #50
123
+
124
+ ### :rocket: Enhancements
125
+
126
+ - The new `primer/colors` rule enforces color variable usage in `color`, `background-color`, and `fill` properties
127
+ - The new `primer/borders` rule enforces border variable usage in border CSS props
128
+ - The new `primer/box-shadow` rule enforces `$box-shadow*` variables
129
+ - The new `primer/spacing` rule enforces `$spacer-*` variables in margin and padding props
130
+ - The new `primer/typography` rule enforces typography variable use in `font-family`, `line-height`, and `font-weight` props
131
+ - Variable replacements for autofixing are automatically detected in variable data from Primer CSS (see: https://github.com/primer/css/pull/949) #52
132
+ - It is now possible to define variable rules using functions that take the variables, as in:
133
+ ```js
134
+ module.exports = createVariableRule('primer/whatever', ({variables}) => {
135
+ /* do something with variables here */
136
+ })
137
+ ```
138
+ - It's also now possible to provide rule _overrides_ in local stylelint configs as functions:
139
+ ```js
140
+ module.exports = {
141
+ extends: '@primer/stylelint-config',
142
+ rules: {
143
+ 'primer/colors': [true, {
144
+ rules: ({variables, rules}) => {
145
+ /* do something with variables and/or rules here */
146
+ return rules
147
+ }]
148
+ }
149
+ })
150
+ ```
151
+ - This release adds support for an optional `singular: true` flag to rule configs, which skips the parsing of individual values in the matched properties. We use this in `primer/box-shadow` to prevent multiple warnings for a single value like `box-shadow: inset 0 1px $blue` (before there would be 4 separate ones!).
152
+
153
+ ### :bug: Bug fixes
154
+
155
+ - Use `requirePrimerFile()` when loading `dist/variables.json` so that we can access the right file when running _within_ the `@primer/css` repo.
156
+ - Walk only declarations (`prop: value`) in rules (blocks with selectors, _not_ `@rules`), and skip linting for declarations nested in `@each`, `@for`, `@function`, and `@mixin` blocks, since those can define their own variables and we can't reliably assert their values.
157
+ - Allow `$*-shadow` variable patterns in `primer/box-shadow` to match `$btn-active-shadow` and `$form-control-shadow`
158
+ - Allow `color: inherit` in `primer/colors`
159
+ - Allow `$em-spacer-*` in `padding` and `margin` properties
160
+ - Allow (and auto-fix!) negative spacer variables in `margin` properties
161
+ - Make `primer/colors` smarter re: `background` property shorthand values (allowing positions and image `url(*)` values)
162
+ - Remove `100%` from allowed values for `border-radius`, and suggest `50%` instead
163
+ - Prohibit negative spacer values in `padding` properties
164
+ - Allow `$h000-size` for marketing 😬
165
+
166
+ ## 2.0.0
167
+
168
+ :boom: **The following updates are breaking changes**, since code that disables the deprecated rule will now produce linting errors. Please update your `stylelint-disable` statements accordingly.
169
+
170
+ - Replaced `selector-no-id: true` with `selector-max-id: 0`
171
+ - Replaced `selector-no-type: true` with `selector-max-type: 0`
172
+
173
+ The rest of the changes should not introduce new linting errors:
174
+
175
+ - Updated: moved [browserslist](https://github.com/ai/browserslist) spec to `package.json`
176
+ - Updated: using the [`no-unsupported-browser-features` plugin](https://github.com/ismay/stylelint-no-unsupported-browser-features) instead of the deprecated `no-unsupported-browser-features` rule
177
+ - Removed: `media-feature-no-missing-punctuation`
178
+ - Updated: replaced `rule-nested-empty-line-before` and `rule-non-nested-empty-line-before` with `rule-empty-line-before`
179
+
180
+ ## 1.4.0
181
+
182
+ - Updated: Development dependencies are any version `*`
183
+ - Removed: `selector-class-pattern` from config. https://github.com/primer/stylelint-config/pull/11
184
+
185
+ ## 1.3.0
186
+
187
+ - Added: `length-zero-no-unit` to disallow zero values with units eg `0px`
188
+
189
+ ## 1.2.0
190
+
191
+ - Removed: We don't need `scss/at-extend-no-missing-placeholder` anymore taken care of by `at-rule-blacklist`
192
+ - Added: Adding `selector-no-type` to the rules
193
+
194
+ ## 1.0.0
195
+
196
+ - Creating a sharable config object
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 GitHub Inc.
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 ADDED
@@ -0,0 +1,44 @@
1
+ # Primer Stylelint Config
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@primer/stylelint-config.svg)](https://www.npmjs.org/package/@primer/stylelint-config)
4
+
5
+ > A sharable stylelint config object that enforces GitHub's CSS rules
6
+
7
+ ## Install
8
+
9
+ ```
10
+ $ npm install --save --dev @primer/stylelint-config
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Within your [stylelint config object](http://stylelint.io/user-guide/configuration/#extends) You can extend this configuration. This will serve as a base for your config, then you can make overrides in your own config object:
16
+
17
+ ```json
18
+ {
19
+ "extends": "@primer/stylelint-config"
20
+ }
21
+ ```
22
+
23
+ ## Documentation
24
+
25
+ Primer Stylelint Config extends the [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) configuration supplied by Stylelint, and makes modifications in `/index.js`.
26
+
27
+ ### Plugins
28
+
29
+ - [stylelint-order](https://github.com/hudochenkov/stylelint-order): Order-related linting rules for stylelint. Properties must be [sorted according to this list](https://github.com/primer/stylelint-config/blob/main/property-order.js).
30
+ - [stylelint-scss](https://github.com/kristerkari/stylelint-scss): A collection of SCSS specific linting rules for stylelint
31
+ - [scss/selector-no-redundant-nesting-selector](https://github.com/kristerkari/stylelint-scss/blob/master/src/rules/selector-no-redundant-nesting-selector/README.md): Disallow redundant nesting selectors (`&`).
32
+ - [primer/no-override](./plugins/#primerno-override): Prohibits custom styles that target Primer CSS selectors.
33
+ - [primer/no-unused-vars](./plugins/#primerno-unused-vars): Warns about SCSS variables that are declared by not used in your local files.
34
+ - [primer/no-undefined-vars](./plugins/#primerno-undefined-vars): Prohibits usage of undefined CSS variables.
35
+ - [primer/no-scale-colors](./plugins/#primerno-scale-colors): Prohibits the use of [non-functional scale CSS variables](https://primer.style/css/support/color-system#color-palette)
36
+ - [primer/colors](./plugins/#primercolors): Enforces the use of certain color variables.
37
+ - [primer/spacing](./plugins/#primerspacing): Enforces the use of spacing variables for margin and padding.
38
+ - [primer/typography](./plugins/#primertypography): Enforces the use of typography variables for certain CSS properties.
39
+ - [primer/borders](./plugins/#primerborders): Enforces the use of certain variables for border properties.
40
+ - [primer/box-shadow](./plugins/#primerbox-shadow): Enforces the use of certain variables for `box-shadow`.
41
+
42
+ ## License
43
+
44
+ [MIT](./LICENSE) © [GitHub](https://github.com/)
package/browsers.js ADDED
@@ -0,0 +1,7 @@
1
+ module.exports = [
2
+ '> 5%',
3
+ 'last 2 firefox versions',
4
+ 'last 2 chrome versions',
5
+ 'last 2 safari versions',
6
+ 'last 2 edge versions'
7
+ ]
package/index.js ADDED
@@ -0,0 +1,69 @@
1
+ const browsers = require('./browsers')
2
+ const propertyOrder = require('./property-order')
3
+
4
+ module.exports = {
5
+ extends: ['stylelint-config-standard'],
6
+ plugins: [
7
+ 'stylelint-no-unsupported-browser-features',
8
+ 'stylelint-order',
9
+ 'stylelint-scss',
10
+ './plugins/no-override',
11
+ './plugins/no-deprecated-colors',
12
+ './plugins/no-unused-vars',
13
+ './plugins/no-undefined-vars',
14
+ './plugins/no-scale-colors',
15
+ './plugins/borders',
16
+ './plugins/box-shadow',
17
+ './plugins/colors',
18
+ './plugins/spacing',
19
+ './plugins/typography'
20
+ ],
21
+ rules: {
22
+ 'at-rule-disallowed-list': ['extend'],
23
+ 'block-no-empty': true,
24
+ 'color-named': 'never',
25
+ 'color-no-invalid-hex': true,
26
+ 'declaration-block-no-duplicate-properties': [
27
+ true,
28
+ {
29
+ ignore: ['consecutive-duplicates']
30
+ }
31
+ ],
32
+ 'declaration-block-no-shorthand-property-overrides': true,
33
+ 'order/properties-order': propertyOrder,
34
+ 'declaration-block-semicolon-newline-after': 'always',
35
+ 'declaration-property-value-disallowed-list': {
36
+ '/^transition/': ['/all/'],
37
+ '/^background/': ['http:', 'https:'],
38
+ '/^border/': ['none'],
39
+ '/.+/': ['initial']
40
+ },
41
+ 'function-calc-no-unspaced-operator': true,
42
+ 'function-linear-gradient-no-nonstandard-direction': true,
43
+ 'max-nesting-depth': 3,
44
+ 'no-duplicate-selectors': true,
45
+ 'no-extra-semicolons': true,
46
+ 'plugin/no-unsupported-browser-features': [
47
+ true,
48
+ {
49
+ severity: 'warning',
50
+ browsers
51
+ }
52
+ ],
53
+ 'primer/no-override': true,
54
+ 'primer/no-deprecated-colors': true,
55
+ // unused vars are not necessarily an error, since they may be referenced
56
+ // in other projects
57
+ 'primer/no-unused-vars': [true, {severity: 'warning'}],
58
+ 'scss/selector-no-redundant-nesting-selector': true,
59
+ 'selector-max-compound-selectors': 3,
60
+ 'selector-max-id': 0,
61
+ 'selector-max-specificity': '0,4,0',
62
+ 'selector-max-type': 0,
63
+ 'selector-no-qualifying-type': true,
64
+ 'selector-pseudo-element-no-unknown': true,
65
+ 'string-no-newline': true,
66
+ 'string-quotes': 'single',
67
+ 'unit-no-unknown': true
68
+ }
69
+ }
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@primer/stylelint-config",
3
+ "version": "0.0.0-20211023235144",
4
+ "description": "Sharable stylelint config used by GitHub's CSS",
5
+ "homepage": "http://primer.style/css/tools/linting",
6
+ "author": "GitHub, Inc.",
7
+ "license": "MIT",
8
+ "main": "index.js",
9
+ "repository": "primer/stylelint-config",
10
+ "keywords": [
11
+ "github",
12
+ "primer",
13
+ "css",
14
+ "stylelint-config",
15
+ "stylelint"
16
+ ],
17
+ "files": [
18
+ "property-order.js",
19
+ "browsers.js",
20
+ "plugins/"
21
+ ],
22
+ "scripts": {
23
+ "test": "jest",
24
+ "lint": "eslint .",
25
+ "release": "changeset publish"
26
+ },
27
+ "dependencies": {
28
+ "anymatch": "^3.1.1",
29
+ "globby": "^11.0.1",
30
+ "lodash.kebabcase": "^4.1.1",
31
+ "postcss-value-parser": "^4.0.2",
32
+ "string.prototype.matchall": "^4.0.2",
33
+ "stylelint-config-standard": "24.0.0",
34
+ "stylelint-no-unsupported-browser-features": "^5.0.1",
35
+ "stylelint-order": "^5.0.0",
36
+ "stylelint-scss": "^4.0.0",
37
+ "tap-map": "^1.0.0"
38
+ },
39
+ "peerDependencies": {
40
+ "@primer/css": "*",
41
+ "@primer/primitives": "^7.0.1"
42
+ },
43
+ "devDependencies": {
44
+ "@changesets/changelog-github": "0.4.1",
45
+ "@changesets/cli": "2.18.0",
46
+ "@github/prettier-config": "0.0.4",
47
+ "@primer/css": "^16.3.0",
48
+ "@primer/primitives": "^7.0.1",
49
+ "dedent": "0.7.0",
50
+ "eslint": "8.3.0",
51
+ "eslint-plugin-github": "4.3.4",
52
+ "eslint-plugin-jest": "25.2.4",
53
+ "eslint-plugin-prettier": "4.0.0",
54
+ "jest": "27.3.1",
55
+ "jest-preset-stylelint": "4.2.0",
56
+ "postcss-scss": "4.0.2",
57
+ "prettier": "2.4.1",
58
+ "stylelint": "14.1.0"
59
+ },
60
+ "jest": {
61
+ "preset": "jest-preset-stylelint",
62
+ "collectCoverage": true,
63
+ "collectCoverageFrom": [
64
+ "src/**/*.js",
65
+ "plugins/**/*.js"
66
+ ],
67
+ "setupFilesAfterEnv": [
68
+ "<rootDir>/__tests__/utils/setup.js"
69
+ ],
70
+ "testPathIgnorePatterns": [
71
+ "/node_modules/",
72
+ "__tests__/utils"
73
+ ]
74
+ }
75
+ }