• This repository has been archived on 21/Dec/2022
  • Stars
    star
    175
  • Rank 218,059 (Top 5 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

code > prettier > stylelint > formatted code

prettier-stylelint NPM Version NPM Downloads NPM License Build Status codecov

Format your styles with ease!

code > prettier > stylelint > formatted code

prettier-stylelint attempts to create a prettier config based on the stylelint config, then format with prettier followed by stylelint --fix. So after that you should end up with formatted code with no linting errors.

Install

yarn add prettier-stylelint -D
npm install prettier-stylelint --save-dev

Usage

This package has a stylelint config to disable some rules that conflict with prettier.

"stylelint": {
    "extends": [
        "stylelint-config-idiomatic-order",
        "./node_modules/prettier-stylelint/config.js"
    ],
    "rules": {
        "indentation": 4,
        "string-quotes": "single"
    }
}

After adding the disabling config you can just prettier-stylelint --write and its done. Check the CLI options below for more information.
Also in a near future we should have support for prettier-stylelint in prettier-vscode follow this PR.

API

const format = require('prettier-eslint')
const sourceCode = 'a[id="foo"] { content: "x"; }'
const options = {
  text: sourceCode
}
const formatted = format(options)


// formatted 
a[id='foo'] {
    content: 'x';
}

CLI Options

The cli automatically ignores .gitignore and .prettierignore.

NOTE: It is recommended that you keep your files under source control and committed before running prettier-stylelint --write as it will overwrite your files!

Usage
  $ prettier-stylelint [<file|glob> ...]

Options
  --ignore          Additional paths to ignore  [Can be set multiple times]
  --extension       Additional extension to lint [Can be set multiple times]
  --cwd=<dir>       Working directory for files
  --stdin           Validate/fix code from stdin ('prettier-stylelint -' also works)
  --write           Edit files in place (DRAGONS AHEAD !!)
  --quiet -q        Only log stderr

Examples
  $ prettier-stylelint
  $ prettier-stylelint index.js
  $ prettier-stylelint *.js !foo.js
  $ echo 'a[id="foo"] { content: "x"; }' | prettier-stylelint --stdin

Default pattern when no arguments:
  **/*.{css,scss,less,sss}

Related

License

MIT © Hugo Dias

More Repositories

1

playwright-test

Run unit tests with several test runners or benchmark inside real browsers with playwright and other Javascript runtimes.
JavaScript
100
star
2

postgrest-url

Build urls for PostgREST
JavaScript
41
star
3

rabin-wasm

Rabin fingerprinting implemented in WASM
WebAssembly
28
star
4

connect-deps

This is a CLI tool that intends to be a better yarn link
JavaScript
22
star
5

iso-url

Isomorphic/Universal WHATWG URL API with some support legacy node URL API
JavaScript
7
star
6

iso-repo

Set of tools for passkeys, filecoin, dids, signatures, base encoding
JavaScript
4
star
7

component

JavaScript
3
star
8

halo

JavaScript
3
star
9

view

JavaScript
2
star
10

w3up-delegation-api

JavaScript
2
star
11

ipns-ns

IPNS Nameserver
JavaScript
1
star
12

stylelint-config-hd

Shareable stylelint config for me
JavaScript
1
star
13

nft-storage

JavaScript
1
star
14

dgsi-search

JavaScript
1
star
15

metamask

Metasmask Tools
JavaScript
1
star
16

iso-stream-http

Isomorphic/Universal implementation of the node http module
JavaScript
1
star
17

generator-hd

yo generator for my oss projects
JavaScript
1
star
18

mono-release

testing mono repo and release-please
JavaScript
1
star
19

docker-ansible

This repo is mirrored every hour from gitlab
1
star
20

iso-constants

Isomorphic node constants to be used in browsers or node.
JavaScript
1
star
21

crud

A CRUD model for laravel with built in valdiation
PHP
1
star
22

ansible-role-nginx

Ansible role to install nginx
1
star
23

iso-random-stream

Random bytes stream for node and browser
JavaScript
1
star
24

eslint-config-halo

ESLint shareable config for Halo
JavaScript
1
star
25

hd-scripts

JS Configs for my repos
JavaScript
1
star
26

halo-autocomplete

Autocomplete component for Halo
JavaScript
1
star
27

ansible-role-basic

Ansible Role to do basic setup in Debian systems
1
star
28

halo-range

Range component for Halo
JavaScript
1
star
29

pull-to-stream

pull-stream to stream module
JavaScript
1
star
30

halo-selection

Selections controls for Halo based on Material design
CSS
1
star
31

filecoin

Packages to interact with the Filecoin blockchain.
JavaScript
1
star
32

material-hd

JavaScript
1
star