From 737d008236ec404dc8dcbd4bb7db85f61ffeb0f6 Mon Sep 17 00:00:00 2001 From: mgoester Date: Wed, 16 Feb 2022 19:05:56 +0100 Subject: [PATCH] feat: add stylelint-config-prettier This stylelint plugin makes sure all linting rules which might clash with prettier are disabled. --- CHANGELOG.md | 7 +++++-- index.js | 6 +++--- package-lock.json | 22 ++++++++++++++++++++++ package.json | 1 + 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d414fb..b9b8331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ - updated `stylelint` from `^13.7.2` to `^14.5.0` - updated `stylelint-config-standard` from `^20.0.0` to `^24.0.0` - updated `stylelint` peer dependency to `^14.0.0`, i.e. removed support for older versions +- added `stylelint-config-prettier` dependency -## Changes to custom rules +## Changes to linting rules - removed duplicate rules that were or became standard in stylelint-config-standard or stylelint-config-recommended: @@ -20,6 +21,8 @@ "selector-attribute-quotes": "always", ``` +- by adding `stylelint-config-prettier`, all rules that might cause conflict when using prettier are disabled. + - disabled all stylistic rules as recommended by stylelint [here](https://stylelint.io/user-guide/rules/list/#stylistic-issues), by changing ```js @@ -41,7 +44,7 @@ to "value-keyword-case": null, ``` -- and by adding the following to disable all other stylistic rules which might come with stylelint-config-standard. Those should be handled by a pretty printer instead: +- and by adding the following to disable all other stylistic rules which might come with stylelint-config-standard. Those should be handled by a pretty printer instead. ```js "function-name-case": null, diff --git a/index.js b/index.js index 8f82481..0de2f40 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict'; module.exports = { - extends: 'stylelint-config-standard', + extends: ['stylelint-config-standard', 'stylelint-config-prettier'], rules: { /** * Limit the number of ID selectors in a selector. @@ -53,8 +53,6 @@ module.exports = { * Disable stylistic issues as these rules will be deprecated or removed in the future * See: https://stylelint.io/user-guide/rules/list/#stylistic-issues */ - 'max-empty-lines': null, - 'string-quotes': null, 'value-keyword-case': null, 'function-name-case': null, 'custom-property-empty-line-before': null, @@ -63,6 +61,8 @@ module.exports = { 'at-rule-empty-line-before': null, 'comment-empty-line-before': null, 'comment-whitespace-inside': null, + 'max-empty-lines': null, + 'string-quotes': null, 'color-hex-case': null, 'function-comma-newline-after': null, 'function-comma-newline-before': null, diff --git a/package-lock.json b/package-lock.json index 23e5d7e..acf00cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "MIT", "dependencies": { + "stylelint-config-prettier": "^9.0.3", "stylelint-config-standard": "^25.0.0" }, "devDependencies": { @@ -11889,6 +11890,21 @@ "url": "https://opencollective.com/stylelint" } }, + "node_modules/stylelint-config-prettier": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/stylelint-config-prettier/-/stylelint-config-prettier-9.0.3.tgz", + "integrity": "sha512-5n9gUDp/n5tTMCq1GLqSpA30w2sqWITSSEiAWQlpxkKGAUbjcemQ0nbkRvRUa0B1LgD3+hCvdL7B1eTxy1QHJg==", + "bin": { + "stylelint-config-prettier": "bin/check.js", + "stylelint-config-prettier-check": "bin/check.js" + }, + "engines": { + "node": ">= 12" + }, + "peerDependencies": { + "stylelint": ">=11.0.0" + } + }, "node_modules/stylelint-config-recommended": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-7.0.0.tgz", @@ -22391,6 +22407,12 @@ } } }, + "stylelint-config-prettier": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/stylelint-config-prettier/-/stylelint-config-prettier-9.0.3.tgz", + "integrity": "sha512-5n9gUDp/n5tTMCq1GLqSpA30w2sqWITSSEiAWQlpxkKGAUbjcemQ0nbkRvRUa0B1LgD3+hCvdL7B1eTxy1QHJg==", + "requires": {} + }, "stylelint-config-recommended": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/stylelint-config-recommended/-/stylelint-config-recommended-7.0.0.tgz", diff --git a/package.json b/package.json index 49a9b1b..543c78e 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "watch": "jest --watch" }, "dependencies": { + "stylelint-config-prettier": "^9.0.3", "stylelint-config-standard": "^25.0.0" }, "devDependencies": {