@vortiquo/eslint-config 2.0.0 → 2.1.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/package.json +1 -1
- package/src/react/index.js +3 -7
- package/src/react-lib/index.js +8 -0
- package/src/react-lib/strict.js +0 -2
- package/src/ts/index.js +8 -0
- package/src/ts/strict.js +8 -0
package/package.json
CHANGED
package/src/react/index.js
CHANGED
|
@@ -33,10 +33,8 @@ export const react = [
|
|
|
33
33
|
...reactPlugin.configs.recommended.rules,
|
|
34
34
|
...reactPlugin.configs['jsx-runtime'].rules,
|
|
35
35
|
|
|
36
|
-
// React Hooks recommended (
|
|
36
|
+
// React Hooks recommended (includes rules-of-hooks + exhaustive-deps)
|
|
37
37
|
...reactHooksPlugin.configs.recommended.rules,
|
|
38
|
-
|
|
39
|
-
// Preferencias (opinionadas pero OK)
|
|
40
38
|
'react/prop-types': 'off',
|
|
41
39
|
'react/jsx-no-target-blank': 'error',
|
|
42
40
|
'react/jsx-curly-brace-presence': [
|
|
@@ -44,18 +42,16 @@ export const react = [
|
|
|
44
42
|
{ props: 'never', children: 'never' },
|
|
45
43
|
],
|
|
46
44
|
'react/self-closing-comp': 'error',
|
|
47
|
-
|
|
48
|
-
// Esta es MUY opinionada; si no quieren ruido, muévanla a reactStrict
|
|
49
45
|
'react/jsx-sort-props': [
|
|
50
46
|
'warn',
|
|
51
47
|
{ callbacksLast: true, shorthandFirst: true, reservedFirst: true },
|
|
52
48
|
],
|
|
53
49
|
|
|
54
|
-
//
|
|
50
|
+
// TypeScript handles prop types and defaults better
|
|
55
51
|
'react/require-default-props': 'off',
|
|
56
52
|
'react/jsx-props-no-spreading': 'off',
|
|
57
53
|
|
|
58
|
-
//
|
|
54
|
+
// In React components you typically don't want to enforce return types
|
|
59
55
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
60
56
|
},
|
|
61
57
|
},
|
package/src/react-lib/index.js
CHANGED
|
@@ -58,6 +58,14 @@ export const reactLib = [
|
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
|
|
61
|
+
{
|
|
62
|
+
name: '@vortiquo/react-lib:style',
|
|
63
|
+
files: ['src/**/*.{ts,tsx}'],
|
|
64
|
+
rules: {
|
|
65
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
|
|
61
69
|
// TypeScript-specific expectations for libs
|
|
62
70
|
{
|
|
63
71
|
name: '@vortiquo/react-lib:ts',
|
package/src/react-lib/strict.js
CHANGED
|
@@ -22,8 +22,6 @@ export const reactLibStrict = [
|
|
|
22
22
|
// Catch subtle API bugs
|
|
23
23
|
'@typescript-eslint/no-unnecessary-condition': 'error',
|
|
24
24
|
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
25
|
-
|
|
26
|
-
// En libs sí suele ser buena idea
|
|
27
25
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
28
26
|
},
|
|
29
27
|
},
|
package/src/ts/index.js
CHANGED
|
@@ -45,6 +45,14 @@ export const baseTs = [
|
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
+
{
|
|
49
|
+
name: '@vortiquo/ts:style',
|
|
50
|
+
files: TS_FILES,
|
|
51
|
+
rules: {
|
|
52
|
+
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
|
|
48
56
|
// Relax rules for config files
|
|
49
57
|
{
|
|
50
58
|
name: '@vortiquo/ts:config-files',
|
package/src/ts/strict.js
CHANGED
|
@@ -32,6 +32,14 @@ export const tsStrictTypeAware = [
|
|
|
32
32
|
name: '@vortiquo/ts:strict-extras',
|
|
33
33
|
files: TS_FILES,
|
|
34
34
|
rules: {
|
|
35
|
+
'@typescript-eslint/restrict-template-expressions': [
|
|
36
|
+
'error',
|
|
37
|
+
{
|
|
38
|
+
allowNumber: true,
|
|
39
|
+
allowBoolean: true,
|
|
40
|
+
allowNullish: false,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
35
43
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
36
44
|
'@typescript-eslint/no-misused-promises': [
|
|
37
45
|
'error',
|