prettier-stylelint

WebJar for prettier-stylelint

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

prettier-stylelint
Last Version

Last Version

0.4.2
Release Date

Release Date

Type

Type

jar
Description

Description

prettier-stylelint
WebJar for prettier-stylelint
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/hugomrdias/prettier-stylelint

Download prettier-stylelint

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/prettier-stylelint/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>prettier-stylelint</artifactId>
    <version>0.4.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/prettier-stylelint/
implementation 'org.webjars.npm:prettier-stylelint:0.4.2'
// https://jarcasting.com/artifacts/org.webjars.npm/prettier-stylelint/
implementation ("org.webjars.npm:prettier-stylelint:0.4.2")
'org.webjars.npm:prettier-stylelint:jar:0.4.2'
<dependency org="org.webjars.npm" name="prettier-stylelint" rev="0.4.2">
  <artifact name="prettier-stylelint" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='prettier-stylelint', version='0.4.2')
)
libraryDependencies += "org.webjars.npm" % "prettier-stylelint" % "0.4.2"
[org.webjars.npm/prettier-stylelint "0.4.2"]

Dependencies

compile (14)

Group / Artifact Type Version
org.webjars.npm : debug jar [3.0.1,4)
org.webjars.npm : temp-write jar [3.3.0,4)
org.webjars.npm : get-stdin jar [5.0.1,6)
org.webjars.npm : meow jar [3.7.0,4)
org.webjars.npm : prettier jar [1.7.0,2)
org.webjars.npm : update-notifier jar [2.2.0,3)
org.webjars.npm : tempy jar [0.2.1,0.3)
org.webjars.npm : globby jar [6.1.0,7)
org.webjars.npm : resolve-from jar [4.0.0,5)
org.webjars.npm : cosmiconfig jar [3.0.1,4)
org.webjars.npm : ignore jar [3.3.5,4)
org.webjars.npm : import-local jar [0.1.1,0.2)
org.webjars.npm : pify jar [3.0.0,4)
org.webjars.npm : stylelint jar [8.1.1,9)

Project Modules

There are no modules declared in this project.

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

Versions

Version
0.4.2