├── .gitignore ├── .npmignore ├── .pre-commit-hooks.yaml ├── .version ├── LICENSE ├── README.md ├── hooks.yaml └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/visualstudiocode,macos,windows,linux,node,python,sublimetext,emacs,vim 3 | 4 | ### Emacs ### 5 | # -*- mode: gitignore; -*- 6 | *~ 7 | \#*\# 8 | /.emacs.desktop 9 | /.emacs.desktop.lock 10 | *.elc 11 | auto-save-list 12 | tramp 13 | .\#* 14 | 15 | # Org-mode 16 | .org-id-locations 17 | *_archive 18 | 19 | # flymake-mode 20 | *_flymake.* 21 | 22 | # eshell files 23 | /eshell/history 24 | /eshell/lastdir 25 | 26 | # elpa packages 27 | /elpa/ 28 | 29 | # reftex files 30 | *.rel 31 | 32 | # AUCTeX auto folder 33 | /auto/ 34 | 35 | # cask packages 36 | .cask/ 37 | dist/ 38 | 39 | # Flycheck 40 | flycheck_*.el 41 | 42 | # server auth directory 43 | /server/ 44 | 45 | # projectiles files 46 | .projectile 47 | 48 | # directory configuration 49 | .dir-locals.el 50 | 51 | ### Linux ### 52 | 53 | # temporary files which can be created if a process still has a handle open of a deleted file 54 | .fuse_hidden* 55 | 56 | # KDE directory preferences 57 | .directory 58 | 59 | # Linux trash folder which might appear on any partition or disk 60 | .Trash-* 61 | 62 | # .nfs files are created when an open file is removed but is still being accessed 63 | .nfs* 64 | 65 | ### macOS ### 66 | *.DS_Store 67 | .AppleDouble 68 | .LSOverride 69 | 70 | # Icon must end with two \r 71 | Icon 72 | 73 | 74 | # Thumbnails 75 | ._* 76 | 77 | # Files that might appear in the root of a volume 78 | .DocumentRevisions-V100 79 | .fseventsd 80 | .Spotlight-V100 81 | .TemporaryItems 82 | .Trashes 83 | .VolumeIcon.icns 84 | .com.apple.timemachine.donotpresent 85 | 86 | # Directories potentially created on remote AFP share 87 | .AppleDB 88 | .AppleDesktop 89 | Network Trash Folder 90 | Temporary Items 91 | .apdisk 92 | 93 | ### Node ### 94 | # Logs 95 | logs 96 | *.log 97 | npm-debug.log* 98 | yarn-debug.log* 99 | yarn-error.log* 100 | 101 | # Runtime data 102 | pids 103 | *.pid 104 | *.seed 105 | *.pid.lock 106 | 107 | # Directory for instrumented libs generated by jscoverage/JSCover 108 | lib-cov 109 | 110 | # Coverage directory used by tools like istanbul 111 | coverage 112 | 113 | # nyc test coverage 114 | .nyc_output 115 | 116 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 117 | .grunt 118 | 119 | # Bower dependency directory (https://bower.io/) 120 | bower_components 121 | 122 | # node-waf configuration 123 | .lock-wscript 124 | 125 | # Compiled binary addons (http://nodejs.org/api/addons.html) 126 | build/Release 127 | 128 | # Dependency directories 129 | node_modules/ 130 | jspm_packages/ 131 | 132 | # Typescript v1 declaration files 133 | typings/ 134 | 135 | # Optional npm cache directory 136 | .npm 137 | 138 | # Optional eslint cache 139 | .eslintcache 140 | 141 | # Optional REPL history 142 | .node_repl_history 143 | 144 | # Output of 'npm pack' 145 | *.tgz 146 | 147 | # Yarn Integrity file 148 | .yarn-integrity 149 | 150 | # dotenv environment variables file 151 | .env 152 | 153 | 154 | ### Python ### 155 | # Byte-compiled / optimized / DLL files 156 | __pycache__/ 157 | *.py[cod] 158 | *$py.class 159 | 160 | # C extensions 161 | *.so 162 | 163 | # Distribution / packaging 164 | .Python 165 | env/ 166 | build/ 167 | develop-eggs/ 168 | downloads/ 169 | eggs/ 170 | .eggs/ 171 | lib/ 172 | lib64/ 173 | parts/ 174 | sdist/ 175 | var/ 176 | wheels/ 177 | *.egg-info/ 178 | .installed.cfg 179 | *.egg 180 | 181 | # PyInstaller 182 | # Usually these files are written by a python script from a template 183 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 184 | *.manifest 185 | *.spec 186 | 187 | # Installer logs 188 | pip-log.txt 189 | pip-delete-this-directory.txt 190 | 191 | # Unit test / coverage reports 192 | htmlcov/ 193 | .tox/ 194 | .coverage 195 | .coverage.* 196 | .cache 197 | nosetests.xml 198 | coverage.xml 199 | *,cover 200 | .hypothesis/ 201 | 202 | # Translations 203 | *.mo 204 | *.pot 205 | 206 | # Django stuff: 207 | local_settings.py 208 | 209 | # Flask stuff: 210 | instance/ 211 | .webassets-cache 212 | 213 | # Scrapy stuff: 214 | .scrapy 215 | 216 | # Sphinx documentation 217 | docs/_build/ 218 | 219 | # PyBuilder 220 | target/ 221 | 222 | # Jupyter Notebook 223 | .ipynb_checkpoints 224 | 225 | # pyenv 226 | .python-version 227 | 228 | # celery beat schedule file 229 | celerybeat-schedule 230 | 231 | # SageMath parsed files 232 | *.sage.py 233 | 234 | # dotenv 235 | 236 | # virtualenv 237 | .venv 238 | venv/ 239 | ENV/ 240 | 241 | # Spyder project settings 242 | .spyderproject 243 | 244 | # Rope project settings 245 | .ropeproject 246 | 247 | ### SublimeText ### 248 | # cache files for sublime text 249 | *.tmlanguage.cache 250 | *.tmPreferences.cache 251 | *.stTheme.cache 252 | 253 | # workspace files are user-specific 254 | *.sublime-workspace 255 | 256 | # project files should be checked into the repository, unless a significant 257 | # proportion of contributors will probably not be using SublimeText 258 | # *.sublime-project 259 | 260 | # sftp configuration file 261 | sftp-config.json 262 | 263 | # Package control specific files 264 | Package Control.last-run 265 | Package Control.ca-list 266 | Package Control.ca-bundle 267 | Package Control.system-ca-bundle 268 | Package Control.cache/ 269 | Package Control.ca-certs/ 270 | Package Control.merged-ca-bundle 271 | Package Control.user-ca-bundle 272 | oscrypto-ca-bundle.crt 273 | bh_unicode_properties.cache 274 | 275 | # Sublime-github package stores a github token in this file 276 | # https://packagecontrol.io/packages/sublime-github 277 | GitHub.sublime-settings 278 | 279 | ### Vim ### 280 | # swap 281 | [._]*.s[a-v][a-z] 282 | [._]*.sw[a-p] 283 | [._]s[a-v][a-z] 284 | [._]sw[a-p] 285 | # session 286 | Session.vim 287 | # temporary 288 | .netrwhist 289 | # auto-generated tag files 290 | tags 291 | 292 | ### VisualStudioCode ### 293 | .vscode/* 294 | !.vscode/settings.json 295 | !.vscode/tasks.json 296 | !.vscode/launch.json 297 | !.vscode/extensions.json 298 | 299 | ### Windows ### 300 | # Windows thumbnail cache files 301 | Thumbs.db 302 | ehthumbs.db 303 | ehthumbs_vista.db 304 | 305 | # Folder config file 306 | Desktop.ini 307 | 308 | # Recycle Bin used on file shares 309 | $RECYCLE.BIN/ 310 | 311 | # Windows Installer files 312 | *.cab 313 | *.msi 314 | *.msm 315 | *.msp 316 | 317 | # Windows shortcuts 318 | *.lnk 319 | 320 | # End of https://www.gitignore.io/api/visualstudiocode,macos,windows,linux,node,python,sublimetext,emacs,vim -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /.pre-commit-hooks.yaml: -------------------------------------------------------------------------------- 1 | - id: stylelint 2 | name: stylelint 3 | entry: stylelint 4 | language: node 5 | files: \.(css|scss|sass)$ 6 | args: [] 7 | 8 | 9 | # Use additional_dependencies to install the actual node package 10 | minimum_pre_commit_version: 0.7.0 11 | -------------------------------------------------------------------------------- /.version: -------------------------------------------------------------------------------- 1 | 7.9.0 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Prathik Shetty 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Pre-commit hook for Styleint 2 | ============================= 3 | 4 | This is the Stylelint hook for [pre-commit](https://github.com/pre-commit/pre-commit). This prevents git commits unless the checks pass. 5 | 6 | 7 | ### Using styleint with pre-commit 8 | 9 | - To use this you first need to install pre-commit(see links below). 10 | - Then create a pre-commit config file and also a stylelint config file in the root of your project. 11 | - Run `pre-commit install` from the root of your project 12 | 13 | Finally add this to your `.pre-commit-config.yaml`: 14 | 15 | ```yaml 16 | - repo: https://github.com/awebdeveloper/pre-commit-stylelint 17 | rev: '' # Use the sha or tag you want to point at like 0.0.1 18 | hooks: 19 | - id: stylelint 20 | additional_dependencies: ['stylelint@13.2.1', 'stylelint-config-standard@20.0.0'] //specify the latest version 21 | ``` 22 | PS: These are for version 2.3.0 visit https://pre-commit.com/#2-add-a-pre-commit-configuration for latest config syntax or for config syntax specific to your version 23 | 24 | Now everytime you commit a scss/css file. It will run stylelint on this and prevent commit if the checks fail. 25 | 26 | ### Links 27 | - For pre-commit: see https://github.com/pre-commit/pre-commit 28 | 29 | - For stylelint: see http://stylelint.io/ 30 | 31 | 32 | -------------------------------------------------------------------------------- /hooks.yaml: -------------------------------------------------------------------------------- 1 | - id: stylelint 2 | name: stylelint 3 | entry: stylelint 4 | language: node 5 | files: \.(css|scss|sass)$ 6 | args: [] 7 | 8 | minimum_pre_commit_version: 0.7.0 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pre-commit-stylelint", 3 | "description": "Note: double curly-braces because python .format", 4 | "version": "0.0.0" 5 | } 6 | --------------------------------------------------------------------------------