From 1363c17545214bcef41ec1c8d12ae50ed87c5cf2 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 18 Oct 2015 20:17:41 +0100 Subject: [PATCH 1/8] :bug: Fix ignored files not being ignored --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index bc4c6a6b..39b82a74 100644 --- a/index.js +++ b/index.js @@ -67,10 +67,12 @@ sassLint.lintText = function (file, options, configPath) { sassLint.lintFiles = function (files, options, configPath) { var that = this, - results = []; + results = [], + ignores = ''; if (files) { - files = glob.sync(files); + ignores = this.getConfig(options, configPath).files.ignore || ''; + files = glob.sync(files, {'ignore': ignores}); } else { files = this.getConfig(options, configPath).files; From c0b87c72f0e0e5d5c88a02c69af80f44e0c403ef Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 18 Oct 2015 21:15:20 +0100 Subject: [PATCH 2/8] :white_check_mark: Add tests for ignored files --- tests/cli.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tests/cli.js b/tests/cli.js index f71f9db1..7a55e606 100644 --- a/tests/cli.js +++ b/tests/cli.js @@ -234,4 +234,50 @@ describe('cli', function () { } }); }); + + it('should not include ignored paths', function (done) { + + var sassTestsPath = path.join(__dirname, '/sass/'), + files = []; + + files.push(sassTestsPath + fs.readdirSync(sassTestsPath)); + + var command = 'sass-lint -i \'**/*.s+(a|c)ss\''; + + childProcess.exec(command, function (err, stdout) { + + if (err) { + return done(err); + } + + files.forEach(function (file) { + assert(stdout.indexOf(file) === -1); + }); + + done(); + }); + }); + + it('should not include multiple ignored paths', function (done) { + + var sassTestsPath = path.join(__dirname, '/sass/'), + files = []; + + files.push(sassTestsPath + fs.readdirSync(sassTestsPath)); + + var command = 'sass-lint -i \'**/*.scss, **/*.sass \''; + + childProcess.exec(command, function (err, stdout) { + + if (err) { + return done(err); + } + + files.forEach(function (file) { + assert(stdout.indexOf(file) === -1); + }); + + done(); + }); + }); }); From 6cd148aab510bbd3c95b00752ccaadfda5b37fd0 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 18 Oct 2015 21:44:07 +0100 Subject: [PATCH 3/8] :art: Fix formatting --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 39b82a74..a5391781 100644 --- a/index.js +++ b/index.js @@ -71,8 +71,8 @@ sassLint.lintFiles = function (files, options, configPath) { ignores = ''; if (files) { - ignores = this.getConfig(options, configPath).files.ignore || ''; - files = glob.sync(files, {'ignore': ignores}); + ignores = this.getConfig(options, configPath).files.ignore || ''; + files = glob.sync(files, {'ignore': ignores}); } else { files = this.getConfig(options, configPath).files; From 819a31ad77543bf8443f0e6ad885e88323c53423 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 18 Oct 2015 21:58:00 +0100 Subject: [PATCH 4/8] :art: Update Cli help message --- bin/sass-lint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sass-lint.js b/bin/sass-lint.js index 8c3727b7..2ef42eef 100755 --- a/bin/sass-lint.js +++ b/bin/sass-lint.js @@ -27,7 +27,7 @@ program .version(meta.version) .usage('[options] ') .option('-c, --config [path]', 'path to custom config file') - .option('-i, --ignore [pattern]', 'pattern to ignore. For multiple ignores, separate each pattern by `, `') + .option('-i, --ignore [pattern]', 'pattern to ignore. For multiple ignores, separate each pattern by `, ` within a string') .option('-q, --no-exit', 'do not exit on errors') .option('-v, --verbose', 'verbose output') .option('-f, --format [format]', 'pass one of the available eslint formats') From 9869824385bd1a967d914873199cdd01309bdc47 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 25 Oct 2015 09:44:58 +0000 Subject: [PATCH 5/8] Add OSX files to gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 59d842ba..f42d6469 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,10 @@ pids *.pid *.seed +# OSX +._* +.DS_Store + # Directory for instrumented libs generated by jscoverage/JSCover lib-cov From 80bce9a72a7d688355ca6fd9a9581262e6879502 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 25 Oct 2015 12:40:23 +0000 Subject: [PATCH 6/8] :arrow_up: Upgrade node-glob dependency --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d5065243..67f2c591 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "commander": "^2.8.1", "eslint": "^1.1.0", "fs-extra": "^0.24.0", - "glob": "^4.3.5", + "glob": "^5.0.15", "gonzales-pe": "3.0.0-31", "js-yaml": "^3.2.6", "merge": "^1.2.0", From 87249a0134848703274d51cdd835b58296d29067 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 25 Oct 2015 12:40:54 +0000 Subject: [PATCH 7/8] :memo: Update CLI doc format --- docs/cli/readme.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/cli/readme.md b/docs/cli/readme.md index f3b851c1..0b06def3 100644 --- a/docs/cli/readme.md +++ b/docs/cli/readme.md @@ -4,15 +4,19 @@ Sass Lint can be run via its Command Line Interface (CLI). To do so, run `sass-l By default, the command will run against the glob defined by a user's `file.include` option in their config, or a glob (or single file) can be passed as the last argument to the CLI to be explicitly run against. +> Please note that when using glob patterns such as `folder/**/*.scss` as a command line argument (files to be linted or ignored) you will need to wrap the pattern in quotes or escape the `*` characters to prevent bash/zsh from automatically expanding the glob pattern. + ## Options The following options are available for the CLI: -* `-h, --help`: Outputs usage information for the CLI -* `-V, --version`: Outputs the version number of Sass Lint -* `-c, --config [path]`: Path to the config file that should be used, relative to the directory the the command is being run in (will override other config path options) -* `-i, --ignore [pattern]`: A pattern that should be ignored from linting. Multiple patterns can be used by separating each pattern by `, `. Patterns should be wrapped in quotes (will be merged with other ignore options) -* `-q, --no-exit`: Prevents the CLI from throwing an error if there is one (useful for development work) -* `-v, --verbose`: Verbose output (fully formatted output) -* `-f, --format [format]`: Pass one of the available [Eslint formats](https://github.com/eslint/eslint/tree/master/lib/formatters) to format the output of sass-lint results. -* `-o, --output [output]`: The path plus file name relative to where Sass Lint is being run from where the output should be written to. +Command Line Flag | Description +-------------------------|------------------------------------ +`-c`,`--config [path]` | Path to the config file that should be used, relative to the directory the the command is being run in (will override other config path options) +`-f`,`--format [format]` | Pass one of the available [Eslint formats](https://github.com/eslint/eslint/tree/master/lib/formatters) to format the output of sass-lint results. +`-h`,`--help` | Outputs usage information for the CLI +`-i`,`--ignore [pattern]` | A pattern that should be ignored from linting. Multiple patterns can be used by separating each pattern by `, `. Patterns should be wrapped in quotes (will be merged with other ignore options) +`-o`,`--output [output]` | The path plus file name relative to where Sass Lint is being run from where the output should be written to. +`-q`,`--no-exit` | Prevents the CLI from throwing an error if there is one (useful for development work) +`-v`,`--verbose` | Verbose output (fully formatted output) +`-V`,`--version` | Outputs the version number of Sass Lint From 10bc1c665f7011d6210fcdc4cfe1a6cb81a4f949 Mon Sep 17 00:00:00 2001 From: Dan Purdy Date: Sun, 25 Oct 2015 12:41:18 +0000 Subject: [PATCH 8/8] :bug: pass ignored files from CLI --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index a5391781..5af2e440 100644 --- a/index.js +++ b/index.js @@ -72,7 +72,7 @@ sassLint.lintFiles = function (files, options, configPath) { if (files) { ignores = this.getConfig(options, configPath).files.ignore || ''; - files = glob.sync(files, {'ignore': ignores}); + files = glob.sync(files, {ignore: ignores}); } else { files = this.getConfig(options, configPath).files;