All Projects → prettier → Stylelint Prettier

prettier / Stylelint Prettier

Licence: mit
Stylelint plugin for Prettier formatting

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Stylelint Prettier

Prettier Stylelint
code > prettier > stylelint > formatted code
Stars: ✭ 162 (-13.83%)
Mutual labels:  prettier, stylelint
ember-boilerplate
👓 The stable base upon which we build our Ember.js projects at Mirego.
Stars: ✭ 33 (-82.45%)
Mutual labels:  stylelint, prettier
vue3-vite-ts
Vue 3 Scaffolding (Vite + TS + Linters + Jest + TailwindCSS)
Stars: ✭ 27 (-85.64%)
Mutual labels:  stylelint, prettier
promotion-web
基于React: v18.x.x/Webpack: v5.x.x/React Router v6.x.x/ Antd: v5..x.x/Fetch Api/ Typescript: v4.x.x 等最新版本进行构建...
Stars: ✭ 374 (+98.94%)
Mutual labels:  stylelint, prettier
React 2048 Game
🎮 A fancy 2048 game build with react, redux best practices.
Stars: ✭ 401 (+113.3%)
Mutual labels:  prettier, stylelint
website-template
静的Webサイト制作を少しモダンにするためのテンプレート
Stars: ✭ 62 (-67.02%)
Mutual labels:  stylelint, prettier
figma-plugin-typescript-boilerplate
Figma plugin TypeScript boilerplate to start developing right away
Stars: ✭ 43 (-77.13%)
Mutual labels:  stylelint, prettier
linter-sniffer-pretty-printer
Collection of packages and configs to lint and format code in your WordPress project.
Stars: ✭ 35 (-81.38%)
Mutual labels:  stylelint, prettier
Web Configs
Common configurations for building web apps at Shopify
Stars: ✭ 302 (+60.64%)
Mutual labels:  prettier, stylelint
react-component-library-lerna
Build your own React component library managed with lerna, presented with storybook and published in private npm registry.
Stars: ✭ 55 (-70.74%)
Mutual labels:  stylelint, prettier
ultimate-hot-boilerplate
🚀 node-react universal app boilerplate with everything on hot reload, SSR, GraphQL, Flow included
Stars: ✭ 35 (-81.38%)
Mutual labels:  stylelint, prettier
React Ssr Starter
All have been introduced React environment
Stars: ✭ 20 (-89.36%)
Mutual labels:  prettier, stylelint
eslint-config-ns
ESLint config ready to be used in multiple projects. Based on Airbnb's code style with prettier, jest and react support.
Stars: ✭ 27 (-85.64%)
Mutual labels:  stylelint, prettier
fe-standard-config-seed
前端通用代码规范自动化接入
Stars: ✭ 18 (-90.43%)
Mutual labels:  stylelint, prettier
spec
🐣 easy to use eslint/stylelint/tslint/prettier/...
Stars: ✭ 60 (-68.09%)
Mutual labels:  stylelint, prettier
dva-typescript-antd-starter-kit
A admin dashboard application demo based on antd by typescript and dva
Stars: ✭ 61 (-67.55%)
Mutual labels:  stylelint, prettier
React Mobx React Router Boilerplate
A simple boilerplate based on create-react-app and add mobx, react-router, linter, prettier and so on. 一个简单的 react 脚手架依赖于 create-react-app 新增了 mobx react-router,linter,prettier 等。
Stars: ✭ 12 (-93.62%)
Mutual labels:  prettier, stylelint
Nextjs Ts
Opinionated Next JS project boilerplate with TypeScript and Redux
Stars: ✭ 134 (-28.72%)
Mutual labels:  prettier, stylelint
Workflow
一个工作流平台
Stars: ✭ 1,888 (+904.26%)
Mutual labels:  stylelint
Poetic
Automatically install and maintain ESLint, Prettier, EditorConfig and Airbnb rules for JavaScript, TypeScript and React.
Stars: ✭ 165 (-12.23%)
Mutual labels:  prettier

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
  }
}

Recommended Configuration

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

If your desired formatting does not match the prettier output, you should use a different tool such as prettier-stylelint instead.

To integrate this plugin with stylelint-config-prettier, you can use the "recommended" configuration:

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

    npm install --save-dev stylelint-config-prettier
    
  2. Then replace the plugins and rules declarations in your .stylelintrc that you added in the prior section with:

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

This does three things:

  1. Enables the stylelint-plugin-prettier plugin.
  2. Enables the prettier/prettier rule.
  3. Extends the stylelint-config-prettier configuration.

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].