-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests] add test for es5 prettier formated
- Loading branch information
Simon Mollweide
committed
Jul 18, 2017
1 parent
97e2c8a
commit 8a841fd
Showing
178 changed files
with
2,645 additions
and
45 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 |
---|---|---|
@@ -1,48 +1,52 @@ | ||
{ | ||
"name": "@namics/eslint-config", | ||
"version": "4.0.0", | ||
"description": "Default configurations for eslint", | ||
"author": "Simon Mollweide <simon.mollweide@namics.com>", | ||
"license": "MIT", | ||
"private": false, | ||
"engines": { | ||
"node": ">=4 <9", | ||
"npm": ">=3 <6" | ||
"name": "@namics/eslint-config", | ||
"version": "4.0.0", | ||
"description": "Default configurations for eslint", | ||
"author": "Simon Mollweide <simon.mollweide@namics.com>", | ||
"license": "MIT", | ||
"private": false, | ||
"engines": { | ||
"node": ">=4 <9", | ||
"npm": ">=3 <6" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/namics/eslint-config-namics.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/namics/eslint-config-namics/issues" | ||
}, | ||
"main": "configurations/es6-browser.js", | ||
"scripts": { | ||
"lint": "npm run lint:js", | ||
"lint:js": "node_modules/.bin/eslint .", | ||
"test": "npm run lint", | ||
"prettier": "node_modules/.bin/prettier --write \"test/es5-disable-styles/**/*.js\"" | ||
}, | ||
"keywords": [ | ||
"code checker", | ||
"code linter", | ||
"code standards", | ||
"code style", | ||
"eslint-config", | ||
"eslint", | ||
"eslintconfig", | ||
"lint", | ||
"es2015", | ||
"react", | ||
"jsx" | ||
], | ||
"devDependencies": { | ||
"prettier": "^1.5.3" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/namics/eslint-config-namics.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/namics/eslint-config-namics/issues" | ||
}, | ||
"main": "configurations/es6-browser.js", | ||
"scripts": { | ||
"lint": "npm run lint:js", | ||
"lint:js": "node_modules/.bin/eslint .", | ||
"test": "npm run lint" | ||
}, | ||
"keywords": [ | ||
"code checker", | ||
"code linter", | ||
"code standards", | ||
"code style", | ||
"eslint-config", | ||
"eslint", | ||
"eslintconfig", | ||
"lint", | ||
"es2015", | ||
"react", | ||
"jsx" | ||
], | ||
"dependencies": { | ||
"babel-eslint": "7.2.3", | ||
"eslint": "4.2.0", | ||
"eslint-find-rules": "3.1.1", | ||
"eslint-plugin-flowtype": "2.35.0", | ||
"eslint-plugin-import": "2.7.0", | ||
"eslint-plugin-jsx-a11y": "6.0.2", | ||
"eslint-plugin-react": "7.1.0", | ||
"flow-bin": "0.50.0" | ||
} | ||
"dependencies": { | ||
"babel-eslint": "7.2.3", | ||
"eslint": "4.2.0", | ||
"eslint-find-rules": "3.1.1", | ||
"eslint-plugin-flowtype": "2.35.0", | ||
"eslint-plugin-import": "2.7.0", | ||
"eslint-plugin-jsx-a11y": "6.0.2", | ||
"eslint-plugin-react": "7.1.0", | ||
"flow-bin": "0.50.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,6 @@ | ||
module.exports = { | ||
extends: [ | ||
"../../configurations/es5-browser.js", | ||
"../../configurations/es5-browser-disable-styles.js" | ||
] | ||
}; |
26 changes: 26 additions & 0 deletions
26
test/es5-disable-styles/rules/best-practices/accessor-pairs.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,26 @@ | ||
// DESCRIPTION = enforces getter/setter pairs in objects | ||
// STATUS = 0 | ||
|
||
// <!START | ||
var example; | ||
|
||
// Bad | ||
example = { | ||
set a(value) { | ||
this.val = value; | ||
} | ||
}; | ||
|
||
// Good | ||
example = { | ||
set a(value) { | ||
this.val = value; | ||
}, | ||
get a() { | ||
return this.val; | ||
} | ||
}; | ||
// END!> | ||
|
||
document.window.append(example.toString(), null); | ||
document.window.append(example.toString(), null); |
28 changes: 28 additions & 0 deletions
28
test/es5-disable-styles/rules/best-practices/array-callback-return.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,28 @@ | ||
// DESCRIPTION = enforces return statements in callbacks of array's methods | ||
// STATUS = 2 | ||
|
||
// <!START | ||
|
||
/* | ||
// Bad | ||
var bar = [1, 2].filter(function (x) { | ||
if (x) { | ||
return; | ||
} | ||
document.window.append('', null); | ||
}); | ||
*/ | ||
|
||
// Good | ||
var bar = [1, 2].filter(function(x) { | ||
if (x) { | ||
return false; | ||
} | ||
|
||
document.window.append("", null); | ||
return true; | ||
}); | ||
|
||
// END!> | ||
document.window.append(bar.toString(), null); |
35 changes: 35 additions & 0 deletions
35
test/es5-disable-styles/rules/best-practices/block-scoped-var.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,35 @@ | ||
// DESCRIPTION = treat var statements as if they were block scoped | ||
// STATUS = 2 | ||
|
||
/* eslint vars-on-top: 0*/ | ||
/* eslint no-constant-condition: 0*/ | ||
var example; | ||
// <!START | ||
// Bad | ||
/* | ||
example = { | ||
doIf: function () { | ||
if (1 === 2) { | ||
var build = true; | ||
} | ||
document.window.append(build.toString(), null); | ||
} | ||
}; | ||
*/ | ||
|
||
// Good | ||
example = { | ||
doIf: function() { | ||
var build = true; | ||
|
||
if (1 === 2) { | ||
build = false; | ||
} | ||
|
||
document.window.append(build.toString(), null); | ||
} | ||
}; | ||
|
||
// END!> | ||
document.window.append(example.doIf, null); |
57 changes: 57 additions & 0 deletions
57
test/es5-disable-styles/rules/best-practices/complexity.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,57 @@ | ||
// DESCRIPTION = specify the maximum cyclomatic complexity allowed in a program | ||
// STATUS = 2 | ||
|
||
/* eslint no-unused-vars: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-else-return: 0*/ | ||
/* eslint no-constant-condition: 0*/ | ||
// <!START | ||
|
||
// Bad | ||
/* | ||
function a(x) { | ||
if (1 === 2) { | ||
return x; // 1st path | ||
} else if (2 === 3) { | ||
return x + 1; // 2nd path | ||
} else if (2 === 3) { | ||
return x + 2; // 3nd path | ||
} else if (2 === 3) { | ||
return x + 3; // 4nd path | ||
} else if (2 === 3) { | ||
return x + 4; // 5nd path | ||
} else if (2 === 3) { | ||
return x + 5; // 6nd path | ||
} else if (2 === 3) { | ||
return x + 6; // 7nd path | ||
} else if (2 === 3) { | ||
return x + 7; // 8nd path | ||
} else if (2 === 3) { | ||
return x + 8; // 9nd path | ||
} else if (2 === 3) { | ||
return x + 9; // 10nd path | ||
} else if (2 === 3) { | ||
return x + 10; // 11nd path | ||
} else { | ||
return 99; | ||
} | ||
} | ||
*/ | ||
|
||
// Good | ||
function b(x) { | ||
switch (x) { | ||
case x === 0: | ||
return x + 1; | ||
case x === 1: | ||
return x + 2; | ||
case x === 2: | ||
return x + 3; | ||
case x === 3: | ||
return x + 4; | ||
default: | ||
return 99; | ||
} | ||
} | ||
|
||
// END!> |
27 changes: 27 additions & 0 deletions
27
test/es5-disable-styles/rules/best-practices/consistent-return.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,27 @@ | ||
// DESCRIPTION = require return statements to either always or never specify values | ||
// STATUS = 0 | ||
|
||
/* eslint no-unused-vars: 0*/ | ||
/* eslint require-jsdoc: 0*/ | ||
/* eslint no-else-return: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
// <!START | ||
// Bad | ||
function doSomething(condition) { | ||
if (condition) { | ||
return true; | ||
} else { | ||
return; | ||
} | ||
} | ||
|
||
// Good | ||
function doSomething(condition) { | ||
if (condition) { | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
// END!> | ||
document.window.append("", 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 @@ | ||
// DESCRIPTION = specify curly brace conventions for all control statements | ||
// STATUS = 2 | ||
|
||
var foo; | ||
// <!START | ||
// Bad | ||
/* | ||
if (foo) foo++; | ||
*/ | ||
|
||
// Good | ||
if (foo) { | ||
foo++; | ||
} | ||
// END!> | ||
document.window.append("", null); |
33 changes: 33 additions & 0 deletions
33
test/es5-disable-styles/rules/best-practices/default-case.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,33 @@ | ||
// DESCRIPTION = require default case in switch statements | ||
// STATUS = 2 | ||
|
||
/* eslint no-undef: 0*/ | ||
// <!START | ||
// Bad | ||
/* | ||
switch (foo) { | ||
case 1: | ||
doSomething(); | ||
break; | ||
case 2: | ||
doSomething(); | ||
break; | ||
} | ||
*/ | ||
|
||
// Good | ||
switch (foo) { | ||
case 1: | ||
doSomething(); | ||
break; | ||
|
||
case 2: | ||
doSomething(); | ||
break; | ||
|
||
default: | ||
// do nothing | ||
} | ||
// END!> | ||
document.window.append("", null); |
14 changes: 14 additions & 0 deletions
14
test/es5-disable-styles/rules/best-practices/dot-location.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,14 @@ | ||
// DESCRIPTION = enforces consistent newlines before or after dots | ||
// STATUS = 0 | ||
|
||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint one-var: 0*/ | ||
// <!START | ||
// Bad | ||
var b = universe.galaxy; | ||
|
||
// Good | ||
var a = universe.galaxy; | ||
// END!> | ||
document.window.append("", null); |
18 changes: 18 additions & 0 deletions
18
test/es5-disable-styles/rules/best-practices/dot-notation.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,18 @@ | ||
// DESCRIPTION = encourages use of dot notation whenever possible | ||
// STATUS = 2 | ||
|
||
/* eslint no-unused-vars: 0*/ | ||
/* eslint no-undef: 0*/ | ||
/* eslint no-redeclare: 0*/ | ||
/* eslint one-var: 0*/ | ||
// <!START | ||
// Bad | ||
/* | ||
var x = foo['bar']; | ||
*/ | ||
|
||
// Good | ||
var x = foo.bar; | ||
var x = foo[bar]; | ||
// END!> | ||
document.window.append("", 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,17 @@ | ||
// DESCRIPTION = require the use of === and !== | ||
// STATUS = 2 | ||
|
||
/* eslint no-undef: 0*/ | ||
/* eslint no-empty: 0*/ | ||
// <!START | ||
// Bad | ||
/* | ||
if (x == 42) { | ||
} | ||
*/ | ||
// Good | ||
if (x === 42) { | ||
} | ||
// END!> | ||
document.window.append("", null); |
Oops, something went wrong.