@primer/stylelint-config 13.0.0 → 13.0.1-rc.5358628

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/dist/index.cjs CHANGED
@@ -1125,7 +1125,7 @@ const messages$1 = ruleMessages(ruleName$1, {
1125
1125
 
1126
1126
  const fontWeightKeywordMap = {
1127
1127
  normal: 400,
1128
- bold: 600,
1128
+ bold: 700,
1129
1129
  bolder: 600,
1130
1130
  lighter: 300,
1131
1131
  };
@@ -1170,7 +1170,7 @@ for (const variable of variables) {
1170
1170
  }
1171
1171
 
1172
1172
  /** @type {import('stylelint').Rule} */
1173
- const ruleFunction = (primary, secondaryOptions, context) => {
1173
+ const ruleFunction = primary => {
1174
1174
  return (root, result) => {
1175
1175
  const validOptions = validateOptions(result, ruleName$1, {
1176
1176
  actual: primary,
@@ -1183,7 +1183,7 @@ const ruleFunction = (primary, secondaryOptions, context) => {
1183
1183
  root.walkDecls(declNode => {
1184
1184
  const {prop, value} = declNode;
1185
1185
 
1186
- if (!propList.some(typographyProp => prop.startsWith(typographyProp))) return
1186
+ if (!propList.some(typographyProp => prop === typographyProp)) return
1187
1187
 
1188
1188
  const problems = [];
1189
1189
 
@@ -1240,25 +1240,25 @@ const ruleFunction = (primary, secondaryOptions, context) => {
1240
1240
  return
1241
1241
  }
1242
1242
 
1243
- if (replacementTokens.length > 1) {
1244
- return replacementTokens
1245
- }
1246
-
1247
1243
  return replacementTokens[0]
1248
1244
  };
1249
1245
  const replacement = getReplacements();
1250
1246
  const fixable = replacement && !replacement.length;
1251
-
1252
- if (fixable && context.fix) {
1253
- declNode.value = value.replace(value, `var(${replacement['name']})`);
1254
- } else {
1255
- problems.push({
1256
- index: declarationValueIndex(declNode),
1257
- endIndex: declarationValueIndex(declNode) + value.length,
1258
- message: messages$1.rejected(value, replacement, prop),
1259
- });
1247
+ let fixedValue = '';
1248
+ if (fixable) {
1249
+ fixedValue = value.replace(value, `var(${replacement['name']})`);
1260
1250
  }
1261
1251
 
1252
+ problems.push({
1253
+ index: declarationValueIndex(declNode),
1254
+ endIndex: declarationValueIndex(declNode) + value.length,
1255
+ message: messages$1.rejected(value, replacement, prop),
1256
+ fix: () => {
1257
+ if (!fixable) return
1258
+ declNode.value = fixedValue;
1259
+ },
1260
+ });
1261
+
1262
1262
  if (problems.length) {
1263
1263
  for (const err of problems) {
1264
1264
  report({
@@ -1268,6 +1268,7 @@ const ruleFunction = (primary, secondaryOptions, context) => {
1268
1268
  node: declNode,
1269
1269
  result,
1270
1270
  ruleName: ruleName$1,
1271
+ fix: err.fix,
1271
1272
  });
1272
1273
  }
1273
1274
  }
@@ -1385,7 +1386,6 @@ var index = {
1385
1386
  'declaration-property-value-disallowed-list': {
1386
1387
  '/^transition/': ['/all/'],
1387
1388
  '/^background/': ['http:', 'https:'],
1388
- '/^border/': ['none'],
1389
1389
  '/.+/': ['initial'],
1390
1390
  },
1391
1391
  'function-calc-no-unspaced-operator': true,
package/dist/index.mjs CHANGED
@@ -1122,7 +1122,7 @@ const messages$1 = ruleMessages(ruleName$1, {
1122
1122
 
1123
1123
  const fontWeightKeywordMap = {
1124
1124
  normal: 400,
1125
- bold: 600,
1125
+ bold: 700,
1126
1126
  bolder: 600,
1127
1127
  lighter: 300,
1128
1128
  };
@@ -1167,7 +1167,7 @@ for (const variable of variables) {
1167
1167
  }
1168
1168
 
1169
1169
  /** @type {import('stylelint').Rule} */
1170
- const ruleFunction = (primary, secondaryOptions, context) => {
1170
+ const ruleFunction = primary => {
1171
1171
  return (root, result) => {
1172
1172
  const validOptions = validateOptions(result, ruleName$1, {
1173
1173
  actual: primary,
@@ -1180,7 +1180,7 @@ const ruleFunction = (primary, secondaryOptions, context) => {
1180
1180
  root.walkDecls(declNode => {
1181
1181
  const {prop, value} = declNode;
1182
1182
 
1183
- if (!propList.some(typographyProp => prop.startsWith(typographyProp))) return
1183
+ if (!propList.some(typographyProp => prop === typographyProp)) return
1184
1184
 
1185
1185
  const problems = [];
1186
1186
 
@@ -1237,25 +1237,25 @@ const ruleFunction = (primary, secondaryOptions, context) => {
1237
1237
  return
1238
1238
  }
1239
1239
 
1240
- if (replacementTokens.length > 1) {
1241
- return replacementTokens
1242
- }
1243
-
1244
1240
  return replacementTokens[0]
1245
1241
  };
1246
1242
  const replacement = getReplacements();
1247
1243
  const fixable = replacement && !replacement.length;
1248
-
1249
- if (fixable && context.fix) {
1250
- declNode.value = value.replace(value, `var(${replacement['name']})`);
1251
- } else {
1252
- problems.push({
1253
- index: declarationValueIndex(declNode),
1254
- endIndex: declarationValueIndex(declNode) + value.length,
1255
- message: messages$1.rejected(value, replacement, prop),
1256
- });
1244
+ let fixedValue = '';
1245
+ if (fixable) {
1246
+ fixedValue = value.replace(value, `var(${replacement['name']})`);
1257
1247
  }
1258
1248
 
1249
+ problems.push({
1250
+ index: declarationValueIndex(declNode),
1251
+ endIndex: declarationValueIndex(declNode) + value.length,
1252
+ message: messages$1.rejected(value, replacement, prop),
1253
+ fix: () => {
1254
+ if (!fixable) return
1255
+ declNode.value = fixedValue;
1256
+ },
1257
+ });
1258
+
1259
1259
  if (problems.length) {
1260
1260
  for (const err of problems) {
1261
1261
  report({
@@ -1265,6 +1265,7 @@ const ruleFunction = (primary, secondaryOptions, context) => {
1265
1265
  node: declNode,
1266
1266
  result,
1267
1267
  ruleName: ruleName$1,
1268
+ fix: err.fix,
1268
1269
  });
1269
1270
  }
1270
1271
  }
@@ -1382,7 +1383,6 @@ var index = {
1382
1383
  'declaration-property-value-disallowed-list': {
1383
1384
  '/^transition/': ['/all/'],
1384
1385
  '/^background/': ['http:', 'https:'],
1385
- '/^border/': ['none'],
1386
1386
  '/.+/': ['initial'],
1387
1387
  },
1388
1388
  'function-calc-no-unspaced-operator': true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/stylelint-config",
3
- "version": "13.0.0",
3
+ "version": "13.0.1-rc.5358628",
4
4
  "description": "Sharable stylelint config used by GitHub's CSS",
5
5
  "author": "GitHub, Inc.",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@ export const messages = ruleMessages(ruleName, {
27
27
 
28
28
  const fontWeightKeywordMap = {
29
29
  normal: 400,
30
- bold: 600,
30
+ bold: 700,
31
31
  bolder: 600,
32
32
  lighter: 300,
33
33
  }
@@ -72,7 +72,7 @@ for (const variable of variables) {
72
72
  }
73
73
 
74
74
  /** @type {import('stylelint').Rule} */
75
- const ruleFunction = (primary, secondaryOptions, context) => {
75
+ const ruleFunction = primary => {
76
76
  return (root, result) => {
77
77
  const validOptions = validateOptions(result, ruleName, {
78
78
  actual: primary,
@@ -85,7 +85,7 @@ const ruleFunction = (primary, secondaryOptions, context) => {
85
85
  root.walkDecls(declNode => {
86
86
  const {prop, value} = declNode
87
87
 
88
- if (!propList.some(typographyProp => prop.startsWith(typographyProp))) return
88
+ if (!propList.some(typographyProp => prop === typographyProp)) return
89
89
 
90
90
  const problems = []
91
91
 
@@ -142,25 +142,25 @@ const ruleFunction = (primary, secondaryOptions, context) => {
142
142
  return
143
143
  }
144
144
 
145
- if (replacementTokens.length > 1) {
146
- return replacementTokens
147
- }
148
-
149
145
  return replacementTokens[0]
150
146
  }
151
147
  const replacement = getReplacements()
152
148
  const fixable = replacement && !replacement.length
153
-
154
- if (fixable && context.fix) {
155
- declNode.value = value.replace(value, `var(${replacement['name']})`)
156
- } else {
157
- problems.push({
158
- index: declarationValueIndex(declNode),
159
- endIndex: declarationValueIndex(declNode) + value.length,
160
- message: messages.rejected(value, replacement, prop),
161
- })
149
+ let fixedValue = ''
150
+ if (fixable) {
151
+ fixedValue = value.replace(value, `var(${replacement['name']})`)
162
152
  }
163
153
 
154
+ problems.push({
155
+ index: declarationValueIndex(declNode),
156
+ endIndex: declarationValueIndex(declNode) + value.length,
157
+ message: messages.rejected(value, replacement, prop),
158
+ fix: () => {
159
+ if (!fixable) return
160
+ declNode.value = fixedValue
161
+ },
162
+ })
163
+
164
164
  if (problems.length) {
165
165
  for (const err of problems) {
166
166
  report({
@@ -170,6 +170,7 @@ const ruleFunction = (primary, secondaryOptions, context) => {
170
170
  node: declNode,
171
171
  result,
172
172
  ruleName,
173
+ fix: err.fix,
173
174
  })
174
175
  }
175
176
  }