Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #33 from Arcanemagus/new-linter-api
Browse files Browse the repository at this point in the history
Update to the new Linter API
  • Loading branch information
steelbrain committed Aug 5, 2015
2 parents 1f6663b + 75fcbee commit 690037f
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 64 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
.idea
npm-debug.log
node_modules
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ This linter plugin for [Linter](https://github.com/AtomLinter/Linter) provides a
Linter package must be installed in order to use this plugin. If Linter is not installed, please follow the instructions [here](https://github.com/AtomLinter/Linter).

### Plugin installation
```
```ShellSession
$ apm install linter-csslint
```

## Settings
You can configure linter-csslint by editing ~/.atom/config.cson (choose Open Your Config in Atom menu):
```
```cson
'linter-csslint':
'csslintExecutablePath': null #csslint path. run 'which csslint' to find the path
#csslint path. run 'which csslint' to find the path
'executablePath': null
```

## Contributing
Expand All @@ -25,15 +26,12 @@ If you would like to contribute enhancements or fixes, please do the following:
1. Hack on a separate topic branch created from the latest `master`.
1. Commit and push the topic branch.
1. Make a pull request.
1. welcome to the club
1. Welcome to the club!

Please note that modifications should follow these coding guidelines:

- Indent is 2 spaces.
- Code should pass coffeelint linter.
- Code should pass [CoffeeLint](http://www.coffeelint.org/) with the provided `coffeelint.json`
- Vertical whitespace helps readability, don’t be afraid to use it.

Thank you for helping out!

## Donation
[![Share the love!](https://chewbacco-stuff.s3.amazonaws.com/donate.png)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KXUYS4ARNHCN8)
**Thank you for helping out!**
38 changes: 38 additions & 0 deletions coffeelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"max_line_length": {
"value": 120,
"level": "warn"
},
"no_empty_param_list": {
"level": "error"
},
"arrow_spacing": {
"level": "error"
},
"no_interpolation_in_single_quotes": {
"level": "error"
},
"no_debugger": {
"level": "error"
},
"prefer_english_operator": {
"level": "error"
},
"colon_assignment_spacing": {
"spacing": {
"left": 0,
"right": 1
},
"level": "error"
},
"braces_spacing": {
"spaces": 0,
"level": "error"
},
"spacing_after_comma": {
"level": "error"
},
"no_stand_alone_at": {
"level": "error"
}
}
11 changes: 0 additions & 11 deletions lib/init.coffee

This file was deleted.

37 changes: 0 additions & 37 deletions lib/linter-csslint.coffee

This file was deleted.

34 changes: 34 additions & 0 deletions lib/main.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
helpers = require('atom-linter')
path = require('path')

module.exports =
provideLinter: ->
helpers = require('atom-linter')
provider =
grammarScopes: ['source.css', 'source.html']
scope: 'file'
lintOnFly: true
lint: (textEditor) ->
filePath = textEditor.getPath()
text = textEditor.getText()
parameters = ['--format=json', '-']
exec = path.join(__dirname, '..', 'node_modules', 'csslint', 'cli.js')
helpers.execNode(exec, parameters, {stdin: text}).then (output) ->
lintResult = JSON.parse(output)
toReturn = []
if lintResult.messages.length < 1
return toReturn
for data in lintResult.messages
line = data.line - 1
col = data.col - 1
toReturn.push({
type: data.type.charAt(0).toUpperCase() + data.type.slice(1),
text: data.message,
filePath: filePath
range: [[line, col], [line, col]],
trace: [{
type: "Text",
text: '[' + data.rule.id + '] ' + data.rule.desc
}]
})
return toReturn
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@
"linter",
"lint"
],
"main": "./lib/init",
"linter-package": true,
"version": "0.0.14",
"main": "./lib/main",
"version": "0.0.15",
"description": "Lint CSS on the fly, using csslint",
"repository": "https://github.com/AtomLinter/linter-csslint",
"license": "MIT",
"engines": {
"atom": ">0.50.0"
},
"dependencies": {
"csslint": "~0.10.0"
"csslint": "AtomLinter/csslint",
"atom-linter": "^3.0.0"
},
"providedServices": {
"linter": {
"versions": {
"1.0.0": "provideLinter"
}
}
}
}

0 comments on commit 690037f

Please sign in to comment.