-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathes2015.js
50 lines (42 loc) · 1.4 KB
/
es2015.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*eslint constructor-super: "error"*/
class A extends B {
constructor() {
// Constructors of derived classes must call super().
}
}
/*eslint no-this-before-super: "error"*/
class A extends B {
constructor() {
this.a = 0; // In the constructor of derived classes,
// if this are used before super() calls, it raises a reference error.
super();
}
}
/*eslint no-dupe-class-members: "error"*/
class Foo {
bar() { }
bar() { } // Duplicate names in class members.
}
/*eslint no-class-assign: "error"*/
class C { } // Creates the `A` variable.
C = 0; // Modify the `A` variable. But the modification is a mistake in most cases.
/*eslint no-const-assign: "error"*/
const a = 0;
a += 1; // We cannot modify variables that are declared using const keyword.
// It will raise a runtime error.
/*eslint no-new-symbol: "error"*/
var foo = new Symbol('foo'); // The Symbol constructor is not intended to be used with the new operator,
// but to be called as a function.
/*eslint require-yield: "error"*/
function* foo() {
return 10; // This generator functions that do not have the `yield` keyword.
}
/*eslint class-methods-use-this: "error"*/
class A {
constructor() {
this.a = "hi";
}
sayHi() {
console.log("hi"); // The sayHi method doesn’t use this, so we can make it a static method.
}
}