{"id":20886067,"url":"https://github.com/srowhani/spruce","last_synced_at":"2026-06-03T19:31:48.719Z","repository":{"id":88227369,"uuid":"139768140","full_name":"srowhani/spruce","owner":"srowhani","description":"Abstract syntax tree traversal for s(a|c)ss","archived":false,"fork":false,"pushed_at":"2018-07-11T08:43:38.000Z","size":106,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-12T22:43:17.884Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srowhani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-07-04T21:42:21.000Z","updated_at":"2018-07-11T08:43:39.000Z","dependencies_parsed_at":"2023-03-13T18:28:42.743Z","dependency_job_id":null,"html_url":"https://github.com/srowhani/spruce","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/srowhani/spruce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fspruce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fspruce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fspruce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fspruce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srowhani","download_url":"https://codeload.github.com/srowhani/spruce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fspruce/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33876893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-03T02:00:06.370Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T08:15:40.283Z","updated_at":"2026-06-03T19:31:48.710Z","avatar_url":"https://github.com/srowhani.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sass Lint Auto Fix\n\n[![NPM Version](https://badge.fury.io/js/spruce.svg?style=flat)](https://npmjs.org/package/spruce)\n![npm](https://img.shields.io/npm/dm/spruce.svg)\n[![Build Status](https://travis-ci.org/srowhani/spruce.svg?branch=master)](https://travis-ci.org/srowhani/spruce/)\n[![dependencies Status](https://david-dm.org/srowhani/spruce/status.svg)](https://david-dm.org/srowhani/spruce) [![Coverage Status](https://coveralls.io/repos/github/srowhani/spruce/badge.svg?branch=master)](https://coveralls.io/github/srowhani/spruce?branch=master)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n\n![](https://i.imgur.com/mpxlhLX.png)\n\n## Description\nThis package serves as a compliment to [sass-lint](https://github.com/sasstools/sass-lint), giving you the ability to resolve\nsimple linting issues with an easy to use command line interface. Issues are resolved by parsing the `s(a|c)ss` as an [ast](https://github.com/tonyganch/gonzales-pe), traversing through it, and modifying certain branches to be in accordance to the `.sass-lint.yml` standards.\n\n## Getting Started\n\n### Usage\n\n```\n  Usage: spruce \"\u003cpattern\u003e\" [options]\n\n  Options:\n\n    -V, --version        output the version number\n    -c, --config \u003cpath\u003e  custom config path (e.g /path/to/spruce.yml)\n    -s, --silent         runs in silent mode\n    -h, --help           output usage information\n```    \n\n\n### Installing as a dependency\n\nTo begin install the package as a dev-dependency for your repository.\n\n```\nnpm install --save-dev spruce\n```\n\nModify `package.json` scripts to include `lint:fix`\n\n```\n{\n  ...,\n  \"scripts\": {\n    \"lint\": \"sass-lint -v\",\n    \"lint:fix\": \"spruce\"\n  }\n}\n```\n\n`lint:fix` works really well with [husky](https://github.com/typicode/husky), which allows you to run commands on hooks that fire when\nrunning git commands\n\nAdd the following to your `package.json`\n```\n{\n  \"husky\": {\n    \"hooks\": {\n      \"pre-commit\": \"npm run lint:fix \u0026\u0026 npm run lint\",\n      \"pre-push\": \"npm test\",\n      \"...\": \"...\"\n    }\n  }\n}\n```\n\n### Installing globally\n\n```\nnpm install -g spruce\n```\n\n## Configuration\n\nConfiguration can be provided through as either json, yml, or js.\n\nThe generic structure of the configuration file you would provide would look something like [this](https://github.com/srowhani/spruce/blob/master/src/config/default.yml):\n\n```yml\nfiles:\n  include: \"**/*.s+(a|c)ss\"\n  ignore: []\nsyntax:\n    include:\n      - scss\n      - sass\nresolvers:\n  property-sort-order: 1\n  attribute-quotes: 1\n  border-zero: 1\n  no-color-keywords: 1\n  no-css-comments: 1\n  no-important: 1\n  no-trailing-zero: 1\n  space-after-bang: 1\n  space-before-bang: 1\n  space-after-colon: 1\n  space-before-colon: 1\n  hex-length: 1\n```\n\n#### Disabling Rules\n\n```yml\nresolvers:\n  property-sort-order: 1\n  attribute-quotes: 0\n```\n\nBy default, all rule \"resolvers\" are enabled. If you wish to change that, specify a config file when running.\nConfiguration of resolvers only allows you to enable or disable rules.\n\n\n```\n  spruce -c path/to/config.file\n```\n\n#### Configuring which rules to run against\nBy default, sass-lint will look for a `.sass-lint.yml` or `.sasslintrc`, or an entry in your `package.json`.\nWhen applying the resolver to a given rule, **configuration is parsed from one of the above files.**.\n\nMore information is specified [here](https://github.com/srowhani/spruce/issues/10).\n\nIn this snippet example, the only rule enabled is `property-sort-order`. If you wish to manually enable certain resolvers, you would do so for each one you wish to include.\n\nFor more information about the rules themselves, you can read the [documentation from sass-lint](https://github.com/sasstools/sass-lint/tree/develop/docs/rules)\n\n#### Opt out of error reporting\n\nBy default, all errors captured while attempting to resolve issues are reported by sentry.\n\nYou can opt out by adding a `optOut` flag in your spruce config file (yml, json, js, ts)\n\nE.g\n```yml\nfiles:\n  include: \"**/*.s+(a|c)ss\"\n  ignore:\n    - node_modules/**\nsyntax:\n    include:\n      - scss\nresolvers:\n  property-sort-order: 1\n  attribute-quotes: 1\n  ...\noptOut: true\n```\n\n## Developing\n\n### Setup\n```\ngit clone https://github.com/srowhani/spruce.git;\nnpm install;\nnpm run build;\n```\n\n### Contributing\n\nThis project uses [semantic-release](https://github.com/semantic-release/commit-analyzer#rules-matching). Scope of the commit's included in a pull request will decide whether a new release is warranted.\n\nMore information can be found [here](https://github.com/semantic-release/commit-analyzer/blob/master/lib/default-release-rules.js).\n\n### Testing\n\n```\nnpm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrowhani%2Fspruce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrowhani%2Fspruce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrowhani%2Fspruce/lists"}