Skip to content

Commit

Permalink
v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
brentlintner committed Oct 25, 2015
0 parents commit c707b4f
Show file tree
Hide file tree
Showing 17 changed files with 336 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .ctags
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/**
9 changes: 9 additions & 0 deletions .editorconfig
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
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/**
lib/**
.build/**
31 changes: 31 additions & 0 deletions .eslintrc
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
10 changes: 10 additions & 0 deletions .fs-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"rules": [{
"files": [
"src/**",
"test/**"
],
"naming": "lowercase_underscore",
"level": "error"
}]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
coverage
.test
lib
5 changes: 5 additions & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.git
coverage
.build/**
lib/**
42 changes: 42 additions & 0 deletions .jshintrc
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
}
}
37 changes: 37 additions & 0 deletions .vile.yml
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"
]
44 changes: 44 additions & 0 deletions README.md
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
3 changes: 3 additions & 0 deletions bin/dev
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 &
2 changes: 2 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('./../.test/runner').run()
35 changes: 35 additions & 0 deletions package.json
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"
}
}
55 changes: 55 additions & 0 deletions src/index.js
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
}
9 changes: 9 additions & 0 deletions test/helpers/sinon_chai.coffee
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
15 changes: 15 additions & 0 deletions test/runner.coffee
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
17 changes: 17 additions & 0 deletions test/spec.coffee
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", ->

0 comments on commit c707b4f

Please sign in to comment.