Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
feat(stylelint-order): extend order rules
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-lit committed Jan 29, 2021
1 parent dd75fdf commit 23abac9
Show file tree
Hide file tree
Showing 4 changed files with 398 additions and 315 deletions.
34 changes: 18 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
"stylelint-use-nesting": "^3.0.0"
},
"devDependencies": {
"@alexlit/lint-kit": "0.14.12"
"@alexlit/lint-kit": "0.15.0"
}
}
273 changes: 253 additions & 20 deletions plugins/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,264 @@ module.exports = {

rules: {
'order/order': [
{
type: 'at-rule',
name: 'extend',
},
{
type: 'at-rule',
name: 'include',
},
/**
* SASS
*/
{ type: 'at-rule', name: 'extend' },
{ type: 'at-rule', name: 'include' },

'dollar-variables',

/**
* LESS
*/
'at-variables',

/**
* CSS
*/
'custom-properties',

'declarations',

/**
* Pseudo Elements
*/
{ type: 'rule', selector: '::first-line' },
{ type: 'rule', selector: '::first-letter' },
{ type: 'rule', selector: '::before' },
{ type: 'rule', selector: '::after' },
{ type: 'rule', selector: '::selection' },

/**
* Pseudo Classes
*/
{ type: 'rule', selector: ':active' },
{ type: 'rule', selector: ':checked' },
{ type: 'rule', selector: ':disabled' },
{ type: 'rule', selector: ':empty' },
{ type: 'rule', selector: ':enabled' },
{ type: 'rule', selector: ':first-child' },
{ type: 'rule', selector: ':first-of-type' },
{ type: 'rule', selector: ':focus' },
{ type: 'rule', selector: ':has' },
{ type: 'rule', selector: ':hover' },
{ type: 'rule', selector: ':in-range' },
{ type: 'rule', selector: ':invalid' },
{ type: 'rule', selector: ':lang' },
{ type: 'rule', selector: ':last-child' },
{ type: 'rule', selector: ':last-of-type' },
{ type: 'rule', selector: ':link' },
{ type: 'rule', selector: ':not' },
{ type: 'rule', selector: ':nth-child' },
{ type: 'rule', selector: ':nth-last-child' },
{ type: 'rule', selector: ':nth-last-of-type' },
{ type: 'rule', selector: ':nth-of-type' },
{ type: 'rule', selector: ':only-of-type' },
{ type: 'rule', selector: ':only-child' },
{ type: 'rule', selector: ':optional' },
{ type: 'rule', selector: ':out-of-range' },
{ type: 'rule', selector: ':read-only' },
{ type: 'rule', selector: ':read-write' },
{ type: 'rule', selector: ':required' },
{ type: 'rule', selector: ':target' },
{ type: 'rule', selector: ':valid' },
{ type: 'rule', selector: ':visited' },

/**
* CSS [attribute*=value] Selector
*/
{ type: 'rule', selector: /\[accept/ },
{ type: 'rule', selector: /\[accept-charset/ },
{ type: 'rule', selector: /\[accesskey/ },
{ type: 'rule', selector: /\[action/ },
{ type: 'rule', selector: /\[align/ },
{ type: 'rule', selector: /\[alt/ },
{ type: 'rule', selector: /\[async/ },
{ type: 'rule', selector: /\[autocomplete/ },
{ type: 'rule', selector: /\[autofocus/ },
{ type: 'rule', selector: /\[autoplay/ },
{ type: 'rule', selector: /\[bgcolor/ },
{ type: 'rule', selector: /\[border/ },
{ type: 'rule', selector: /\[charset/ },
{ type: 'rule', selector: /\[checked/ },
{ type: 'rule', selector: /\[cite/ },
{ type: 'rule', selector: /\[class/ },
{ type: 'rule', selector: /\[color/ },
{ type: 'rule', selector: /\[cols/ },
{ type: 'rule', selector: /\[colspan/ },
{ type: 'rule', selector: /\[content/ },
{ type: 'rule', selector: /\[contenteditable/ },
{ type: 'rule', selector: /\[controls/ },
{ type: 'rule', selector: /\[coords/ },
{ type: 'rule', selector: /\[data/ },
{ type: 'rule', selector: /\[data-/ },
{ type: 'rule', selector: /\[datetime/ },
{ type: 'rule', selector: /\[default/ },
{ type: 'rule', selector: /\[defer/ },
{ type: 'rule', selector: /\[dir/ },
{ type: 'rule', selector: /\[dirname/ },
{ type: 'rule', selector: /\[disabled/ },
{ type: 'rule', selector: /\[download/ },
{ type: 'rule', selector: /\[draggable/ },
{ type: 'rule', selector: /\[enctype/ },
{ type: 'rule', selector: /\[for/ },
{ type: 'rule', selector: /\[form/ },
{ type: 'rule', selector: /\[formaction/ },
{ type: 'rule', selector: /\[headers/ },
{ type: 'rule', selector: /\[height/ },
{ type: 'rule', selector: /\[hidden/ },
{ type: 'rule', selector: /\[high/ },
{ type: 'rule', selector: /\[href/ },
{ type: 'rule', selector: /\[hreflang/ },
{ type: 'rule', selector: /\[http-equiv/ },
{ type: 'rule', selector: /\[id/ },
{ type: 'rule', selector: /\[ismap/ },
{ type: 'rule', selector: /\[kind/ },
{ type: 'rule', selector: /\[label/ },
{ type: 'rule', selector: /\[lang/ },
{ type: 'rule', selector: /\[list/ },
{ type: 'rule', selector: /\[loop/ },
{ type: 'rule', selector: /\[low/ },
{ type: 'rule', selector: /\[max/ },
{ type: 'rule', selector: /\[maxlength/ },
{ type: 'rule', selector: /\[media/ },
{ type: 'rule', selector: /\[method/ },
{ type: 'rule', selector: /\[min/ },
{ type: 'rule', selector: /\[multiple/ },
{ type: 'rule', selector: /\[muted/ },
{ type: 'rule', selector: /\[name/ },
{ type: 'rule', selector: /\[novalidate/ },
{ type: 'rule', selector: /\[onabort/ },
{ type: 'rule', selector: /\[onafterprint/ },
{ type: 'rule', selector: /\[onbeforeprint/ },
{ type: 'rule', selector: /\[onbeforeunload/ },
{ type: 'rule', selector: /\[onblur/ },
{ type: 'rule', selector: /\[oncanplay/ },
{ type: 'rule', selector: /\[oncanplaythrough/ },
{ type: 'rule', selector: /\[onchange/ },
{ type: 'rule', selector: /\[onclick/ },
{ type: 'rule', selector: /\[oncontextmenu/ },
{ type: 'rule', selector: /\[oncopy/ },
{ type: 'rule', selector: /\[oncuechange/ },
{ type: 'rule', selector: /\[oncut/ },
{ type: 'rule', selector: /\[ondblclick/ },
{ type: 'rule', selector: /\[ondrag/ },
{ type: 'rule', selector: /\[ondragend/ },
{ type: 'rule', selector: /\[ondragenter/ },
{ type: 'rule', selector: /\[ondragleave/ },
{ type: 'rule', selector: /\[ondragover/ },
{ type: 'rule', selector: /\[ondragstart/ },
{ type: 'rule', selector: /\[ondrop/ },
{ type: 'rule', selector: /\[ondurationchange/ },
{ type: 'rule', selector: /\[onemptied/ },
{ type: 'rule', selector: /\[onended/ },
{ type: 'rule', selector: /\[onerror/ },
{ type: 'rule', selector: /\[onfocus/ },
{ type: 'rule', selector: /\[onhashchange/ },
{ type: 'rule', selector: /\[oninput/ },
{ type: 'rule', selector: /\[oninvalid/ },
{ type: 'rule', selector: /\[onkeydown/ },
{ type: 'rule', selector: /\[onkeypress/ },
{ type: 'rule', selector: /\[onkeyup/ },
{ type: 'rule', selector: /\[onload/ },
{ type: 'rule', selector: /\[onloadeddata/ },
{ type: 'rule', selector: /\[onloadedmetadata/ },
{ type: 'rule', selector: /\[onloadstart/ },
{ type: 'rule', selector: /\[onmousedown/ },
{ type: 'rule', selector: /\[onmousemove/ },
{ type: 'rule', selector: /\[onmouseout/ },
{ type: 'rule', selector: /\[onmouseover/ },
{ type: 'rule', selector: /\[onmouseup/ },
{ type: 'rule', selector: /\[onmousewheel/ },
{ type: 'rule', selector: /\[onoffline/ },
{ type: 'rule', selector: /\[ononline/ },
{ type: 'rule', selector: /\[onpagehide/ },
{ type: 'rule', selector: /\[onpageshow/ },
{ type: 'rule', selector: /\[onpaste/ },
{ type: 'rule', selector: /\[onpause/ },
{ type: 'rule', selector: /\[onplay/ },
{ type: 'rule', selector: /\[onplaying/ },
{ type: 'rule', selector: /\[onpopstate/ },
{ type: 'rule', selector: /\[onprogress/ },
{ type: 'rule', selector: /\[onratechange/ },
{ type: 'rule', selector: /\[onreset/ },
{ type: 'rule', selector: /\[onresize/ },
{ type: 'rule', selector: /\[onscroll/ },
{ type: 'rule', selector: /\[onsearch/ },
{ type: 'rule', selector: /\[onseeked/ },
{ type: 'rule', selector: /\[onseeking/ },
{ type: 'rule', selector: /\[onselect/ },
{ type: 'rule', selector: /\[onstalled/ },
{ type: 'rule', selector: /\[onstorage/ },
{ type: 'rule', selector: /\[onsubmit/ },
{ type: 'rule', selector: /\[onsuspend/ },
{ type: 'rule', selector: /\[ontimeupdate/ },
{ type: 'rule', selector: /\[ontoggle/ },
{ type: 'rule', selector: /\[onunload/ },
{ type: 'rule', selector: /\[onvolumechange/ },
{ type: 'rule', selector: /\[onwaiting/ },
{ type: 'rule', selector: /\[onwheel/ },
{ type: 'rule', selector: /\[open/ },
{ type: 'rule', selector: /\[optimum/ },
{ type: 'rule', selector: /\[pattern/ },
{ type: 'rule', selector: /\[placeholder/ },
{ type: 'rule', selector: /\[poster/ },
{ type: 'rule', selector: /\[preload/ },
{ type: 'rule', selector: /\[readonly/ },
{ type: 'rule', selector: /\[rel/ },
{ type: 'rule', selector: /\[required/ },
{ type: 'rule', selector: /\[reversed/ },
{ type: 'rule', selector: /\[rows/ },
{ type: 'rule', selector: /\[rowspan/ },
{ type: 'rule', selector: /\[sandbox/ },
{ type: 'rule', selector: /\[scope/ },
{ type: 'rule', selector: /\[selected/ },
{ type: 'rule', selector: /\[shape/ },
{ type: 'rule', selector: /\[size/ },
{ type: 'rule', selector: /\[sizes/ },
{ type: 'rule', selector: /\[span/ },
{ type: 'rule', selector: /\[spellcheck/ },
{ type: 'rule', selector: /\[src/ },
{ type: 'rule', selector: /\[srcdoc/ },
{ type: 'rule', selector: /\[srclang/ },
{ type: 'rule', selector: /\[srcset/ },
{ type: 'rule', selector: /\[start/ },
{ type: 'rule', selector: /\[step/ },
{ type: 'rule', selector: /\[style/ },
{ type: 'rule', selector: /\[tabindex/ },
{ type: 'rule', selector: /\[target/ },
{ type: 'rule', selector: /\[title/ },
{ type: 'rule', selector: /\[translate/ },
{ type: 'rule', selector: /\[type/ },
{ type: 'rule', selector: /\[usemap/ },
{ type: 'rule', selector: /\[value/ },
{ type: 'rule', selector: /\[width/ },
{ type: 'rule', selector: /\[/ },

/**
* BEM modifiers
*/
{ type: 'rule', selector: /--/ },

/**
* Rules
*/
'rules',
{
type: 'at-rule',
name: 'at-root',
},

/**
* At Rules
*/
{ type: 'at-rule', name: 'at-root' },
'at-rules',
{
type: 'at-rule',
name: 'media',
},
{
type: 'at-rule',
name: 'keyframes',
},
{ type: 'at-rule', name: 'media' },
{ type: 'at-rule', name: 'keyframes' },

/**
* ::v-deep
*/
{ type: 'rule', selector: /::v-deep/ },
],
},
'order/properties-alphabetical-order': true,
};
Loading

0 comments on commit 23abac9

Please sign in to comment.