@digest/eslint-config 4.8.2 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/package.json +51 -46
- package/src/eslint.config.js +103 -0
- package/src/general.eslint.config.js +105 -0
- package/src/index.js +15 -12
- package/src/yaml.eslint.config.js +31 -0
- package/src/.eslintrc.js +0 -293
package/README.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
|
|
2
|
+
<img alt="Digest Crane" src="https://gitlab.com/digested/node-digest/raw/master/packages/webpack/share/favicon.png" />
|
|
3
3
|
</div><br>
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
|
-
|
|
6
|
+
<h1>@digest/eslint-config</h1>
|
|
7
7
|
</div>
|
|
8
8
|
|
|
9
9
|
<div align="center">
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
<a href="https://commitizen.github.io/cz-cli/"><img alt="Commitizen Friendly" src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?maxAge=2592000" /></a>
|
|
11
|
+
<a href="https://github.com/semantic-release/semantic-release"><img alt="Semantic Release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?maxAge=2592000" /></a>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
14
|
<div align="center">
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
<a href="https://gitlab.com/digested/node-digest/-/commits/master" target="_blank">
|
|
16
|
+
<img alt="Status" aria-hidden="" src="https://gitlab.com/digested/node-digest/badges/master/pipeline.svg">
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://digested.gitlab.io/node-digest/coverage">
|
|
19
|
+
<img alt="Coverage Report" src="https://gitlab.com/digested/node-digest/badges/master/coverage.svg" />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://www.npmjs.org/package/@digest/webpack">
|
|
22
|
+
<img alt="NPM Version" src="http://img.shields.io/npm/v/@digest/eslint-config.svg?maxAge=86400" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://www.gnu.org/licenses/lgpl-3.0.en.html">
|
|
25
|
+
<img alt="License LGPL 3.0 or later" src="https://img.shields.io/npm/l/@digest/eslint-config.svg?maxAge=2592000" />
|
|
26
|
+
</a>
|
|
27
|
+
<a href="https://github.com/gajus/eslint-config-canonical">
|
|
28
|
+
<img alt="Code Style Canonical" src="https://img.shields.io/badge/code%20style-canonical-blue.svg?maxAge=2592000" />
|
|
29
|
+
</a>
|
|
30
30
|
</div>
|
|
31
31
|
<br />
|
|
32
32
|
<br />
|
package/package.json
CHANGED
|
@@ -1,48 +1,53 @@
|
|
|
1
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
|
-
|
|
2
|
+
"name": "@digest/eslint-config",
|
|
3
|
+
"title": "ESLint Digest",
|
|
4
|
+
"license": "LGPL-3.0-or-later",
|
|
5
|
+
"version": "4.9.0",
|
|
6
|
+
"description": "Digested ESLint configurations",
|
|
7
|
+
"author": "wallzero @wallzeroblog (http://wallzero.com)",
|
|
8
|
+
"contributors": [
|
|
9
|
+
{
|
|
10
|
+
"name": "Connor Schlesiger",
|
|
11
|
+
"email": "connor@schlesiger.ca",
|
|
12
|
+
"position": "Initial and Lead Developer"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"main": "src/eslint.config.js",
|
|
16
|
+
"files": [
|
|
17
|
+
"/src/eslint.config.js",
|
|
18
|
+
"/src/general.eslint.config.js",
|
|
19
|
+
"/src/yaml.eslint.config.js",
|
|
20
|
+
"/src/index.js",
|
|
21
|
+
"COPYING.md",
|
|
22
|
+
"COPYING.LESSER.md"
|
|
23
|
+
],
|
|
24
|
+
"homepage": "https://gitlab.com/digested/node-digest/tree/master/packages/eslint-config",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://gitlab.com/digested/node-digest.git"
|
|
28
|
+
},
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://gitlab.com/digested/node-digest/issues"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"lint": "run-p lint:es",
|
|
34
|
+
"lint:es": "eslint",
|
|
35
|
+
"clean": "rimraf node_modules package-lock.json npm-debug.log"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@digest/scripts": "^4.0.0",
|
|
39
|
+
"@eslint/js": "9.14.0",
|
|
40
|
+
"@stylistic/eslint-plugin-js": "^2.10.1",
|
|
41
|
+
"eslint": "^9.14.0",
|
|
42
|
+
"eslint-config-canonical": "^44.3.28",
|
|
43
|
+
"eslint-plugin-canonical": "^5.0.0",
|
|
44
|
+
"eslint-plugin-import": "^2.31.0",
|
|
45
|
+
"globals": "^15.12.0",
|
|
46
|
+
"typescript-eslint": "^8.14.0"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"digest",
|
|
50
|
+
"eslint"
|
|
51
|
+
],
|
|
52
|
+
"gitHead": "3adbdb9c769b07590ee9f012304455e0f26a4d03"
|
|
48
53
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
eslint-disable
|
|
3
|
+
unicorn/prefer-module,
|
|
4
|
+
canonical/filename-match-exported
|
|
5
|
+
*/
|
|
6
|
+
/*
|
|
7
|
+
|
|
8
|
+
This file is part of the Node Digest.
|
|
9
|
+
|
|
10
|
+
Node Digest is free software: you can redistribute it and/or modify it under
|
|
11
|
+
the terms of the GNU Lesser General Public License as published by the Free
|
|
12
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
13
|
+
any later version.
|
|
14
|
+
|
|
15
|
+
Node Digest is distributed in the hope that it will be useful, but WITHOUT
|
|
16
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
18
|
+
for more details.
|
|
19
|
+
|
|
20
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
21
|
+
along with Node Digest . If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const generalConfigs = require('./general.eslint.config');
|
|
26
|
+
const yamlConfigs = require('./yaml.eslint.config');
|
|
27
|
+
const {
|
|
28
|
+
config: {
|
|
29
|
+
eslintBabel,
|
|
30
|
+
eslintGraphQL,
|
|
31
|
+
eslintJest,
|
|
32
|
+
eslintReact,
|
|
33
|
+
eslintReactNative,
|
|
34
|
+
eslintTypeScript
|
|
35
|
+
}
|
|
36
|
+
} = require('@digest/scripts');
|
|
37
|
+
|
|
38
|
+
const getBabelConfig = () => {
|
|
39
|
+
if (eslintBabel) {
|
|
40
|
+
// eslint-disable-next-line n/global-require, n/no-extraneous-require, import/no-extraneous-dependencies
|
|
41
|
+
return require('@digest/eslint-config-babel');
|
|
42
|
+
} else {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const getReactConfig = () => {
|
|
48
|
+
if (eslintReact) {
|
|
49
|
+
// eslint-disable-next-line n/global-require, n/no-extraneous-require, import/no-extraneous-dependencies
|
|
50
|
+
return require('@digest/eslint-config-react');
|
|
51
|
+
} else {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const getReactNativeConfig = () => {
|
|
57
|
+
if (eslintReact && eslintReactNative) {
|
|
58
|
+
// eslint-disable-next-line n/global-require, n/no-extraneous-require, import/no-extraneous-dependencies
|
|
59
|
+
return require('@digest/eslint-config-react-native');
|
|
60
|
+
} else {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const getTypeScriptConfig = () => {
|
|
66
|
+
if (eslintTypeScript) {
|
|
67
|
+
// eslint-disable-next-line n/global-require, n/no-extraneous-require, import/no-extraneous-dependencies
|
|
68
|
+
return require('@digest/eslint-config-typescript');
|
|
69
|
+
} else {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const getGraphQLConfig = () => {
|
|
75
|
+
if (eslintGraphQL) {
|
|
76
|
+
// eslint-disable-next-line n/global-require, n/no-extraneous-require, import/no-extraneous-dependencies
|
|
77
|
+
return require('@digest/eslint-config-graphql');
|
|
78
|
+
} else {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const getJestConfig = () => {
|
|
84
|
+
if (eslintJest) {
|
|
85
|
+
// eslint-disable-next-line n/global-require, n/no-extraneous-require, import/no-extraneous-dependencies
|
|
86
|
+
return require('@digest/eslint-config-jest');
|
|
87
|
+
} else {
|
|
88
|
+
return [];
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const configs = [
|
|
93
|
+
...generalConfigs,
|
|
94
|
+
...yamlConfigs,
|
|
95
|
+
...getReactConfig(),
|
|
96
|
+
...getReactNativeConfig(),
|
|
97
|
+
...getBabelConfig(),
|
|
98
|
+
...getTypeScriptConfig(),
|
|
99
|
+
...getGraphQLConfig(),
|
|
100
|
+
...getJestConfig()
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
module.exports = configs;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/*
|
|
2
|
+
eslint-disable
|
|
3
|
+
unicorn/prefer-module,
|
|
4
|
+
canonical/filename-match-exported
|
|
5
|
+
*/
|
|
6
|
+
/*
|
|
7
|
+
|
|
8
|
+
This file is part of the Node Digest.
|
|
9
|
+
|
|
10
|
+
Node Digest is free software: you can redistribute it and/or modify it under
|
|
11
|
+
the terms of the GNU Lesser General Public License as published by the Free
|
|
12
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
13
|
+
any later version.
|
|
14
|
+
|
|
15
|
+
Node Digest is distributed in the hope that it will be useful, but WITHOUT
|
|
16
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
18
|
+
for more details.
|
|
19
|
+
|
|
20
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
21
|
+
along with Node Digest . If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const canonicalBrowser = require('eslint-config-canonical/configurations/browser');
|
|
26
|
+
const canonical = require('eslint-config-canonical/configurations/canonical');
|
|
27
|
+
const canonicalJSDoc = require('eslint-config-canonical/configurations/jsdoc');
|
|
28
|
+
const canonicalJSON = require('eslint-config-canonical/configurations/json');
|
|
29
|
+
const canonicalLodash = require('eslint-config-canonical/configurations/lodash');
|
|
30
|
+
const canonicalModule = require('eslint-config-canonical/configurations/module');
|
|
31
|
+
const canonicalNode = require('eslint-config-canonical/configurations/node');
|
|
32
|
+
const canonicalRegExp = require('eslint-config-canonical/configurations/regexp');
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
'import/no-extraneous-dependencies': noExraneousDependencies,
|
|
36
|
+
...canonicalFixedRules
|
|
37
|
+
} = canonical.recommended.rules;
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
'n/no-extraneous-import': noExraneousImport,
|
|
41
|
+
...canonicalNodeFixedRules
|
|
42
|
+
} = canonicalNode.recommended.rules;
|
|
43
|
+
|
|
44
|
+
const {
|
|
45
|
+
'jsonc/sort-keys': sortKeys,
|
|
46
|
+
...canonicalJSONFixedRules
|
|
47
|
+
} = canonicalJSON.recommended.rules;
|
|
48
|
+
|
|
49
|
+
const generalConfigs = [
|
|
50
|
+
{
|
|
51
|
+
ignores: [
|
|
52
|
+
'**/dist/*'
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
...canonical.recommended,
|
|
57
|
+
rules: {
|
|
58
|
+
...canonicalFixedRules,
|
|
59
|
+
'@stylistic/comma-dangle': 'off'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
...canonical.recommended,
|
|
64
|
+
ignores: [
|
|
65
|
+
'**/__tests__/*'
|
|
66
|
+
],
|
|
67
|
+
rules: {
|
|
68
|
+
'@stylistic/comma-dangle': 'off',
|
|
69
|
+
'import/no-extraneous-dependencies': noExraneousDependencies
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
...canonicalNode.recommended,
|
|
74
|
+
rules: canonicalNodeFixedRules
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
...canonicalNode.recommended,
|
|
78
|
+
ignores: [
|
|
79
|
+
'**/__tests__/*'
|
|
80
|
+
],
|
|
81
|
+
rules: {
|
|
82
|
+
'n/no-extraneous-import': noExraneousImport
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
canonicalModule.recommended,
|
|
86
|
+
canonicalBrowser.recommended,
|
|
87
|
+
canonicalRegExp.recommended,
|
|
88
|
+
canonicalJSDoc.recommended,
|
|
89
|
+
canonicalLodash.recommended,
|
|
90
|
+
{
|
|
91
|
+
...canonicalJSON.recommended,
|
|
92
|
+
rules: canonicalJSONFixedRules
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
...canonicalJSON.recommended,
|
|
96
|
+
ignores: [
|
|
97
|
+
'**/package.json'
|
|
98
|
+
],
|
|
99
|
+
rules: {
|
|
100
|
+
'jsonc/sort-keys': sortKeys
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
module.exports = generalConfigs;
|
package/src/index.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
eslint-disable
|
|
3
|
+
unicorn/prefer-module
|
|
4
|
+
*/
|
|
1
5
|
/*
|
|
2
6
|
|
|
3
7
|
This file is part of the Node Digest.
|
|
4
8
|
|
|
5
9
|
Node Digest is free software: you can redistribute it and/or modify it under
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
the terms of the GNU Lesser General Public License as published by the Free
|
|
11
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
12
|
+
any later version.
|
|
9
13
|
|
|
10
14
|
Node Digest is distributed in the hope that it will be useful, but WITHOUT
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
17
|
+
for more details.
|
|
14
18
|
|
|
15
19
|
You should have received a copy of the GNU Lesser General Public License
|
|
16
|
-
|
|
20
|
+
along with Node Digest . If not, see <https://www.gnu.org/licenses/>.
|
|
17
21
|
|
|
18
22
|
*/
|
|
19
23
|
/*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
DO NOT REMOVE
|
|
25
|
+
This file is still required; package.json `main` parameter ignored in some
|
|
26
|
+
cases
|
|
23
27
|
*/
|
|
24
|
-
|
|
25
|
-
module.exports = require('./.eslintrc');
|
|
28
|
+
module.exports = require('./eslint.config');
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
eslint-disable
|
|
3
|
+
unicorn/prefer-module,
|
|
4
|
+
canonical/filename-match-exported
|
|
5
|
+
*/
|
|
6
|
+
/*
|
|
7
|
+
|
|
8
|
+
This file is part of the Node Digest.
|
|
9
|
+
|
|
10
|
+
Node Digest is free software: you can redistribute it and/or modify it under
|
|
11
|
+
the terms of the GNU Lesser General Public License as published by the Free
|
|
12
|
+
Software Foundation, either version 3 of the License, or (at your option)
|
|
13
|
+
any later version.
|
|
14
|
+
|
|
15
|
+
Node Digest is distributed in the hope that it will be useful, but WITHOUT
|
|
16
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
18
|
+
for more details.
|
|
19
|
+
|
|
20
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
21
|
+
along with Node Digest . If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const canonicalYAML = require('eslint-config-canonical/configurations/yaml');
|
|
26
|
+
|
|
27
|
+
const yamlConfigs = [
|
|
28
|
+
canonicalYAML.recommended
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
module.exports = yamlConfigs;
|
package/src/.eslintrc.js
DELETED
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
This file is part of the Node Digest.
|
|
4
|
-
|
|
5
|
-
Node Digest is free software: you can redistribute it and/or modify it under
|
|
6
|
-
the terms of the GNU Lesser General Public License as published by the Free
|
|
7
|
-
Software Foundation, either version 3 of the License, or (at your option)
|
|
8
|
-
any later version.
|
|
9
|
-
|
|
10
|
-
Node Digest is distributed in the hope that it will be useful, but WITHOUT
|
|
11
|
-
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12
|
-
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
13
|
-
for more details.
|
|
14
|
-
|
|
15
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
16
|
-
along with Node Digest . If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
/*
|
|
20
|
-
eslint-disable
|
|
21
|
-
filenames/match-regex,
|
|
22
|
-
import/unambiguous,
|
|
23
|
-
import/no-commonjs
|
|
24
|
-
*/
|
|
25
|
-
const fs = require('fs');
|
|
26
|
-
const path = require('path');
|
|
27
|
-
const {
|
|
28
|
-
config
|
|
29
|
-
} = require('@digest/scripts');
|
|
30
|
-
|
|
31
|
-
const angular = config.angular && config.eslintAngular;
|
|
32
|
-
const babel = config.babel && config.eslintBabel;
|
|
33
|
-
const emotion = config.emotion && config.eslintEmotion;
|
|
34
|
-
const flow = config.flow && config.eslintFlow;
|
|
35
|
-
const graphql = config.graphql && config.eslintGraphQL;
|
|
36
|
-
const jest = config.jest && config.eslintJest;
|
|
37
|
-
const react = config.react && config.eslintReact;
|
|
38
|
-
const reactNative = react && config.reactNative && config.eslintReactNative;
|
|
39
|
-
const typescript = config.typescript && config.eslintTypeScript;
|
|
40
|
-
|
|
41
|
-
let graphqlSchema;
|
|
42
|
-
|
|
43
|
-
if (graphql && config.graphqlSchema) {
|
|
44
|
-
require.extensions['.graphql'] = function (module, filename) {
|
|
45
|
-
module.exports = fs.readFileSync(filename, 'utf8');
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
// eslint-disable-next-line import/no-dynamic-require
|
|
50
|
-
graphqlSchema = require(path.resolve(config.graphqlSchema) ?? '');
|
|
51
|
-
} catch {
|
|
52
|
-
graphqlSchema = undefined;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = {
|
|
57
|
-
env: {
|
|
58
|
-
browser: true,
|
|
59
|
-
commonjs: true,
|
|
60
|
-
jest: Boolean(jest),
|
|
61
|
-
node: true
|
|
62
|
-
},
|
|
63
|
-
extends: [
|
|
64
|
-
'eslint:recommended',
|
|
65
|
-
'plugin:import/recommended',
|
|
66
|
-
'plugin:import/errors',
|
|
67
|
-
'plugin:import/warnings',
|
|
68
|
-
'canonical',
|
|
69
|
-
'canonical/lodash',
|
|
70
|
-
'canonical/browser',
|
|
71
|
-
'canonical/json',
|
|
72
|
-
'canonical/module',
|
|
73
|
-
'canonical/node',
|
|
74
|
-
'canonical/yaml'
|
|
75
|
-
].concat(
|
|
76
|
-
babel ? [
|
|
77
|
-
'plugin:import/stage-0'
|
|
78
|
-
] : [],
|
|
79
|
-
jest ? [
|
|
80
|
-
'canonical/jest'
|
|
81
|
-
] : [],
|
|
82
|
-
react ? [
|
|
83
|
-
'plugin:react/recommended',
|
|
84
|
-
'plugin:react-hooks/recommended',
|
|
85
|
-
'plugin:jsx-a11y/recommended',
|
|
86
|
-
'plugin:import/react',
|
|
87
|
-
'canonical/react',
|
|
88
|
-
'canonical/jsx-a11y',
|
|
89
|
-
'plugin:css-modules/recommended'
|
|
90
|
-
] : [],
|
|
91
|
-
/*
|
|
92
|
-
graphql ? [
|
|
93
|
-
'canonical/graphql'
|
|
94
|
-
] : [],/**/
|
|
95
|
-
flow && !typescript ? [
|
|
96
|
-
'plugin:flowtype/recommended',
|
|
97
|
-
'canonical/flowtype'
|
|
98
|
-
] : [],
|
|
99
|
-
typescript ? [
|
|
100
|
-
'plugin:@typescript-eslint/eslint-recommended',
|
|
101
|
-
'plugin:@typescript-eslint/recommended',
|
|
102
|
-
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
103
|
-
'plugin:import/typescript',
|
|
104
|
-
'plugin:canonical/recommended',
|
|
105
|
-
'canonical/typescript'
|
|
106
|
-
] : []
|
|
107
|
-
),
|
|
108
|
-
globals: {
|
|
109
|
-
// angular: Boolean(angular),
|
|
110
|
-
define: true
|
|
111
|
-
},
|
|
112
|
-
ignorePatterns: [
|
|
113
|
-
'.eslintrc.js',
|
|
114
|
-
'*~.js',
|
|
115
|
-
'*~.ts'
|
|
116
|
-
],
|
|
117
|
-
overrides: [
|
|
118
|
-
{
|
|
119
|
-
files: [
|
|
120
|
-
'*.graphql'
|
|
121
|
-
],
|
|
122
|
-
parser: '@graphql-eslint/eslint-plugin',
|
|
123
|
-
plugins: [
|
|
124
|
-
'@graphql-eslint'
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
files: [
|
|
129
|
-
'*.json'
|
|
130
|
-
],
|
|
131
|
-
parser: 'eslint-plugin-json-es'
|
|
132
|
-
}
|
|
133
|
-
],
|
|
134
|
-
parser: typescript ?
|
|
135
|
-
'@typescript-eslint/parser' :
|
|
136
|
-
// eslint-disable-next-line no-extra-parens
|
|
137
|
-
(babel ?
|
|
138
|
-
'@babel/eslint-parser' :
|
|
139
|
-
undefined),
|
|
140
|
-
parserOptions: {
|
|
141
|
-
allowImportExportEverywhere: Boolean(babel),
|
|
142
|
-
babelOptions: babel ?
|
|
143
|
-
{
|
|
144
|
-
configFile: config.babel,
|
|
145
|
-
} :
|
|
146
|
-
undefined,
|
|
147
|
-
createDefaultProgram: true,
|
|
148
|
-
ecmaFeatures: {
|
|
149
|
-
jsx: Boolean(react)
|
|
150
|
-
},
|
|
151
|
-
ecmaVersion: 10,
|
|
152
|
-
project: typescript ?
|
|
153
|
-
config.typescript :
|
|
154
|
-
undefined,
|
|
155
|
-
requireConfigFile: Boolean(babel),
|
|
156
|
-
sourceType: 'module',
|
|
157
|
-
warnOnUnsupportedTypeScriptVersion: false
|
|
158
|
-
|
|
159
|
-
// below significantly slows down linter
|
|
160
|
-
/* 'project': typescript ||
|
|
161
|
-
require.resolve('@digest/typescript/src/tsconfig.json'),
|
|
162
|
-
'tsconfigRootDir': '../../../../'*/
|
|
163
|
-
},
|
|
164
|
-
plugins: [
|
|
165
|
-
'import',
|
|
166
|
-
'canonical'
|
|
167
|
-
].concat(
|
|
168
|
-
babel ? ['@babel'] : [],
|
|
169
|
-
emotion ? ['@emotion'] : [],
|
|
170
|
-
angular ? [] : [],
|
|
171
|
-
react ? [
|
|
172
|
-
'react',
|
|
173
|
-
'react-hooks',
|
|
174
|
-
'jsx-a11y',
|
|
175
|
-
'css-modules'
|
|
176
|
-
] : [],
|
|
177
|
-
reactNative ? [
|
|
178
|
-
'react-native',
|
|
179
|
-
'@react-native-community',
|
|
180
|
-
] : [],
|
|
181
|
-
graphqlSchema ? ['@graphql-eslint'] : [],
|
|
182
|
-
flow ? ['flowtype'] : [],
|
|
183
|
-
typescript ? [
|
|
184
|
-
'@typescript-eslint'
|
|
185
|
-
] : []
|
|
186
|
-
),
|
|
187
|
-
// eslint-disable-next-line fp/no-mutating-assign
|
|
188
|
-
rules: Object.assign(
|
|
189
|
-
{
|
|
190
|
-
'comma-dangle': ['error', 'never'],
|
|
191
|
-
'function-call-argument-newline': ['error', 'always'],
|
|
192
|
-
'function-paren-newline': ['error', 'multiline-arguments'],
|
|
193
|
-
'import/no-extraneous-dependencies': 'off',
|
|
194
|
-
'import/no-unassigned-import': 'off',
|
|
195
|
-
'import/no-unresolved': 'off',
|
|
196
|
-
'jsdoc/check-tag-names': 'off', // incompatible with @jest-environment
|
|
197
|
-
'multiline-ternary': ['error', 'always'],
|
|
198
|
-
'no-tabs': 'off',
|
|
199
|
-
},
|
|
200
|
-
typescript ? {
|
|
201
|
-
'@typescript-eslint/comma-dangle': [
|
|
202
|
-
'error',
|
|
203
|
-
'never'
|
|
204
|
-
],
|
|
205
|
-
'@typescript-eslint/member-delimiter-style': [
|
|
206
|
-
'error',
|
|
207
|
-
{
|
|
208
|
-
multiline: {
|
|
209
|
-
delimiter: 'semi',
|
|
210
|
-
requireLast: true
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
],
|
|
214
|
-
'@typescript-eslint/indent': [
|
|
215
|
-
'error',
|
|
216
|
-
'tab'
|
|
217
|
-
],
|
|
218
|
-
'@typescript-eslint/restrict-plus-operands': 'off',
|
|
219
|
-
indent: 'off',
|
|
220
|
-
'no-use-before-define': 'off',
|
|
221
|
-
'no-useless-constructor': 'off'
|
|
222
|
-
} : {
|
|
223
|
-
indent: [
|
|
224
|
-
'error',
|
|
225
|
-
'tab'
|
|
226
|
-
]
|
|
227
|
-
},
|
|
228
|
-
react ? {
|
|
229
|
-
'react/forbid-component-props': 'off',
|
|
230
|
-
'react/jsx-fragments': [
|
|
231
|
-
'error',
|
|
232
|
-
'syntax'
|
|
233
|
-
],
|
|
234
|
-
'react/jsx-indent': [
|
|
235
|
-
'error',
|
|
236
|
-
'tab'
|
|
237
|
-
],
|
|
238
|
-
'react/jsx-indent-props': [
|
|
239
|
-
'error',
|
|
240
|
-
'tab'
|
|
241
|
-
],
|
|
242
|
-
'react/jsx-sort-default-props': 'off',
|
|
243
|
-
'react/sort-default-props': 'error',
|
|
244
|
-
'react/jsx-wrap-multilines': [
|
|
245
|
-
'error',
|
|
246
|
-
{
|
|
247
|
-
arrow: 'parens-new-line',
|
|
248
|
-
assignment: 'parens-new-line',
|
|
249
|
-
condition: 'parens-new-line',
|
|
250
|
-
declaration: 'parens-new-line',
|
|
251
|
-
logical: 'parens-new-line',
|
|
252
|
-
prop: 'parens-new-line',
|
|
253
|
-
return: 'parens-new-line'
|
|
254
|
-
}
|
|
255
|
-
],
|
|
256
|
-
'react/no-unknown-property': ['error', { ignore: ['styleName'] }]
|
|
257
|
-
} : {},
|
|
258
|
-
jest ? {
|
|
259
|
-
'jest/no-test-callback': 'off'
|
|
260
|
-
} : {},
|
|
261
|
-
graphqlSchema ? {
|
|
262
|
-
'graphql/template-strings': [
|
|
263
|
-
'error',
|
|
264
|
-
{
|
|
265
|
-
env: 'apollo',
|
|
266
|
-
schemaString: graphqlSchema
|
|
267
|
-
}
|
|
268
|
-
]
|
|
269
|
-
} : {}
|
|
270
|
-
),
|
|
271
|
-
settings: {
|
|
272
|
-
flowtype: {
|
|
273
|
-
onlyFilesWithFlowAnnotation: true
|
|
274
|
-
},
|
|
275
|
-
'import/ignore': [
|
|
276
|
-
'\\.(scss|less|css)$'
|
|
277
|
-
],
|
|
278
|
-
'import/parsers': Object.assign(
|
|
279
|
-
{},
|
|
280
|
-
typescript ? {
|
|
281
|
-
'@typescript-eslint/parser': [
|
|
282
|
-
'.ts',
|
|
283
|
-
'.tsx'
|
|
284
|
-
]
|
|
285
|
-
} : {}
|
|
286
|
-
),
|
|
287
|
-
propWrapperFunctions: ['forbidExtraProps'],
|
|
288
|
-
react: {
|
|
289
|
-
flowVersion: flow && !typescript ? 'detect' : undefined,
|
|
290
|
-
version: react ? 'detect' : undefined
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
};
|