Code Monkey home page Code Monkey logo

stylelint-prettier's Introduction

stylelint-prettier Build Status

Runs Prettier as a Stylelint rule and reports differences as individual Stylelint issues.

Sample

Given the input file style.css:

.insert {
  display: block
}

.alter:after {color: red; content: 'example'}

.delete {
  display: block;;
}

Running ./node_modules/.bin/stylelint style.css shall output:

style.css
 2:17  ✖  Insert ";"                                          prettier/prettier
 5:15  ✖  Replace "color:·red;·content:·'example'" with       prettier/prettier
          "⏎··color:·red;⏎··content:·"example";⏎"
 8:17  ✖  Delete ";"                                          prettier/prettier

Installation

npm install --save-dev stylelint-prettier prettier

stylelint-prettier does not install Prettier or Stylelint for you. You must install these yourself.

Then, in your .stylelintrc:

{
  "plugins": ["stylelint-prettier"],
  "rules": {
    "prettier/prettier": true
  }
}

Alternatively you can extend from the stylelint-prettier/recommended config, which does the same thing:

{
  "extends": ["stylelint-prettier/recommended"]
}

Disabling rules that may conflict with Prettier

As of Stylelint v15, Stylelint deprecated all stylistic rules that conflict with prettier, and removed these rules in Stylelint v16. If you are using Stylelint v15 or above 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.

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 to disable all stylistic Stylelint rules.

To integrate this plugin with stylelint-config-prettier:

  1. In addition to the above installation instructions, install stylelint-config-prettier:

    npm install --save-dev stylelint-config-prettier
  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:

    {
      "extends": [
        "stylelint-prettier/recommended",
        "stylelint-config-prettier"
      ]
    }

You can then set Prettier's own options inside a .prettierrc file.

Options

stylelint-prettier will honor your .prettierrc file by default. You only need this section if you wish to override those settings.

Note: While it is possible to pass options to Prettier via your Stylelint configuration file, it is not recommended because editor extensions such as prettier-atom and prettier-vscode will read .prettierrc, but won't read settings from Stylelint, which can lead to an inconsistent experience.

Objects are passed directly to Prettier as options. Example:

{
  "rules": {
    "prettier/prettier": [true, {"singleQuote": true, "tabWidth": 4}]
  }
}

NB: This option will merge and override any config set with .prettierrc files (for Prettier < 1.7.0, config files are ignored)


Contributing

See CONTRIBUTING.md

Inspiration

The layout for this codebase and base configuration of prettier was taken from https://github.com/prettier/eslint-plugin-prettier

stylelint-prettier's People

Contributors

bpscott avatar dependabot[bot] avatar huyenltnguyen avatar kristjanesperanto avatar lipis avatar mattlyons0 avatar nschonni avatar rzontar avatar schniz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

stylelint-prettier's Issues

Stylelint V3 requires plugin to expose it's self. The plugin is not doing this.

What version of stylelint, prettier and stylelint-prettier are you using?

"stylelint": "^13.12.0",
"stylelint-prettier": "^1.2.0",

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

// stylelint.config.js
module.exports = {
  extends: [
    //"stylelint-config-sass-guidelines",
    //"stylelint-config-recommended",
    //"stylelint-config-recommended-scss",
    "stylelint-config-twbs-bootstrap/scss",
    //"stylelint-prettier/recommended",
  ],
  plugins: ["prettier-stylelint"],
  defaultSeverity: "warning",
  rules: {
    "prettier/prettier": true,
   }
}

What source code are you linting?
SCSS

What did you expect to happen?
Normal working linting

What actually happened?
stylelint-prettier-issue

**Extra info **
npm i -D stylelint-prettier renames it's self to prettier-stylelint
plugins: ["stylelint-prettier] --> gives an error plugin not found
plugins: ["prettier-stylelint] --> gives the error mentioned above

stylelint-prettier-node_modules

plugins: ["stylelint-prettier] --> npm run fix-styles -->

stylelint-config

stylelint-prettier-scripts-error
stylelint-prettier-scripts

TypeError: Cannot read property 'append' of undefined

What version of stylelint, prettier and stylelint-prettier are you using?

"devDependencies": {
    "prettier": "^1.15.2",
    "stylelint": "^9.8.0",
    "stylelint-config-prettier": "^4.0.0",
    "stylelint-prettier": "^1.0.5"
  }

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

{
  "extends": [
    "stylelint-prettier/recommended"
  ]
}

What source code are you linting?
Any vue file.

What did you expect to happen?
To format/lint the file.

What actually happened?

TypeError: Cannot read property 'append' of undefined
    at Document.append (/Users/Suah/WebstormProjects/asdf/node_modules/postcss-syntax/document.js:16:13)
    at /Users/Suah/WebstormProjects/asdf/node_modules/stylelint-prettier/stylelint-prettier.js:139:14
    at Promise.resolve.then (/Users/Suah/WebstormProjects/asdf/node_modules/stylelint/lib/lintSource.js:230:9)
    at <anonymous>

perf: recommend disable the rule for files which have already handled by `esling-plugin-prettier`

What version of stylelint, prettier and stylelint-prettier are you using?

stylelint: 14.9.1
prettier: 2.7.1
stylelint-prettier: 2.0.0

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

Conflict with prettier-plugin-svelte, because postcss-html extract CSS only for .svelte files, so stylelint-svelte only receives css parts but try to parse it as svelte.

What source code are you linting?

<script lang="ts">
let count = 1

// the `$:` means 're-run whenever these values change'
$: doubled = count * 2
$: quadrupled = doubled * 2

function handleClick() {
  count += 1
}
</script>

<button class="test" on:click={handleClick}>Count: {count}</button>

<p>{count} * 2 = {doubled}</p>
<p>{doubled} * 2 = {quadrupled}</p>

<style>
.test {
  border: transparent;
}
</style>

What did you expect to happen?

No error

What actually happened?

ParseError: Expected }
  1 | .test {
> 2 |   border: transparent;
    |        ^
  3 | }
    at error (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17805:20)
    at Parser$1.error (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17881:10)
    at Parser$1.eat (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17895:19)
    at mustache (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17566:17)
    at new Parser$1 (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17840:22)
    at Object.parse$3 [as parse] (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17972:21)
    at Object.parse (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]_o3ioganyptcsrh6x4hnxvjkpqi/node_modules/prettier-plugin-svelte/plugin.js:1934:83)
    at Object.parse (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7334:23)
    at coreFormat (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8645:18)
    at formatWithCursor2 (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8837:18)
    at /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:37229:12
    at Object.format (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:37243:12)
    at /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]_ajb4dyjcjxvkvtnz4mzu4n3pcq/node_modules/stylelint-prettier/stylelint-prettier.js:107:35
    at /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/stylelint/lib/lintPostcssResult.js:113:8
    at Array.map (<anonymous>)
    at lintPostcssResult (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/stylelint/lib/lintPostcssResult.js:104:18)
    at lintSource (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/stylelint/lib/lintSource.js:91:8)
    at async /Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/stylelint/lib/standalone.js:228:27
    at async Promise.all (index 0)
    at async standalone (/Users/JounQin/Workspaces/GitHub/configs/node_modules/.pnpm/[email protected]/node_modules/stylelint/lib/standalone.js:267:22)

Seeing a lot of "Insert line break" errors

What version of stylelint, prettier and stylelint-prettier are you using?

    "prettier": "^2.3.2",
    "stylelint": "^13.13.1",
    "stylelint-config-prettier": "^8.0.2",
    "stylelint-config-recess-order": "^2.5.0",
    "stylelint-config-recommended-scss": "^4.2.0",
    "stylelint-config-standard": "^22.0.0",
    "stylelint-order": "^4.1.0",
    "stylelint-prettier": "^1.2.0",
    "stylelint-scss": "^3.19.0",

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

I have also tried disabling all other configs, same error.

{
  "proseWrap": "always",
  "printWidth": 90,
  "semi": false,
  "trailingComma": "all"
}
{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-recommended-scss",
    "stylelint-config-recess-order",
    "stylelint-prettier/recommended"
  ],
  "rules": {
    "selector-type-no-unknown": [
      true,
      {
        "ignoreTypes": [
          "/^ion-/"
        ]
      }
    ]
  }
}

What source code are you linting?

.fullHeight,
[full-height] {
  height: 100%;
}

but it is applied to everything so it's not specific to one code part.

What did you expect to happen?

No errors

What actually happened?

   5:46  ✖  Insert "␍"                                 prettier/prettier            
   6:43  ✖  Insert "␍"                                 prettier/prettier            
   7:50  ✖  Insert "␍"                                 prettier/prettier            
   8:50  ✖  Insert "␍"                                 prettier/prettier            
   9:55  ✖  Insert "␍"                                 prettier/prettier            
  10:46  ✖  Insert "␍"                                 prettier/prettier            
  11:43  ✖  Insert "␍"                                 prettier/prettier            
  12:1   ✖  Insert "␍"                                 prettier/prettier      

Attempting to install `stylelint-config-prettier` results in NPM error

I attempted to install the prettier config file per the instructions by running

npm install --save-dev stylelint-config-prettier

However this resulted in an error (see below). Looking through issues I assume this might be related to issue #284 - and if so it seems like the readme file for this project needs to be updated to remove some information.

What version of stylelint, prettier and stylelint-prettier are you using?

"prettier": "3.0.3",
"stylelint": "^15.10.3",
"stylelint-config-standard": "^34.0.0",
"stylelint-config-standard-scss": "^11.0.0",
"stylelint-prettier": "^4.0.2",

What did you expect to happen?
For it to install the config

What actually happened?

npm install --save-dev stylelint-config-prettier
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/stylelint
npm ERR!   dev stylelint@"^15.10.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer stylelint@">= 11.x < 15" from [email protected]
npm ERR! node_modules/stylelint-config-prettier
npm ERR!   dev stylelint-config-prettier@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\chris\AppData\Local\npm-cache\_logs\2023-09-18T14_03_06_143Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\chris\AppData\Local\npm-cache\_logs\2023-09-18T14_03_06_143Z-debug-0.log

[HELP] rules in stylelintrc conflict with prettierrc

Version:
prettier: 1.14.2
stylelint: 9.6.0
stylelint-prettier: 1.0.3
stylelint-config-prettier: 4.0.0

.stylelintrc

{
  "extends": [
    "stylelint-config-recommended",
    "stylelint-prettier/recommended"
  ]
}

.prettierrc

{
  "singleQuote": true,
}

What source code are you linting?

.alter:after {
  color: red;
  content: "example"; // <-- want to enable double quotes
}

What did you expect to happen?
should not remove the double quotes in CSS string on editor save.

What actually happened?
removed double quotes in CSS sting on editor save, and added single quotes. I guess that .prettierrc has a rule single quote: true that actually for Javascript files.

questions
Is there a way to add rules for stylelint-prettier that enable double quotes?

stylelint-prettier doesn't fix problems at the same time as removing empty extra lines

Here is a minimal reproducible demo:

a {
  width: 0px; /* -> length-zero-no-unit problem; not autofixed */
}
  /* -> prettier/prettier problem; autofixed */
// .stylelintrc.json
{
  "plugins": ["stylelint-prettier"],
  "rules": {
    "length-zero-no-unit": true,
    "prettier/prettier": true
  }
}

What version of stylelint, prettier and stylelint-prettier are you using?

{
  "stylelint": "16.4.0",
  "stylelint-prettier": "5.0.0",
  "prettier": "3.2.5"
}

Running Stylelint gives a prettier error and reduces all CSS to one line

What version of stylelint, prettier and stylelint-prettier are you using?

prettier - 1.17.0
stylelint - 10.0.1
styelint-prettier - 1.0.6
stylelint-config-prettier - 5.1.0

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

{
  "extends": ["stylelint-prettier/recommended"],
  "ignoreFiles": [
    "dist/**",
    "**/*.json",
    "**/*.ico"
  ]
}

What source code are you linting?

Original

<style scoped>
.header {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.cards {
  display: flex;
  flex-wrap: wrap;
}
</style>

What did you expect to happen?

Lint normally without reducing all CSS to one line.

What actually happened?

Output

<style scoped>
.header { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .cards
{ display: flex; flex-wrap: wrap; }
</style>
components/Card.vue
 19:9  ✖  Replace                                                                                                                                          prettier/prettier
          "␍⏎··font-family:·"Segoe·UI",·Tahoma,·Geneva,·Verdana,·sans-serif;␍⏎··padding:·1rem;␍⏎··display:·block;␍⏎··margin:·0.25rem;␍⏎··border:·0.                         
          25rem·solid·gainsboro;␍⏎}␍" with                                                                                                                                  
          "·font-family:·"Segoe·UI",·Tahoma,·Geneva,·Verdana,·sans-serif;·padding:⏎1rem;·display:·block;·margin:·0.25rem;·border:·0.                                        
          25rem·solid·gainsboro;·}"                                                                                                                                         

components/NewUser.vue
 41:12  ✖  Delete "⏎·"                                                                                                                                     prettier/prettier
 43:1   ✖  Replace "··padding:·1rem;⏎··margin:·0.25rem;⏎··border:·0.25rem·solid·gainsboro;⏎" with                                                          prettier/prettier
           "padding:·1rem;·margin:·0.25rem;·border:·0.25rem·solid·gainsboro;·"                                                                                              

components/UserRow.vue
 20:9  ✖  Replace                                                                                                                                          prettier/prettier
          "␍⏎··font-family:·"Segoe·UI",·Tahoma,·Geneva,·Verdana,·sans-serif;␍⏎··padding:·1rem;␍⏎··margin:·0.25rem;␍⏎··border:·0.25rem·solid·gainsboro;                      
          ␍⏎}␍" with "·font-family:·"Segoe·UI",·Tahoma,·Geneva,·Verdana,·sans-serif;·padding:⏎1rem;·margin:·0.25rem;·border:·0.25rem·solid·gainsboro;·}"                    

components/VideoPreview.vue
 31:17  ✖  Replace "⏎··width:·31.25rem;⏎··height:·23.4375;⏎··background-color:·#666;⏎" with "·width:·31.25rem;·height:·23.4375;·background-color:·#666;·"  prettier/prettier

pages/index.vue
 42:10  ✖  Replace "⏎··font-family:·"Segoe·UI",·Tahoma,·Geneva,·Verdana,·sans-serif;⏎}⏎⏎.cards·{⏎··display:·flex;⏎··flex-wrap:·wrap;⏎" with                prettier/prettier
           "·font-family:·"Segoe·UI",·Tahoma,·Geneva,·Verdana,·sans-serif;·}·.cards⏎{·display:·flex;·flex-wrap:·wrap;·"

Long declaration not correctly formated

What version of stylelint, prettier and stylelint-prettier are you using?
styleline: 13.8.0
prettier: 2.2.1
Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)
none
What source code are you linting?
https://prettier.io/playground/#N4Igxg9gdgLgprEAuEAjCATAngAmAHShxwFoB3OVAawEsYT0APEgZwAsBDDCMpHABgE4AbhwBOAChIkA4gHUSAIQDyADRIBlABIBBACLKFygKoAVAKIAlEgCYSl-QEljGgJQCANCPFTZCgMLKADLK1iqWelauANyEAL6EIB4gEAAOMDTQLMig4mI8AAriCNkoHAA2ZBxY2cmoYhxgVHAwGqmNNFAA5sgwYgCucMlwALaocBgYE0Ec3f0cXXAAYhBiIxwwGd3IIBz9MBBJIGwwI+VybHRwLO1gcBoldDTCdFg7YCy1IJ0scGIwBQaXXWyAAZhVfskAFYsRiKBpNFoaDgjOBBTpwMEQoYgGGMDSdLrlOAARX6EHgWPKkJA7TEvzEOxYHy+qTEnRgchoGBgbGQAA5+Mk2RBfnIGqkdmzrn9hJjkgBHcnwQFpUq7FgkKBwCYTI5iOBKmgGwELEFIcHUnG-EY0XoDa2E4lkimYi3Y5IwDioLk8vlIGyeho0cqE-wQEbmkDXACsR36v1M3tKlppwkGjigU1gGjA7PSOizGhgWGJVN+cTiQA

What did you expect to happen?
No errors from stylelint
What actually happened?
Error shown:
https://stylelint.io/demo#N4Igxg9gJgpiBcIBG0CeACYAdAdu9AtAO4xIDWAlgC4EoAeBAzgBYCGUER86ADL+gDdWAJwAUBAgHEA6gQBCAeQAaBAMoAJAIIARBbIUBVACoBRAEoEATATM6AkgdUBKXgBpc+fELESZBAMIKADIKFopm2uZOANy4AL64IK4gjKg4VKx0CClgjIxJ4BA4AGYUAObZ2HjoWCDCAK4ANjCMtdxVnjUgrDQNzQQ4EAT1OGSDRDht6FQNMO7V+LVIjRBgZANDMAC2AA5UqFMz9XMenrWQK8IbBBQ4Qo0UUATMMHSHs-Od5xBbWzDp122ewOCGmH1OixAsDAjREPQoRVoKzW1yg9R2DzAPRgBB2wggOxgwioFBaUwA2hDPEcTgtPB1OmcQOVBsIYBSqYyupAcIwYGB6iSBDi0RiKFiqC1iNRmAQoBRisUif8aPdjq0QJzPABdLUJOnaz5M6Gw4TwxHLVbrQZMZgQYlsHBPPEEon7AgQYXCYSPMmgmlGyHFIo0YqsLYURqoVHozHYgbhv3cANU2rBgFhiNR64RvK3MoEMr-InigiZyPRsgwVBEe1Qd7HQNdYojMAkxFYxpga63e6PBu0r4gFs4NsInAETvdm0jRg7VhgGBPV1mqj2gdNtOt9sTh44GAiQtm+Uq66DXkZJ0iJ7ytljoob1MgKuoYpmv5y-mm80Tm0UXb2peVCPnStR-PKrBlgeVD1GyCYfjOozjJM-rgqBIA2rAjCLk6+ZMISYAKuK1AgsmaFDphsbivGPQ3ABxIEH0SZgo2T6UWKEo4nyzRtvaGpkax6E2kC7qMBAsGLiBFGbHQMyQXyEYXEU-EsYOTJ-ncrAPDe4nLFxsIsJOPx-OkKkpuhLqEsS0aIWMnAoQJamQtx-JrlcOx8vUHCTgZjDXCMdkTFJTIubx7med5MDNCZNC2chwXOVFrn2gQ+yEv5SH2QlXSMDMeE2vuRB7uyqGCUOIzUBlgUOapm7dL0TQ4iJ0bFbQMDBmyHJ0pCWlEKwqAak2+AMlytSvIuexdVyQ6WmszR5AQrDFJKVyMIm8E4rNZDzYNWpDqUwi5QMLSSvWmrdTqQ1Miy9oldwlIXUOS0rUZvwqrUe3oLqF36p0hpPrRTEbZOrB8lMtQrCQwi1HVgONcDc4Ljiz1EuD3SNH1A1MPm-TFTDAMNf0CnihAKy-jARW3Mjy2o6CtS9f1u3oVtPkQIweFIGai4EM1BCtUg7W3Wj+5evjzPIusMJsxzXM4oVrUo9DdPo5jTMzRLrPszgBac0jx2U-ubUdXdXQM1jWxNCSfNU2L6tWprMt64j3MC8baNm35WtlLjNtJE+LOujgjvc-LVOLTTSvcPTGOMwQFuNFbeN++L9uB8HXHztzivuzHWNez7+620yAeEkH2u0LL+F667QvKx7ReQkpVwvAwWJg8rkO03VTfPK8fP-GUVDMGjLCAQ33LGaevP84LnWgg9o0q4z4-DZ9Y10BNwHz59QYUIdsUnUuH2PV9V2Qjdc-3TvOX7M0e40JAvysE6Gqfd9XK-ZdT6PzFxDMNQLRM44luOzWAOdVbj3OPUXKPxcT4isu6aeYca6X3QAvRk0cIHJy5CNDBIBxowEmtvE+PUI6TmgWuLYcCVz7BXngg6R19y5SPudaap817MjKKyE26C2H0zIT-d62C2FdBAb6bG2sC6bQlsfNh79GSf3wP9dCJo4Q7loM-AsztqYrWFjAUWwjISqNXOODR5dtFG1rlHJeA1IFQi-Go0xLNiZKXJgbHRtNrEezjpbCg1tC6GK6MYn8SJ7YuNJoiCx2c66509jjHESc6rBPUc47YJMyZVxdrPE2tQRZdyfMkpxGt84JLDlsTIn4YSOOUlMAAjEkhxJiLQazkpGPC4SybgOXoE2ohSOwRLcQrCOXTza+P8SVBpVSmkTlcZkjxkdTaxIkd7UpATJnfnUbMixKCckYX0fklRjSQlIMNjsqaeD66BNXifdem9zl8O6GQvpKEz5MgYQfZhZ036vNqBfHh19+EvUEekOhQ4xGwGWVI0JaxZHTXkZ0RR7D0IjnvDM4ykFQ6G2iV4pZ8dE6+zqiizZ6K5nh10TE1WkLVkTKfES0xP95JAMsag3J+ylaEu3KY8pDATnMR4By0c6icDrTbrszu7LaWcsRPONk6QXh8j8pi4BvJfQjL8nivxiTJWCtMTKlU8qpQWPBbsvJq14njLsXSxERB-6SiicMil3S6q3FgOkH8UxLB1WaNrIeBAABeRIhiIWoNlMCFTeUqXqU+cCFBIJKh6LBHEWymXYsWVguqMa43QUTUZDJ2zsl6IMRmpcsaoIJrgsKj8oq0birsZmstME4J6rlS0Q1TLjWFoOUOet8bG04jNNrHEK4egpXteSnF6bo0lqzeW-tmih1WRHatJlZzHW2J6SAetABHY4wgWoUCOgy-WQzx1ptjhqi1G7t27v3YeklY7PFnrzuarV6Fr1ElvQ-e9K6C3K1NXY4SpM-4AO0aGjCQxcxex5k6D0xQmDiWECHCmSdHJ1RwPULYAsrjNHYHhAN+I1UAYw1h64rS9wFnw2zMDlk3TRmrR3TgXamRA15cy-5F1MHnrGa+nBHCCFEKviQ5se9GGHy+SfZRDy-n3OmoCokr0Yqwq5PCzwiLJMhSSmFRaVA8pIEFJtLmVYqCe3bSqsBf62V2NCm5bTun9MekXTZh9CzWVFqfNZlKPQ7OSgc0SJdpLV3WP-RujzVxH5IFuP55zhGQuaZs+FyLTmf1uzXWrDTPEbNYRwlAZ+X7MOJZSgVSJQCwOhetnep+x6w6ps4+uuqZWHgVfKQF39QXLOxYyylblPNdjumKipfl7m4spQ8jALyQwqkLXo9Y2tHXkrhTG95Sbflm1D1bSZvWHaLNufQmV0b42ebRVPNNros36vDYWwdpKv9ZmDAyDuNGHB6h6Ssxd1KqB0onYhoxiV6EKoP1BmKn7di1Q4hfLWYQTwvsgDO0+UH5W8vNaVWSx9tX1XcYJXDrSxwEcKcZXrGrNi4mSOpSD7HpSmv46ySltrO2hzw8azQbrEapg8FOPqOIIA4hAA

CR at End Of File

When formatting css files on Windows we ran into a problem where the Files terminated with CR and not CRLF as excepted. We set the prettier Option endOfLine to "crlf" explicitly, but the problem persisted.

What version of stylelint, prettier and stylelint-prettier are you using?
stylelint 10.0.1
prettier 1.17.1
stylelint-prettier 1.1.0 (tested with 1.0.7 as well)

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)
I made a minimal sample to reproduce the error:
https://github.com/rzontar/stylelint-prettier-cr

What source code are you linting?
CSS

What did you expect to happen?
Running stylelint --fix .\test.css
should format line 6 as }CRLF

What actually happened?
Running stylelint --fix .\test.css
formats line 6 as }CR

But running prettier standalone produces correct results.
prettier --write .\test.css

I've this issue `188:3 ✖ Insert "··" prettier/prettier` with `--fix` flag, but no error without `--fix` flag

What version of stylelint, prettier and stylelint-prettier are you using?
I'm using:

"prettier": "^2.6.2",
"stylelint": "^14.8.4",
"stylelint-config-prettier": "^9.0.3",
"stylelint-prettier": "^2.0.0",

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)
my .prettierc is

{
  "arrowParens": "avoid",
  "semi": false,
  "singleQuote": true,
  "trailingComma": "none",
  "tabWidth": 2
}

and my .stylelintrc is

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-standard-scss",
    "stylelint-prettier/recommended"
  ],
  "plugins": [
    "stylelint-scss",
    "stylelint-selector-bem-pattern",
    "stylelint-order",
    "stylelint-prettier"
  ],
  "rules": {
    "alpha-value-notation": "number",
    "at-rule-allowed-list": null,
    "at-rule-disallowed-list": null,
    "at-rule-name-case": "lower",
    "at-rule-no-unknown": null,
    "at-rule-no-vendor-prefix": true,
    "at-rule-semicolon-newline-after": "always",
    "at-rule-semicolon-space-before": "never",
    "block-closing-brace-empty-line-before": "never",
    "block-closing-brace-newline-after": [
      "always",
      {
        "ignoreAtRules": [ "if", "else" ]
      }
    ],
    "block-closing-brace-newline-before": "always-multi-line",
    "block-closing-brace-space-after": null,
    "block-closing-brace-space-before": "always-single-line",
    "block-no-empty": true,
    "block-opening-brace-newline-after": "always-multi-line",
    "block-opening-brace-newline-before": "never-single-line",
    "block-opening-brace-space-after": "always-single-line",
    "block-opening-brace-space-before": "always",
    "color-function-notation": "legacy",
    "color-hex-case": "lower",
    "color-hex-length": "long",
    "color-named": null,
    "color-no-hex": null,
    "color-no-invalid-hex": true,
    "comment-empty-line-before": [
      "always",
      {
        "except": [ "first-nested" ],
        "ignore": [ "stylelint-commands" ]
      }
    ],
    "comment-no-empty": true,
    "comment-whitespace-inside": "always",
    "comment-word-disallowed-list": null,
    "custom-media-pattern": null,
    "custom-property-pattern": ".+",
    "custom-property-empty-line-before": [
      "always",
      {
        "except": [
          "after-custom-property",
          "first-nested"
        ],
        "ignore": [
          "after-comment",
          "inside-single-line-block"
        ]
      }
    ],
    "declaration-bang-space-after": "never",
    "declaration-bang-space-before": "always",
    "declaration-block-no-duplicate-properties": [
      true,
      {
        "ignore": [ "consecutive-duplicates-with-different-values" ]
      }
    ],
    "declaration-block-no-redundant-longhand-properties": true,
    "declaration-block-no-shorthand-property-overrides": true,
    "declaration-block-semicolon-newline-after": "always-multi-line",
    "declaration-block-semicolon-newline-before": "never-multi-line",
    "declaration-block-semicolon-space-after": "always-single-line",
    "declaration-block-semicolon-space-before": "never",
    "declaration-block-single-line-max-declarations": 1,
    "declaration-block-trailing-semicolon": "always",
    "declaration-colon-space-after": "always-single-line",
    "declaration-colon-space-before": "never",
    "declaration-empty-line-before": [
      "always",
      {
        "except": [
          "after-declaration",
          "first-nested"
        ],
        "ignore": [
          "after-comment",
          "inside-single-line-block"
        ]
      }
    ],
    "declaration-no-important": null,
    "declaration-property-unit-allowed-list": null,
    "declaration-property-unit-disallowed-list": null,
    "declaration-property-value-allowed-list": null,
    "declaration-property-value-disallowed-list": [
      {
        "/color/": ["none"]
      },
      {
        "message": "Color related properties do not support 'none'" 
      }
    ],
    "font-family-name-quotes": "always-where-recommended",
    "font-family-no-duplicate-names": true,
    "font-family-no-missing-generic-family-keyword": true,
    "font-weight-notation": [
      "numeric",
      {
        "ignore": [ "relative" ]
      }
    ],
    "function-allowed-list": null,
    "function-disallowed-list": null,
    "function-calc-no-unspaced-operator": true,
    "function-comma-newline-before": "never-multi-line",
    "function-comma-newline-after": "always-multi-line",
    "function-comma-space-after": "always-single-line",
    "function-comma-space-before": "never",
    "function-linear-gradient-no-nonstandard-direction": true,
    "function-max-empty-lines": 0,
    "function-name-case": "lower",
    "function-no-unknown": null,
    "function-parentheses-newline-inside": "always-multi-line",
    "function-parentheses-space-inside": "never-single-line",
    "function-url-no-scheme-relative": null,
    "function-url-quotes": "always",
    "function-url-scheme-allowed-list": null,
    "function-url-scheme-disallowed-list": null,
    "function-whitespace-after": "always",
    "indentation": 2,
    "keyframe-declaration-no-important": true,
    "keyframes-name-pattern": "^([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
    "length-zero-no-unit": true,
    "linebreaks": "unix",
    "max-empty-lines": 1,
    "max-nesting-depth": null,
    "media-feature-colon-space-after": "always",
    "media-feature-colon-space-before": "never",
    "media-feature-name-allowed-list": null,
    "media-feature-name-disallowed-list": null,
    "media-feature-name-case": "lower",
    "media-feature-name-no-unknown": true,
    "media-feature-name-no-vendor-prefix": true,
    "media-feature-name-value-allowed-list": null,
    "media-feature-parentheses-space-inside": "never",
    "media-feature-range-operator-space-after": "always",
    "media-feature-range-operator-space-before": "always",
    "media-query-list-comma-newline-after": "always-multi-line",
    "media-query-list-comma-newline-before": "never-multi-line",
    "media-query-list-comma-space-after": "always-single-line",
    "media-query-list-comma-space-before": "never",
    "no-descending-specificity": null,
    "no-duplicate-at-import-rules": true,
    "no-duplicate-selectors": null,
    "no-empty-first-line": true,
    "no-empty-source": true,
    "no-eol-whitespace": true,
    "no-extra-semicolons": true,
    "no-invalid-double-slash-comments": true,
    "no-missing-end-of-source-newline": true,
    "no-unknown-animations": true,
    "number-max-precision": 4,
    "number-no-trailing-zeros": true,
    "order/order": ["custom-properties", "declarations"],
    "order/properties-alphabetical-order": true,
    "plugin/selector-bem-pattern": {
      "componentName": "[A-Z]+",
      "componentSelectors": {
        "initial": "^\\.{componentName}(?:-[a-z]+)?$",
        "combined": "^\\.combined-{componentName}-[a-z]+$"
      },
      "utilitySelectors": "^\\.util-[a-z]+$"
    },
    "prettier/prettier": true,
    "property-allowed-list": null,
    "property-disallowed-list": null,
    "property-case": "lower",
    "property-no-unknown": true,
    "property-no-vendor-prefix": true,
    "scss/at-rule-no-unknown": true,
    "scss/at-else-closing-brace-newline-after": "always-last-in-chain",
    "scss/at-else-closing-brace-space-after": "always-intermediate",
    "scss/at-else-empty-line-before": "never",
    "scss/at-else-if-parentheses-space-before": "always",
    "scss/at-extend-no-missing-placeholder": null,
    "scss/at-function-named-arguments": null,
    "scss/at-function-parentheses-space-before": "never",
    "scss/at-function-pattern": null,
    "scss/at-if-closing-brace-newline-after": "always-last-in-chain",
    "scss/at-if-closing-brace-space-after": "always-intermediate",
    "scss/at-import-no-partial-leading-underscore": true,
    "scss/at-import-partial-extension-blacklist": [ "scss" ],
    "scss/at-import-partial-extension-whitelist": null,
    "scss/at-mixin-argumentless-call-parentheses": "always",
    "scss/at-mixin-named-arguments": null,
    "scss/at-mixin-parentheses-space-before": "never",
    "scss/at-mixin-pattern": null,
    "scss/at-rule-conditional-no-parentheses": null,
    "scss/declaration-nested-properties": null,
    "scss/declaration-nested-properties-no-divided-groups": null,
    "scss/dollar-variable-colon-newline-after": null,
    "scss/dollar-variable-colon-space-after": "always",
    "scss/dollar-variable-colon-space-before": "never",
    "scss/dollar-variable-default": null,
    "scss/dollar-variable-empty-line-before": [
      "always",
      {
        "except": [ "after-dollar-variable", "after-comment", "first-nested" ]
      }
    ],
    "scss/dollar-variable-no-missing-interpolation": true,
    "scss/dollar-variable-pattern": null,
    "scss/double-slash-comment-empty-line-before": [
      "always",
      {
        "except": [ "first-nested" ],
        "ignore": [ "between-comments", "stylelint-commands" ]
      }
    ],
    "scss/double-slash-comment-inline": null,
    "scss/double-slash-comment-whitespace-inside": "always",
    "scss/function-no-unknown": [
      true,
      {
        "ignoreFunctions": [
          "/^map-fetch/",
          "/^split-fontset-name/",
          "/^str-replace/"
        ]
      }
    ],
    "scss/media-feature-value-dollar-variable": null,
    "scss/no-dollar-variables": null,
    "scss/no-duplicate-dollar-variables": null,
    "scss/operator-no-newline-after": null,
    "scss/operator-no-newline-before": true,
    "scss/operator-no-unspaced": null,
    "scss/partial-no-import": null,
    "scss/percent-placeholder-pattern": null,
    "scss/selector-no-redundant-nesting-selector": true,
    "selector-attribute-brackets-space-inside": "never",
    "selector-attribute-operator-allowed-list": null,
    "selector-attribute-operator-disallowed-list": null,
    "selector-attribute-operator-space-after": "never",
    "selector-attribute-operator-space-before": "never",
    "selector-attribute-quotes": "always",
    "selector-class-pattern": null,
    "selector-combinator-space-after": "always",
    "selector-combinator-space-before": "always",
    "selector-combinator-allowed-list": null,
    "selector-combinator-disallowed-list": null,
    "selector-descendant-combinator-no-non-space": true,
    "selector-id-pattern": null,
    "selector-list-comma-newline-after": "always",
    "selector-list-comma-newline-before": "never-multi-line",
    "selector-list-comma-space-after": "always-single-line",
    "selector-list-comma-space-before": "never",
    "selector-max-attribute": null,
    "selector-max-class": null,
    "selector-max-combinators": null,
    "selector-max-compound-selectors": null,
    "selector-max-empty-lines": 0,
    "selector-max-id": 1,
    "selector-max-pseudo-class": 5,
    "selector-max-specificity": null,
    "selector-max-type": null,
    "selector-max-universal": 1,
    "selector-nested-pattern": null,
    "selector-no-qualifying-type": null,
    "selector-no-vendor-prefix": true,
    "selector-pseudo-class-allowed-list": null,
    "selector-pseudo-class-disallowed-list": null,
    "selector-pseudo-class-case": "lower",
    "selector-pseudo-class-no-unknown": true,
    "selector-pseudo-class-parentheses-space-inside": "never",
    "selector-pseudo-element-allowed-list": null,
    "selector-pseudo-element-disallowed-list": null,
    "selector-pseudo-element-case": "lower",
    "selector-pseudo-element-colon-notation": null,
    "selector-pseudo-element-no-unknown": true,
    "selector-type-case": "lower",
    "selector-type-no-unknown": true,
    "shorthand-property-no-redundant-values": true,
    "string-no-newline": true,
    "string-quotes": "single",
    "time-min-milliseconds": 100,
    "unit-allowed-list": null,
    "unit-disallowed-list": null,
    "unit-case": "lower",
    "unit-no-unknown": true,
    "value-keyword-case": null,
    "value-list-comma-newline-after": "always-multi-line",
    "value-list-comma-newline-before": "never-multi-line",
    "value-list-comma-space-after": "always-single-line",
    "value-list-comma-space-before": "never",
    "value-list-max-empty-lines": 0,
    "value-no-vendor-prefix": true
  }
}

What source code are you linting?
This is the code with 0, 2, 4, 4, 4 tabs from first to fifth line.

.my-class
  transition: color var(--designtoken-motion-duration-textcolor)
    var(--designtoken-motion-easing-textcolor),
    background-color var(--designtoken-motion-duration-backgroundcolor)
    var(--designtoken-motion-easing-backgroundcolor);

What did you expect to happen?
stylelint --fix '**/*.scss' development command gives me good result!
stylelint '**/*.scss' production command gives me good result!

What actually happened?
stylelint --fix '**/*.scss' development command gives me indeed good result!
stylelint '**/*.scss' production command gives me the following error

myfile.scss
 32:5  ✖  Insert "··"  prettier/prettier
 34:1  ✖  Insert "··"  prettier/prettier

And, it is a blocking issue for deploying.

Am I setting some prettier property wrong?

Error thrown on files that has no associated parser (even when specifying it explicitly)

What version of stylelint, prettier and stylelint-prettier are you using?
"prettier": "1.19.1",
"stylelint": "11.1.1",
"stylelint-prettier": "1.1.1",

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

  "prettier": {
    "trailingComma": "all",
    "singleQuote": true
  },
  "stylelint": {
    "extends": ["stylelint-config-idiomatic-order"],
    "plugins": ["stylelint-prettier"],
    "rules": {
        "prettier/prettier": true
      }
  },

What source code are you linting?

test.overrides

a {
  color: red;
}

What did you expect to happen?
I'm using the CLI, and the error is also observable on VSCode. I run stylelint on a file that has an extension that does not match one of the supported parsers like:

test.overrides

a {
  color: red;
}

Then launch the command:
./node_modules/.bin/stylelint test.overrides --syntax less

What actually happened?
Fails with:

Error: No parser could be inferred for file: /Users/sneridagh/Development/plone/volto/test
    at normalize$1 (/Users/sneridagh/Development/plone/volto/node_modules/prettier/index.js:9798:15)
    at formatWithCursor (/Users/sneridagh/Development/plone/volto/node_modules/prettier/index.js:13525:12)
    at /Users/sneridagh/Development/plone/volto/node_modules/prettier/index.js:44207:15
    at Object.format (/Users/sneridagh/Development/plone/volto/node_modules/prettier/index.js:44226:12)
    at /Users/sneridagh/Development/plone/volto/node_modules/stylelint-prettier/stylelint-prettier.js:101:35
    at performRules.push.Promise.all.postcssRoots.map (/Users/sneridagh/Development/plone/volto/node_modules/stylelint/lib/lintSource.js:223:8)
    at Array.map (<anonymous>)
    at rules.forEach (/Users/sneridagh/Development/plone/volto/node_modules/stylelint/lib/lintSource.js:219:18)
    at Array.forEach (<anonymous>)
    at lintPostcssResult (/Users/sneridagh/Development/plone/volto/node_modules/stylelint/lib/lintSource.js:183:8)

When not using prettier in the middle, stylelint works as expected, without even specifying the parser (which also fails). On supported file extensions it works well.

Unknown rule prettier/prettier

What version of stylelint, prettier and stylelint-prettier are you using?
stylelint:15.11.0
prettier:2.8.8
stylelint-prettier:4.0.2
Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)
.stylelintrc

{
  "extends": [
    "stylelint-config-standard-scss",
    "stylelint-prettier"
  ],
  "rules": {
    "prettier/prettier": true
  }
}

What source code are you linting?

a+ b { color: pink; }

What did you expect to happen?

Expected single space before "+"
What actually happened?
✖ Unknown rule prettier/prettier prettier/prettier

Invalid errors when linting Vue.js SFCs.

What version of stylelint, prettier and stylelint-prettier are you using?

prettier: 1.16.3
stylelint: 9.10.1
stylelint-config-prettier: 5.0.0
stylelint-prettier: 1.0.6

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

// prettier.config.js
module.exports = {
  arrowParens: 'always',
  endOfLine: 'lf',
  semi: false,
  singleQuote: true
}
// stylelint.config.js
module.exports = { extends: ['stylelint-prettier/recommended'] }

What source code are you linting?

// stylelint_prettier_issue.scss
$variants: (
  error: $danger,
  info: $info,
  success: $success,
  warning: $warning
);

@each $variant, $color in $variants {
  .message-box--#{$variant} {
    .message-box__icon {
      color: $color;
    }
  }
}
<!-- stylelint_prettier_issue.vue -->
<script>
export default {
  name: 'StylelintPrettierIssue'
}
</script>

<template>
  <div />
</template>

<style lang="scss" scoped>
$variants: (
  error: $danger,
  info: $info,
  success: $success,
  warning: $warning
);

@each $variant, $color in $variants {
  .message-box--#{$variant} {
    .message-box__icon {
      color: $color;
    }
  }
}
</style>

What did you expect to happen?

No errors.

What actually happened?

$ npx stylelint stylelint_issue.scss stylelint_prettier_issue.vue

stylelint_prettier_issue.vue
 13:13  ✖  Replace "⏎··error:·$danger,⏎··info:·$info,⏎··success:·$success,⏎·" with "·error:·$danger,·info:·$info,·success:·$success,"   prettier/prettier
 18:3   ✖  Replace "⏎⏎@each·$variant,·$color·in·$variants·{⏎·" with "·@each·$variant,·$color·in·$variants·{"                            prettier/prettier
 22:1   ✖  Replace "····.message-box__icon·{⏎······color:·$color;⏎····}⏎··}⏎" with ".message-box__icon·{·color:·$color;·}·}·"           prettier/prettier

for .vue

TypeError: Cannot read property '0' of null
at H:\hui\node_modules\stylelint-prettier\stylelint-prettier.js:174:69
at performRules.push.Promise.all.postcssRoots.map.postcssRoot (H:\hui\node_modules\stylelint\lib\lintSource.js:232:13)
at Array.map ()
at rules.forEach.ruleName (H:\hui\node_modules\stylelint\lib\lintSource.js:228:22)
at Array.forEach ()
at lintPostcssResult (H:\hui\node_modules\stylelint\lib\lintSource.js:196:9)
at stylelint._getPostcssResult.then.postcssResult (H:\hui\node_modules\stylelint\lib\lintSource.js:153:18)
at

`Parsing error: Unexpected token` when used with `stylelint-config-html`

What version of stylelint, prettier and stylelint-prettier are you using?

    "prettier": "^3.0.3",
    "stylelint": "^15.10.3",
    "stylelint-prettier": "^4.0.2"

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

Here’s a minimal reproduction on StackBlitz

.prettierrc
{ "plugins": ["prettier-plugin-astro"] }

.stylelintrc.json

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-html",
    "stylelint-prettier/recommended"
  ]
}

What source code are you linting?

An Astro page:
<html lang="en"><body><style>body { color: red }</style></body></html>

What did you expect to happen?

The file should be parsed and linted

What actually happened?

src/pages/index.astro
 1:39  ✖  Parsing error: Unexpected token, expected "}"  prettier/prettier

1 problem (1 error, 0 warnings)

Prettier changing imports breaks build

What version of stylelint, prettier and stylelint-prettier are you using?
"prettier": "2.5.1",
"stylelint": "14.14.0",
"stylelint-prettier": "2.0.0",

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)
.prettierrc.json

{
  "arrowParens": "always",
  "endOfLine": "auto",
  "trailingComma": "es5",
  "semi": true,
  "singleQuote": true,
  "printWidth": 120,
  "overrides": [
    {
      "files": ["*.scss"],
      "options": {
        "singleQuote": true
      }
    }
  ]
}

.stylelintrc.json

{
  "extends": ["stylelint-config-standard", "stylelint-config-sass-guidelines", "stylelint-prettier/recommended"],
  "plugins": ["stylelint-declaration-strict-value", "stylelint-prettier", "stylelint-order"],
  "ignoreFiles": ["**/src/scss/vendor/**/*.scss"],
  "rules": {
    "at-rule-no-unknown": [
      true,
      {
        "ignoreAtRules": [
          "extends",
          "ignores",
          "include",
          "mixin",
          "extend",
          "if",
          "else",
          "each",
          "warn",
          "function",
          "return",
          "for"
        ]
      }
    ],
    "scale-unlimited/declaration-strict-value": [
      ["color", "fill", "font-family", "z-index"],
      { "ignoreValues": ["transparent", "inherit", "/rgba(.*)/"] }
    ],
    "color-function-notation": ["legacy"],
    "selector-pseudo-element-no-unknown": [
      true,
      {
        "ignorePseudoElements": ["ng-deep"]
      }
    ],
    "selector-class-pattern": "[a-zA-Z0-9]+",
    "declaration-block-no-duplicate-properties": [
      true,
      {
        "ignore": ["consecutive-duplicates-with-different-values"]
      }
    ],
    "max-nesting-depth": 3,
    "order/order": ["custom-properties", "declarations"],
    "order/properties-alphabetical-order": true,
    "no-descending-specificity": true,
    "no-duplicate-at-import-rules": true,
    "no-duplicate-selectors": true,
    "rule-empty-line-before": [
      "always-multi-line",
      {
        "except": ["first-nested"],
        "ignore": ["after-comment"]
      }
    ],
    "prettier/prettier": true
  }
}

What source code are you linting?
.SCSS

What did you expect to happen?
imports are not touched and stay as is @import 'path/file'

What actually happened?
imports reformatted to @import url('path/file') causing build to break

conflict with Stylelint: Expected empty line before at-rule (at-rule-empty-line-before)

I have a conflict with "at-rule-empty-line-before" rule.
it was said here that this problem is solved and Prettier should respect this rule, but it didn't or I'm missing somethig.

** "prettier": "^2.0.5",
"stylelint": "^13.3.3",
"stylelint-prettier": "^1.1.2",
**
.stylelintrc.js

module.exports = {
  "extends": [
    'stylelint-prettier/recommended',
  ],  plugins: ['stylelint-scss', 'stylelint-order', 'stylelint-prettier'],
  rules: {
    // 'string-quotes': 'single',
    'at-rule-empty-line-before': [
      'always',
      {
        except: ['after-same-name'],
        ignore: ['after-comment'],
      },
    ],
    'prettier/prettier': true,
  },
};

This is after Prettier formatting.
image

If I follow the rule and add empty line I got an error from Prettier

How to solve this problem?

Parsing error: Declaration or statement expected.stylelint(prettier/prettier)

What version of stylelint, prettier and stylelint-prettier are you using?

        "prettier": "^1.15.3",
        "stylelint": "^9.10.1",
        "stylelint-config-concentric-order": "^3.4.1",
        "stylelint-config-prettier": "^4.0.0",
        "stylelint-config-recommended": "^2.1.0",
        "stylelint-config-styled-components": "^0.1.1",
        "stylelint-prettier": "^1.0.6",
        "stylelint-processor-styled-components": "^1.5.2",

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)
.prettierrc

{
    "singleQuote": true,
    "printWidth": 120,
    "tabWidth": 4
}

.stylelintrc

{
 "processors": ["stylelint-processor-styled-components"],
  "extends": [
    "stylelint-config-recommended",
    "stylelint-config-styled-components",
    "stylelint-config-concentric-order",
    "stylelint-prettier/recommended"
  ],
  "plugins": ["stylelint-prettier"],
  "rules": {
    "prettier/prettier": true
  }
}

What source code are you linting?
const Wrapper = styled.div` margin: 0 auto; `;
What did you expect to happen?

What actually happened?
Parsing error: Declaration or statement expected.stylelint(prettier/prettier)

Getting this error when running stylelint in the terminal and in VSC itself

image

The error does not happen if i use this syntax

const Wrapper = styled(Image)`
    margin: 0 auto;
`;

stylelint-disable tag is not respected

This package formats files even if they start with /* stylelint-disable */.

What version of stylelint, prettier and stylelint-prettier are you using?
stylelint: 9.8.0
stylelint-prettier: 1.0.5
prettier: 1.15.3

What source code are you linting?
SCSS

What did you expect to happen?
Ignore formatting in whole file.

What actually happened?
Prettier formatted whole file.

Crashes when autofixing with syntax specified (root.source.syntax is undefined) such as when running stylelint via Atom

TL;DR #8 (comment)

What version of stylelint, prettier and stylelint-prettier are you using?

stylelint: 9.6.0
prettier: 1.13.7
stylelint-prettier: 1.0.3

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

Default Prettier settings, "prettier/prettier": true for stylelint.

What source code are you linting?

a {
  color:red;
}

What did you expect to happen?

A space to be inserted before red.

What actually happened?

An error was thrown.

This line fails when running stylelint via linter-stylelint (from this PR which has autofix support: AtomLinter/linter-stylelint#385):

const newRoot = root.source.syntax.parse(

TypeError: Cannot read property 'parse' of undefined
    at /home/lydell/5m/doowin-site/node_modules/stylelint-prettier/stylelint-prettier.js:122

At first I thought it was due that linter-stylelint PR using an older version of stylelint (9.2.0), but I upgraded to 9.6.0 here and it still happens: https://github.com/lydell/linter-stylelint (apm install lydell/linter-stylelint)

I quickly looked over the PostCSS docs and couldn’t find anything about the .syntax property – do you know where it comes from, and why it could be missing when running in Atom? It works fine when running from the command line. EDIT: I've now grepped through the PostCSS, stylelint and stylelint-prettier repos and can't find any obvious references to source.syntax

I know it’s super annoying to get issue reports that involve an editor you might not use – even worse when specific PRs of editor plugins – but I’m putting this out here since I got a bit stuck in my debugging for now and what to see if anyone has any ideas.

conflict with styelint-order "emptyLineBefore" option

What version of stylelint, prettier and stylelint-prettier are you using?

prettier 1.19.1
stylelint 13.2.1
stylelint-prettier 1.1.2

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

.stylelintrc.js:

"use strict";

module.exports = {
  extends: ["stylelint-config-standard", "stylelint-prettier/recommended"],
  plugins: ["stylelint-order", "stylelint-scss"],
  rules: {
    // Order
    "order/order": ["custom-properties", "declarations"],
    "order/properties-order": [
      [
        {
          groupName: "positioning",
          emptyLineBefore: "always",
          noEmptyLineBetween: true,
          properties: ["position", "top", "bottom", "left", "right", "z-index"]
        },
        {
          groupName: "sizing",
          emptyLineBefore: "always",
          noEmptyLineBetween: true,
          properties: [
            "display",
            "box-sizing",
            "width",
            "height",
            "margin",
            "margin-top",
            "margin-bottom",
            "margin-left",
            "margin-right",
            "padding",
            "padding-top",
            "padding-bottom",
            "padding-left",
            "padding-right"
          ]
        },
        {
          groupName: "flex-children",
          emptyLineBefore: "always",
          noEmptyLineBetween: true,
          properties: [
            "order",
            "flex",
            "flex-grow",
            "flex-shrink",
            "flex-basis"
          ]
        },
        {
          groupName: "grid-children",
          emptyLineBefore: "always",
          noEmptyLineBetween: true,
          properties: [
            "grid-column-start",
            "grid-column-end",
            "grid-row-start",
            "grid-row-end",
            "grid-column",
            "grid-row",
            "grid-area"
          ]
        },
        {
          groupName: "flex-grid-children-place",
          noEmptyLineBetween: true,
          properties: ["place-self", "justify-self", "align-self"]
        },
        {
          groupName: "flex-parent",
          emptyLineBefore: "always",
          noEmptyLineBetween: true,
          properties: ["flex-flow", "flex-direction", "flex-wrap"]
        },
        {
          groupName: "grid-parent",
          emptyLineBefore: "always",
          noEmptyLineBetween: true,
          properties: [
            "grid",
            "grid-template",
            "grid-template-columns",
            "grid-template-rows",
            "grid-template-areas",
            "grid-gap",
            "grid-column-gap",
            "grid-row-gap",
            "grid-auto-flow",
            "grid-auto-columns",
            "grid-auto-rows"
          ]
        },
        {
          groupName: "flex-grid-parent-place",
          noEmptyLineBetween: true,
          properties: [
            "place-items",
            "justify-items",
            "align-items",
            "place-content",
            "justify-content",
            "align-content"
          ]
        }
      ],
      { unspecified: "bottomAlphabetical" }
    ],
};

What source code are you linting?

.card {
  display: inline;
  flex: 1 1 auto;
  font-size: 2rem;
}

What did you expect to happen?

Should be formatted without errors.

What actually happened?

Formatted but with stylelint error:

 3:3  ✖  Expected an empty line before property "flex"   order/properties-order

Can't lint or format svelte files at all

Test.svelte:

<h1>test</h1>

<style>
  h1 {
    text-align: center;
    padding: 2.5em 0.1em;
  }
</style>

stylelint.config.cjs:

module.exports = {
  plugins: ["stylelint-prettier"],
  extends: [
    "stylelint-config-standard",
    "stylelint-prettier/recommended",
    "stylelint-config-html/html",
    "stylelint-config-html/svelte",
  ],
  rules: {
    "prettier/prettier": true
  },
};

Error log:

ParseError: Expected }
  1 | h1 {
> 2 |     text-align: center;
    |              ^
  3 |     padding: 2.5em 0.1em;
  4 |   }
    at error (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17796:20)
    at Parser$1.error (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17873:10)
    at Parser$1.eat (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17887:19)
    at mustache (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17618:17)
    at new Parser$1 (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17832:22)
    at Object.parse$3 [as parse] (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/svelte/compiler.js:17964:21)
    at Object.parse (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]_lrllcp5xtrkmmdzifit4hd52ze/node_modules/prettier-plugin-svelte/plugin.js:2025:83)
    at Object.parse (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:7334:23)
    at coreFormat (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8645:18)
    at formatWithCursor2 (/Users/zerdox/p/midas/test/web/node_modules/.pnpm/[email protected]/node_modules/prettier/index.js:8837:18)

Prettier's parser why not just "css"

Question

This plugin use prettier.getFileInfo to decide which parser to use. But this plugin is work with stylelint, so the parser maybe only need be css?

Problem

In China there is someting called miniProgram. It's style file use css syntax but use wxss as the extension. I want use this plugin in miniProgram, but Prettier don't know *.wxss file. If I told Prettier use css parser, it will work fine.

Or

If the parser can not just be css, maybe use css as default parser when inferredParser is null is a idea.


I'm happy to send a PR :)

stylelint: Could not find "stylelint-config-prettier". Do you need a `configBasedir`?

This is in my package.json

{
  "devDependencies": {
    "prettier": "^2.2.1",
    "stylelint": "^13.11.0",
    "stylelint-config-prettier": "^8.0.2",
    "stylelint-config-standard": "^20.0.0",
    "stylelint-prettier": "^1.2.0",
    }
}

This is my .stylelintrc.json

{
  "extends": ["stylelint-config-standard", "stylelint-prettier/recommended"],
  "plugins": ["stylelint-prettier"],
  "rules": {

  }
}

in vscode throw error:
stylelint: Could not find "stylelint-config-prettier". Do you need a configBasedir?

Style attributes in HTML being flagged as errors

What version of stylelint, prettier and stylelint-prettier are you using?

    "stylelint": "10.0.1",
    "stylelint-config-prettier": "5.2.0",
    "stylelint-prettier": "1.1.0"

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

{
  "printWidth": 120,
  "singleQuote": true,
  "useTabs": false,
  "tabWidth": 2,
  "semi": true,
  "bracketSpacing": true
 }
{
  "plugins": ["stylelint-prettier"],
  "extends": ["stylelint-prettier/recommended"],
  "rules": {
    "at-rule-empty-line-before": null,
    "at-rule-no-unknown": null,
    "declaration-colon-newline-after": null,
    "declaration-empty-line-before": null,
    "max-empty-lines": 4,
    "indentation": 2,
    "no-eol-whitespace": [
      true,
      {
        "ignore": ["empty-lines"]
      }
    ],
    "number-leading-zero": null,
    "no-empty-source": null,
    "rule-empty-line-before": null,
    "selector-list-comma-newline-after": "always-multi-line",
    "selector-list-comma-space-after": "always-single-line",
    "selector-pseudo-element-colon-notation": "double",
    "selector-type-no-unknown": null,
    "string-no-newline": null,
    "no-missing-end-of-source-newline": null,
    "no-descending-specificity": null,
    "no-duplicate-selectors": null,
    "unit-whitelist": ["em", "rem", "s", "px", "%", "deg", "ms", "vh", "vw", "dppx", "dpi", "fr"],
    "prettier/prettier": [
      true,
      {
        "singleQuote": false,
        "tabWidth": 2
      }
    ]
  }
}

What source code are you linting?

 <p class="mb-0"
         style="font-size: 12px;">
        By clicking "Complete My Application" you agree to
        <a class="fake-link">our terms of use</a>,
        <a class="fake-link">privacy</a>
        and
        <a class="fake-link">refund policies</a>.
      </p>

What did you expect to happen?
The style tag is valid html and should not be flagged

What actually happened?
Screen Shot 2019-05-28 at 9 29 14 AM

The road to v1.0.0

I believe I've fixed --fix with scss files, but this still needs a bit of battle hardening before I'm confident enough to call a v1.0.0.

I've compared the output of this with running prettier over the boostrap output files and source scss files and the output is the same so that's pretty promising.

Next step is to try and use this within some work codebases. Once I prove this works with big codebases, I'll cut a v1.0.0.

stylelint-prettier should be feature complete - it lints, it autofixes, that's kinda it. I expect no changes between the final release in v.0.2.x to v1.0.0, the version bump will be just to signify stability.

Self-promotion

No such file

Error: ENOENT: no such file or directory, scandir 'C::\Users\yura\WebstormProjects\apartament-web-ui\src\assets\fonts' error in C::\Users Windows 10 WebStorm module.exports = { "plugins": ["stylelint-prettier"], "rules": { "prettier/prettier": true } };
default

Delete "␍" (prettier/prettier)

What version of stylelint, prettier and stylelint-prettier are you using?

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

What source code are you linting?

What did you expect to happen?

What actually happened?

Require ES module

What version of stylelint, prettier and stylelint-prettier are you using?

"prettier": "2.8.7",
"stylelint": "^15.11.0",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-prettier-scss": "^1.0.0",
"stylelint-config-sass-guidelines": "^10.0.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-config-standard-scss": "^11.1.0",
"stylelint-order": "^6.0.3",
"stylelint-prettier": "^5.0.0",
"stylelint-scss": "^5.3.1",

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)


{
    "overrides": [
        {
            "files": [
                "*.scss",
                "**/*.scss"
            ],
            "extends": [
                "stylelint-config-standard",
                "stylelint-config-standard-scss",
                "stylelint-config-sass-guidelines",
                "stylelint-prettier/recommended"
            ],
            "plugins": [
                "stylelint-scss",
                "stylelint-order",
                "stylelint-prettier",
                "stylelint-config-prettier-scss"
            ],
            "customSyntax": "postcss-scss",
            "rules": {
                "prettier/prettier": [
                    "error",
                    {
                        "useTabs": false,
                        "tabWidth": 2,
                        "semi": true,
                        "singleQuote": true,
                        "quoteProps": "consistent",
                        "trailingComma": "es5",
                        "bracketSpacing": true,
                        "arrowParens": "avoid",
                        "printWidth": 120
                    }
                ]
            }
        }
    ]
}

What source code are you linting?
scss
What did you expect to happen?
Format without error
What actually happened?

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/stylelint-prettier/recommended.js from /home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/loaders.js not supported. Instead change the require of recommended.js in /home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/loaders.js to a dynamic import() which is available in all CommonJS modules.     at f._load (node:electron/js2c/asar_bundle:2:13377)     at module.exports (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected]/node_modules/import-fresh/index.js:32:59)     at Object.loadJsSync (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/loaders.js:17:12)     at .js (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/createStylelint.js:26:47)     at #loadConfiguration (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/Explorer.js:92:30)     at #readConfiguration (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/Explorer.js:77:80)     at async load (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/Explorer.js:20:48)     at async Explorer.load (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/Explorer.js:23:20)     at async extendConfig (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/augmentConfig.js:184:19)     at async augmentConfigBasic (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/augmentConfig.js:57:20)     at async augmentConfigFull (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/augmentConfig.js:111:24)     at async load (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/Explorer.js:20:20)     at async Explorer.load (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/cosmiconfig/dist/Explorer.js:23:20)     at async getConfigForFile (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/getConfigForFile.js:61:5)     at async isPathIgnored (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/isPathIgnored.js:24:17)     at async lintSource (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/lintSource.js:41:20)     at async Function.standalone [as lint] (/home/me/Documents/Perso/cda-project/node_modules/.pnpm/[email protected][email protected]/node_modules/stylelint/lib/standalone.js:125:26)     at async ZR.lintDocument (/home/me/.vscode/extensions/stylelint.vscode-stylelint-1.3.0/dist/start-server.js:71:5691)     at async y2 (/home/me/.vscode/extensions/stylelint.vscode-stylelint-1.3.0/dist/start-server.js:70:30584)     at async LE.CE (/home/me/.vscode/extensions/stylelint.vscode-stylelint-1.3.0/dist/start-server.js:71:70761)     at async Yh.n1 (/home/me/.vscode/extensions/stylelint.vscode-stylelint-1.3.0/dist/start-server.js:71:10026)     at async Yh.o1 (/home/me/.vscode/extensions/stylelint.vscode-stylelint-1.3.0/dist/start-server.js:71:11032)     at async /home/me/.vscode/extensions/stylelint.vscode-stylelint-1.3.0/dist/start-server.js:71:8933

I didn't spend much time setting stylelint so I might have missed something. Basically everything was working great except it didn't format well.

Formatting actually works (except for error notification), but since I'm using other tools it crashes because of the error.

image

4.0.1 causes crash if a .prettierrc.js file is not present

stylelint crashes with the introduction of with stylelint-prettier 4.0.1. The crash goes away if a .prettierrc.js file is created.

What version of stylelint, prettier and stylelint-prettier are you using?

[email protected]
[email protected]
[email protected]

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

.prettierrc (none)

.stylelintrc.js
module.exports = {
  plugins: ["stylelint-declaration-strict-value"],
  extends: [
    "stylelint-config-standard",
    "stylelint-config-recommended-scss",
    "stylelint-prettier/recommended",
  ],
  rules: {
    "alpha-value-notation": null,
    "color-function-notation": null,
    "declaration-empty-line-before": null,
    "declaration-no-important": true,
    "import-notation": null,
    "max-nesting-depth": 1,
    "no-empty-source": null,
    "no-invalid-position-at-import-rule": null,
    "property-no-unknown": [
      true,
      {
        // Allow property used for css-fonts-4 variable fonts
        ignoreProperties: ["font-named-instance"],
      },
    ],
    "scale-unlimited/declaration-strict-value": [
      "/color/",
      {
        disableFix: true,
        ignoreValues: [
          "currentcolor",
          "inherit",
          "initial",
          "transparent",
          "unset",
        ],
      },
    ],
    "scss/at-function-pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
    "scss/at-mixin-pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
    "scss/dollar-variable-pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
    "scss/no-global-function-names": null,
    "scss/no-duplicate-dollar-variables": true,
    "scss/selector-no-redundant-nesting-selector": true,
    "selector-class-pattern": [
      // classes must be in BEM form, like this:
      // my-component
      // my-component--variant
      // my-component__element
      // my-component__element--variant
      // my-component__long-element-name
      // my-component__long-element-name--variant
      "^[a-z]+(-[a-z]+)*(__[a-z]+(-[a-z]+)*)?(--[a-z]+(-[a-z]+)*)*$",
      {
        resolveNestedSelectors: true,
        message:
          "Classes must be in BEM form like `my-component__element--variant`",
      },
    ],
    "selector-max-compound-selectors": 2,
    "selector-max-id": 0,
    "selector-no-qualifying-type": true,
  },
};

What source code are you linting?

.scss files

What did you expect to happen?

I expected stylelint to run without errors.

What actually happened?

TypeError: Cannot read properties of null (reading 'plugins')
    at node_modules/stylelint-prettier/stylelint-prettier.js:59:29
    at async Promise.all (index 0)
    at async Promise.all (index 20)
    at async lintSource (node_modules/stylelint/lib/lintSource.js:110:2)
    at async node_modules/stylelint/lib/standalone.js:211:27
    at async Promise.all (index 0)
    at async standalone (node_modules/stylelint/lib/standalone.js:254:22)

Ignored vue file style block?

What version of stylelint, prettier and stylelint-prettier are you using?

  • stylelint: 15.10.2
  • prettier: 3.0.2
  • stylelint-prettier: 4.0.2
  • node: 18.16.0
  • npm: 9.5.1

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

No prettier config files.

.stylelintrc.json:

{
  "extends": [
    "stylelint-config-html",
    "stylelint-config-recommended",
    "stylelint-config-recommended-vue",
    "stylelint-prettier/recommended"
  ],
  "rules": {
    "at-rule-no-unknown": null
  }
}

What source code are you linting?

<style>
.insert {
  display: block
}

.alter:after {color: red; content: 'example'}

.delete {
  display: block;;
}
</style>

What did you expect to happen?

Output like README.

What actually happened?

Nothing happened.

Repo

https://github.com/ModyQyW/stylelint-prettier-322

npm install
npm run stylelint

If I run npm run prettier, I can see the output is correct. So I think it is caused by stylelint-prettier.

Double vs. Single Quotes

What version of stylelint, prettier and stylelint-prettier are you using?
"prettier": "1.17.0",
"stylelint": "10.0.1",
"stylelint-config-prettier": "^5.1.0",
"stylelint-config-standard": "18.3.0",
"stylelint-prettier": "1.0.6"

Please paste any applicable config files that you're using (e.g. .prettierrc or .stylelintrc files)

.stylelintrc:

{
  "extends": [
    "stylelint-prettier/recommended"
  ],
  "rules": {
    "prettier/prettier": [
      true,
      {
        "singleQuote": true,
        "tabWidth": 2
      }
    ]
  }
}

.prettierrc

{
  "printWidth": 120,
  "singleQuote": true,
  "useTabs": false,
  "tabWidth": 2,
  "semi": true,
  "bracketSpacing": true
 }

What source code are you linting?

@import "home";
@import "payments";
@import "registration";
@import "rewards";

What actually happened?

Saving the file in VSCode formats this with double-quotes. This is then flagged as a prettier warning. Even if I fix them to single quotes, they are returned to double on format.

The only way to suppress the warning is to set the config to

    "prettier/prettier": [
      true,
      {
        "singleQuote": false,
        "tabWidth": 2
      }
    ]

So, I can only use double-quotes for strings. Not the end of the world, but why?

I saw this issue which explains how to override prettier to allow fo double quotes — but that doesn't explain why the formatter keeps using double quotes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.