Skip to content

Commit 7805f2c

Browse files
committed
release: 0.4.0 for eslint 6, package renamed to eslint-plugin-coremail
1 parent eb5cc8f commit 7805f2c

File tree

7 files changed

+125
-80
lines changed

7 files changed

+125
-80
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Ginhing
3+
Copyright (c) 2020 Coremail.cn
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
# ESLint config files for Coremail (c)
33
[![npm][npm-image]][npm-url]
44

5-
[npm-image]: https://img.shields.io/npm/v/eslint-config-coremail.svg
6-
[npm-url]: https://npmjs.org/package/eslint-config-coremail
5+
[npm-image]: https://img.shields.io/npm/v/eslint-plugin-coremail.svg
6+
[npm-url]: https://npmjs.org/package/eslint-plugin-coremail
7+
8+
## Important Note
9+
10+
Since eslint 6 changes it's config resolving mechanism, config module can not share outside project root.
11+
12+
<ins>**This project has been changed to a plugin module and renamed (only package name).**</ins>
13+
14+
For more information, check this issue: https://github.com/eslint/eslint/issues/12654
715

816
## Usage
917

@@ -12,16 +20,16 @@ To use this config, add this to your `package.json`
1220
```json
1321
{
1422
"devDependencies" : {
15-
"eslint" : "4.19.1",
16-
"eslint-config-coremail" : "0.3.0"
23+
"eslint" : "6.7.2",
24+
"eslint-plugin-coremail" : "0.4.0"
1725
}
1826
}
1927
```
2028

2129
or install manually
2230

2331
```bash
24-
npm install eslint eslint-config-coremail
32+
npm install eslint eslint-plugin-coremail
2533
```
2634

2735

@@ -30,13 +38,13 @@ Then, add this to your `.eslintrc.yaml` file:
3038
- Using standard rules
3139

3240
```yaml
33-
extends: coremail
41+
extends: plugin:coremail/standard
3442
```
3543
3644
- Applying compliant rules (old IE compatible)
3745
3846
```yaml
39-
extends: coremail/config/compliant.yaml
47+
extends: plugin:coremail/compliant
4048
```
4149
4250
@@ -48,4 +56,4 @@ For more information the full listing of rules, editor plugins, FAQs, and more,
4856
4957
## License
5058
51-
MIT. Copyright (c) [Coremail](http://coremail.cn).
59+
MIT. Copyright (c) [Coremail](http://coremail.cn).

config/compliant.js

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1+
/**
2+
* Copyright (c) 2020 Coremail.cn, Ltd. All Rights Reserved.
3+
*/
14

5+
const error = 'error';
26

3-
parserOptions:
4-
ecmaVersion : 3
7+
module.exports = {
58

9+
parserOptions : {
10+
ecmaVersion : 3,
11+
},
612

7-
rules:
8-
# here two rules are only for ES3 compliant / IE6 supports
9-
quote-props :
10-
- error
11-
- as-needed
12-
- keywords : true
13-
unnecessary : false
14-
dot-notation :
15-
- error
16-
- allowKeywords : false
17-
allowPattern : .*
18-
comma-dangle : [error, never]
19-
# ES3 compliant END
20-
no-tabs : [error]
13+
rules : {
14+
/* eslint-disable indent *//* @formatter:off */
2115

16+
// here two rules are only for ES3 compliant / IE6 supports
17+
'quote-props' : [error, 'as-needed', {
18+
keywords : true,
19+
unnecessary : false,
20+
}],
21+
'dot-notation' : [error, {
22+
allowKeywords : false,
23+
allowPattern : '.*',
24+
}],
25+
'comma-dangle' : [error, 'never'],
26+
// ES3 compliant END
27+
'no-tabs' : [error],
28+
},
29+
};

config/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) 2020 Coremail.cn, Ltd. All Rights Reserved.
3+
*/
4+
5+
module.exports = {
6+
configs : {
7+
standard : require('./standard'),
8+
compliant : require('./compliant'),
9+
},
10+
};

config/standard.js

Lines changed: 62 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,68 @@
1+
/**
2+
* Copyright (c) 2020 Coremail.cn, Ltd. All Rights Reserved.
3+
*/
14

5+
const error = 'error', off = 'off', first = 'first';
26

3-
extends: [standard]
7+
module.exports = {
48

9+
extends : ['standard'],
510

6-
parserOptions:
7-
ecmaVersion: 2018
11+
parserOptions : {
12+
ecmaVersion : 2020,
13+
},
814

15+
rules : {
16+
/* eslint-disable indent *//* @formatter:off */
917

10-
rules:
11-
no-var : [error]
12-
no-tabs : [error]
13-
indent :
14-
- error
15-
- 4
16-
- SwitchCase : 0
17-
VariableDeclarator : { var : 1, let : 1, const : 1 }
18-
ImportDeclaration : first
19-
ArrayExpression : first
20-
ObjectExpression : first
21-
FunctionDeclaration : {parameters: first}
22-
FunctionExpression : {parameters: first}
23-
CallExpression : {arguments: 1}
24-
MemberExpression : off
25-
ignoreComments : true
26-
semi : [off, never]
27-
quotes : [error, single, avoid-escape]
28-
arrow-parens : [error, as-needed]
29-
operator-linebreak : [error, before] # corrected now, ternary operator should has nothing special
30-
comma-dangle : [error, always-multiline] # more friendly to VCS system / manual code arrangements
31-
padded-blocks : [off] # extra space in blocks should not be a problem
32-
prefer-const : [off]
33-
yoda : [off]
34-
no-new : [off]
35-
default-case : [off]
36-
one-var : [off]
37-
space-before-function-paren : [error, {named: never, anonymous: ignore, asyncArrow: always}]
38-
space-before-blocks : [error]
39-
no-multiple-empty-lines : [off]
40-
no-multi-spaces :
41-
- error
42-
- exceptions: {VariableDeclarator: true, ImportDeclaration: true}
43-
ignoreEOLComments: true
44-
keyword-spacing : [error]
45-
key-spacing : [off]
46-
comma-spacing : [error]
47-
space-infix-ops : [error]
48-
spaced-comment : [error]
49-
eol-last : [error]
18+
'no-var' : [error],
19+
'no-tabs' : [error],
20+
'indent' : [error, 4, {
21+
SwitchCase : 0,
22+
VariableDeclarator : { var : 1, let : 1, const : 1 },
23+
ImportDeclaration : first,
24+
ArrayExpression : first,
25+
ObjectExpression : first,
26+
FunctionDeclaration : {parameters: first},
27+
FunctionExpression : {parameters: first},
28+
CallExpression : {arguments: 1},
29+
MemberExpression : off,
30+
ignoreComments : true,
31+
}],
32+
'semi' : [off, 'never'],
33+
'quotes' : [error, 'single', 'avoid-escape'],
34+
'arrow-parens' : [error, 'as-needed'],
35+
'operator-linebreak' : [error, 'before'], // corrected now, ternary operator should has nothing special
36+
'comma-dangle' : [error, { // more friendly to VCS system / manual code arrangements
37+
arrays : 'always-multiline',
38+
objects : 'always-multiline',
39+
imports : 'always-multiline',
40+
exports : 'always-multiline',
41+
functions : 'only-multiline',
42+
}],
43+
'padded-blocks' : [off], // extra space in blocks should not be a problem
44+
'prefer-const' : [off],
45+
'yoda' : [off],
46+
'no-new' : [off],
47+
'no-void' : [off],
48+
'no-case-declarations' : [off],
49+
'default-case' : [off],
50+
'one-var' : [off],
51+
'dot-notation' : [off],
52+
'quote-props' : [off],
53+
'object-curly-spacing' : [off],
54+
'space-before-function-paren' : [error, {named: 'never', anonymous: 'ignore', asyncArrow: 'always'}],
55+
'space-before-blocks' : [error],
56+
'no-multiple-empty-lines' : [off],
57+
'no-multi-spaces' : [error, {
58+
exceptions: {VariableDeclarator: true, ImportDeclaration: true},
59+
ignoreEOLComments: true,
60+
}],
61+
'keyword-spacing' : [error],
62+
'key-spacing' : [off],
63+
'comma-spacing' : [error],
64+
'space-infix-ops' : [error],
65+
'spaced-comment' : [error],
66+
'eol-last' : [error],
67+
},
68+
};

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name" : "eslint-config-coremail",
2+
"name" : "eslint-plugin-coremail",
33
"description" : "Javascript Standard Style - ESLint Shareable Config for coremail.cn",
4-
"version" : "0.3.0",
4+
"version" : "0.4.0",
55
"author" : {
66
"name" : "William Leung",
77
"email" : "[email protected]"
@@ -21,30 +21,30 @@
2121
},
2222

2323
"license" : "MIT",
24-
"main" : "config/standard.yaml",
24+
"main" : "config/index.js",
2525

2626
"scripts" : {
2727
"test" : "eslint ."
2828
},
2929

3030
"peerDependencies" : {
31-
"eslint" : "^4.16.0"
31+
"eslint" : "^6.7.2"
3232
},
3333

3434
"devDependencies" : {
35-
"eslint" : "~4.19.1"
35+
"eslint" : "~6.7.2"
3636
},
3737

3838
"dependencies" : {
39-
"eslint-plugin-promise" : "~3.7.0",
40-
"eslint-plugin-import" : "~2.11.0",
41-
"eslint-plugin-node" : "~6.0.1",
42-
"eslint-plugin-standard" : "~3.1.0",
43-
"eslint-config-standard" : "~11.0.0"
39+
"eslint-plugin-promise" : "~4.2.1",
40+
"eslint-plugin-import" : "~2.18.2",
41+
"eslint-plugin-node" : "~10.0.0",
42+
"eslint-plugin-standard" : "~4.0.1",
43+
"eslint-config-standard" : "~14.1.0"
4444
},
4545

4646
"eslintConfig" : {
4747
"root" : true,
48-
"extends" : "./config/standard.yaml"
48+
"extends" : "./config/standard.js"
4949
}
5050
}

test/samples/sample5-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018 Mailtech.cn, Ltd. All Rights Reserved.
2+
* Copyright (c) 2020 Coremail.cn, Ltd. All Rights Reserved.
33
*/
44

55
{ // eslint-disable-line no-lone-blocks

0 commit comments

Comments
 (0)