stylelint-prettier
Advanced tools
Comparing version 2.0.0 to 3.0.0
# Changelog | ||
## 3.0.0 (2023-02-22) | ||
Remove `stylelint-config-prettier` from the recommended config. [Stylelint v15 deprecated the rules that `stylelint-config-prettier` disabled](https://stylelint.io/migration-guide/to-15/#deprecated-stylistic-rules), thus if you do not use those deprecated rules then you do not need `stylelint-config-prettier`. If you are still using these deprecated rules then you should install and configure `stylelint-config-prettier` separatly. | ||
Increase the mimimum required node version. No code changes have been required and v2.0.0 works with stylelint v15, however continuing to test with the unsupported node 12 is a burden that is not worth carrying. | ||
- Minimum node requirement is now "^14.17.0 || >=16.0.0" (drop support for v12.x) | ||
- If you extended from the `stylelint-prettier/recommended` in v2 then you must add an explict extend from `stylelint-config-prettier` to retain the same behaviour. | ||
## 2.0.0 (2021-11-05) | ||
@@ -4,0 +13,0 @@ |
{ | ||
"name": "stylelint-prettier", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Runs prettier as an stylelint rule", | ||
@@ -39,24 +39,26 @@ "keywords": [ | ||
"devDependencies": { | ||
"@stylelint/postcss-css-in-js": "^0.37.2", | ||
"eslint": "^8.1.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint": "^8.34.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^27.3.1", | ||
"postcss": "^8.3.11", | ||
"postcss-html": "^1.2.0", | ||
"postcss-markdown": "^1.1.0", | ||
"postcss-scss": "^4.0.2", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^29.4.3", | ||
"jest-preset-stylelint": "^6.1.0", | ||
"postcss": "^8.4.21", | ||
"postcss-html": "^1.5.0", | ||
"postcss-markdown": "^1.2.0", | ||
"postcss-scss": "^4.0.6", | ||
"postcss-styled-syntax": "^0.3.3", | ||
"postcss-syntax": "^0.36.2", | ||
"prettier": "^2.4.1", | ||
"prettier-plugin-svelte": "^2.4.0", | ||
"prettier": "^2.8.4", | ||
"prettier-plugin-svelte": "^2.9.0", | ||
"strip-ansi": "^6.0.0", | ||
"stylelint": "^14.0.0", | ||
"stylelint-config-prettier": "^9.0.3", | ||
"svelte": "^3.34.0" | ||
"stylelint": "^15.0.0", | ||
"svelte": "^3.55.0", | ||
"typescript": "4.9.5" | ||
}, | ||
"engines": { | ||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" | ||
"node": "^14.17.0 || >=16.0.0" | ||
}, | ||
"jest": { | ||
"preset": "jest-preset-stylelint", | ||
"setupFiles": [ | ||
@@ -63,0 +65,0 @@ "./jest-setup.js" |
@@ -52,29 +52,37 @@ # stylelint-prettier [![Build Status](https://github.com/prettier/stylelint-prettier/workflows/CI/badge.svg?branch=master)](https://github.com/prettier/stylelint-prettier/actions?query=workflow%3ACI+branch%3Amaster) | ||
## Recommended Configuration | ||
Alternatively you can extend from the `stylelint-prettier/recommended` config, | ||
which does the same thing: | ||
This plugin works best if you disable all other Stylelint rules relating to code formatting, and only enable rules that detect patterns in the AST. (If another active Stylelint rule disagrees with `prettier` about how code should be formatted, it will be impossible to avoid lint errors.) You can use [stylelint-config-prettier](https://github.com/prettier/stylelint-config-prettier) to disable all formatting-related Stylelint rules. | ||
```json | ||
{ | ||
"extends": ["stylelint-prettier/recommended"] | ||
} | ||
``` | ||
If your desired formatting does not match the `prettier` output, you should use a different tool such as [prettier-stylelint](https://github.com/hugomrdias/prettier-stylelint) instead. | ||
## Disabling rules that may conflict with Prettier | ||
To integrate this plugin with `stylelint-config-prettier`, you can use the `"recommended"` configuration: | ||
As of Stylelint v15, [Stylelint deprecated all stylistic rules that conflict | ||
with prettier](https://stylelint.io/migration-guide/to-15/#deprecated-stylistic-rules). | ||
If you are using Stylelint v15 and are not using any of these deprecated rules then you do not need to do anything extra; this section does not apply to you. | ||
1. In addition to the above installation instructions, install `stylelint-config-prettier`: | ||
If you are using Stylelint's stylistic rules, then many of them shall conflict with Prettier. This plugin works best if you disable all other Stylelint rules relating to stylistic opinions. If another active Stylelint rule disagrees with `prettier` about how code should be formatted, it will be impossible to avoid lint errors. You should use [stylelint-config-prettier](https://github.com/prettier/stylelint-config-prettier) to disable all stylistic Stylelint rules. | ||
```sh | ||
npm install --save-dev stylelint-config-prettier | ||
``` | ||
To integrate this plugin with `stylelint-config-prettier`: | ||
2. Then replace the plugins and rules declarations in your `.stylelintrc` that you added in the prior section with: | ||
1. In addition to the above installation instructions, install `stylelint-config-prettier`: | ||
```json | ||
{ | ||
"extends": ["stylelint-prettier/recommended"] | ||
} | ||
``` | ||
```sh | ||
npm install --save-dev stylelint-config-prettier | ||
``` | ||
This does three things: | ||
2. Then add `stylelint-config-prettier` to the list of extended configs in your `.stylelintrc` that you added in the prior section. `stylelint-config-prettier` should go last in the array so that it will override other configs: | ||
1. Enables the `stylelint-plugin-prettier` plugin. | ||
2. Enables the `prettier/prettier` rule. | ||
3. Extends the `stylelint-config-prettier` configuration. | ||
```json | ||
{ | ||
"extends": [ | ||
"stylelint-prettier/recommended" | ||
"stylelint-config-prettier" | ||
] | ||
} | ||
``` | ||
@@ -81,0 +89,0 @@ You can then set Prettier's own options inside a `.prettierrc` file. |
module.exports = { | ||
plugins: ['.'], | ||
extends: ['stylelint-config-prettier'], | ||
rules: {'prettier/prettier': true}, | ||
}; |
@@ -207,3 +207,3 @@ const stylelint = require('stylelint'); | ||
// Report in the the order the differences appear in the content | ||
// Report in the order the differences appear in the content | ||
differences.forEach((difference) => { | ||
@@ -210,0 +210,0 @@ switch (difference.operation) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19093
118
18
223