-
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 d50f8d5
Showing
9 changed files
with
287 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,2 @@ | ||
node_modules/ | ||
.DS_Store |
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 @@ | ||
## 0.1.0 - First Release | ||
|
||
* Initial release |
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 @@ | ||
Copyright (c) 2018, DopustimVladimir <[email protected]> | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
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,64 @@ | ||
|
||
# @dopustim/coffeelint-config | ||
|
||
Configuration file for CoffeeLint | ||
|
||
[![NPM](https://img.shields.io/npm/dt/@dopustim/coffeelint-config.svg?style=flat-square)](https://www.npmjs.com/package/@dopustim/coffeelint-config) | ||
|
||
[![GitHub tag](https://img.shields.io/github/tag/dopustim/coffeelint-config.svg?style=flat-square)](https://github.com/dopustim/coffeelint-config/tags) | ||
[![GitHub stars](https://img.shields.io/github/stars/dopustim/coffeelint-config.svg?style=flat-square)](https://github.com/dopustim/coffeelint-config/stargazers) | ||
[![GitHub issues](https://img.shields.io/github/issues/dopustim/coffeelint-config.svg?style=flat-square)](https://github.com/dopustim/coffeelint-config/issues) | ||
|
||
[![License](https://img.shields.io/badge/license-ISC-green.svg?style=flat-square)](/LICENSE.md) | ||
|
||
## Features | ||
|
||
- Provide Errors and Warnings | ||
- 4 spaces for indentation (warning) | ||
- 100 symbols per line (warning) | ||
- Unix linebreaks (warning) | ||
|
||
## Usage | ||
|
||
Install `@dopustim/coffeelint-config` package via [NPM](https://www.npmjs.com/package/@dopustim/coffeelint-config): | ||
|
||
```sh | ||
$ npm i -D coffeelint @dopustim/coffeelint-config | ||
``` | ||
|
||
Extend this config in your `coffeelint.json`: | ||
|
||
```json | ||
{ | ||
"extends": "@dopustim/coffeelint-config" | ||
} | ||
``` | ||
|
||
Or use your `package.json`: | ||
|
||
```json | ||
"coffeelintConfig": { | ||
"extends": "@dopustim/coffeelint-config" | ||
} | ||
``` | ||
|
||
You can also reassign any rule for your needs: | ||
|
||
```json | ||
{ | ||
"extends": "@dopustim/coffeelint-config", | ||
"rules": { | ||
"space_operators": { | ||
"level": "ignore" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Rules | ||
|
||
You can find all rules on [official site](http://www.coffeelint.org/#options). | ||
|
||
## License | ||
|
||
[ISC License](./LICENSE.md) © 2018 Dopustim Vladimir |
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,25 @@ | ||
{ | ||
"name": "@dopustim/coffeelint-config", | ||
"version": "0.1.0", | ||
"description": "Configuration file for CoffeeLint", | ||
"keywords": [ | ||
"configuration", | ||
"config", | ||
"json", | ||
"validate", | ||
"lint", | ||
"linter", | ||
"coffeelint" | ||
], | ||
"author": "DopustimVladimir", | ||
"license": "ISC", | ||
"repository": "https://github.com/dopustim/coffeelint-config", | ||
"main": "recommended.json", | ||
"scripts": { | ||
"test": "jasmine spec/index-spec.js" | ||
}, | ||
"devDependencies": { | ||
"coffeelint": "^2.1.0", | ||
"jasmine": "^3.3.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,135 @@ | ||
{ | ||
"arrow_spacing": { | ||
"level": "warn" | ||
}, | ||
"braces_spacing": { | ||
"spaces": 0, | ||
"empty_object_spaces": 0, | ||
"level": "warn" | ||
}, | ||
"camel_case_classes": { | ||
"level": "error" | ||
}, | ||
"coffeescript_error": { | ||
"level": "error" | ||
}, | ||
"colon_assignment_spacing": { | ||
"spacing": { | ||
"left": 0, | ||
"right": 1 | ||
}, | ||
"level": "warn" | ||
}, | ||
"cyclomatic_complexity": { | ||
"value": 10, | ||
"level": "warn" | ||
}, | ||
"duplicate_key": { | ||
"level": "error" | ||
}, | ||
"empty_constructor_needs_parens": { | ||
"level": "ignore" | ||
}, | ||
"ensure_comprehensions": { | ||
"level": "warn" | ||
}, | ||
"eol_last": { | ||
"level": "warn" | ||
}, | ||
"indentation": { | ||
"value": 4, | ||
"level": "warn" | ||
}, | ||
"line_endings": { | ||
"value": "unix", | ||
"level": "warn" | ||
}, | ||
"max_line_length": { | ||
"value": 100, | ||
"limitComments": true, | ||
"level": "warn" | ||
}, | ||
"missing_fat_arrows": { | ||
"is_strict": false, | ||
"level": "ignore" | ||
}, | ||
"newlines_after_classes": { | ||
"value": 3, | ||
"level": "ignore" | ||
}, | ||
"no_backticks": { | ||
"level": "error" | ||
}, | ||
"no_debugger": { | ||
"console": false, | ||
"level": "warn" | ||
}, | ||
"no_empty_functions": { | ||
"level": "ignore" | ||
}, | ||
"no_empty_param_list": { | ||
"level": "ignore" | ||
}, | ||
"no_implicit_braces": { | ||
"strict": false, | ||
"level": "ignore" | ||
}, | ||
"no_implicit_parens": { | ||
"strict": false, | ||
"level": "ignore" | ||
}, | ||
"no_interpolation_in_single_quotes": { | ||
"level": "ignore" | ||
}, | ||
"no_nested_string_interpolation": { | ||
"level": "warn" | ||
}, | ||
"no_plusplus": { | ||
"level": "ignore" | ||
}, | ||
"no_private_function_fat_arrows": { | ||
"level": "warn" | ||
}, | ||
"no_stand_alone_at": { | ||
"level": "ignore" | ||
}, | ||
"no_tabs": { | ||
"level": "error" | ||
}, | ||
"no_this": { | ||
"level": "error" | ||
}, | ||
"no_throwing_strings": { | ||
"level": "error" | ||
}, | ||
"no_trailing_semicolons": { | ||
"level": "error" | ||
}, | ||
"no_trailing_whitespace": { | ||
"allowed_in_comments": false, | ||
"allowed_in_empty_lines": true, | ||
"level": "error" | ||
}, | ||
"no_unnecessary_double_quotes": { | ||
"level": "ignore" | ||
}, | ||
"no_unnecessary_fat_arrows": { | ||
"level": "warn" | ||
}, | ||
"non_empty_constructor_needs_parens": { | ||
"level": "ignore" | ||
}, | ||
"prefer_english_operator": { | ||
"doubleNotLevel": "ignore", | ||
"level": "warn" | ||
}, | ||
"space_operators": { | ||
"level": "warn" | ||
}, | ||
"spacing_after_comma": { | ||
"level": "warn" | ||
}, | ||
"transform_messes_up_line_numbers": { | ||
"level": "warn" | ||
} | ||
} |
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,38 @@ | ||
const fs = require('fs'); | ||
const coffeelint = require('coffeelint'); | ||
const config = require('../'); | ||
|
||
const validSrc = fs.readFileSync('./spec/valid.coffee', 'utf8'); | ||
const invalidSrc = fs.readFileSync('./spec/invalid.coffee', 'utf8'); | ||
|
||
describe('Lint result for valid CoffeeScript file', () => { | ||
|
||
let res; | ||
|
||
beforeAll(() => { | ||
res = coffeelint.lint(validSrc, config); | ||
}); | ||
it('has no errors', () => { | ||
expect(res.length).toBeFalsy(); | ||
}); | ||
}); | ||
|
||
describe('Lint result for invalid CoffeeScript file', () => { | ||
|
||
let res; | ||
|
||
beforeAll(() => { | ||
res = coffeelint.lint(invalidSrc, config); | ||
}); | ||
it('has errors', () => { | ||
expect(res.length).toBeTruthy(); | ||
}); | ||
it('has error for rule "camel_case_classes"', () => { | ||
expect(res[0].rule).toBe('camel_case_classes'); | ||
expect(res[0].level).toBe('error'); | ||
}); | ||
it('has warning for rule "space_operators"', () => { | ||
expect(res[1].rule).toBe('space_operators'); | ||
expect(res[1].level).toBe('warn'); | ||
}); | ||
}); |
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 @@ | ||
|
||
class duck | ||
constructor: (name='Anonimous') -> | ||
@name = name | ||
quack: -> | ||
@name + ' Duck: Quack-quack!' | ||
|
||
donald = new duck 'Donald' | ||
console.log donald.quack() |
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,6 @@ | ||
|
||
class Duck | ||
constructor: (name = 'Anonimous') -> | ||
@name = name | ||
quack: -> | ||
@name + ' Duck: Quack-quack!' |