Skip to content

Commit

Permalink
[tests] add test for es6 prettier formated
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Mollweide committed Jul 18, 2017
1 parent 7885d5b commit 3367b38
Show file tree
Hide file tree
Showing 51 changed files with 774 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
"lint": "npm run lint:js",
"lint:js": "node_modules/.bin/eslint .",
"test": "npm run lint",
"prettier": "yarn prettier:es5 && yarn prettier:es5node",
"prettier": "yarn prettier:es5 && yarn prettier:es5node && yarn prettier:es6",
"prettier:es5": "node_modules/.bin/prettier --write \"test/es5-disable-styles/**/*.js\"",
"prettier:es5node": "node_modules/.bin/prettier --write \"test/es5-node-disable-styles/**/*.js\""
"prettier:es5node": "node_modules/.bin/prettier --write \"test/es5-node-disable-styles/**/*.js\"",
"prettier:es6": "node_modules/.bin/prettier --write \"test/es6-disable-styles/**/*.js\""
},
"keywords": [
"code checker",
Expand Down
6 changes: 6 additions & 0 deletions test/es6-disable-styles/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: [
"../../configurations/es6-browser.js",
"../../configurations/es6-browser-disable-styles.js"
]
};
21 changes: 21 additions & 0 deletions test/es6-disable-styles/rules/es6/arrow-body-style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// DESCRIPTION = enforces no braces where they can be omitted
// STATUS = 0

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
// <!START
// Good
const a = () => 0;

// Bad
const b = () => {
return 0;
};
// END!>
33 changes: 33 additions & 0 deletions test/es6-disable-styles/rules/es6/arrow-parens.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// DESCRIPTION = require parens in arrow function arguments
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
/* eslint no-unused-expressions: 0*/
// <!START
// Bad
/*
a => {};
a => a;
a => { '\n'; };
a.then(foo => {});
a.then(foo => a);
*/

// Good
() => {};
a => {};
a => a;
a => {
"\n";
};
a.then(foo => {});

// END!>
24 changes: 24 additions & 0 deletions test/es6-disable-styles/rules/es6/arrow-spacing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// DESCRIPTION = require space before/after arrow function's arrow
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
/* eslint no-unused-expressions: 0*/
// <!START
// Bad
/*
()=>{};
()=> {};
() =>{};
*/

// Good
() => {};
// END!>
7 changes: 7 additions & 0 deletions test/es6-disable-styles/rules/es6/constructor-super.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DESCRIPTION = verify super() callings in constructors
// STATUS = 0

// <!START

// END!>
document.window.append("", null);
29 changes: 29 additions & 0 deletions test/es6-disable-styles/rules/es6/generator-star-spacing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// DESCRIPTION = enforce the spacing around the * in generator functions
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
/* eslint no-unused-expressions: 0*/
// <!START
// Bad
/*
function *generator() {
yield '44';
yield '55';
}
*/

// Good
function* generator() {
yield "44";
yield "55";
}

// END!>
19 changes: 19 additions & 0 deletions test/es6-disable-styles/rules/es6/no-class-assign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// DESCRIPTION = disallow modifying variables of class declarations
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
// <!START
// Bad
/*
class A { }
A = 0;
*/
// END!>
30 changes: 30 additions & 0 deletions test/es6-disable-styles/rules/es6/no-confusing-arrow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// DESCRIPTION = disallow arrow functions where they could be confused with comparisons
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
/* eslint no-constant-condition: 0*/
/* eslint arrow-parens: 0*/
/* eslint no-var: 0*/
// <!START
// Bad
/*
var x = a => 1 ? 2 : 3;
var x = (a) => 1 ? 2 : 3;
*/

// Good
var x = a => {
return 1 ? 2 : 3;
};
var x = a => {
return 1 ? 2 : 3;
};
// END!>
19 changes: 19 additions & 0 deletions test/es6-disable-styles/rules/es6/no-const-assign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// DESCRIPTION = disallow modifying variables that are declared using const
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
// <!START
// Bad
/*
const a = 0;
a = 1;
*/
// END!>
26 changes: 26 additions & 0 deletions test/es6-disable-styles/rules/es6/no-dupe-class-members.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// DESCRIPTION = disallow duplicate class members
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
// <!START
// Bad
/*
class Foo {
bar() { }
bar() { }
}
class Foo {
bar() { }
get bar() { }
}
*/
// END!>
26 changes: 26 additions & 0 deletions test/es6-disable-styles/rules/es6/no-duplicate-imports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// DESCRIPTION = disallow importing from the same path more than once
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
/* eslint import/no-unresolved: 0*/
/* eslint import/no-duplicates: 0*/
// <!START
// Bad
/*
import { merge } from 'module';
import something from 'another-module';
import { find } from 'module';
*/

// Good
import { merge, find } from "module";
import something from "another-module";
// END!>
21 changes: 21 additions & 0 deletions test/es6-disable-styles/rules/es6/no-new-symbol.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// DESCRIPTION = disallow symbol constructor
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
// <!START
// Bad
/*
const foo = new Symbol('foo');
*/

// Good
const foo = Symbol("foo");
// END!>
7 changes: 7 additions & 0 deletions test/es6-disable-styles/rules/es6/no-restricted-imports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DESCRIPTION = disallow specific imports
// STATUS = 0

// <!START

// END!>
document.window.append("", null);
7 changes: 7 additions & 0 deletions test/es6-disable-styles/rules/es6/no-this-before-super.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DESCRIPTION = disallow to use this/super before super() calling in constructors.
// STATUS = 0

// <!START

// END!>
document.window.append("", null);
7 changes: 7 additions & 0 deletions test/es6-disable-styles/rules/es6/no-useless-computed-key.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DESCRIPTION = disallow useless computed property keys
// STATUS = 2

// <!START

// END!>
document.window.append("", null);
7 changes: 7 additions & 0 deletions test/es6-disable-styles/rules/es6/no-useless-constructor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// DESCRIPTION = disallow unnecessary constructor
// STATUS = 2

// <!START

// END!>
document.window.append("", null);
25 changes: 25 additions & 0 deletions test/es6-disable-styles/rules/es6/no-useless-rename.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// DESCRIPTION = disallow renaming import, export, and destructured assignments to the same name
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
/* eslint import/no-mutable-exports: 0*/
/* eslint import/export: 0*/
/* eslint import/no-unresolved: 0*/
// <!START
// Bad
/*
import { foo as foo } from 'bar';
export { foo as foo };
export { foo as foo } from 'bar';
let { foo: foo } = bar;
let { 'foo': foo } = bar;
*/
// END!>
18 changes: 18 additions & 0 deletions test/es6-disable-styles/rules/es6/no-var.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// DESCRIPTION = require let or const instead of var
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
// <!START
// Bad
/*
var test = 'a';
*/
// END!>
23 changes: 23 additions & 0 deletions test/es6-disable-styles/rules/es6/object-shorthand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// DESCRIPTION = require method and property shorthand syntax for object literals
// STATUS = 2

/* eslint require-jsdoc: 0*/
/* eslint no-use-before-define: 0*/
/* eslint no-undef: 0*/
/* eslint no-unused-vars: 0*/
/* eslint no-unreachable: 0*/
/* eslint no-empty: 0*/
/* eslint no-empty-function: 0*/
/* eslint no-shadow: 0*/
/* eslint no-redeclare: 0*/
// <!START
// Bad
/*
const foo = {
w: function () {},
x: function* () {},
[y]: function () {},
z: z
};
*/
// END!>
Loading

0 comments on commit 3367b38

Please sign in to comment.