-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c707b4f
Showing
17 changed files
with
336 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--recurse=yes | ||
--tag-relative=yes | ||
--exclude=.git | ||
--exclude=lib | ||
--exclude=plugins/**/lib | ||
--exclude=node_modules | ||
--exclude=bower_components | ||
--exclude=plugins/**/node_modules | ||
--exclude=plugins/reek/lib/** | ||
--exclude=plugins/rubocop/lib/** | ||
--exclude=plugins/newline/lib/** | ||
--exclude=plugins/comment/lib/** | ||
--exclude=plugins/hlint/lib/** | ||
--exclude=plugins/lesshint/lib/** | ||
--exclude=plugins/csslint/lib/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/** | ||
lib/** | ||
.build/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
env: | ||
node: true | ||
es6: true | ||
|
||
rules: | ||
curly: [0, "all"] | ||
dot-notation: [2, {}] | ||
eqeqeq: [0, "smart"] | ||
camelcase: [0] | ||
semi: [2, "never"] | ||
strict: [2, "never"] | ||
max-nested-callbacks: [2, 4] | ||
no-mixed-requires: [1, false] | ||
no-return-assign: [2, "always"] | ||
no-unused-vars: [2, {"vars": "all", "args": "none"}] | ||
no-process-exit: [0] | ||
|
||
globals: | ||
$: true, | ||
require: false, | ||
document: true, | ||
expect: true, | ||
describe: false, | ||
xdescribe: false, | ||
it: false, | ||
xit: false, | ||
afterEach: false, | ||
after: false, | ||
beforeEach: false, | ||
before: false, | ||
Promise: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"rules": [{ | ||
"files": [ | ||
"src/**", | ||
"test/**" | ||
], | ||
"naming": "lowercase_underscore", | ||
"level": "error" | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
coverage | ||
.test | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.git | ||
coverage | ||
.build/** | ||
lib/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"strict": false, | ||
"browser": true, | ||
"node": true, | ||
"asi": true, | ||
"trailing": true, | ||
"evil": true, | ||
"boss": true, | ||
"expr": true, | ||
"loopfunc": true, | ||
"maxstatements": 50, | ||
"maxcomplexity": 15, | ||
"maxlen": 10000, | ||
"maxparams": 7, | ||
"quotmark": "double", | ||
"maxdepth": 5, | ||
"latedef": "nofunc", | ||
"undef": "nodefunc", | ||
"unused": "vars", | ||
"sub": true, | ||
"newcap": true, | ||
"immed": true, | ||
"indent": 2, | ||
"eqeqeq": false, | ||
"eqnull": true, | ||
"esnext": true, | ||
|
||
"globals": { | ||
"$": true, | ||
"require": false, | ||
"expect": true, | ||
"describe": false, | ||
"xdescribe": false, | ||
"it": false, | ||
"xit": false, | ||
"afterEach": false, | ||
"after": false, | ||
"beforeEach": false, | ||
"before": false, | ||
"Promise": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
vile: | ||
ignore: [ | ||
"node_modules", | ||
".build", | ||
".test", | ||
"coverage" | ||
] | ||
|
||
length: | ||
config: | ||
file: 250 | ||
line: 80 | ||
|
||
license: | ||
config: [ | ||
"MPL-2.0", | ||
"MIT", | ||
"MIT*", | ||
"The MIT License", | ||
"Public Domain", | ||
"PSF", | ||
"BSD", | ||
"BSD*", | ||
"BSD-3-Clause", | ||
"BSD-2-Clause", | ||
"BSD-3-Clause AND MIT", | ||
"Artistic-2.0", | ||
"(BSD-2-Clause OR MIT OR Apache-2.0)", | ||
"ISC", | ||
"WTFPL", | ||
"(BSD-2-Clause OR WTFPL)", | ||
"Apache*", | ||
"Apache License 2.0", | ||
"Apache 2.0", | ||
"Apache-2.0", | ||
"WTFPL" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# vile-scsslint | ||
|
||
A [Vile](http://vile.io) plugin for | ||
[SCSS-Lint](https://github.com/brigade/scss-lint). | ||
|
||
## Requirements | ||
|
||
- [nodejs](http://nodejs.org) | ||
- [npm](http://npmjs.org) | ||
- [ruby](http://nodejs.org) | ||
- [rubygems](http://rubygems.org) | ||
|
||
## Installation | ||
|
||
Currently, you need to have the `scsslint` CLI installed globally. | ||
|
||
Example: | ||
|
||
npm i vile-scsslint | ||
gem install scss_lint | ||
|
||
## Config | ||
|
||
Currently, you need to have a `.scss-lint.yml` file to have detailed config. | ||
|
||
You can also specify a custom config file in you `.vile.yml`: | ||
|
||
```yaml | ||
scsslint: | ||
config: .my-scss-lint-config.yml | ||
``` | ||
## Architecture | ||
This project is currently written in JavaScript. `scss_lint` provides | ||
a JSON CLI output that is currently used until a more ideal | ||
IPC option is implemented. | ||
|
||
## Hacking | ||
|
||
cd vile-scsslint | ||
npm install | ||
npm run dev | ||
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env sh | ||
babel -w -d lib -m common --compact false src & | ||
coffee -cwbo .test test & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/usr/bin/env node | ||
require('./../.test/runner').run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "@brentlintner/vile-scsslint", | ||
"version": "0.0.1", | ||
"description": "A vile plugin for scss-lint", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"postinstall": "babel -d lib -m common src", | ||
"dev": "bin/dev", | ||
"test": "bin/test" | ||
}, | ||
"keywords": [ | ||
"vile", | ||
"scss", | ||
"sass", | ||
"lint", | ||
"scsslint", | ||
"scss-lint", | ||
"scss_lint" | ||
], | ||
"dependencies": { | ||
"@brentlintner/vile": "~0.1.7", | ||
"babel": "5.6.14", | ||
"bluebird": "2.9.32", | ||
"lodash": "3.9.3" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "1.9.3", | ||
"chai": "3.0.0", | ||
"istanbul": "0.3.16", | ||
"mimus": "0.1.2", | ||
"mocha": "2.2.5", | ||
"sinon": "1.15.4", | ||
"sinon-chai": "2.8.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
let _ = require("lodash") | ||
let vile = require("@brentlintner/vile") | ||
const scsslint_bin = "scss-lint" | ||
|
||
// TODO: support custom ignoring via config | ||
|
||
let scsslint = (custom_config_path) => { | ||
let opts = {} | ||
|
||
if (typeof custom_config_path == "string") { | ||
opts.c = custom_config_path | ||
} | ||
|
||
opts.args = _.reduce(opts, (arr, option, name) => { | ||
return arr.concat([`-${name}`, option]) | ||
}, []).concat(["-f", "JSON"]) | ||
|
||
return vile | ||
.spawn(scsslint_bin, opts) | ||
.then((stdout) => { | ||
try { | ||
return JSON.parse(stdout) | ||
} catch (e) { | ||
// TODO: better - HACK (no -q option, shows text if nothing found) | ||
return [] | ||
} | ||
}) | ||
} | ||
|
||
let to_vile_issue = (severity="") => { | ||
return severity.toLowerCase() == "warning" ? | ||
vile.WARNING : vile.ERROR | ||
} | ||
|
||
let vile_issue = (issue, file) => { | ||
return vile.issue( | ||
to_vile_issue(issue.severity), | ||
file, | ||
`${issue.reason} (${issue.linter})`, | ||
{ line: issue.line, character: issue.column } | ||
) | ||
} | ||
|
||
let punish = (plugin_config) => { | ||
return scsslint(_.get(plugin_config, "config")) | ||
.then((issues_per_file) => { | ||
return _.flatten(_.map(issues_per_file, (per_file, file) => { | ||
return _.map(per_file, (issue) => vile_issue(issue, file)) | ||
})) | ||
}) | ||
} | ||
|
||
module.exports = { | ||
punish: punish | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
sinon = require "sinon" | ||
chai = require "chai" | ||
sinonChai = require "sinon-chai" | ||
|
||
chai.use sinonChai | ||
.use chai.should | ||
.should() | ||
|
||
module.exports = chai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
path = require "path" | ||
Mocha = require "mocha" | ||
|
||
run = (type) -> | ||
runner = new Mocha | ||
ui: "bdd" | ||
reporter: "dot" | ||
timeout: 10000 | ||
|
||
runner.files = [ path.join __dirname, "spec.js" ] | ||
|
||
runner.run process.exit | ||
|
||
module.exports = | ||
run: run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
mimus = require "mimus" | ||
newline = require "./../lib" | ||
chai = require "./helpers/sinon_chai" | ||
expect = chai.expect | ||
|
||
describe "finding newlines", -> | ||
afterEach newline.reset | ||
after newline.restore | ||
|
||
describe "with lf", -> | ||
|
||
describe "with crlf", -> | ||
|
||
describe "with whitespace", -> | ||
describe "crlf", -> | ||
|
||
describe "lf", -> |