@w5s/eslint-config 1.0.0-alpha.8 → 1.0.0-alpha.9
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/ignore.js +3 -0
- package/index.js +34 -3
- package/json.js +1 -0
- package/package.json +3 -3
- package/rules/jest.js +1 -15
- package/rules/jsdoc.js +3 -14
- package/rules/typescript.js +12 -0
package/ignore.js
ADDED
package/index.js
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
// http://eslint.org/docs/user-guide/configuring
|
|
2
|
+
/**
|
|
3
|
+
* @param {string} name
|
|
4
|
+
*/
|
|
5
|
+
function tryResolve(name) {
|
|
6
|
+
try {
|
|
7
|
+
require.resolve(name);
|
|
8
|
+
return true;
|
|
9
|
+
} catch (_error) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @template T
|
|
16
|
+
* @param {boolean} condition
|
|
17
|
+
* @param {T} value
|
|
18
|
+
*/
|
|
19
|
+
function includeIf(condition, value) {
|
|
20
|
+
return condition ? [value] : [];
|
|
21
|
+
}
|
|
22
|
+
|
|
2
23
|
module.exports = {
|
|
3
|
-
extends: [
|
|
24
|
+
extends: [
|
|
25
|
+
require.resolve('./ignore'),
|
|
26
|
+
require.resolve('./es'),
|
|
27
|
+
require.resolve('./json'),
|
|
28
|
+
...includeIf(tryResolve('react'), require.resolve('./react')),
|
|
29
|
+
],
|
|
4
30
|
overrides: [
|
|
5
|
-
{
|
|
31
|
+
...includeIf(tryResolve('typescript'), {
|
|
6
32
|
extends: [require.resolve('./ts')],
|
|
7
33
|
files: ['*.+(ts|tsx)'],
|
|
8
|
-
},
|
|
34
|
+
}),
|
|
9
35
|
{
|
|
10
36
|
extends: [require.resolve('./jest')],
|
|
11
37
|
files: [
|
|
@@ -13,6 +39,11 @@ module.exports = {
|
|
|
13
39
|
'**/__tests__/**/*.+(ts|tsx|js|jsx)',
|
|
14
40
|
'**/?(*.)+(spec|test).+(ts|tsx|js|jsx)',
|
|
15
41
|
],
|
|
42
|
+
settings: {
|
|
43
|
+
jest: {
|
|
44
|
+
version: 'latest',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
16
47
|
},
|
|
17
48
|
],
|
|
18
49
|
root: true,
|
package/json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w5s/eslint-config",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.9",
|
|
4
4
|
"description": "ESLint configuration presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"eslint-plugin-prettier": "^4.0.0",
|
|
56
56
|
"eslint-plugin-react": "^7.28.0",
|
|
57
57
|
"eslint-plugin-total-functions": "^5.0.0",
|
|
58
|
-
"eslint-plugin-unicorn": "^
|
|
58
|
+
"eslint-plugin-unicorn": "^41.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@babel/eslint-parser": "7.17.0",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "0bf05f35388f1ddb53438a017186cf64d2ce99f2"
|
|
87
87
|
}
|
package/rules/jest.js
CHANGED
|
@@ -10,23 +10,8 @@ module.exports = concatESConfig(
|
|
|
10
10
|
rules: {
|
|
11
11
|
'jest/expect-expect': off, // Disabled because it does not handle functions that does the expect
|
|
12
12
|
'jest/no-alias-methods': error,
|
|
13
|
-
'jest/no-commented-out-tests': error,
|
|
14
|
-
'jest/no-deprecated-functions': off,
|
|
15
|
-
'jest/no-disabled-tests': off,
|
|
16
|
-
'jest/no-done-callback': error,
|
|
17
|
-
'jest/no-export': off,
|
|
18
|
-
'jest/no-focused-tests': error,
|
|
19
|
-
'jest/no-identical-title': error,
|
|
20
|
-
'jest/no-restricted-matchers': [
|
|
21
|
-
error,
|
|
22
|
-
{
|
|
23
|
-
toBeFalsy: 'Avoid `toBeFalsy`',
|
|
24
|
-
toBeTruthy: 'Avoid `toBeTruthy`',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
13
|
'jest/prefer-spy-on': error,
|
|
28
14
|
'jest/prefer-to-contain': error,
|
|
29
|
-
'jest/valid-expect': error,
|
|
30
15
|
'jest/valid-title': [error, { ignoreTypeOfDescribeName: true }],
|
|
31
16
|
},
|
|
32
17
|
},
|
|
@@ -37,6 +22,7 @@ module.exports = concatESConfig(
|
|
|
37
22
|
rules: {
|
|
38
23
|
'unicorn/consistent-function-scoping': off,
|
|
39
24
|
'unicorn/no-useless-undefined': off,
|
|
25
|
+
'unicorn/prefer-module': off,
|
|
40
26
|
},
|
|
41
27
|
},
|
|
42
28
|
/**
|
package/rules/jsdoc.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
const { off
|
|
1
|
+
const { off } = require('./_rule');
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
+
extends: ['plugin:jsdoc/recommended'],
|
|
4
5
|
plugins: ['jsdoc'],
|
|
5
6
|
rules: {
|
|
6
|
-
'jsdoc/
|
|
7
|
-
'jsdoc/check-tag-names': warn,
|
|
8
|
-
'jsdoc/check-types': warn,
|
|
9
|
-
'jsdoc/newline-after-description': [warn, 'always'],
|
|
10
|
-
'jsdoc/require-description': off,
|
|
11
|
-
'jsdoc/require-description-complete-sentence': off,
|
|
12
|
-
'jsdoc/require-hyphen-before-param-description': off,
|
|
13
|
-
'jsdoc/require-param': off,
|
|
14
|
-
'jsdoc/require-param-description': off,
|
|
15
|
-
'jsdoc/require-param-name': error,
|
|
16
|
-
'jsdoc/require-param-type': off,
|
|
17
|
-
'jsdoc/require-returns-description': off,
|
|
18
|
-
'jsdoc/require-returns-type': off,
|
|
7
|
+
'jsdoc/require-jsdoc': off,
|
|
19
8
|
},
|
|
20
9
|
};
|
package/rules/typescript.js
CHANGED
|
@@ -130,6 +130,18 @@ module.exports = concatESConfig(
|
|
|
130
130
|
'@typescript-eslint/type-annotation-spacing': error,
|
|
131
131
|
},
|
|
132
132
|
},
|
|
133
|
+
/**
|
|
134
|
+
* JSDoc overrides
|
|
135
|
+
*/
|
|
136
|
+
{
|
|
137
|
+
rules: {
|
|
138
|
+
'jsdoc/no-types': error,
|
|
139
|
+
'jsdoc/require-param': off,
|
|
140
|
+
'jsdoc/require-param-type': off,
|
|
141
|
+
'jsdoc/require-returns': off,
|
|
142
|
+
'jsdoc/require-returns-type': off,
|
|
143
|
+
},
|
|
144
|
+
},
|
|
133
145
|
/**
|
|
134
146
|
* Import overrides
|
|
135
147
|
*/
|