Skip to content

Commit 0e08e98

Browse files
authored
Merge pull request #45 from htmlacademy/feature/update-source
Release 1.0.0
2 parents da56d30 + b490d68 commit 0e08e98

File tree

13 files changed

+200
-15
lines changed

13 files changed

+200
-15
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,25 @@ For validating **ECMAScript 2015 (ES6)** in **Node.js** environment project use
6161
}
6262
}
6363
```
64+
65+
For validating **ECMAScript 2018 (ES9)** project use `es9` version:
66+
67+
```json
68+
{
69+
"parserOptions": {
70+
"ecmaVersion": 9,
71+
"sourceType": "module"
72+
},
73+
"env": {
74+
"es2017": true,
75+
"browser": true,
76+
"commonjs": true,
77+
},
78+
"extends": "htmlacademy/basic",
79+
"rules": {
80+
// Additional rules...
81+
}
82+
}
83+
```
6484
[travis-image]: https://travis-ci.org/htmlacademy/eslint-config-htmlacademy.svg?branch=master
6585
[travis-url]: https://travis-ci.org/htmlacademy/eslint-config-htmlacademy

basic.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
extends: 'eslint:recommended',
3+
rules: {
4+
// Possible Errors
5+
// https://eslint.org/docs/rules/#possible-errors
6+
// ---------------------------------------------
7+
'no-console': 'error',
8+
// Stylistic Issues
9+
// https://eslint.org/docs/rules/#stylistic-issues
10+
// ---------------------------------------------
11+
'comma-dangle': ['error', {
12+
'arrays': 'always-multiline',
13+
'objects': 'always-multiline',
14+
'functions': 'always-multiline',
15+
}],
16+
'indent': ['error', 2, {
17+
SwitchCase: 1,
18+
}],
19+
'quotes': ['error', 'single'],
20+
// ECMAScript 6
21+
// https://eslint.org/docs/rules/#ecmascript-6
22+
// ---------------------------------------------
23+
'no-var': ['error'],
24+
},
25+
};

changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
1.0.0 / 2021-01-08
2+
==================
3+
4+
* 1.0.0
5+
* update eslint to 7.16.0
6+
* adds ES9 configuration extending eslint:recommended rules
7+
* adds tests for es9 configuration
8+
* updates README.md according to new configuration
9+
* fixes tests for es5 and es6 configurations
10+
111
0.6.0 / 2020-09-09
212
==================
313

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-htmlacademy",
3-
"version": "0.6.0",
3+
"version": "1.0.0",
44
"description": "ESLint shareable config for the HTML Academy style",
55
"files": [
66
"es5.js",
@@ -45,9 +45,9 @@
4545
},
4646
"homepage": "https://github.com/htmlacademy/eslint-config-htmlacademy#readme",
4747
"peerDependencies": {
48-
"eslint": ">=4.2.0"
48+
"eslint": ">=7.16.0"
4949
},
5050
"devDependencies": {
51-
"eslint": "4.2.0"
51+
"eslint": "7.16.0"
5252
}
5353
}

test/basic/.eslintrc.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const config = require('../../basic');
2+
3+
config.parserOptions = {
4+
ecmaVersion: 9,
5+
sourceType: 'module',
6+
};
7+
config.env = {
8+
'es2017': true,
9+
'browser': true,
10+
'commonjs': true,
11+
};
12+
13+
module.exports = config;

test/basic/comma-dangles.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const arr0 = ['a', 'b', 'c'];
2+
const arr1 = [
3+
'a',
4+
'b',
5+
'c',
6+
];
7+
8+
const obj0 = {q: 'q', w: 'w'};
9+
const obj1 = {
10+
q: 'q',
11+
w: 'w',
12+
};
13+
14+
const func0 = (a, b) => {
15+
return a + b;
16+
};
17+
const func1 = (
18+
a,
19+
b,
20+
) => {
21+
return a + b;
22+
};
23+
24+
func0(
25+
obj0.a,
26+
obj0.b,
27+
);
28+
29+
throw new Error(arr0, arr1, obj0, obj1, func0, func1);

test/basic/eslint.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
extends: 'eslint:recommended',
3+
rules: {
4+
// Possible Errors
5+
// https://eslint.org/docs/rules/#possible-errors
6+
// ---------------------------------------------
7+
'no-console': 'error',
8+
// Stylistic Issues
9+
// https://eslint.org/docs/rules/#stylistic-issues
10+
// ---------------------------------------------
11+
'comma-dangle': ['error', {
12+
'arrays': 'always-multiline',
13+
'objects': 'always-multiline',
14+
'functions': 'always-multiline',
15+
}],
16+
'indent': ['error', 2, {
17+
SwitchCase: 1,
18+
}],
19+
'quotes': ['error', 'single'],
20+
// ECMAScript 6
21+
// https://eslint.org/docs/rules/#ecmascript-6
22+
// ---------------------------------------------
23+
'no-var': ['error'],
24+
},
25+
};

test/basic/indent.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'use strict';
2+
3+
// Continuation, aka MemberExpression
4+
const promise = window.Promise.resolve(true);
5+
promise.
6+
then(function (data) {
7+
return data;
8+
}).
9+
then(function (truthy) {
10+
return !truthy;
11+
}).
12+
catch(function () {
13+
return false;
14+
});
15+
16+
// Function expression
17+
const fun = function (first, second) {
18+
return first + second;
19+
};
20+
21+
// Function declaration
22+
function Constructor(first, second) {
23+
this.data = {
24+
first: first,
25+
second: second,
26+
};
27+
}
28+
29+
// Calling site arguments
30+
const myObject = new Constructor(
31+
'Petya',
32+
'Vasya',
33+
);
34+
myObject.toString();
35+
36+
const result = fun(
37+
'one',
38+
'two',
39+
);
40+
result.toString();
41+
42+
// Switch
43+
const a = 'a';
44+
45+
switch(a) {
46+
case 'a':
47+
break;
48+
case 'b':
49+
break;
50+
}

test/basic/no-var.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let a = 0;
2+
const B = 'B';
3+
4+
throw new Error (a, B);

test/basic/quotes.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const a = 'Anything string';
2+
const b = `Anything
3+
string`;
4+
const c = `This's a ${a}`;
5+
6+
throw new Error(a, b, c);

test/es5/.eslintrc.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
let config = require('../../es5');
1+
'use strict';
2+
3+
var config = require('../../es5');
4+
25
config.env = {
36
'es6': false,
47
'browser': true,
58
'commonjs': true
69
};
710

8-
module.exports = config;
11+
module.exports = config;

test/es6/.eslintrc.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
const config = require('../../es6');
2-
const es5config = require('../../es5');
1+
const config = require(`../../es6`);
2+
const es5config = require(`../../es5`);
33

44
const es5Rules = es5config.rules;
55

66
config.rules = {
7-
...config.rules,
8-
...es5Rules
7+
...es5Rules,
8+
...config.rules
99
};
1010

1111
config.parserOptions = {
12-
ecmaVersion: 6,
13-
sourceType: 'module'
12+
ecmaVersion: 9,
13+
sourceType: `module`
1414
};
1515
config.env = {
1616
'es6': true,
1717
'browser': true,
1818
'commonjs': true
1919
};
2020

21-
module.exports = config;
21+
module.exports = config;

test/node/.eslintrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
const config = require('../../node');
1+
const config = require(`../../node`);
22
config.parserOptions = {
33
ecmaVersion: 6,
4-
sourceType: 'module'
4+
sourceType: `module`
55
};
66
config.env = {
77
'es6': true,
@@ -10,4 +10,4 @@ config.env = {
1010
'commonjs': true
1111
};
1212

13-
module.exports = config;
13+
module.exports = config;

0 commit comments

Comments
 (0)