Installations
npm install stylelint-prettier
Releases
Unable to fetch releases
Developer
prettier
Developer Guide
Module System
ESM
Min. Node Version
>=18.12.0
Typescript Support
No
Node Version
NPM Version
Statistics
357 Stars
148 Commits
20 Forks
5 Watching
21 Branches
37 Contributors
Updated on 27 Nov 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
114,816,974
Last day
-5.1%
141,105
Compared to previous day
Last week
-1.4%
686,345
Compared to previous week
Last month
7%
3,040,549
Compared to previous month
Last year
11.5%
33,851,592
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
stylelint-prettier
Runs Prettier as a Stylelint rule and reports differences as individual Stylelint issues.
Sample
Given the input file style.css
:
1.insert { 2 display: block 3} 4 5.alter:after {color: red; content: 'example'} 6 7.delete { 8 display: block;; 9} 10
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
1npm 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
:
1{ 2 "plugins": ["stylelint-prettier"], 3 "rules": { 4 "prettier/prettier": true 5 } 6}
Alternatively you can extend from the stylelint-prettier/recommended
config,
which does the same thing:
1{ 2 "extends": ["stylelint-prettier/recommended"] 3}
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
:
-
In addition to the above installation instructions, install
stylelint-config-prettier
:1npm install --save-dev stylelint-config-prettier
-
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{ 2 "extends": [ 3 "stylelint-prettier/recommended", 4 "stylelint-config-prettier" 5 ] 6}
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
andprettier-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:
1{ 2 "rules": { 3 "prettier/prettier": [true, {"singleQuote": true, "tabWidth": 4}] 4 } 5}
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
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
security policy file detected
Details
- Info: security policy file detected: github.com/prettier/.github/security.md:1
- Info: Found linked content: github.com/prettier/.github/security.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/prettier/.github/security.md:1
- Info: Found text in security policy: github.com/prettier/.github/security.md:1
Reason
0 existing vulnerabilities detected
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 3/19 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/ci.yml:1
- Info: no jobLevel write permissions found
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/prettier/stylelint-prettier/ci.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/prettier/stylelint-prettier/ci.yml/main?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 17 are checked with a SAST tool
Score
4.8
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to stylelint-prettier
@iceworks/spec
Easy to use eslint/stylelint/prettier/commitlint in rax, ice and react project.
stylelint-config-superology-scss
Shared Stylelint & Prettier config for SCSS based projects at Superology
@applint/spec
在 ICE、Rax、React 项目中更简单接入 ESLint(support TypeScript) / Stylelint / Prettier / Commitlint 规则。
@ubic/stylelint-config
Стандартная конфигурация StyleLint для проектов. Покрывает все [стандартные правила](https://stylelint.io/user-guide/rules) StyleLint. Правила относящиеся к форматированию кода форматируются с помощью [stylelint-prettier](https://github.com/prettier/style