question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with running sass-lint

See original GitHub issue

Description

If I run sass-lint on my project with the following command directly it works: sass-lint -v -q '**/*.scss' passing a specific file also works: sass-lint -v -q src/app/_file.scss

However, the following lint staged config is not working.

{
  "linters": {
    "*.ts": "tslint",
    "*.scss": [
      "sass-lint -v -q",
      "git add"
    ]
  },
  "relative": true,
  "concurrent": false
}

I’ve tried variations of this config, removing the tslint, removing the extra options, changing *.scss to **/*.scss, etc. None of which is working.

Debug Logs

expand to view
> project-storybook@0.0.0 lint /Users/danwebb/Documents/projects/etch/project/project-storybook
> lint-staged --debug

  lint-staged:bin Running `lint-staged@8.1.5` +0ms
  lint-staged:find-bin Loaded package.json using `process.cwd()` +0ms
  lint-staged Loading config using `cosmiconfig` +0ms
  lint-staged Successfully loaded config from `/Users/danwebb/Documents/projects/etch/project/project-storybook/.lintstagedrc`:
  lint-staged { linters:
  lint-staged    { '*.ts': 'tslint', '*.scss': [ 'sass-lint -v -q', 'git add' ] },
  lint-staged   relative: true,
  lint-staged   concurrent: false } +23ms
  lint-staged:cfg Normalizing config +0ms
  lint-staged:cfg Validating config +3ms
Running lint-staged with the following config:
{
  linters: {
    '*.ts': 'tslint',
    '*.scss': [
      'sass-lint -v -q',
      'git add'
    ]
  },
  relative: true,
  concurrent: false,
  chunkSize: 9007199254740991,
  globOptions: {
    matchBase: true,
    dot: true
  },
  ignore: [],
  subTaskConcurrency: 1,
  renderer: 'verbose'
}
  lint-staged:run Running all linter scripts +0ms
  lint-staged:run Resolved git directory to be `/Users/danwebb/Documents/projects/etch/project/project-storybook` +1ms
  lint-staged:run Loaded list of staged files in git:
  lint-staged:run [ 'src/app/components/organisms/payment-breakdown/_payment-breakdown.scss',
  lint-staged:run   'package.json',
  lint-staged:run   '.lintstagedrc' ] +134ms
  lint-staged:gen-tasks Generating linter tasks +0ms
  lint-staged:cfg Normalizing config +153ms
  lint-staged:gen-tasks Generated task:
  lint-staged:gen-tasks { pattern: '*.ts', commands: 'tslint', fileList: [] } +29ms
  lint-staged:gen-tasks Generated task:
  lint-staged:gen-tasks { pattern: '*.scss',
  lint-staged:gen-tasks   commands: [ 'sass-lint -v -q', 'git add' ],
  lint-staged:gen-tasks   fileList:
  lint-staged:gen-tasks    [ 'src/app/components/organisms/payment-breakdown/_payment-breakdown.scss' ] } +4ms
Stashing changes... [started]
Stashing changes... [skipped]
→ No partially staged files found...
Running linters... [started]
Running tasks for *.ts [started]
Running tasks for *.ts [skipped]
→ No staged files match *.ts
Running tasks for *.scss [started]
  lint-staged:make-cmd-tasks Creating listr tasks for commands [ 'sass-lint -v -q', 'git add' ] +0ms
  lint-staged:find-bin Resolving binary for command `sass-lint -v -q` +701ms
  lint-staged:find-bin Binary for `sass-lint -v -q` resolved to `/Users/danwebb/Documents/projects/etch/project/project-storybook/node_modules/.bin/sass-lint` +9ms
  lint-staged:task ✔  OS: darwin; File path chunking unnecessary +0ms
  lint-staged:find-bin Resolving binary for command `git add` +1ms
  lint-staged:find-bin Binary for `git add` resolved to `/usr/local/bin/git` +2ms
  lint-staged:task ✔  OS: darwin; File path chunking unnecessary +3ms
sass-lint -v -q [started]
  lint-staged:task bin: /Users/danwebb/Documents/projects/etch/project/project-storybook/node_modules/.bin/sass-lint +1ms
  lint-staged:task args: [ '-v',
  lint-staged:task   '-q',
  lint-staged:task   'src/app/components/organisms/payment-breakdown/_payment-breakdown.scss' ] +0ms
  lint-staged:task opts: { reject: false } +0ms
sass-lint -v -q [completed]
git add [started]
  lint-staged:task bin: /usr/local/bin/git +2s
  lint-staged:task args: [ 'add',
  lint-staged:task   'src/app/components/organisms/payment-breakdown/_payment-breakdown.scss' ] +1ms
  lint-staged:task opts: { reject: false } +0ms
git add [completed]
Running tasks for *.scss [completed]
Running linters... [completed]
  lint-staged linters were executed successfully! +2s

These show the command running against the correct file but not reporting any errors.

Environment

  • OS: macOS 10.14.3
  • Node.js: 10.13.0
  • lint-staged: 8.1.5

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DanWebbcommented, Apr 2, 2019

For anyone else that comes across this…You’ve got to set sass-lint like sass-lint --max-warnings=0 -v to force lint-staged to stop when any warnings are found and provide output. Unless it exits lint-staged won’t provide any linter output.

0reactions
DanWebbcommented, Mar 27, 2019

Okay, if it’s not due to any known issues I’ll see if I can investigate a bit more when I get time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using sass-lint within npm script leads to error - Stack Overflow
I'm going to write my styles in SCSS and as such I want to have linting available for my SCSS files. Node-sass is...
Read more >
Sass Lint - Code Climate
Sass Lint is a Node-only Sass linter for both sass and scss syntax! Enable the Plugin. To enable Sass Lint for your hosted...
Read more >
sass-lint-auto-fix - npm Package Health Analysis - Snyk
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix advice.
Read more >
Add sass-lint to radix sub theme [#3161016] | Drupal.org
https://www.drupal.org/project/radix/issues/3021020 ... (2) Add laravel mix plugin to webpack.js to run the sass-lint.
Read more >
intellihr/sass-lint-auto-fix NPM
Issues are resolved by parsing the s(a|c)ss as an ast, traversing through it, and modifying certain branches to be in accordance to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found