@shopify/stylelint-polaris
Advanced tools
Comparing version 0.0.0-alpha.6 to 0.0.0-next.7
@@ -0,1 +1,3 @@ | ||
const {getCustomPropertyNames, tokens} = require('@shopify/polaris-tokens'); | ||
/** | ||
@@ -13,3 +15,3 @@ * Internal Stylelint config for @shopify/polaris | ||
*/ | ||
const polarisCustomPropertyNames = require('../data/polaris-custom-property-names'); | ||
const polarisCustomPropertyNames = getCustomPropertyNames(tokens); | ||
@@ -16,0 +18,0 @@ /** |
@@ -0,1 +1,3 @@ | ||
const {getCustomPropertyNames, tokens} = require('@shopify/polaris-tokens'); | ||
const { | ||
@@ -9,3 +11,3 @@ ruleName: customPropertiesAllowedListRuleName, | ||
*/ | ||
const polarisCustomPropertyNames = require('./data/polaris-custom-property-names'); | ||
const polarisCustomPropertyNames = getCustomPropertyNames(tokens); | ||
@@ -12,0 +14,0 @@ /** |
{ | ||
"name": "@shopify/stylelint-polaris", | ||
"description": "Polaris Design System Stylelint tooling", | ||
"version": "0.0.0-alpha.6", | ||
"version": "0.0.0-next.7", | ||
"private": false, | ||
@@ -19,3 +19,2 @@ "license": "MIT", | ||
"configs/", | ||
"data/", | ||
"plugins/", | ||
@@ -32,6 +31,5 @@ "utils/" | ||
"scripts": { | ||
"gen-polaris-data": "node ./scripts/gen-polaris-data.js", | ||
"build": "yarn gen-polaris-data", | ||
"test": "yarn build && node tests/index.js", | ||
"prepublishOnly": "yarn build" | ||
"lint": "TIMING=1 eslint --cache .", | ||
"test": "jest", | ||
"clean": "rm -rf .turbo node_modules dist" | ||
}, | ||
@@ -42,4 +40,8 @@ "dependencies": { | ||
"peerDependencies": { | ||
"stylelint": "^14.1.0" | ||
"stylelint": "^14.1.0", | ||
"@shopify/polaris-tokens": "^5.0.2-next.0" | ||
}, | ||
"jest": { | ||
"preset": "jest-preset-stylelint" | ||
} | ||
} |
@@ -16,6 +16,5 @@ const stylelint = require('stylelint'); | ||
/** | ||
* @param {string} invalidProperty | ||
* @param {string[]} invalidValues | ||
* @type {stylelint.RuleMessageFunc} | ||
*/ | ||
rejected: (invalidProperty = '', invalidValues = []) => { | ||
rejected: (invalidProperty, invalidValues) => { | ||
const invalidPropertyMessage = invalidProperty | ||
@@ -25,4 +24,4 @@ ? `Unexpected custom property [${invalidProperty}].` | ||
const invalidValuesMessage = invalidValues.length | ||
? `Invalid custom properties [${invalidValues.join(', ')}].` | ||
const invalidValuesMessage = invalidValues | ||
? `Invalid custom properties [${invalidValues}].` | ||
: null; | ||
@@ -89,3 +88,6 @@ | ||
stylelint.utils.report({ | ||
message: messages.rejected(invalidProperty, invalidValues), | ||
message: messages.rejected( | ||
/** @type {string} */ (invalidProperty), | ||
/** @type {string} */ (invalidValues?.join(', ')), | ||
), | ||
node: decl, | ||
@@ -92,0 +94,0 @@ result, |
@@ -43,3 +43,3 @@ const stylelint = require('stylelint'); | ||
? test | ||
: decl.value.match(test)?.[0]; | ||
: /** @type {string} */ (decl.value.match(test)?.[0]); | ||
@@ -46,0 +46,0 @@ stylelint.utils.report({ |
@@ -82,12 +82,6 @@ # Stylelint Polaris (WIP) | ||
2. Generate Polaris custom property names | ||
2. Run `stylelint` on `polaris-react` | ||
```sh | ||
yarn workspace @shopify/stylelint-polaris gen-polaris-var | ||
yarn lint:stylelint | ||
``` | ||
3. Run `stylelint` on `polaris-react` | ||
```sh | ||
yarn workspace @shopify/polaris lint:styles | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
792
28354
3
87