{"id":15513657,"url":"https://github.com/srowhani/sass-lint-auto-fix","last_synced_at":"2025-07-07T17:34:45.077Z","repository":{"id":45876957,"uuid":"126087721","full_name":"srowhani/sass-lint-auto-fix","owner":"srowhani","description":"Automatically resolve s(a|c)ss linting issues","archived":false,"fork":false,"pushed_at":"2021-11-30T13:44:42.000Z","size":3012,"stargazers_count":96,"open_issues_count":42,"forks_count":17,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T12:08:16.980Z","etag":null,"topics":["ast","fix","gonzales-pe","sass-lint"],"latest_commit_sha":null,"homepage":"https://srowhani.github.io/sass-lint-auto-fix","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}},"created_at":"2018-03-20T21:57:40.000Z","updated_at":"2023-08-22T23:10:03.000Z","dependencies_parsed_at":"2022-07-22T18:32:43.846Z","dependency_job_id":null,"html_url":"https://github.com/srowhani/sass-lint-auto-fix","commit_stats":null,"previous_names":[],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fsass-lint-auto-fix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fsass-lint-auto-fix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fsass-lint-auto-fix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srowhani%2Fsass-lint-auto-fix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srowhani","download_url":"https://codeload.github.com/srowhani/sass-lint-auto-fix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675597,"owners_count":20977376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["ast","fix","gonzales-pe","sass-lint"],"created_at":"2024-10-02T09:54:30.815Z","updated_at":"2025-04-07T15:09:20.277Z","avatar_url":"https://github.com/srowhani.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Sass Lint Auto Fix\n\n[![NPM Version](https://badge.fury.io/js/sass-lint-auto-fix.svg?style=flat)](https://npmjs.org/package/sass-lint-auto-fix)\n![npm](https://img.shields.io/npm/dm/sass-lint-auto-fix.svg)\n[![Build Status](https://travis-ci.org/srowhani/sass-lint-auto-fix.svg?branch=master)](https://travis-ci.org/srowhani/sass-lint-auto-fix/)\n[![dependencies Status](https://david-dm.org/srowhani/sass-lint-auto-fix/status.svg)](https://david-dm.org/srowhani/sass-lint-auto-fix) [![Coverage Status](https://coveralls.io/repos/github/srowhani/sass-lint-auto-fix/badge.svg?branch=master)](https://coveralls.io/github/srowhani/sass-lint-auto-fix?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 complement 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: sass-lint-auto-fix \"\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/.sass-lint-auto-fix.yml)\n    --config-sass-lint \u003cpath\u003e        custom sass lint config path (e.g /path/to/.sass-lint.yml\n    -s, --silent                     runs in silent mode\n    -d, --debug                      runs in debug 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 sass-lint-auto-fix\n```\n\nModify `package.json` scripts to include `lint:fix`\n\n```\n{\n  ...,\n  \"scripts\": {\n    \"lint\": \"sass-lint -v\",\n    \"lint:fix\": \"sass-lint-auto-fix\"\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\": \"yarn lint:fix \u0026\u0026 yarn lint\",\n      \"pre-push\": \"yarn test\",\n      \"...\": \"...\"\n    }\n  }\n}\n```\n\n### Installing globally\n\n```\nnpm install -g sass-lint-auto-fix\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/sass-lint-auto-fix/blob/master/src/config/default.yml):\n\n```ts\ninterface Ruleset {\n  [ruleName: string]: number | { [ruleOption: string]: any };\n}\n\ninterface ConfigOpts {\n  logger: Logger;\n  slRules?: any;\n  slConfig?: any;\n  files: {\n    include: string;\n    ignore?: string;\n  };\n  syntax: {\n    include: (keyof typeof ValidFileType)[];\n  };\n  resolvers: Ruleset;\n  options: {\n    optOut: boolean;\n  };\n}\n```\n\nAn example of this in yaml.\n\n```yml\nfiles:\n  include: \"**/*.s+(a|c)ss\"\n  ignore:\n    - node_modules/**\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: 0\n  no-important: 0\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  empty-line-between-blocks: 1\n  url-quotes: 1\n  zero-unit: 1\n  hex-notation: 1\n  indentation: 0\n  final-newline: 1\noptions:\n  optOut: false\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  sass-lint-auto-fix -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/sass-lint-auto-fix/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 sass-lint-auto-fix 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  ...\noptions:\n  optOut: true\n```\n\n## Developing\n\n### Setup\n```\ngit clone https://github.com/srowhani/sass-lint-auto-fix.git;\nyarn install;\nyarn 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```\nyarn test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrowhani%2Fsass-lint-auto-fix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrowhani%2Fsass-lint-auto-fix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrowhani%2Fsass-lint-auto-fix/lists"}