-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ported all rules from old JSHint/JSCS
Also added tests based on eslint-config-standard, Added TravisCI testing Updated README and LICENSE Update gitignore Added editorconfig
- Loading branch information
Daniel Spitzer
committed
Oct 5, 2016
1 parent
4d2bf51
commit 33b4ad2
Showing
11 changed files
with
218 additions
and
68 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,10 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = UTF-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = 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,15 @@ | ||
node_modules | ||
.node_repl_history | ||
.npm | ||
npm-debug.log* | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
*.iml | ||
*.swp | ||
*.swn | ||
*.swo |
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 @@ | ||
language: node_js | ||
node_js: | ||
- '4' | ||
- 'node' |
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,7 @@ | ||
ISC License | ||
|
||
Copyright (c) 2016, Tradeshift | ||
|
||
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,49 @@ | ||
# Standard - ESLint Shareable Config | ||
[![travis][travis-image]][travis-url] | ||
[![npm][npm-image]][npm-url] | ||
[![downloads][downloads-image]][downloads-url] | ||
|
||
[travis-image]: https://img.shields.io/travis/Tradeshift/eslint-config-tradeshift/master.svg | ||
[travis-url]: https://travis-ci.org/Tradeshift/eslint-config-tradeshift | ||
[npm-image]: https://img.shields.io/npm/v/eslint-config-tradeshift.svg | ||
[npm-url]: https://npmjs.org/package/eslint-config-tradeshift | ||
[downloads-image]: https://img.shields.io/npm/dm/eslint-config-tradeshift.svg | ||
[downloads-url]: https://npmjs.org/package/eslint-config-tradeshift | ||
|
||
#### An ESLint [Shareable Config](http://eslint.org/docs/developer-guide/shareable-configs) for [JavaScript Tradeshift Style](http://apps.tradeshift.com) | ||
|
||
## Install | ||
|
||
```bash | ||
npm install eslint-config-tradeshift | ||
``` | ||
|
||
## Usage | ||
|
||
Shareable configs are designed to work with the `extends` feature of `.eslintrc` files. | ||
You can learn more about | ||
[Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) on the | ||
official ESLint website. | ||
|
||
To use the JavaScript Tradeshift Style shareable config, first run this: | ||
|
||
```bash | ||
npm install eslint-config-tradeshift eslint-config-standard eslint-plugin-standard eslint-plugin-promise | ||
``` | ||
|
||
Then, add this to your .eslintrc file: | ||
|
||
``` | ||
{ | ||
"extends": "tradeshift" | ||
} | ||
``` | ||
|
||
*Note: We omitted the `eslint-config-` prefix since it is automatically assumed by ESLint.* | ||
|
||
You can override settings from the shareable config by adding them directly into your | ||
`.eslintrc` file. | ||
|
||
## License | ||
|
||
ISC. Copyright (c) 2016, [Tradeshift](https://github.com/Tradeshift). |
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,39 @@ | ||
{ | ||
"extends": "standard", | ||
"env": { | ||
"es6": true, | ||
"browser": true, | ||
"node": true, | ||
"jasmine": true | ||
}, | ||
"globals": { | ||
"t": true, | ||
"ts": true, | ||
"gui": true, | ||
"app": true, | ||
"__app": true, | ||
"__config": true, | ||
"runtime": true, | ||
"server": true | ||
}, | ||
"rules": { | ||
"array-bracket-spacing": [2, "never"], | ||
"block-scoped-var": 1, | ||
"camelcase": [1, { "properties": "never" }], | ||
"dot-notation": 2, | ||
"eqeqeq": [2, "always"], | ||
"guard-for-in": 2, | ||
"indent": [2, "tab", { "SwitchCase": 2 }], | ||
"keyword-spacing": [2, { "before": true, "after": true }], | ||
"linebreak-style": 2, | ||
"no-empty": [2, { "allowEmptyCatch": true }], | ||
"no-invalid-this": 2, | ||
"no-loop-func": 2, | ||
"no-script-url": 2, | ||
"no-shadow": 2, | ||
"no-var": 0, | ||
"quote-props": [2, "as-needed", { "keywords": true }], | ||
"semi": [2, "always"], | ||
"space-before-function-paren": [2, "never"] | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1 @@ | ||
module.exports = { | ||
"extends": "standard", | ||
"rules": { | ||
"semi": [2, "always"], | ||
"no-tabs": 0, | ||
"indent": [ | ||
2, | ||
"tab" | ||
] | ||
} | ||
}; | ||
module.exports = require('./eslintrc.json') |
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 |
---|---|---|
@@ -1,28 +1,62 @@ | ||
{ | ||
"name": "eslint-config-tradeshift", | ||
"version": "1.0.1", | ||
"description": "Javascript styleguide for Tradeshift", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Søren Louv-Jansen <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/sqren/eslint-config-tradeshift.git" | ||
}, | ||
"peerDependencies": { | ||
"eslint": ">= 3" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"eslintconfig", | ||
"style guide", | ||
"lint", | ||
"tradeshift", | ||
"es6", | ||
"es2015", | ||
"javascript" | ||
], | ||
"license": "ISC" | ||
"name": "eslint-config-tradeshift", | ||
"description": "Javascript Tradeshift Style - ESLint Shareable Config", | ||
"version": "2.0.0", | ||
"author": "Tradeshift <[email protected]>", | ||
"contributors": [ | ||
"Daniel Spitzer <[email protected]>", | ||
"Søren Louv-Jansen <[email protected]>" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/Tradeshift/eslint-config-tradeshift/issues" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^3.1.1", | ||
"eslint-config-standard": "^6.2.0", | ||
"eslint-plugin-promise": "^2.0.0", | ||
"eslint-plugin-standard": "^2.0.0", | ||
"tape": "^4.6.0" | ||
}, | ||
"homepage": "https://github.com/Tradeshift/eslint-config-tradeshift", | ||
"keywords": [ | ||
"JavaScript Tradeshift Style", | ||
"check", | ||
"checker", | ||
"code", | ||
"code checker", | ||
"code linter", | ||
"code standards", | ||
"code style", | ||
"enforce", | ||
"eslint", | ||
"eslintconfig", | ||
"hint", | ||
"jscs", | ||
"jshint", | ||
"lint", | ||
"policy", | ||
"quality", | ||
"simple", | ||
"style", | ||
"style checker", | ||
"style linter", | ||
"verify", | ||
"javascript", | ||
"tradeshift", | ||
"es6", | ||
"es2016" | ||
], | ||
"license": "ISC", | ||
"main": "index.js", | ||
"peerDependencies": { | ||
"eslint": ">=3.0.0", | ||
"eslint-config-standard": ">=6.2.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Tradeshift/eslint-config-tradeshift.git" | ||
}, | ||
"scripts": { | ||
"test": "tape test/*.js" | ||
} | ||
} |
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 @@ | ||
var config = require('../'); | ||
var test = require('tape'); | ||
|
||
test('test basic properties of config', function(t) { | ||
t.ok(isString(config.extends)); | ||
t.ok(isObject(config.env)); | ||
t.ok(isObject(config.globals)); | ||
t.ok(isObject(config.rules)); | ||
t.end(); | ||
}); | ||
|
||
function isObject(obj) { | ||
return typeof obj === 'object' && obj !== null; | ||
} | ||
function isString(str) { | ||
return typeof str === 'string' && str !== null; | ||
} |
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,16 @@ | ||
var eslint = require('eslint'); | ||
var test = require('tape'); | ||
|
||
test('load config in eslint to validate all rule syntax is correct', function (t) { | ||
var CLIEngine = eslint.CLIEngine; | ||
|
||
var cli = new CLIEngine({ | ||
useEslintrc: false, | ||
configFile: 'eslintrc.json' | ||
}); | ||
|
||
var code = 'var foo = 1;\nvar bar = function() {};\nbar(foo);\n'; | ||
|
||
t.equal(cli.executeOnText(code).errorCount, 0); | ||
t.end(); | ||
}); |