Skip to content

Commit

Permalink
🎨 Add support for .sasslintrc
Browse files Browse the repository at this point in the history
  • Loading branch information
ngryman authored and DanPurdy committed Sep 3, 2017
1 parent ca0690b commit ebd8511
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ module.exports = function (options, configPath) {
}
else {
configPath = confHelpers.findFile(false, '.sass-lint.yml');

if (!configPath) {
configPath = confHelpers.findFile(false, '.sasslintrc');
}
}
}
else if (!pathIsAbsolute(configPath)) {
Expand Down
42 changes: 42 additions & 0 deletions tests/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,48 @@ describe('cli', function () {
});
});

// Test default config files

it('should return JSON from .sass-lint.yml', function (done) {
var command = 'sass-lint ../../sass/cli.scss --verbose';

childProcess.exec(command, { cwd: path.join(__dirname, 'yml', '.sass-lint.yml') }, function (err, stdout) {

if (err) {
return done(err);
}
else {
try {
JSON.parse(stdout);
return done();
}
catch (e) {
return done(new Error('Not JSON'));
}
}
});
});

it('should return JSON from .sasslintrc', function (done) {
var command = 'sass-lint ../../sass/cli.scss --verbose';

childProcess.exec(command, { cwd: path.join(__dirname, 'yml', '.sasslintrc') }, function (err, stdout) {

if (err) {
return done(err);
}
else {
try {
JSON.parse(stdout);
return done();
}
catch (e) {
return done(new Error('Not JSON'));
}
}
});
});

// Test custom config path

it('should return JSON from a custom config', function (done) {
Expand Down
1 change: 1 addition & 0 deletions tests/yml/.sass-lint.yml/.sass-lint.yml
1 change: 1 addition & 0 deletions tests/yml/.sasslintrc/.sasslintrc

0 comments on commit ebd8511

Please sign in to comment.