From 03af75503fefa4e4bb12439109befff35c4e2d50 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Tue, 15 Mar 2022 15:30:27 +0900 Subject: [PATCH 1/5] Add `scss/function-no-unknown` rule (#591) * Add `scss/function-no-unknown` rule * Update functions list * Update functions list * npm i github:stylelint/stylelint#bump-css-functions-list * git+https * Revert "git+https" This reverts commit f70c826635decce7b7aae38a89dd43aff63e35cc. * Revert "npm i github:stylelint/stylelint#bump-css-functions-list" This reverts commit a38124c514df1c4f19acfb6be4687d085ba1c31b. * Update lockfile * Bump stylelint to 14.5.1 * Add reject case for unknown SCSS function * Add more accept cases --- package-lock.json | 306 ++++++++++-------- package.json | 4 +- src/rules/function-no-unknown/README.md | 64 ++++ .../function-no-unknown/__tests__/index.js | 85 +++++ src/rules/function-no-unknown/index.js | 77 +++++ src/rules/index.js | 2 + src/utils/functions.js | 249 ++++++++++++++ src/utils/index.js | 1 + 8 files changed, 654 insertions(+), 134 deletions(-) create mode 100644 src/rules/function-no-unknown/README.md create mode 100644 src/rules/function-no-unknown/__tests__/index.js create mode 100644 src/rules/function-no-unknown/index.js create mode 100644 src/utils/functions.js diff --git a/package-lock.json b/package-lock.json index d5ce6f9e..6840beda 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "stylelint-scss", - "version": "4.0.1", + "version": "4.1.0", "license": "MIT", "dependencies": { "lodash": "^4.17.21", @@ -35,10 +35,10 @@ "postcss-scss": "^4.0.1", "prettier": "^1.19.1", "rimraf": "^3.0.2", - "stylelint": "^14.0.1" + "stylelint": "^14.5.1" }, "peerDependencies": { - "stylelint": "^14.0.0" + "stylelint": "^14.5.0" } }, "node_modules/@babel/cli": { @@ -3659,6 +3659,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "node_modules/colord": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", + "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "dev": true + }, "node_modules/colorette": { "version": "2.0.16", "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz", @@ -3813,6 +3819,15 @@ "node": ">=8" } }, + "node_modules/css-functions-list": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.0.1.tgz", + "integrity": "sha512-PriDuifDt4u4rkDgnqRCLnjfMatufLmWNfQnGCq34xZwpY3oabwhB9SqRBmuvWUgndbemCFlKqg+nO7C2q0SBw==", + "dev": true, + "engines": { + "node": ">=12.22" + } + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -3869,9 +3884,9 @@ "dev": true }, "node_modules/debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -4735,9 +4750,9 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -4747,7 +4762,7 @@ "micromatch": "^4.0.4" }, "engines": { - "node": ">=8" + "node": ">=8.6.0" } }, "node_modules/fast-json-stable-stringify": { @@ -5112,16 +5127,16 @@ } }, "node_modules/globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", - "fast-glob": "^3.1.1", - "ignore": "^5.1.4", - "merge2": "^1.3.0", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" }, "engines": { @@ -5132,9 +5147,9 @@ } }, "node_modules/globby/node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -8219,9 +8234,9 @@ } }, "node_modules/known-css-properties": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.23.0.tgz", - "integrity": "sha512-h9ivI88e1lFNmTT4HovBN33Ysn0OIJG7IPG2mkpx2uniQXFWqo35QdiX7w0TovlUFXfW8aPFblP5/q0jlOr2sA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.24.0.tgz", + "integrity": "sha512-RTSoaUAfLvpR357vWzAz/50Q/BmHfmE6ETSWfutT0AJiw10e6CmcdYRQJlLRd95B53D0Y2aD1jSxD3V3ySF+PA==", "dev": true }, "node_modules/latest-version": { @@ -8867,12 +8882,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -9361,9 +9370,9 @@ "dev": true }, "node_modules/nanoid": { - "version": "3.1.30", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", - "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", "dev": true, "bin": { "nanoid": "bin/nanoid.cjs" @@ -10409,14 +10418,14 @@ } }, "node_modules/postcss": { - "version": "8.3.11", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz", - "integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==", + "version": "8.4.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.6.tgz", + "integrity": "sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA==", "dev": true, "dependencies": { - "nanoid": "^3.1.30", + "nanoid": "^3.2.0", "picocolors": "^1.0.0", - "source-map-js": "^0.6.2" + "source-map-js": "^1.0.2" }, "engines": { "node": "^10 || ^12 || >=14" @@ -10478,9 +10487,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz", - "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.9.tgz", + "integrity": "sha512-UO3SgnZOVTwu4kyLR22UQ1xZh086RyNZppb7lLAKBFK8a32ttG5i87Y/P3+2bRSjZNyJ1B7hfFNo273tKe9YxQ==", "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -10490,9 +10499,9 @@ } }, "node_modules/postcss-value-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", - "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, "node_modules/prelude-ls": { "version": "1.2.1", @@ -11159,9 +11168,9 @@ } }, "node_modules/signal-exit": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", - "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "node_modules/sisteransi": { @@ -11236,9 +11245,9 @@ } }, "node_modules/source-map-js": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "dev": true, "engines": { "node": ">=0.10.0" @@ -11463,49 +11472,52 @@ "dev": true }, "node_modules/stylelint": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.0.1.tgz", - "integrity": "sha512-ZcAkmFLVCultmwkQUjxKzxW/o5+CzNmDk6TPJj/d4Y7ipTGGrewIWmNm+InjdSr04PR5/yynsAJeYJY/wisdMg==", + "version": "14.5.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.5.1.tgz", + "integrity": "sha512-8Hf4HtnhxlWlf7iXF9zFfhSc3X0teRnVzl6PqPs2JEFx+dy/mhMhghZfiTDW4QG0ihDw9+WP7GZw5Nzx7cQF5A==", "dev": true, "dependencies": { "balanced-match": "^2.0.0", + "colord": "^2.9.2", "cosmiconfig": "^7.0.1", - "debug": "^4.3.2", + "css-functions-list": "^3.0.1", + "debug": "^4.3.3", "execall": "^2.0.0", - "fast-glob": "^3.2.7", + "fast-glob": "^3.2.11", "fastest-levenshtein": "^1.0.12", "file-entry-cache": "^6.0.1", "get-stdin": "^8.0.0", "global-modules": "^2.0.0", - "globby": "^11.0.4", + "globby": "^11.1.0", "globjoin": "^0.1.4", "html-tags": "^3.1.0", - "ignore": "^5.1.8", + "ignore": "^5.2.0", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.23.0", + "known-css-properties": "^0.24.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.4", "normalize-path": "^3.0.0", "normalize-selector": "^0.2.0", "picocolors": "^1.0.0", - "postcss": "^8.3.11", + "postcss": "^8.4.6", "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.6", - "postcss-value-parser": "^4.1.0", + "postcss-selector-parser": "^6.0.9", + "postcss-value-parser": "^4.2.0", "resolve-from": "^5.0.0", "specificity": "^0.4.1", "string-width": "^4.2.3", "strip-ansi": "^6.0.1", "style-search": "^0.1.0", + "supports-hyperlinks": "^2.2.0", "svg-tags": "^1.0.0", - "table": "^6.7.2", + "table": "^6.8.0", "v8-compile-cache": "^2.3.0", - "write-file-atomic": "^3.0.3" + "write-file-atomic": "^4.0.1" }, "bin": { "stylelint": "bin/stylelint.js" @@ -11525,9 +11537,9 @@ "dev": true }, "node_modules/stylelint/node_modules/ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true, "engines": { "node": ">= 4" @@ -11571,6 +11583,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/stylelint/node_modules/write-file-atomic": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz", + "integrity": "sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -11639,13 +11664,12 @@ "dev": true }, "node_modules/table": { - "version": "6.7.2", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz", - "integrity": "sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", "dev": true, "dependencies": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", @@ -15162,6 +15186,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "colord": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", + "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "dev": true + }, "colorette": { "version": "2.0.16", "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.16.tgz", @@ -15286,6 +15316,12 @@ "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "dev": true }, + "css-functions-list": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.0.1.tgz", + "integrity": "sha512-PriDuifDt4u4rkDgnqRCLnjfMatufLmWNfQnGCq34xZwpY3oabwhB9SqRBmuvWUgndbemCFlKqg+nO7C2q0SBw==", + "dev": true + }, "cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -15332,9 +15368,9 @@ "dev": true }, "debug": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", - "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", + "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", "dev": true, "requires": { "ms": "2.1.2" @@ -15969,9 +16005,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -16257,23 +16293,23 @@ "dev": true }, "globby": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", - "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "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", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", "slash": "^3.0.0" }, "dependencies": { "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "slash": { @@ -18572,9 +18608,9 @@ "dev": true }, "known-css-properties": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.23.0.tgz", - "integrity": "sha512-h9ivI88e1lFNmTT4HovBN33Ysn0OIJG7IPG2mkpx2uniQXFWqo35QdiX7w0TovlUFXfW8aPFblP5/q0jlOr2sA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.24.0.tgz", + "integrity": "sha512-RTSoaUAfLvpR357vWzAz/50Q/BmHfmE6ETSWfutT0AJiw10e6CmcdYRQJlLRd95B53D0Y2aD1jSxD3V3ySF+PA==", "dev": true }, "latest-version": { @@ -19062,12 +19098,6 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -19433,9 +19463,9 @@ "dev": true }, "nanoid": { - "version": "3.1.30", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", - "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", "dev": true }, "natural-compare": { @@ -20202,14 +20232,14 @@ } }, "postcss": { - "version": "8.3.11", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz", - "integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==", + "version": "8.4.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.6.tgz", + "integrity": "sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA==", "dev": true, "requires": { - "nanoid": "^3.1.30", + "nanoid": "^3.2.0", "picocolors": "^1.0.0", - "source-map-js": "^0.6.2" + "source-map-js": "^1.0.2" } }, "postcss-less": { @@ -20243,18 +20273,18 @@ "requires": {} }, "postcss-selector-parser": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz", - "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==", + "version": "6.0.9", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.9.tgz", + "integrity": "sha512-UO3SgnZOVTwu4kyLR22UQ1xZh086RyNZppb7lLAKBFK8a32ttG5i87Y/P3+2bRSjZNyJ1B7hfFNo273tKe9YxQ==", "requires": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "postcss-value-parser": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz", - "integrity": "sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, "prelude-ls": { "version": "1.2.1", @@ -20746,9 +20776,9 @@ "dev": true }, "signal-exit": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz", - "integrity": "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ==", + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, "sisteransi": { @@ -20807,9 +20837,9 @@ "dev": true }, "source-map-js": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "dev": true }, "source-map-support": { @@ -20989,49 +21019,52 @@ "dev": true }, "stylelint": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.0.1.tgz", - "integrity": "sha512-ZcAkmFLVCultmwkQUjxKzxW/o5+CzNmDk6TPJj/d4Y7ipTGGrewIWmNm+InjdSr04PR5/yynsAJeYJY/wisdMg==", + "version": "14.5.1", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.5.1.tgz", + "integrity": "sha512-8Hf4HtnhxlWlf7iXF9zFfhSc3X0teRnVzl6PqPs2JEFx+dy/mhMhghZfiTDW4QG0ihDw9+WP7GZw5Nzx7cQF5A==", "dev": true, "requires": { "balanced-match": "^2.0.0", + "colord": "^2.9.2", "cosmiconfig": "^7.0.1", - "debug": "^4.3.2", + "css-functions-list": "^3.0.1", + "debug": "^4.3.3", "execall": "^2.0.0", - "fast-glob": "^3.2.7", + "fast-glob": "^3.2.11", "fastest-levenshtein": "^1.0.12", "file-entry-cache": "^6.0.1", "get-stdin": "^8.0.0", "global-modules": "^2.0.0", - "globby": "^11.0.4", + "globby": "^11.1.0", "globjoin": "^0.1.4", "html-tags": "^3.1.0", - "ignore": "^5.1.8", + "ignore": "^5.2.0", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.23.0", + "known-css-properties": "^0.24.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.4", "normalize-path": "^3.0.0", "normalize-selector": "^0.2.0", "picocolors": "^1.0.0", - "postcss": "^8.3.11", + "postcss": "^8.4.6", "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.6", - "postcss-value-parser": "^4.1.0", + "postcss-selector-parser": "^6.0.9", + "postcss-value-parser": "^4.2.0", "resolve-from": "^5.0.0", "specificity": "^0.4.1", "string-width": "^4.2.3", "strip-ansi": "^6.0.1", "style-search": "^0.1.0", + "supports-hyperlinks": "^2.2.0", "svg-tags": "^1.0.0", - "table": "^6.7.2", + "table": "^6.8.0", "v8-compile-cache": "^2.3.0", - "write-file-atomic": "^3.0.3" + "write-file-atomic": "^4.0.1" }, "dependencies": { "balanced-match": { @@ -21041,9 +21074,9 @@ "dev": true }, "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", "dev": true }, "meow": { @@ -21071,6 +21104,16 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true + }, + "write-file-atomic": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.1.tgz", + "integrity": "sha512-nSKUxgAbyioruk6hU87QzVbY279oYT6uiwgDoujth2ju4mJ+TZau7SQBhtbTmUyuNYTuXnSyRn66FV0+eCgcrQ==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } } } }, @@ -21129,13 +21172,12 @@ "dev": true }, "table": { - "version": "6.7.2", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz", - "integrity": "sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", "dev": true, "requires": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", diff --git a/package.json b/package.json index 219fa303..6c6396af 100644 --- a/package.json +++ b/package.json @@ -35,10 +35,10 @@ "postcss-scss": "^4.0.1", "prettier": "^1.19.1", "rimraf": "^3.0.2", - "stylelint": "^14.0.1" + "stylelint": "^14.5.1" }, "peerDependencies": { - "stylelint": "^14.0.0" + "stylelint": "^14.5.1" }, "eslintConfig": { "extends": [ diff --git a/src/rules/function-no-unknown/README.md b/src/rules/function-no-unknown/README.md new file mode 100644 index 00000000..2d8a3cb8 --- /dev/null +++ b/src/rules/function-no-unknown/README.md @@ -0,0 +1,64 @@ +# function-no-unknown + +Disallow unknown functions. Should be used **instead of** Stylelint's [function-no-unknown](https://stylelint.io/user-guide/rules/list/at-rule-no-unknown). + +```css +a { color: unknown(1); } +/** ↑ + * Functions like this */ +``` + +This rule is basically a wrapper around the mentioned core rule. You must disable Stylelint's core rule to make this rule work: + +```json +{ + "rules": { + "function-no-unknown": null, + "scss/function-no-unknown": true + } +} +``` + +## Options + +### `true` + +The following patterns are considered warnings: + +```css +a { color: unknown(1); } +``` + +The following patterns are *not* considered warnings: + +```css +a { color: hsl(240 100% 50%); } +``` + +```css +a { color: if(true, green, red); } +``` + +## Optional secondary options + +### `ignoreFunctions: ["/regex/", /regex/, "non-regex"]` + +Given: + +```json +["/^my-/i", "foo"] +``` + +The following patterns are *not* considered warnings: + +```css +a { color: my-func(1); } +``` + +```css +a { color: MY-FUNC(1); } +``` + +```css +a { color: foo(1); } +``` diff --git a/src/rules/function-no-unknown/__tests__/index.js b/src/rules/function-no-unknown/__tests__/index.js new file mode 100644 index 00000000..c03411e1 --- /dev/null +++ b/src/rules/function-no-unknown/__tests__/index.js @@ -0,0 +1,85 @@ +import { ruleName, messages } from ".."; + +testRule({ + ruleName, + config: [true], + customSyntax: "postcss-scss", + + accept: [ + { + code: "a { color: hwb(240 100% 50%); }", + description: "Normal CSS function" + }, + { + code: "a { color: hsl(240 100% 50%); }", + description: "Function both in CSS and SCSS" + }, + { + code: "a { color: if(true, green, red); }", + description: "SCSS function" + }, + { + code: "a { color: adjust-color(#6b717f, $red: 15); }" + }, + { + code: "a { color: color.adjust(#6b717f, $red: 15); }" + } + ], + + reject: [ + { + code: "a { color: unknown(1); }", + message: messages.rejected("unknown"), + line: 1, + column: 12 + }, + { + code: "a { color: color.unknown(#6b717f, $red: 15); }", + message: messages.rejected("color.unknown"), + line: 1, + column: 12 + } + ] +}); + +testRule({ + ruleName, + config: [true, { ignoreFunctions: ["/^my-/i", /foo$/, "bar"] }], + customSyntax: "postcss-scss", + + accept: [ + { + code: "a { color: my-func(1); }" + }, + { + code: "a { color: MY-FUNC(1); }" + }, + { + code: "a { color: func-foo(1); }" + }, + { + code: "a { color: bar(1); }" + } + ], + + reject: [ + { + code: "a { color: my(1); }", + message: messages.rejected("my"), + line: 1, + column: 12 + }, + { + code: "a { color: foo-func(1); }", + message: messages.rejected("foo-func"), + line: 1, + column: 12 + }, + { + code: "a { color: barrr(1); }", + message: messages.rejected("barrr"), + line: 1, + column: 12 + } + ] +}); diff --git a/src/rules/function-no-unknown/index.js b/src/rules/function-no-unknown/index.js new file mode 100644 index 00000000..43967213 --- /dev/null +++ b/src/rules/function-no-unknown/index.js @@ -0,0 +1,77 @@ +import { isRegExp, isString } from "lodash"; +import { rules, utils } from "stylelint"; +import valueParser from "postcss-value-parser"; +import { namespace, ALL_FUNCTIONS } from "../../utils"; + +const ruleToCheckAgainst = "function-no-unknown"; + +export const ruleName = namespace(ruleToCheckAgainst); + +export const messages = utils.ruleMessages(ruleName, { + rejected: (...args) => { + return rules[ruleToCheckAgainst].messages + .rejected(...args) + .replace(` (${ruleToCheckAgainst})`, ""); + } +}); + +export default function rule(primaryOption, secondaryOptions) { + return (root, result) => { + const validOptions = utils.validateOptions( + result, + ruleName, + { + actual: primaryOption + }, + { + actual: secondaryOptions, + possible: { + ignoreFunctions: [isString, isRegExp] + }, + optional: true + } + ); + + if (!validOptions) { + return; + } + + const optionsFunctions = + (secondaryOptions && secondaryOptions.ignoreFunctions) || []; + const ignoreFunctions = ALL_FUNCTIONS.concat(optionsFunctions); + const ignoreFunctionsAsSet = new Set(ignoreFunctions); + const newSecondaryOptions = Object.assign({}, secondaryOptions, { + ignoreFunctions + }); + + utils.checkAgainstRule( + { + ruleName: ruleToCheckAgainst, + ruleSettings: [primaryOption, newSecondaryOptions], + root + }, + warning => { + const { node, index } = warning; + + // NOTE: Using `valueParser` is necessary for extracting a function name. This may be a performance waste. + valueParser(node.value).walk(valueNode => { + const { type, value: funcName } = valueNode; + + if (type !== "function") { + return; + } + + if (!ignoreFunctionsAsSet.has(funcName)) { + utils.report({ + message: messages.rejected(funcName), + ruleName, + result, + node, + index + }); + } + }); + } + ); + }; +} diff --git a/src/rules/index.js b/src/rules/index.js index ff53f40c..52d97bee 100644 --- a/src/rules/index.js +++ b/src/rules/index.js @@ -40,6 +40,7 @@ import doubleSlashCommentEmptyLineBefore from "./double-slash-comment-empty-line import doubleSlashCommentInline from "./double-slash-comment-inline"; import doubleSlashCommentWhitespaceInside from "./double-slash-comment-whitespace-inside"; import functionColorRelative from "./function-color-relative"; +import functionNoUnknown from "./function-no-unknown"; import functionNoQuotedStrings from "./function-quote-no-quoted-strings-inside"; import functionNoUnquotedStrings from "./function-unquote-no-unquoted-strings-inside"; import mapKeysQuotes from "./map-keys-quotes"; @@ -102,6 +103,7 @@ export default { "function-quote-no-quoted-strings-inside": functionNoQuotedStrings, "function-unquote-no-unquoted-strings-inside": functionNoUnquotedStrings, "function-color-relative": functionColorRelative, + "function-no-unknown": functionNoUnknown, "map-keys-quotes": mapKeysQuotes, "media-feature-value-dollar-variable": mediaFeatureValueDollarVariable, "no-dollar-variables": noDollarVariables, diff --git a/src/utils/functions.js b/src/utils/functions.js new file mode 100644 index 00000000..6149a40f --- /dev/null +++ b/src/utils/functions.js @@ -0,0 +1,249 @@ +/** + * @see https://sass-lang.com/documentation/modules#global-functions + */ +export const GLOBAL_FUNCTIONS = Object.freeze([ + "hsl", + "hsla", + "if", + "rgb", + "rgba" +]); + +/** + * @see https://sass-lang.com/documentation/modules/color + */ +export const COLOR_FUNCTIONS = Object.freeze([ + "adjust-color", + "adjust-hue", + "alpha", + "blackness", + "blue", + "change-color", + "complement", + "darken", + "desaturate", + "fade-in", + "fade-out", + "grayscale", + "green", + "hue", + "ie-hex-str", + "invert", + "lighten", + "lightness", + "mix", + "opacity", + "red", + "saturate", + "saturation", + "scale-color", + "transparentize", + + // with namespace + "color.adjust", + "color.alpha", + "color.blackness", + "color.blue", + "color.change", + "color.complement", + "color.grayscale", + "color.green", + "color.hue", + "color.hwb", + "color.ie-hex-str", + "color.invert", + "color.lightness", + "color.mix", + "color.red", + "color.saturation", + "color.scale", + "color.whiteness" +]); + +/** + * @see https://sass-lang.com/documentation/modules/list + */ +export const LIST_FUNCTIONS = Object.freeze([ + "append", + "index", + "is-bracketed", + "join", + "length", + "list-separator", + "nth", + "set-nth", + "list.zip", + + // with namespace + "list.append", + "list.index", + "list.is-bracketed", + "list.join", + "list.length", + "list.nth", + "list.separator", + "list.set-nth", + "list.slash", + "zip" +]); + +/** + * @see https://sass-lang.com/documentation/modules/map + */ +export const MAP_FUNCTIONS = Object.freeze([ + "map-get", + "map-has-key", + "map-keys", + "map-merge", + "map-remove", + "map-values", + + // with namespace + "map.deep-merge", + "map.deep-remove", + "map.get", + "map.has-key", + "map.keys", + "map.merge", + "map.remove", + "map.set", + "map.values" +]); + +/** + * @see https://sass-lang.com/documentation/modules/math + */ +export const MATH_FUNCTIONS = Object.freeze([ + "abs", + "ceil", + "comparable", + "floor", + "max", + "min", + "percentage", + "random", + "round", + "unit", + "unitless", + + // with namespace + "math.abs", + "math.acos", + "math.asin", + "math.atan", + "math.atan2", + "math.ceil", + "math.clamp", + "math.compatible", + "math.cos", + "math.div", + "math.floor", + "math.hypot", + "math.is-unitless", + "math.log", + "math.max", + "math.min", + "math.percentage", + "math.pow", + "math.random", + "math.round", + "math.sin", + "math.sqrt", + "math.tan", + "math.unit" +]); + +/** + * @see https://sass-lang.com/documentation/modules/meta + */ +export const META_FUNCTIONS = Object.freeze([ + "call", + "content-exists", + "feature-exists", + "function-exists", + "get-function", + "global-variable-exists", + "inspect", + "keywords", + "mixin-exists", + "type-of", + "variable-exists", + + // with namespace + "meta.calc-args", + "meta.calc-name", + "meta.call", + "meta.content-exists", + "meta.feature-exists", + "meta.function-exists", + "meta.get-function", + "meta.global-variable-exists", + "meta.inspect", + "meta.keywords", + "meta.mixin-exists", + "meta.module-functions", + "meta.module-variables", + "meta.type-of", + "meta.variable-exists" +]); + +/** + * @see https://sass-lang.com/documentation/modules/selector + */ +export const SELECTOR_FUNCTIONS = Object.freeze([ + "is-superselector", + "selector-append", + "selector-extend", + "selector-nest", + "selector-parse", + "selector-replace", + "selector-unify", + "simple-selectors", + + // with namespace + "selector.append", + "selector.extend", + "selector.is-superselector", + "selector.nest", + "selector.parse", + "selector.replace", + "selector.simple-selectors", + "selector.unify" +]); + +/** + * @see https://sass-lang.com/documentation/modules/string + */ +export const STRING_FUNCTIONS = Object.freeze([ + "quote", + "str-index", + "str-insert", + "str-length", + "str-slice", + "to-lower-case", + "to-upper-case", + "unique-id", + "unquote", + + // with namespace + "string.index", + "string.insert", + "string.length", + "string.quote", + "string.slice", + "string.to-lower-case", + "string.to-upper-case", + "string.unique-id", + "string.unquote" +]); + +export const ALL_FUNCTIONS = Object.freeze([ + ...GLOBAL_FUNCTIONS, + ...COLOR_FUNCTIONS, + ...LIST_FUNCTIONS, + ...MAP_FUNCTIONS, + ...MATH_FUNCTIONS, + ...META_FUNCTIONS, + ...SELECTOR_FUNCTIONS, + ...STRING_FUNCTIONS +]); diff --git a/src/utils/index.js b/src/utils/index.js index b6341934..b46351be 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -7,6 +7,7 @@ export { default as declarationValueIndex } from "./declarationValueIndex"; // Todo should be deleted after upgrade `stylelint` to `10` export { default as eachRoot } from "./eachRoot"; export { default as findCommentsInRaws } from "./findCommentsInRaws"; +export * from "./functions"; export { default as hasBlock } from "./hasBlock"; export { default as hasEmptyLine } from "./hasEmptyLine"; export { default as hasInterpolatingAmpersand } from "./hasInterpolatingAmpersand"; From 40439c426810782b04131c81cdb382348da6d14b Mon Sep 17 00:00:00 2001 From: Krister Kari Date: Tue, 15 Mar 2022 17:08:06 +0200 Subject: [PATCH 2/5] Add function-no-unknown to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 3aeb2092..12331272 100644 --- a/README.md +++ b/README.md @@ -144,6 +144,7 @@ Please also see the [example configs](./docs/examples/) for special cases. ### Function - [`function-color-relative`](./src/rules/function-color-relative/README.md): Encourage the use of the [scale-color](https://sass-lang.com/documentation/modules/color#scale-color) function over regular color functions. +- [`function-no-unknown`](./src/rules/function-no-unknown/README.md): Disallow unknown functions. Should be used **instead of** Stylelint's [function-no-unknown](https://stylelint.io/user-guide/rules/list/at-rule-no-unknown). - [`function-quote-no-quoted-strings-inside`](./src/rules/function-quote-no-quoted-strings-inside/README.md): Disallow quoted strings inside the [quote function](https://sass-lang.com/documentation/modules/string#quote) (Autofixable). - [`function-unquote-no-unquoted-strings-inside`](./src/rules/function-unquote-no-unquoted-strings-inside/README.md): Disallow unquoted strings inside the [unquote function](https://sass-lang.com/documentation/modules/string#unquote) (Autofixable). From 2785709f2357d4ab3313c7a38032a2e500562cc4 Mon Sep 17 00:00:00 2001 From: Krister Kari Date: Tue, 15 Mar 2022 17:22:38 +0200 Subject: [PATCH 3/5] Update contributors list --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 12331272..b4b24885 100644 --- a/README.md +++ b/README.md @@ -223,80 +223,80 @@ Thanks goes to these wonderful people: + - - + + - - +
stof niksy kaysonwu srawlinsstofpipopotamasu ybiquitouspipopotamasu
stof niksy kaysonwu srawlinsstofpipopotamasu ybiquitouspipopotamasu
+ - + -
jhae-de OriR ntwb ricardogobbosouza jeddy3 bjankordkevindew
jhae-de OriR ntwb ricardogobbosouza jeddy3 bjankordkevindew
+ - + -
kevindew thibaudcolas AndyOGo chalkygames123 xboy2012 alexander-akaitvseventer
kevindew thibaudcolas AndyOGo chalkygames123 xboy2012 alexander-akaitvseventer
+ - + -
vseventer SterlingVix Calme1709 Deimos diego-codesdiego-codes EvanHahn
vseventer SterlingVix Calme1709 Deimos diego-codesdiego-codes EvanHahn
From 0620acf28bf9ff04d6c3546f69dc95979484ac0c Mon Sep 17 00:00:00 2001 From: Krister Kari Date: Tue, 15 Mar 2022 17:35:57 +0200 Subject: [PATCH 4/5] Prepare version 4.2.0 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9391d845..7b4e3b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 4.2.0 + +- Added: `function-no-unknown` rule (#591). +- Updated: `stylelint` peer dependency version to `^14.5.1` (required by the `function-no-unknown` rule). + # 4.1.0 - Added: `at-use-no-unnamespaced` rule (#569). From a11f3d39b78b6c14acb96a08837ee11da72cfc05 Mon Sep 17 00:00:00 2001 From: Krister Kari Date: Tue, 15 Mar 2022 17:37:14 +0200 Subject: [PATCH 5/5] 4.2.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6840beda..6ad079d8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "stylelint-scss", - "version": "4.1.0", + "version": "4.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "stylelint-scss", - "version": "4.1.0", + "version": "4.2.0", "license": "MIT", "dependencies": { "lodash": "^4.17.21", diff --git a/package.json b/package.json index 6c6396af..3a843b1e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "stylelint-scss", "description": "A collection of SCSS specific rules for Stylelint", - "version": "4.1.0", + "version": "4.2.0", "author": "Krister Kari", "babel": { "presets": [