-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scripts: Add lint-style script based on stylelint (#12722)
* Scripts: Add lint-css script based on stylelint * Update packages/scripts/README.md Co-Authored-By: gziolo <grzegorz@gziolo.pl> * Update default config for lint-style script * Scripts: Extend description for the package
- Loading branch information
1 parent
93974a3
commit aeeb433
Showing
7 changed files
with
80 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "stylelint-config-wordpress" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
const { sync: spawn } = require( 'cross-spawn' ); | ||
const { sync: resolveBin } = require( 'resolve-bin' ); | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
const { | ||
fromConfigRoot, | ||
getCliArgs, | ||
hasCliArg, | ||
hasProjectFile, | ||
hasPackageProp, | ||
} = require( '../utils' ); | ||
|
||
const args = getCliArgs(); | ||
|
||
const hasStylelintConfig = hasCliArg( '--config' ) || | ||
hasProjectFile( '.stylelintrc' ) || | ||
hasProjectFile( '.stylelintrc.js' ) || | ||
hasProjectFile( '.stylelintrc.json' ) || | ||
hasProjectFile( '.stylelintrc.yaml' ) || | ||
hasProjectFile( '.stylelintrc.yml' ) || | ||
hasProjectFile( '.stylelint.config.js' ) || | ||
hasPackageProp( 'stylelint' ); | ||
|
||
const config = ! hasStylelintConfig ? | ||
[ '--config', fromConfigRoot( '.stylelintrc.json' ) ] : | ||
[]; | ||
|
||
const result = spawn( | ||
resolveBin( 'stylelint' ), | ||
[ ...config, ...args ], | ||
{ stdio: 'inherit' } | ||
); | ||
|
||
process.exit( result.status ); |