eslint-config-vylda-vanilla-react 4.0.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/.editorconfig +12 -0
- package/.gitlab-ci.yml +13 -0
- package/.husky/pre-commit +1 -0
- package/.husky/pre-push +1 -0
- package/.vscode/extensions.json +8 -0
- package/.vscode/settings.json +6 -0
- package/Changelog.md +112 -0
- package/LICENSE +24 -0
- package/README.md +294 -0
- package/eslint.config.mjs +55 -0
- package/index.js +150 -0
- package/package.json +43 -0
- package/rules/a11y.mjs +333 -0
- package/rules/best-practices.mjs +57 -0
- package/rules/constants.mjs +20 -0
- package/rules/hooks.mjs +129 -0
- package/rules/imports.mjs +12 -0
- package/rules/index.mjs +37 -0
- package/rules/perfectionist.mjs +33 -0
- package/rules/react.mjs +610 -0
- package/rules/refresh.mjs +10 -0
- package/rules/stylistic.mjs +154 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { INDENT } from './constants.mjs';
|
|
2
|
+
|
|
3
|
+
const config = [
|
|
4
|
+
{
|
|
5
|
+
name: 'stylistic/jsx/stylistic',
|
|
6
|
+
rules: {
|
|
7
|
+
// Enforce consistent spacing inside JSX curly braces
|
|
8
|
+
// https://eslint.style/rules/jsx/jsx-child-element-spacing
|
|
9
|
+
'@stylistic/jsx-child-element-spacing': 'off',
|
|
10
|
+
|
|
11
|
+
// Enforce consistent placement of closing brackets in JSX
|
|
12
|
+
// https://eslint.style/rules/jsx/jsx-closing-bracket-location
|
|
13
|
+
'@stylistic/jsx-closing-bracket-location': ['error', 'line-aligned'],
|
|
14
|
+
|
|
15
|
+
// Enforce consistent placement of closing tags in JSX
|
|
16
|
+
// https://eslint.style/rules/jsx/jsx-closing-tag-location
|
|
17
|
+
'@stylistic/jsx-closing-tag-location': ['error', 'tag-aligned'],
|
|
18
|
+
|
|
19
|
+
// Enforce curly braces or disallow unnecessary curly braces in JSX props and/or children
|
|
20
|
+
// https://eslint.style/rules/jsx/jsx-curly-brace-presence
|
|
21
|
+
'@stylistic/jsx-curly-brace-presence': [
|
|
22
|
+
'error',
|
|
23
|
+
{ children: 'never', props: 'never' },
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
// Enforce consistent line breaks inside JSX curly braces
|
|
27
|
+
// https://eslint.style/rules/jsx/jsx-curly-newline
|
|
28
|
+
'@stylistic/jsx-curly-newline': [
|
|
29
|
+
'error', {
|
|
30
|
+
multiline: 'consistent',
|
|
31
|
+
singleline: 'consistent',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
|
|
35
|
+
// Enforce consistent spacing inside JSX curly braces
|
|
36
|
+
// https://eslint.style/rules/jsx/jsx-curly-spacing
|
|
37
|
+
'@stylistic/jsx-curly-spacing': [
|
|
38
|
+
'error',
|
|
39
|
+
{
|
|
40
|
+
allowMultiline: true,
|
|
41
|
+
children: true,
|
|
42
|
+
objectLiterals: 'never',
|
|
43
|
+
when: 'never',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
|
|
47
|
+
// Enforce consistent spacing around equal signs in JSX attributes
|
|
48
|
+
// https://eslint.style/rules/jsx/jsx-equals-spacing
|
|
49
|
+
'@stylistic/jsx-equals-spacing': ['error', 'never'],
|
|
50
|
+
|
|
51
|
+
// Require that the first prop in a JSX element be on a new line when the element is multiline
|
|
52
|
+
// https://eslint.style/rules/jsx/jsx-first-prop-new-line
|
|
53
|
+
'@stylistic/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
|
|
54
|
+
|
|
55
|
+
// Enforce line breaks before and after JSX elements when they are used as arguments to a function.
|
|
56
|
+
// https://eslint.style/rules/jsx/jsx-function-call-newline
|
|
57
|
+
'@stylistic/jsx-function-call-newline': ['error', 'multiline'],
|
|
58
|
+
|
|
59
|
+
// Enforce consistent indentation of props in JSX
|
|
60
|
+
// https://eslint.style/rules/jsx/jsx-indent-props
|
|
61
|
+
'@stylistic/jsx-indent-props': ['error', INDENT],
|
|
62
|
+
|
|
63
|
+
// Enforce maximum of props on a single line in JSX.
|
|
64
|
+
// https://eslint.style/rules/jsx/jsx-max-props-per-line
|
|
65
|
+
'@stylistic/jsx-max-props-per-line': [
|
|
66
|
+
'error',
|
|
67
|
+
{ maximum: 1, when: 'multiline' },
|
|
68
|
+
],
|
|
69
|
+
|
|
70
|
+
// Require or prevent a new line after jsx elements and expressions
|
|
71
|
+
// https://eslint.style/rules/jsx/jsx-newline
|
|
72
|
+
'@stylistic/jsx-newline': [
|
|
73
|
+
'error',
|
|
74
|
+
{
|
|
75
|
+
prevent: false,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
|
|
79
|
+
// Require one JSX element per line.
|
|
80
|
+
// https://eslint.style/rules/jsx/jsx-one-expression-per-line
|
|
81
|
+
'@stylistic/jsx-one-expression-per-line': [
|
|
82
|
+
'error',
|
|
83
|
+
{ allow: 'single-child' },
|
|
84
|
+
],
|
|
85
|
+
|
|
86
|
+
// Enforces coding style that user-defined JSX components are defined and referenced in PascalCase.
|
|
87
|
+
// https://eslint.style/rules/jsx/jsx-pascal-case
|
|
88
|
+
'@stylistic/jsx-pascal-case': [
|
|
89
|
+
'error',
|
|
90
|
+
{
|
|
91
|
+
allowAllCaps: false,
|
|
92
|
+
allowLeadingUnderscore: false,
|
|
93
|
+
allowNamespace: true,
|
|
94
|
+
ignore: [],
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
|
|
98
|
+
// Disallow multiple spaces between inline JSX props
|
|
99
|
+
// https://eslint.style/rules/jsx/jsx-self-closing-comp
|
|
100
|
+
'@stylistic/jsx-self-closing-comp': [
|
|
101
|
+
'error',
|
|
102
|
+
{
|
|
103
|
+
component: true,
|
|
104
|
+
html: true,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
|
|
108
|
+
// Enforce props alphabetical sorting
|
|
109
|
+
// https://eslint.style/rules/jsx/jsx-sort-props
|
|
110
|
+
'@stylistic/jsx-sort-props': [
|
|
111
|
+
'error',
|
|
112
|
+
{
|
|
113
|
+
callbacksLast: false,
|
|
114
|
+
ignoreCase: true,
|
|
115
|
+
locale: 'en',
|
|
116
|
+
multiline: 'ignore',
|
|
117
|
+
noSortAlphabetically: false,
|
|
118
|
+
reservedFirst: true,
|
|
119
|
+
shorthandFirst: false,
|
|
120
|
+
shorthandLast: true,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
|
|
124
|
+
// Enforce whitespace in and around the JSX opening and closing brackets.
|
|
125
|
+
// https://eslint.style/rules/jsx/jsx-tag-spacing
|
|
126
|
+
'@stylistic/jsx-tag-spacing': [
|
|
127
|
+
'error',
|
|
128
|
+
{
|
|
129
|
+
afterOpening: 'never',
|
|
130
|
+
beforeClosing: 'never',
|
|
131
|
+
beforeSelfClosing: 'always',
|
|
132
|
+
closingSlash: 'never',
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
|
|
136
|
+
// Disallow missing parentheses around multiline JSX.
|
|
137
|
+
// https://eslint.style/rules/jsx/jsx-wrap-multilines
|
|
138
|
+
'@stylistic/jsx-wrap-multilines': [
|
|
139
|
+
'error',
|
|
140
|
+
{
|
|
141
|
+
arrow: 'parens-new-line',
|
|
142
|
+
assignment: 'parens-new-line',
|
|
143
|
+
condition: 'parens-new-line',
|
|
144
|
+
declaration: 'parens-new-line',
|
|
145
|
+
logical: 'parens-new-line',
|
|
146
|
+
prop: 'parens-new-line',
|
|
147
|
+
'return': 'parens-new-line',
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
export default config;
|