Skip to content

Commit 1072157

Browse files
committed
release: 0.5.0 for eslint 8 & es2024
1 parent 1ce5ebf commit 1072157

File tree

8 files changed

+69
-41
lines changed

8 files changed

+69
-41
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
## Important Note
99

10-
Since eslint 6 changes it's config resolving mechanism, config module can not share outside project root.
10+
Since eslint 6 changes its config resolving mechanism, config module can not share outside project root.
1111

1212
<ins>**This project has been changed to a plugin module and renamed (only package name).**</ins>
1313

@@ -20,8 +20,8 @@ To use this config, add this to your `package.json`
2020
```json
2121
{
2222
"devDependencies" : {
23-
"eslint" : "7.4.0",
24-
"eslint-plugin-coremail" : "0.4.1"
23+
"eslint" : "8.46.0",
24+
"eslint-plugin-coremail" : "0.5.0"
2525
}
2626
}
2727
```
@@ -51,7 +51,7 @@ Then, add this to your `.eslintrc.yaml` file:
5151
## Learn more
5252
5353
For the full listing of rules that eslint supports, and more, visit
54-
For more information the full listing of rules, editor plugins, FAQs, and more, visit the
54+
For more information on the full listing of rules, editor plugins, FAQs, and more, visit the
5555
[ESLint official site](http://eslint.org/docs/rules/).
5656
5757
## License

config/compliant.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/**
2-
* Copyright (c) 2020 Coremail.cn, Ltd. All Rights Reserved.
2+
* Copyright (c) 2023 Coremail.cn, Ltd. All Rights Reserved.
33
*/
44

55
const error = 'error';
66

77
module.exports = {
88

9-
parserOptions : {
10-
ecmaVersion : 3,
11-
},
9+
parserOptions : {ecmaVersion : 3, allowReserved : true},
1210

1311
rules : {
1412
/* eslint-disable indent *//* @formatter:off */

config/standard.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
/**
2-
* Copyright (c) 2020 Coremail.cn, Ltd. All Rights Reserved.
2+
* Copyright (c) 2023 Coremail.cn, Ltd. All Rights Reserved.
33
*/
44

5-
const error = 'error', off = 'off', first = 'first';
5+
const error = 'error', off = 'off', first = 'first', never = 'never';
66

77
module.exports = {
88

9-
extends : ['standard'],
10-
11-
parserOptions : {
12-
ecmaVersion : 2020,
13-
},
9+
extends : ['standard'],
10+
parserOptions : { ecmaVersion : 2024 },
1411

12+
/* eslint-disable indent */// @formatter:off
1513
rules : {
16-
/* eslint-disable indent *//* @formatter:off */
17-
1814
'no-var' : [error],
1915
'no-tabs' : [error],
2016
'indent' : [error, 4, {
@@ -29,10 +25,10 @@ module.exports = {
2925
MemberExpression : off,
3026
ignoreComments : true,
3127
}],
32-
'semi' : [off, 'never'],
28+
'semi' : [off, never],
3329
'quotes' : [error, 'single', 'avoid-escape'],
3430
'arrow-parens' : [error, 'as-needed'],
35-
'operator-linebreak' : [error, 'before'], // corrected now, ternary operator should has nothing special
31+
'operator-linebreak' : [error, 'before'], // corrected now, ternary operator should have nothing special
3632
'comma-dangle' : [error, { // more friendly to VCS system / manual code arrangements
3733
arrays : 'always-multiline',
3834
objects : 'always-multiline',
@@ -52,7 +48,7 @@ module.exports = {
5248
'dot-notation' : [off],
5349
'quote-props' : [off],
5450
'object-curly-spacing' : [off],
55-
'space-before-function-paren' : [error, {named: 'never', anonymous: 'ignore', asyncArrow: 'always'}],
51+
'space-before-function-paren' : [error, {named: never, anonymous: 'ignore', asyncArrow: 'always'}],
5652
'space-before-blocks' : [error],
5753
'no-multiple-empty-lines' : [off],
5854
'no-multi-spaces' : [error, {
@@ -65,5 +61,15 @@ module.exports = {
6561
'space-infix-ops' : [error],
6662
'spaced-comment' : [error],
6763
'eol-last' : [error],
64+
'camelcase' : [error, {
65+
properties : never,
66+
ignoreDestructuring : true,
67+
ignoreGlobals : true,
68+
}],
69+
'multiline-ternary' : [off],
70+
'array-callback-return' : [off],
71+
'no-empty' : [off],
72+
'n/no-path-concat' : [off],
73+
'n/no-exports-assign' : [off],
6874
},
6975
};

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "eslint-plugin-coremail",
33
"description" : "Javascript Standard Style - ESLint Shareable Config for coremail.cn",
4-
"version" : "0.4.1",
4+
"version" : "0.5.0",
55
"author" : {
66
"name" : "William Leung",
77
"email" : "[email protected]"
@@ -28,19 +28,18 @@
2828
},
2929

3030
"peerDependencies" : {
31-
"eslint" : "^7.4.0"
31+
"eslint" : "^8.46.0"
3232
},
3333

3434
"devDependencies" : {
35-
"eslint" : "~7.4.0"
35+
"eslint" : "~8.46.0"
3636
},
3737

3838
"dependencies" : {
39-
"eslint-plugin-promise" : "~4.2.1",
40-
"eslint-plugin-import" : "~2.22.0",
39+
"eslint-plugin-promise" : "~6.1.1",
40+
"eslint-plugin-import" : "~2.28.0",
4141
"eslint-plugin-node" : "~11.1.0",
42-
"eslint-plugin-standard" : "~4.0.1",
43-
"eslint-config-standard" : "~14.1.1"
42+
"eslint-config-standard" : "~17.1.0"
4443
},
4544

4645
"eslintConfig" : {

test/samples/es3/.eslintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
---
3+
root : true
4+
extends : "../../../config/compliant.js"

test/samples/es3/es3-sample.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
3+
console.log([
4+
1,
5+
2,
6+
'never comma-dangle'
7+
], {
8+
'var' : 'keyword must be quoted',
9+
KKKKK : keywords({'long' : long(), 'final' : final()}),
10+
last : 'never comma-dangle'
11+
});
12+
13+
function keywords(x, long, final) {
14+
return console.log(x['long'], x['final'], long, final);
15+
}
16+
17+
function long() {
18+
}
19+
20+
function final() {
21+
}

test/samples/sample3-spaces.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22

3-
// noinspection NpmUsedModulesInstalled
3+
// noinspection ES6UnusedImports
44
import {Component} from 'react'
55

66
// noinspection JSUnusedLocalSymbols
@@ -18,11 +18,11 @@ function foo(_x, y, z) {
1818
for (let j = 0; j < 10; j++) {
1919
switch (j) {
2020
case 0:
21-
// noinspection JSUndeclaredVariable
21+
// noinspection JSUndeclaredVariable, JSUnresolvedReference
2222
value = "zero";
2323
break;
2424
case 1:
25-
// noinspection JSUndeclaredVariable
25+
// noinspection JSUndeclaredVariable, JSUnresolvedReference
2626
value = "one";
2727
break;
2828
}

test/samples/sample4-wrapping.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22

3-
// noinspection NpmUsedModulesInstalled
3+
// noinspection JSUnresolvedReference, ES6UnusedImports
44
import {
55
Component,
66
property1,
@@ -24,8 +24,8 @@ let foo = {
2424
b : {id : 456, type : "Int"},
2525
},
2626
// fBar : function (x,y);
27-
fOne : function (a, b, c, d,
28-
e, f, g, h) {
27+
fOne : function (a, b, c, d, e,
28+
f, g, h, i, j) {
2929
// noinspection JSUnusedLocalSymbols
3030
let x = a
3131
+ b
@@ -43,7 +43,6 @@ let foo = {
4343
// noinspection JSUnusedAssignment
4444
z = a === 10 ? 'yes' : 'no';
4545
let colors = ['red', 'green', 'blue', 'black', 'white', 'gray'];
46-
// noinspection JSUndeclaredVariable
4746
for (j = 0; j < 2; j++) i = a;
4847
// noinspection JSUnusedLocalSymbols, ES6ConvertVarToLetConst
4948
for (let i = 0; i
@@ -54,7 +53,7 @@ let foo = {
5453

5554
chainedCallSample(a, b, c, d,
5655
e, f, g, h) {
57-
// noinspection JSUnresolvedVariable, JSUnresolvedFunction, ES6ModulesDependencies, JSValidateTypes
56+
// noinspection JSUnresolvedVariable, JSUnresolvedFunction, ES6ModulesDependencies, JSValidateTypes, JSCheckFunctionSignatures
5857
chainRoot.firstCall(a, b, c, d,
5958
e, f, g, h).secondCall(a, b, c, d).thirdCall(a, b, c, d).fourthCall().q(a).r(a, b).s();
6059
// noinspection JSUnresolvedVariable, JSUnresolvedFunction, ES6ModulesDependencies, JSValidateTypes
@@ -70,12 +69,12 @@ let foo = {
7069
/**
7170
* Function JSDoc. Long lines can be wrapped with 'Comments'/'Wrap at right margin' option
7271
* @param {string} a Parameter A description.
73-
* @param {string} b Parameter B description. Can extend beyond the right margin.
72+
* @param {string} b Parameter B description. It can extend beyond the right margin.
7473
*/
7574
fTwo : function (a, b, c, d) {
76-
// noinspection JSUnresolvedFunction
77-
foo(a, b, c, d); // Line comment which can be wrapped if long.
78-
// noinspection ConstantIfStatementJS
75+
// noinspection JSUnresolvedFunction, JSValidateTypes
76+
foo(a, b, c, d); // line comment which can be wrapped if long.
77+
// noinspection ConstantIfStatementJS, PointlessBooleanExpressionJS
7978
if (true) {
8079
return c;
8180
}
@@ -134,6 +133,7 @@ let foo = {
134133
},
135134
};
136135

136+
// noinspection NpmUsedModulesInstalled
137137
funDeclare(require('jquery'), 300, 20, 10);
138138

139139
function funDeclare($,
@@ -144,5 +144,5 @@ function funDeclare($,
144144
)));
145145
}
146146

147-
/* eslint curly: "off" */
148-
/* eslint brace-style: "off" */
147+
/* eslint curly: off */
148+
/* eslint brace-style: off */

0 commit comments

Comments
 (0)