From d28640cd57099b4131a04cccb2d0ade94d86d262 Mon Sep 17 00:00:00 2001 From: Mike Allanson Date: Wed, 3 Jun 2020 22:09:54 +0100 Subject: [PATCH 01/12] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f567739c91..97efea8219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project are documented in this file. ## Head - Added: `ignoreSelectors[]` to `block-opening-brace-space-before` ([#4640](https://github.com/stylelint/stylelint/pull/4640)). -- Fixed: false positives for all scope disables in `--report-invalid-scope-disables ([#4784](https://github.com/stylelint/stylelint/pull/4784)) +- Fixed: false positives for all scope disables in `--report-invalid-scope-disables` ([#4784](https://github.com/stylelint/stylelint/pull/4784)) - Fixed: workaround CSS-in-JS syntax throws a TypeError in the following conditions: 1. encounter a call or template expression named 'html' and 2. syntax loads via `autoSyntax()`. - Fixed: specify minimum node version in `package.json`'s `engine` field ([#4790](https://github.com/stylelint/stylelint/pull/4790)). - Fixed: write error information to `stderr` ([#4799](https://github.com/stylelint/stylelint/pull/4799)). From c223dab6819c13d18b542af11505d6275d326233 Mon Sep 17 00:00:00 2001 From: jeddy3 Date: Thu, 4 Jun 2020 14:30:48 +0100 Subject: [PATCH 02/12] Prepare 13.6.0 --- CHANGELOG.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97efea8219..3edc7cc1cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,13 @@ All notable changes to this project are documented in this file. -## Head +## 13.6.0 - Added: `ignoreSelectors[]` to `block-opening-brace-space-before` ([#4640](https://github.com/stylelint/stylelint/pull/4640)). -- Fixed: false positives for all scope disables in `--report-invalid-scope-disables` ([#4784](https://github.com/stylelint/stylelint/pull/4784)) -- Fixed: workaround CSS-in-JS syntax throws a TypeError in the following conditions: 1. encounter a call or template expression named 'html' and 2. syntax loads via `autoSyntax()`. -- Fixed: specify minimum node version in `package.json`'s `engine` field ([#4790](https://github.com/stylelint/stylelint/pull/4790)). -- Fixed: write error information to `stderr` ([#4799](https://github.com/stylelint/stylelint/pull/4799)). +- Fixed: false positives for all scope disables in `--report-invalid-scope-disables` ([#4784](https://github.com/stylelint/stylelint/pull/4784)). +- Fixed: TypeError for CSS-in-JS when encountering a call or template expression named 'html' ([#4797](https://github.com/stylelint/stylelint/pull/4797)). +- Fixed: writing error information to `stderr` ([#4799](https://github.com/stylelint/stylelint/pull/4799)). +- Fixed: minimum node version in `package.json`'s `engine` field ([#4790](https://github.com/stylelint/stylelint/pull/4790)). - Fixed: `alpha-value-notation` number precision errors ([#4802](https://github.com/stylelint/stylelint/pull/4802)). - Fixed: `font-family-no-missing-generic-family-keyword` false positives for variables ([#4806](https://github.com/stylelint/stylelint/pull/4806)). - Fixed: `no-duplicate-selectors` false positives for universal selector and `disallowInList` ([#4809](https://github.com/stylelint/stylelint/pull/4809)). From 95de6f1d21b7aedf8c8291b57d45aa2acb607ea5 Mon Sep 17 00:00:00 2001 From: jeddy3 Date: Thu, 4 Jun 2020 14:37:11 +0100 Subject: [PATCH 03/12] Update deps --- package-lock.json | 310 +++++++++++++++++----------------------------- package.json | 22 ++-- 2 files changed, 124 insertions(+), 208 deletions(-) diff --git a/package-lock.json b/package-lock.json index 05619313ba..257bb065b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1172,9 +1172,9 @@ } }, "@types/lodash": { - "version": "4.14.154", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.154.tgz", - "integrity": "sha512-VoDZIJmg3P8vPEnTldLvgA+q7RkIbVkbYX4k0cAVFzGAOQwUehVgRHgIr2/wepwivDst/rVRqaiBSjCXRnoWwQ==", + "version": "4.14.155", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.155.tgz", + "integrity": "sha512-vEcX7S7aPhsBCivxMwAANQburHBtfN9RdyXFk84IJmu2Z4Hkg1tOFgaslRiEqqvoLtbCBi6ika1EMspE+NZ9Lg==", "dev": true }, "@types/micromatch": { @@ -1550,17 +1550,17 @@ "dev": true }, "autoprefixer": { - "version": "9.7.6", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.7.6.tgz", - "integrity": "sha512-F7cYpbN7uVVhACZTeeIeealwdGM6wMtfWARVLTy5xmKtgVdBNJvbDRoCK3YO1orcs7gv/KwYlb3iXwu9Ug9BkQ==", + "version": "9.8.0", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.8.0.tgz", + "integrity": "sha512-D96ZiIHXbDmU02dBaemyAg53ez+6F5yZmapmgKcjm35yEe1uVDYI8hGW3VYoGRaG290ZFf91YxHrR518vC0u/A==", "requires": { - "browserslist": "^4.11.1", - "caniuse-lite": "^1.0.30001039", + "browserslist": "^4.12.0", + "caniuse-lite": "^1.0.30001061", "chalk": "^2.4.2", "normalize-range": "^0.1.2", "num2fraction": "^1.2.2", - "postcss": "^7.0.27", - "postcss-value-parser": "^4.0.3" + "postcss": "^7.0.30", + "postcss-value-parser": "^4.1.0" }, "dependencies": { "chalk": { @@ -1857,12 +1857,12 @@ "dev": true }, "browserslist": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.11.1.tgz", - "integrity": "sha512-DCTr3kDrKEYNw6Jb9HFxVLQNaue8z+0ZfRBRjmCunKDEXEBajKDj2Y+Uelg+Pi29OnvaSGwjOsnRyNEkXzHg5g==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.12.0.tgz", + "integrity": "sha512-UH2GkcEDSI0k/lRkuDSzFl9ZZ87skSy9w2XAn1MsZnL+4c4rqbBd3e82UWHbYDpztABrPBhZsTEeuxVfHppqDg==", "requires": { - "caniuse-lite": "^1.0.30001038", - "electron-to-chromium": "^1.3.390", + "caniuse-lite": "^1.0.30001043", + "electron-to-chromium": "^1.3.413", "node-releases": "^1.1.53", "pkg-up": "^2.0.0" } @@ -1947,9 +1947,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001040", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001040.tgz", - "integrity": "sha512-Ep0tEPeI5wCvmJNrXjE3etgfI+lkl1fTDU6Y3ZH1mhrjkPlVI9W4pcKbMo+BQLpEWKVYYp2EmYaRsqpPC3k7lQ==" + "version": "1.0.30001077", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001077.tgz", + "integrity": "sha512-AEzsGvjBJL0lby/87W96PyEvwN0GsYvk5LHsglLg9tW37K4BqvAvoSCdWIE13OZQ8afupqZ73+oL/1LkedN8hA==" }, "capture-exit": { "version": "2.0.0", @@ -2186,12 +2186,6 @@ "wrap-ansi": "^6.2.0" } }, - "clone": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", - "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", - "dev": true - }, "clone-regexp": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clone-regexp/-/clone-regexp-2.2.0.tgz", @@ -2506,15 +2500,6 @@ "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", "dev": true }, - "defaults": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", - "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", - "dev": true, - "requires": { - "clone": "^1.0.2" - } - }, "defer-to-connect": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz", @@ -2749,15 +2734,9 @@ } }, "electron-to-chromium": { - "version": "1.3.403", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.403.tgz", - "integrity": "sha512-JaoxV4RzdBAZOnsF4dAlZ2ijJW72MbqO5lNfOBHUWiBQl3Rwe+mk2RCUMrRI3rSClLJ8HSNQNqcry12H+0ZjFw==" - }, - "elegant-spinner": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-2.0.0.tgz", - "integrity": "sha512-5YRYHhvhYzV/FC4AiMdeSIg3jAYGq9xFvbhZMpPlJoBsfYgrw2DSCYeXfat6tYBu45PWiyRr3+flaCPPmviPaA==", - "dev": true + "version": "1.3.459", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.459.tgz", + "integrity": "sha512-aN3Z89qEYIwVjzGi9SrcTjjopRZ3STUA6xTufS0fxZy8xOO2iqVw8rYKdT32CHgOKHOYj5KGmz3n6xUKE4QJiQ==" }, "emoji-regex": { "version": "8.0.0", @@ -2859,9 +2838,9 @@ } }, "eslint": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.0.0.tgz", - "integrity": "sha512-qY1cwdOxMONHJfGqw52UOpZDeqXy8xmD0u8CT6jIstil72jkhURC704W8CFyTPDPllz4z4lu0Ql1+07PG/XdIg==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.1.0.tgz", + "integrity": "sha512-DfS3b8iHMK5z/YLSme8K5cge168I8j8o1uiVmFCgnnjxZQbCGyraF8bMl7Ju4yfBmCuxD7shOF7eqGkcuIHfsA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -2903,9 +2882,9 @@ }, "dependencies": { "cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -3144,14 +3123,28 @@ "dev": true }, "espree": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-7.0.0.tgz", - "integrity": "sha512-/r2XEx5Mw4pgKdyb7GNLQNsu++asx/dltf/CI8RFi9oGHxmQFgvLbc5Op4U6i8Oaj+kdslhJtVlEZeAqH5qOTw==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.1.0.tgz", + "integrity": "sha512-dcorZSyfmm4WTuTnE5Y7MEN1DyoPYy1ZR783QW1FJoenn7RailyWFsq/UL6ZAAA7uXurN9FIpYyUs3OfiIW+Qw==", "dev": true, "requires": { - "acorn": "^7.1.1", + "acorn": "^7.2.0", "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" + "eslint-visitor-keys": "^1.2.0" + }, + "dependencies": { + "acorn": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", + "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", + "dev": true + }, + "eslint-visitor-keys": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz", + "integrity": "sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ==", + "dev": true + } } }, "esprima": { @@ -3770,9 +3763,9 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, "globby": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.0.tgz", - "integrity": "sha512-iuehFnR3xu5wBBtm4xi0dMe92Ob87ufyu/dHwpDYfbcpYpIbrO5OnS8M1vWvrBhSGEJ3/Ecj7gnX76P8YxpPEg==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", + "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", "requires": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -3796,9 +3789,9 @@ } }, "got": { - "version": "11.1.4", - "resolved": "https://registry.npmjs.org/got/-/got-11.1.4.tgz", - "integrity": "sha512-z94KIXHhFSpJONuY6C6w1wC+igE7P1d0b5h3H2CvrOXn0/tum/OgFblIGUAxI5PBXukGLvKb9MJXVHW8vsYaBA==", + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/got/-/got-11.2.0.tgz", + "integrity": "sha512-68pBow9XXXSdVRV5wSx0kWMCZsag4xE3Ru0URVe0PWsSYmU4SJrUmEO6EVYFlFHc9rq/6Yqn6o1GxIb9torQxg==", "dev": true, "requires": { "@sindresorhus/is": "^2.1.1", @@ -4016,9 +4009,9 @@ }, "dependencies": { "quick-lru": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.0.tgz", - "integrity": "sha512-WjAKQ9ORzvqjLijJXiXWqc3Gcs1ivoxCj6KJmEjoWBE6OtHwuaDLSAUqGHALUiid7A1KqGqsSHZs8prxF5xxAQ==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", + "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true } } @@ -4057,9 +4050,9 @@ } }, "ignore": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", - "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==" + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==" }, "import-fresh": { "version": "3.2.1", @@ -6297,19 +6290,21 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=" }, "lint-staged": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.2.2.tgz", - "integrity": "sha512-78kNqNdDeKrnqWsexAmkOU3Z5wi+1CsQmUmfCuYgMTE8E4rAIX8RHW7xgxwAZ+LAayb7Cca4uYX4P3LlevzjVg==", + "version": "10.2.9", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.2.9.tgz", + "integrity": "sha512-ziRAuXEqvJLSXg43ezBpHxRW8FOJCXISaXU//BWrxRrp5cBdRkIx7g5IsB3OI45xYGE0S6cOacfekSjDyDKF2g==", "dev": true, "requires": { "chalk": "^4.0.0", - "commander": "^5.0.0", + "cli-truncate": "2.1.0", + "commander": "^5.1.0", "cosmiconfig": "^6.0.0", "debug": "^4.1.1", "dedent": "^0.7.0", - "execa": "^4.0.0", - "listr2": "1.3.8", - "log-symbols": "^3.0.0", + "enquirer": "^2.3.5", + "execa": "^4.0.1", + "listr2": "^2.1.0", + "log-symbols": "^4.0.0", "micromatch": "^4.0.2", "normalize-path": "^3.0.0", "please-upgrade-node": "^3.2.0", @@ -6318,9 +6313,9 @@ }, "dependencies": { "cross-spawn": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", - "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, "requires": { "path-key": "^3.1.0", @@ -6329,9 +6324,9 @@ } }, "execa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.1.tgz", - "integrity": "sha512-SCjM/zlBdOK8Q5TIjOn6iEHZaPHFsMoTxXQ2nvUvtPnuohz3H2dIozSg+etNR98dGoYUp2ENSKLL/XaMmbxVgw==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/execa/-/execa-4.0.2.tgz", + "integrity": "sha512-QI2zLa6CjGWdiQsmSkZoGtDx2N+cQIGb3yNolGTdjSQzydzLgYYf8LRuagp7S7fPimjcrzUDSUFd/MgzELMi4Q==", "dev": true, "requires": { "cross-spawn": "^7.0.0", @@ -6351,28 +6346,6 @@ "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true }, - "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", - "dev": true, - "requires": { - "chalk": "^2.4.2" - }, - "dependencies": { - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - } - } - }, "npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -6745,68 +6718,21 @@ } }, "listr2": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/listr2/-/listr2-1.3.8.tgz", - "integrity": "sha512-iRDRVTgSDz44tBeBBg/35TQz4W+EZBWsDUq7hPpqeUHm7yLPNll0rkwW3lIX9cPAK7l+x95mGWLpxjqxftNfZA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-2.1.0.tgz", + "integrity": "sha512-pWrbMLO+6jxGbgAasTLUzfRYdBaQvv6sNTWDfIX8ENBNmTwt/eafZ/LlJ66/dNaDnEhzCpWricLH4U9cjSAHYg==", "dev": true, "requires": { - "@samverschueren/stream-to-observable": "^0.3.0", - "chalk": "^3.0.0", - "cli-cursor": "^3.1.0", + "chalk": "^4.0.0", "cli-truncate": "^2.1.0", - "elegant-spinner": "^2.0.0", - "enquirer": "^2.3.4", "figures": "^3.2.0", "indent-string": "^4.0.0", "log-update": "^4.0.0", "p-map": "^4.0.0", - "pad": "^3.2.0", - "rxjs": "^6.3.3", - "through": "^2.3.8", - "uuid": "^7.0.2" + "rxjs": "^6.5.5", + "through": "^2.3.8" }, "dependencies": { - "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", - "dev": true, - "requires": { - "@types/color-name": "^1.1.1", - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, "p-map": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", @@ -6815,15 +6741,6 @@ "requires": { "aggregate-error": "^3.0.0" } - }, - "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } } } }, @@ -7374,9 +7291,9 @@ } }, "node-releases": { - "version": "1.1.53", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.53.tgz", - "integrity": "sha512-wp8zyQVwef2hpZ/dJH7SfSrIPD6YoJz6BDQDpGEkcA0s3LpAQoxBIYmfIq6QAhC1DhwsyCgTaTTcONwX8qzCuQ==" + "version": "1.1.58", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.58.tgz", + "integrity": "sha512-NxBudgVKiRh/2aPWMgPR7bPTX0VPmGx5QBwCtdHitnqFE5/O8DeBXuIMH1nwNnw/aMo6AjOrpsHzfY3UbUJ7yg==" }, "normalize-package-data": { "version": "2.5.0", @@ -8362,15 +8279,6 @@ } } }, - "pad": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/pad/-/pad-3.2.0.tgz", - "integrity": "sha512-2u0TrjcGbOjBTJpyewEl4hBO3OeX5wWue7eIFPzQTg6wFSvoaHcBTTUY5m+n0hd04gmTCPuY0kCpVIVuw5etwg==", - "dev": true, - "requires": { - "wcwidth": "^1.0.1" - } - }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -8590,9 +8498,9 @@ "dev": true }, "postcss": { - "version": "7.0.30", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.30.tgz", - "integrity": "sha512-nu/0m+NtIzoubO+xdAlwZl/u5S5vi/y6BCsoL8D+8IxsD3XvBS8X4YEADNIVXKVuQvduiucnRv+vPIqj56EGMQ==", + "version": "7.0.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", + "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", "requires": { "chalk": "^2.4.2", "source-map": "^0.6.1", @@ -8729,11 +8637,11 @@ } }, "postcss-scss": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-2.0.0.tgz", - "integrity": "sha512-um9zdGKaDZirMm+kZFKKVsnKPF7zF7qBAtIfTSnZXD1jZ0JNZIxdB6TxQOjCnlSzLRInVl2v3YdBh/M881C4ug==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-2.1.1.tgz", + "integrity": "sha512-jQmGnj0hSGLd9RscFw9LyuSVAa5Bl1/KBPqG1NQw9w8ND55nY4ZEsdlVuYJvLPpV+y0nwTV5v/4rHPzZRihQbA==", "requires": { - "postcss": "^7.0.0" + "postcss": "^7.0.6" } }, "postcss-selector-parser": { @@ -10092,6 +10000,22 @@ "globby": "11.0.0", "is-plain-obj": "2.1.0", "sort-object-keys": "^1.1.3" + }, + "dependencies": { + "globby": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.0.tgz", + "integrity": "sha512-iuehFnR3xu5wBBtm4xi0dMe92Ob87ufyu/dHwpDYfbcpYpIbrO5OnS8M1vWvrBhSGEJ3/Ecj7gnX76P8YxpPEg==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + } } }, "source-map": { @@ -10772,9 +10696,9 @@ } }, "typescript": { - "version": "3.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz", - "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", + "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==", "dev": true }, "unherit": { @@ -11181,12 +11105,13 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/uuid/-/uuid-7.0.3.tgz", "integrity": "sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg==", - "dev": true + "dev": true, + "optional": true }, "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==" }, "v8-to-istanbul": { "version": "4.1.4", @@ -11326,15 +11251,6 @@ "makeerror": "1.0.x" } }, - "wcwidth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", - "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", - "dev": true, - "requires": { - "defaults": "^1.0.3" - } - }, "webidl-conversions": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", diff --git a/package.json b/package.json index 691e0b2eea..525ababb28 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "dependencies": { "@stylelint/postcss-css-in-js": "^0.37.1", "@stylelint/postcss-markdown": "^0.36.1", - "autoprefixer": "^9.7.6", + "autoprefixer": "^9.8.0", "balanced-match": "^1.0.0", "chalk": "^4.0.0", "cosmiconfig": "^6.0.0", @@ -121,10 +121,10 @@ "file-entry-cache": "^5.0.1", "get-stdin": "^8.0.0", "global-modules": "^2.0.0", - "globby": "^11.0.0", + "globby": "^11.0.1", "globjoin": "^0.1.4", "html-tags": "^3.1.0", - "ignore": "^5.1.4", + "ignore": "^5.1.8", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "known-css-properties": "^0.19.0", @@ -135,7 +135,7 @@ "meow": "^7.0.1", "micromatch": "^4.0.2", "normalize-selector": "^0.2.0", - "postcss": "^7.0.30", + "postcss": "^7.0.32", "postcss-html": "^0.36.0", "postcss-less": "^3.1.4", "postcss-media-query-parser": "^0.2.3", @@ -143,7 +143,7 @@ "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^4.0.2", "postcss-sass": "^0.4.4", - "postcss-scss": "^2.0.0", + "postcss-scss": "^2.1.1", "postcss-selector-parser": "^6.0.2", "postcss-syntax": "^0.36.2", "postcss-value-parser": "^4.1.0", @@ -156,7 +156,7 @@ "sugarss": "^2.0.0", "svg-tags": "^1.0.0", "table": "^5.4.6", - "v8-compile-cache": "^2.1.0", + "v8-compile-cache": "^2.1.1", "write-file-atomic": "^3.0.3" }, "devDependencies": { @@ -166,26 +166,26 @@ "@types/debug": "^4.1.5", "@types/global-modules": "^2.0.0", "@types/globjoin": "^0.1.0", - "@types/lodash": "^4.14.154", + "@types/lodash": "^4.14.155", "@types/micromatch": "^4.0.1", "benchmark": "^2.1.4", "common-tags": "^1.8.0", "del": "^5.1.0", - "eslint": "^7.0.0", + "eslint": "^7.1.0", "eslint-config-stylelint": "^12.0.0", - "got": "^11.1.4", + "got": "^11.2.0", "husky": "^4.2.5", "jest": "^26.0.1", "jest-circus": "^26.0.1", "jest-preset-stylelint": "^3.0.0", "jest-watch-typeahead": "^0.6.0", - "lint-staged": "^10.2.2", + "lint-staged": "^10.2.9", "np": "^6.2.3", "npm-run-all": "^4.1.5", "postcss-import": "^12.0.1", "prettier": "^2.0.5", "remark-cli": "^8.0.0", - "typescript": "^3.9.2" + "typescript": "^3.9.3" }, "engines": { "node": ">=10.13.0" From 0f69eac035302bea0928e047e3395eb7164d3334 Mon Sep 17 00:00:00 2001 From: jeddy3 Date: Thu, 4 Jun 2020 14:47:20 +0100 Subject: [PATCH 04/12] 13.6.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 257bb065b6..81eb5d25fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "stylelint", - "version": "13.5.0", + "version": "13.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 525ababb28..b15d8f3a1d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "stylelint", - "version": "13.5.0", + "version": "13.6.0", "description": "A mighty, modern CSS linter.", "keywords": [ "css-in-js", From 8e07ca089b8698e9e3726e4a8d0699d3feb11ed8 Mon Sep 17 00:00:00 2001 From: Mike Allanson Date: Tue, 9 Jun 2020 11:12:07 +0100 Subject: [PATCH 05/12] Create new 'lintPostcssResult' module (#4819) --- lib/lintPostcssResult.js | 142 +++++++++++++++++++++++++++++++++++++++ lib/lintSource.js | 142 ++------------------------------------- 2 files changed, 147 insertions(+), 137 deletions(-) create mode 100644 lib/lintPostcssResult.js diff --git a/lib/lintPostcssResult.js b/lib/lintPostcssResult.js new file mode 100644 index 0000000000..b3e8f8051b --- /dev/null +++ b/lib/lintPostcssResult.js @@ -0,0 +1,142 @@ +'use strict'; + +const assignDisabledRanges = require('./assignDisabledRanges'); +const get = require('lodash/get'); +const getOsEol = require('./utils/getOsEol'); +const reportUnknownRuleNames = require('./reportUnknownRuleNames'); +const rulesOrder = require('./rules'); + +/** @typedef {import('stylelint').StylelintStandaloneOptions} StylelintStandaloneOptions */ +/** @typedef {import('stylelint').PostcssResult} PostcssResult */ +/** @typedef {import('stylelint').StylelintConfig} StylelintConfig */ + +/** + * @param {StylelintStandaloneOptions} stylelintOptions + * @param {PostcssResult} postcssResult + * @param {StylelintConfig} config + * @returns {Promise} + */ +function lintPostcssResult(stylelintOptions, postcssResult, config) { + postcssResult.stylelint.ruleSeverities = {}; + postcssResult.stylelint.customMessages = {}; + postcssResult.stylelint.stylelintError = false; + postcssResult.stylelint.quiet = config.quiet; + postcssResult.stylelint.config = config; + + /** @type {string} */ + let newline; + const postcssDoc = postcssResult.root; + + if (postcssDoc) { + if (!('type' in postcssDoc)) { + throw new Error('Unexpected Postcss root object!'); + } + + // @ts-ignore TODO TYPES property css does not exists + const newlineMatch = postcssDoc.source && postcssDoc.source.input.css.match(/\r?\n/); + + newline = newlineMatch ? newlineMatch[0] : getOsEol(); + + assignDisabledRanges(postcssDoc, postcssResult); + } + + if (stylelintOptions.ignoreDisables) { + postcssResult.stylelint.ignoreDisables = true; + } + + if (stylelintOptions.reportNeedlessDisables) { + postcssResult.stylelint.reportNeedlessDisables = true; + } + + const isFileFixCompatible = isFixCompatible(postcssResult); + + if (!isFileFixCompatible) { + postcssResult.stylelint.disableWritingFix = true; + } + + const postcssRoots = /** @type {import('postcss').Root[]} */ (postcssDoc && + postcssDoc.constructor.name === 'Document' + ? postcssDoc.nodes + : [postcssDoc]); + + // Promises for the rules. Although the rule code runs synchronously now, + // the use of Promises makes it compatible with the possibility of async + // rules down the line. + /** @type {Array>} */ + const performRules = []; + + const rules = config.rules + ? Object.keys(config.rules).sort( + (a, b) => Object.keys(rulesOrder).indexOf(a) - Object.keys(rulesOrder).indexOf(b), + ) + : []; + + rules.forEach((ruleName) => { + const ruleFunction = rulesOrder[ruleName] || get(config, ['pluginFunctions', ruleName]); + + if (ruleFunction === undefined) { + performRules.push( + Promise.all( + postcssRoots.map((postcssRoot) => + reportUnknownRuleNames(ruleName, postcssRoot, postcssResult), + ), + ), + ); + + return; + } + + const ruleSettings = get(config, ['rules', ruleName]); + + if (ruleSettings === null || ruleSettings[0] === null) { + return; + } + + const primaryOption = ruleSettings[0]; + const secondaryOptions = ruleSettings[1]; + + // Log the rule's severity in the PostCSS result + const defaultSeverity = config.defaultSeverity || 'error'; + + postcssResult.stylelint.ruleSeverities[ruleName] = get( + secondaryOptions, + 'severity', + defaultSeverity, + ); + postcssResult.stylelint.customMessages[ruleName] = get(secondaryOptions, 'message'); + + performRules.push( + Promise.all( + postcssRoots.map((postcssRoot) => + ruleFunction(primaryOption, secondaryOptions, { + fix: + stylelintOptions.fix && + // Next two conditionals are temporary measures until #2643 is resolved + isFileFixCompatible && + !postcssResult.stylelint.disabledRanges[ruleName], + newline, + })(postcssRoot, postcssResult), + ), + ), + ); + }); + + return Promise.all(performRules); +} + +/** + * There are currently some bugs in the autofixer of Stylelint. + * The autofixer does not yet adhere to stylelint-disable comments, so if there are disabled + * ranges we can not autofix this document. More info in issue #2643. + * + * @param {PostcssResult} postcssResult + * @returns {boolean} + */ +function isFixCompatible({ stylelint }) { + // Check for issue #2643 + if (stylelint.disabledRanges.all.length) return false; + + return true; +} + +module.exports = lintPostcssResult; diff --git a/lib/lintSource.js b/lib/lintSource.js index 4c38ac96ec..f5bc8f3df4 100644 --- a/lib/lintSource.js +++ b/lib/lintSource.js @@ -1,16 +1,13 @@ 'use strict'; -const _ = require('lodash'); -const assignDisabledRanges = require('./assignDisabledRanges'); -const getOsEol = require('./utils/getOsEol'); +const lintPostcssResult = require('./lintPostcssResult'); const path = require('path'); -const reportUnknownRuleNames = require('./reportUnknownRuleNames'); -const rulesOrder = require('./rules'); /** @typedef {import('stylelint').StylelintInternalApi} StylelintInternalApi */ +/** @typedef {import('stylelint').GetLintSourceOptions} Options */ +/** @typedef {import('postcss').Result} Result */ /** @typedef {import('stylelint').PostcssResult} PostcssResult */ /** @typedef {import('stylelint').StylelintPostcssResult} StylelintPostcssResult */ -/** @typedef {import('stylelint').GetLintSourceOptions} Options */ /** * Run stylelint on a PostCSS Result, either one that is provided @@ -84,7 +81,7 @@ module.exports = function lintSource(stylelint, options = {}) { stylelint: stylelintResult, }); - return lintPostcssResult(stylelint, stylelintPostcssResult, config).then( + return lintPostcssResult(stylelint._options, stylelintPostcssResult, config).then( () => stylelintPostcssResult, ); } @@ -101,7 +98,7 @@ module.exports = function lintSource(stylelint, options = {}) { stylelint: stylelintResult, }); - return lintPostcssResult(stylelint, stylelintPostcssResult, config).then( + return lintPostcssResult(stylelint._options, stylelintPostcssResult, config).then( () => stylelintPostcssResult, ); }); @@ -109,120 +106,6 @@ module.exports = function lintSource(stylelint, options = {}) { }); }; -/** - * @param {StylelintInternalApi} stylelint - * @param {PostcssResult} postcssResult - * @param {import('stylelint').StylelintConfig} config - * @returns {Promise} - */ -function lintPostcssResult(stylelint, postcssResult, config) { - postcssResult.stylelint.ruleSeverities = {}; - postcssResult.stylelint.customMessages = {}; - postcssResult.stylelint.stylelintError = false; - postcssResult.stylelint.quiet = config.quiet; - postcssResult.stylelint.config = config; - - /** @type {string} */ - let newline; - const postcssDoc = postcssResult.root; - - if (postcssDoc) { - if (!('type' in postcssDoc)) { - throw new Error('Unexpected Postcss root object!'); - } - - // @ts-ignore TODO TYPES property css does not exists - const newlineMatch = postcssDoc.source && postcssDoc.source.input.css.match(/\r?\n/); - - newline = newlineMatch ? newlineMatch[0] : getOsEol(); - - assignDisabledRanges(postcssDoc, postcssResult); - } - - if (stylelint._options.ignoreDisables) { - postcssResult.stylelint.ignoreDisables = true; - } - - if (stylelint._options.reportNeedlessDisables) { - postcssResult.stylelint.reportNeedlessDisables = true; - } - - const isFileFixCompatible = isFixCompatible(postcssResult); - - if (!isFileFixCompatible) { - postcssResult.stylelint.disableWritingFix = true; - } - - const postcssRoots = /** @type {import('postcss').Root[]} */ (postcssDoc && - postcssDoc.constructor.name === 'Document' - ? postcssDoc.nodes - : [postcssDoc]); - - // Promises for the rules. Although the rule code runs synchronously now, - // the use of Promises makes it compatible with the possibility of async - // rules down the line. - /** @type {Array>} */ - const performRules = []; - - const rules = config.rules - ? Object.keys(config.rules).sort( - (a, b) => Object.keys(rulesOrder).indexOf(a) - Object.keys(rulesOrder).indexOf(b), - ) - : []; - - rules.forEach((ruleName) => { - const ruleFunction = rulesOrder[ruleName] || _.get(config, ['pluginFunctions', ruleName]); - - if (ruleFunction === undefined) { - performRules.push( - Promise.all( - postcssRoots.map((postcssRoot) => - reportUnknownRuleNames(ruleName, postcssRoot, postcssResult), - ), - ), - ); - - return; - } - - const ruleSettings = _.get(config, ['rules', ruleName]); - - if (ruleSettings === null || ruleSettings[0] === null) { - return; - } - - const primaryOption = ruleSettings[0]; - const secondaryOptions = ruleSettings[1]; - - // Log the rule's severity in the PostCSS result - const defaultSeverity = config.defaultSeverity || 'error'; - - postcssResult.stylelint.ruleSeverities[ruleName] = _.get( - secondaryOptions, - 'severity', - defaultSeverity, - ); - postcssResult.stylelint.customMessages[ruleName] = _.get(secondaryOptions, 'message'); - - performRules.push( - Promise.all( - postcssRoots.map((postcssRoot) => - ruleFunction(primaryOption, secondaryOptions, { - fix: - stylelint._options.fix && - // Next two conditionals are temporary measures until #2643 is resolved - isFileFixCompatible && - !postcssResult.stylelint.disabledRanges[ruleName], - newline, - })(postcssRoot, postcssResult), - ), - ), - ); - }); - - return Promise.all(performRules); -} - /** * @returns {StylelintPostcssResult} */ @@ -253,18 +136,3 @@ function createEmptyPostcssResult(filePath) { warn: () => {}, }; } - -/** - * There are currently some bugs in the autofixer of Stylelint. - * The autofixer does not yet adhere to stylelint-disable comments, so if there are disabled - * ranges we can not autofix this document. More info in issue #2643. - * - * @param {PostcssResult} postcssResult - * @returns {boolean} - */ -function isFixCompatible({ stylelint }) { - // Check for issue #2643 - if (stylelint.disabledRanges.all.length) return false; - - return true; -} From 120df509ccd5e513362548d1c88c5bd1e2d22a21 Mon Sep 17 00:00:00 2001 From: ecuplxd <12050901053@ecupl.edu.cn> Date: Tue, 9 Jun 2020 18:15:26 +0800 Subject: [PATCH 06/12] Fix TypeError for inline comments and autofix for sugarss in max-empty-lines (#4821) --- lib/rules/max-empty-lines/__tests__/index.js | 44 ++++++++++++++++++++ lib/rules/max-empty-lines/index.js | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/lib/rules/max-empty-lines/__tests__/index.js b/lib/rules/max-empty-lines/__tests__/index.js index 50efa8ee46..dafd1ed002 100644 --- a/lib/rules/max-empty-lines/__tests__/index.js +++ b/lib/rules/max-empty-lines/__tests__/index.js @@ -478,6 +478,50 @@ testRule({ ], }); +testRule({ + ruleName, + config: [2], + skipBasicChecks: true, + syntax: 'sugarss', + fix: true, + + accept: [ + { + code: '\n\n// one', + }, + { + code: '// one\n\n', + }, + { + code: '// one\n\n\n// two\n', + }, + ], + + reject: [ + { + code: '\n\n\n// one', + fixed: '\n\n// one', + message: messages.expected(2), + line: 3, + column: 1, + }, + { + code: '// one\n\n\n', + fixed: '// one\n\n', + message: messages.expected(2), + line: 4, + column: 1, + }, + { + code: '// one\n\n\n\n// two\n', + fixed: '// one\n\n\n// two\n', + message: messages.expected(2), + line: 4, + column: 1, + }, + ], +}); + testRule({ ruleName, config: [2, { ignore: 'comments' }], diff --git a/lib/rules/max-empty-lines/index.js b/lib/rules/max-empty-lines/index.js index cd0ffe9450..4f7985db1d 100644 --- a/lib/rules/max-empty-lines/index.js +++ b/lib/rules/max-empty-lines/index.js @@ -154,7 +154,7 @@ function rule(max, options, context) { function replaceEmptyLines(max, str, isSpecialCase = false) { const repeatTimes = isSpecialCase ? max : max + 1; - if (repeatTimes === 0) { + if (repeatTimes === 0 || typeof str !== 'string') { return ''; } From 038daf4f18a693025eeadb56e042b570fd086f28 Mon Sep 17 00:00:00 2001 From: Mike Allanson Date: Tue, 9 Jun 2020 11:15:44 +0100 Subject: [PATCH 07/12] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3edc7cc1cc..4fd977b7ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project are documented in this file. +## Head + +- Fixed: `max-empty-lines` TypeError from inline comment with autofix and sugarss syntax ([#4821](https://github.com/stylelint/stylelint/pull/4821)). + ## 13.6.0 - Added: `ignoreSelectors[]` to `block-opening-brace-space-before` ([#4640](https://github.com/stylelint/stylelint/pull/4640)). From 80f3fabfde54d4960b2083eb2e62c8ebe005fd41 Mon Sep 17 00:00:00 2001 From: Ryutaro Yamada Date: Tue, 9 Jun 2020 19:17:53 +0900 Subject: [PATCH 08/12] Fix false positives for namespaced variables in property-no-unknown (#4803) --- .../property-no-unknown/__tests__/index.js | 4 +++ lib/utils/__tests__/isScssVariable.test.js | 36 +++++++++++++++++++ .../isStandardSyntaxDeclaration.test.js | 12 +++++++ .../isStandardSyntaxProperty.test.js | 3 ++ lib/utils/isScssVariable.js | 21 +++++++++++ lib/utils/isStandardSyntaxDeclaration.js | 5 +-- lib/utils/isStandardSyntaxProperty.js | 5 +-- 7 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 lib/utils/__tests__/isScssVariable.test.js create mode 100644 lib/utils/isScssVariable.js diff --git a/lib/rules/property-no-unknown/__tests__/index.js b/lib/rules/property-no-unknown/__tests__/index.js index d91505ae91..2861598661 100644 --- a/lib/rules/property-no-unknown/__tests__/index.js +++ b/lib/rules/property-no-unknown/__tests__/index.js @@ -86,6 +86,10 @@ testRule({ code: '.foo { $bgColor: white; }', description: 'ignore SCSS variables', }, + { + code: '.foo { namespace.$bgColor: white; }', + description: 'ignore SCSS variables within namespace', + }, { code: '.foo { #{$prop}: black; }', description: 'ignore property interpolation', diff --git a/lib/utils/__tests__/isScssVariable.test.js b/lib/utils/__tests__/isScssVariable.test.js new file mode 100644 index 0000000000..59ac31e4d4 --- /dev/null +++ b/lib/utils/__tests__/isScssVariable.test.js @@ -0,0 +1,36 @@ +'use strict'; + +const isScssVariable = require('../isScssVariable'); + +describe('isScssVariable', () => { + it('sass variable', () => { + expect(isScssVariable('$sass-variable')).toBeTruthy(); + }); + it('sass variable within namespace', () => { + expect(isScssVariable('namespace.$sass-variable')).toBeTruthy(); + }); + it('sass interpolation', () => { + expect(isScssVariable('#{$Attr}-color')).toBeFalsy(); + }); + it('single word property', () => { + expect(isScssVariable('top')).toBeFalsy(); + }); + it('hyphenated property', () => { + expect(isScssVariable('border-top-left-radius')).toBeFalsy(); + }); + it('property with vendor prefix', () => { + expect(isScssVariable('-webkit-appearance')).toBeFalsy(); + }); + it('custom property', () => { + expect(isScssVariable('--custom-property')).toBeFalsy(); + }); + it('less variable', () => { + expect(isScssVariable('@var')).toBeFalsy(); + }); + it('less append property value with comma', () => { + expect(isScssVariable('transform+')).toBeFalsy(); + }); + it('less append property value with space', () => { + expect(isScssVariable('transform+_')).toBeFalsy(); + }); +}); diff --git a/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js b/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js index 3df0d982b5..c0a3fc5978 100644 --- a/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js +++ b/lib/utils/__tests__/isStandardSyntaxDeclaration.test.js @@ -121,6 +121,18 @@ describe('isStandardSyntaxDeclaration', () => { }); }); + it('scss var within namespace', () => { + scssDecls('namespace.$var: b', (decl) => { + expect(isStandardSyntaxDeclaration(decl)).toBeFalsy(); + }); + }); + + it('nested scss var within namespace', () => { + scssDecls('a { namespace.$var: b }', (decl) => { + expect(isStandardSyntaxDeclaration(decl)).toBeFalsy(); + }); + }); + it('sass list', () => { sassDecls('$list: (key: value, key2: value2)', (decl) => { expect(isStandardSyntaxDeclaration(decl)).toBeFalsy(); diff --git a/lib/utils/__tests__/isStandardSyntaxProperty.test.js b/lib/utils/__tests__/isStandardSyntaxProperty.test.js index ec440a26e0..5afb1a2469 100644 --- a/lib/utils/__tests__/isStandardSyntaxProperty.test.js +++ b/lib/utils/__tests__/isStandardSyntaxProperty.test.js @@ -18,6 +18,9 @@ describe('isStandardSyntaxProperty', () => { it('sass variable', () => { expect(isStandardSyntaxProperty('$sass-variable')).toBeFalsy(); }); + it('sass variable within namespace', () => { + expect(isStandardSyntaxProperty('namespace.$sass-variable')).toBeFalsy(); + }); it('sass interpolation', () => { expect(isStandardSyntaxProperty('#{$Attr}-color')).toBeFalsy(); }); diff --git a/lib/utils/isScssVariable.js b/lib/utils/isScssVariable.js new file mode 100644 index 0000000000..fbc938a723 --- /dev/null +++ b/lib/utils/isScssVariable.js @@ -0,0 +1,21 @@ +'use strict'; + +/** + * Check whether a property is SCSS variable + * + * @param {string} property + * @returns {boolean} + */ +module.exports = function (property) { + // SCSS var (e.g. $var: x), list (e.g. $list: (x)) or map (e.g. $map: (key:value)) + if (property.startsWith('$')) { + return true; + } + + // SCSS var within a namespace (e.g. namespace.$var: x) + if (property.includes('.$')) { + return true; + } + + return false; +}; diff --git a/lib/utils/isStandardSyntaxDeclaration.js b/lib/utils/isStandardSyntaxDeclaration.js index 9f36604450..7c6cc2e41e 100644 --- a/lib/utils/isStandardSyntaxDeclaration.js +++ b/lib/utils/isStandardSyntaxDeclaration.js @@ -1,5 +1,6 @@ 'use strict'; +const isScssVariable = require('./isScssVariable'); const { isRoot } = require('./typeGuards'); /** @@ -29,8 +30,8 @@ module.exports = function (decl) { return false; } - // Sass var (e.g. $var: x), nested list (e.g. $list: (x)) or nested map (e.g. $map: (key:value)) - if (prop[0] === '$') { + // SCSS var + if (isScssVariable(prop)) { return false; } diff --git a/lib/utils/isStandardSyntaxProperty.js b/lib/utils/isStandardSyntaxProperty.js index b85d8d23ed..a42bf8a06e 100644 --- a/lib/utils/isStandardSyntaxProperty.js +++ b/lib/utils/isStandardSyntaxProperty.js @@ -1,6 +1,7 @@ 'use strict'; const hasInterpolation = require('../utils/hasInterpolation'); +const isScssVariable = require('./isScssVariable'); /** * Check whether a property is standard @@ -9,8 +10,8 @@ const hasInterpolation = require('../utils/hasInterpolation'); * @returns {boolean} */ module.exports = function (property) { - // SCSS var (e.g. $var: x), list (e.g. $list: (x)) or map (e.g. $map: (key:value)) - if (property.startsWith('$')) { + // SCSS var + if (isScssVariable(property)) { return false; } From 769f917f13c8e8f4f18644c0a5d3319f3c116d41 Mon Sep 17 00:00:00 2001 From: Mike Allanson Date: Tue, 9 Jun 2020 11:19:19 +0100 Subject: [PATCH 09/12] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd977b7ee..39d72f39ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project are documented in this file. ## Head - Fixed: `max-empty-lines` TypeError from inline comment with autofix and sugarss syntax ([#4821](https://github.com/stylelint/stylelint/pull/4821)). +- Fixed: `property-no-unknown` false positives for namespaced variables ([#4803](https://github.com/stylelint/stylelint/pull/4803)). ## 13.6.0 From 5b6b99654eee4724040b81de1c5b6370e6059ea1 Mon Sep 17 00:00:00 2001 From: Mike Allanson Date: Tue, 9 Jun 2020 12:12:57 +0100 Subject: [PATCH 10/12] Add type `Formatter` for formatter functions (#4823) --- docs/developer-guide/formatters.md | 7 +++++-- lib/formatters/compactFormatter.js | 3 +-- lib/formatters/jsonFormatter.js | 3 +-- lib/formatters/stringFormatter.js | 3 +-- lib/formatters/unixFormatter.js | 3 +-- lib/formatters/verboseFormatter.js | 3 +-- lib/standalone.js | 3 ++- types/stylelint/index.d.ts | 11 +++++++++-- 8 files changed, 21 insertions(+), 15 deletions(-) diff --git a/docs/developer-guide/formatters.md b/docs/developer-guide/formatters.md index 5e28ed7e12..b51e1055e0 100644 --- a/docs/developer-guide/formatters.md +++ b/docs/developer-guide/formatters.md @@ -3,12 +3,15 @@ A formatter is a function with the following signature: ```js +/** + * @type {import('stylelint').Formatter} + */ function formatter(results, returnValue) { return "a string of formatted results"; } ``` -Where the first argument (`results`) is an array of stylelint result objects in the form: +Where the first argument (`results`) is an array of stylelint result objects (type `Array`) in the form: ```js // A stylelint result object @@ -42,7 +45,7 @@ Where the first argument (`results`) is an array of stylelint result objects in } ``` -And the second argument (`returnValue`) is an object with one or more of the following keys: +And the second argument (`returnValue`) is an object (type `StylelintStandaloneReturnValue`) with one or more of the following keys: ```js { diff --git a/lib/formatters/compactFormatter.js b/lib/formatters/compactFormatter.js index 8454a40580..3b60e0b4de 100644 --- a/lib/formatters/compactFormatter.js +++ b/lib/formatters/compactFormatter.js @@ -3,8 +3,7 @@ const _ = require('lodash'); /** - * @param {import('stylelint').StylelintResult[]} results - * @returns {string} + * @type {import('stylelint').Formatter} */ const formatter = (results) => _.flatMap(results, (result) => diff --git a/lib/formatters/jsonFormatter.js b/lib/formatters/jsonFormatter.js index e07e6b2612..da5ae965ea 100644 --- a/lib/formatters/jsonFormatter.js +++ b/lib/formatters/jsonFormatter.js @@ -3,8 +3,7 @@ /** * Omit any properties starting with `_`, which are fake-private * - * @param {import('stylelint').StylelintResult[]} results - * @returns {string} + * @type {import('stylelint').Formatter} */ module.exports = function jsonFormatter(results) { const cleanedResults = results.map((result) => diff --git a/lib/formatters/stringFormatter.js b/lib/formatters/stringFormatter.js index d3f97a0d1b..7047f2b595 100644 --- a/lib/formatters/stringFormatter.js +++ b/lib/formatters/stringFormatter.js @@ -189,8 +189,7 @@ function formatter(messages, source) { } /** - * @param {import('stylelint').StylelintResult[]} results - * @returns {string} + * @type {import('stylelint').Formatter} */ module.exports = function (results) { let output = invalidOptionsFormatter(results); diff --git a/lib/formatters/unixFormatter.js b/lib/formatters/unixFormatter.js index cff9f3ac03..6e89f87adc 100644 --- a/lib/formatters/unixFormatter.js +++ b/lib/formatters/unixFormatter.js @@ -3,8 +3,7 @@ const _ = require('lodash'); /** - * @param {import('stylelint').StylelintResult[]} results - * @returns {string} + * @type {import('stylelint').Formatter} */ const unixFormatter = (results) => { const lines = _.flatMap(results, (result) => diff --git a/lib/formatters/verboseFormatter.js b/lib/formatters/verboseFormatter.js index 303b19bcfc..5683b044a2 100644 --- a/lib/formatters/verboseFormatter.js +++ b/lib/formatters/verboseFormatter.js @@ -5,8 +5,7 @@ const chalk = require('chalk'); const stringFormatter = require('./stringFormatter'); /** - * @param {import('stylelint').StylelintResult[]} results - * @returns {string} + * @type {import('stylelint').Formatter} */ module.exports = function (results) { let output = stringFormatter(results); diff --git a/lib/standalone.js b/lib/standalone.js index cd0fcd1435..303f17d485 100644 --- a/lib/standalone.js +++ b/lib/standalone.js @@ -25,6 +25,7 @@ const writeFileAtomic = require('write-file-atomic'); /** @typedef {import('stylelint').StylelintStandaloneOptions} StylelintOptions */ /** @typedef {import('stylelint').StylelintStandaloneReturnValue} StylelintStandaloneReturnValue */ /** @typedef {import('stylelint').StylelintResult} StylelintResult */ +/** @typedef {import('stylelint').Formatter} Formatter */ /** * @param {StylelintOptions} options @@ -77,7 +78,7 @@ module.exports = function (options) { throw new Error('You must pass stylelint a `files` glob or a `code` string, though not both'); } - /** @type {Function} */ + /** @type {Formatter} */ let formatterFunction; if (typeof formatter === 'string') { diff --git a/types/stylelint/index.d.ts b/types/stylelint/index.d.ts index 277f3eabee..39a61017b3 100644 --- a/types/stylelint/index.d.ts +++ b/types/stylelint/index.d.ts @@ -83,6 +83,13 @@ declare module 'stylelint' { warn(message: string, options?: StylelintWarningOptions): void; }; + export type Formatter = ( + results: Array, + returnValue?: StylelintStandaloneReturnValue, + ) => string; + + export type FormatterIdentifier = 'compact' | 'json' | 'string' | 'unix' | 'verbose' | Formatter; + export type StylelintOptions = { config?: StylelintConfig; configFile?: string; @@ -152,7 +159,7 @@ declare module 'stylelint' { maxWarnings?: number; syntax?: string; customSyntax?: string; - formatter?: 'compact' | 'json' | 'string' | 'unix' | 'verbose' | Function; + formatter?: FormatterIdentifier; disableDefaultIgnores?: boolean; fix?: boolean; allowEmptyInput?: boolean; @@ -231,7 +238,7 @@ declare module 'stylelint' { export type StylelintPublicAPI = { lint: Function; rules: { [k: string]: any }; - formatters: { [k: string]: Function }; + formatters: { [k: string]: Formatter }; createPlugin: Function; createLinter: Function; utils: { From 7cf0c3698b9e832347d0baf20496704ad9567674 Mon Sep 17 00:00:00 2001 From: Mike Allanson Date: Tue, 9 Jun 2020 12:13:27 +0100 Subject: [PATCH 11/12] Export an object from the CSS-in-JS syntax (#4824) --- lib/__tests__/syntaxes.test.js | 17 +++++++++++++++++ lib/syntaxes/syntax-css-in-js.js | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/__tests__/syntaxes.test.js diff --git a/lib/__tests__/syntaxes.test.js b/lib/__tests__/syntaxes.test.js new file mode 100644 index 0000000000..9e8288201a --- /dev/null +++ b/lib/__tests__/syntaxes.test.js @@ -0,0 +1,17 @@ +'use strict'; + +const syntaxes = require('../syntaxes/index'); + +const inputs = Object.keys(syntaxes).map((name) => [ + name, + require(`../syntaxes/syntax-${name}.js`), // directly require modules to bypass importLazy() in syntaxes/index.js +]); + +describe('syntaxes', () => { + it.each(inputs)('syntax is an object with parse and stringify keys: %s', (name, module) => { + expect(module).toMatchObject({ + parse: expect.any(Function), + stringify: expect.any(Function), + }); + }); +}); diff --git a/lib/syntaxes/syntax-css-in-js.js b/lib/syntaxes/syntax-css-in-js.js index 78adca2481..0bf6a5f647 100644 --- a/lib/syntaxes/syntax-css-in-js.js +++ b/lib/syntaxes/syntax-css-in-js.js @@ -1,3 +1,3 @@ 'use strict'; -module.exports = require('@stylelint/postcss-css-in-js'); +module.exports = require('@stylelint/postcss-css-in-js')(); From 4a4ea84c22145e7ae5d3eece3d8cf1afd7cec6d8 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2020 12:27:26 +0100 Subject: [PATCH 12/12] Bump got from 11.2.0 to 11.3.0 (#4825) Bumps [got](https://github.com/sindresorhus/got) from 11.2.0 to 11.3.0. - [Release notes](https://github.com/sindresorhus/got/releases) - [Commits](https://github.com/sindresorhus/got/compare/v11.2.0...v11.3.0) Signed-off-by: dependabot-preview[bot] Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 81eb5d25fd..09ead25b3e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3789,9 +3789,9 @@ } }, "got": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/got/-/got-11.2.0.tgz", - "integrity": "sha512-68pBow9XXXSdVRV5wSx0kWMCZsag4xE3Ru0URVe0PWsSYmU4SJrUmEO6EVYFlFHc9rq/6Yqn6o1GxIb9torQxg==", + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/got/-/got-11.3.0.tgz", + "integrity": "sha512-yi/kiZY2tNMtt5IfbfX8UL3hAZWb2gZruxYZ72AY28pU5p0TZjZdl0uRsuaFbnC0JopdUi3I+Mh1F3dPQ9Dh0Q==", "dev": true, "requires": { "@sindresorhus/is": "^2.1.1", diff --git a/package.json b/package.json index b15d8f3a1d..026eab1072 100644 --- a/package.json +++ b/package.json @@ -173,7 +173,7 @@ "del": "^5.1.0", "eslint": "^7.1.0", "eslint-config-stylelint": "^12.0.0", - "got": "^11.2.0", + "got": "^11.3.0", "husky": "^4.2.5", "jest": "^26.0.1", "jest-circus": "^26.0.1",