@croct/eslint-plugin 0.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.
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.javascript = void 0;
4
+ exports.javascript = {
5
+ extends: [
6
+ 'plugin:jest/recommended',
7
+ 'airbnb-base',
8
+ ],
9
+ plugins: [
10
+ 'jest',
11
+ 'import',
12
+ 'no-smart-quotes',
13
+ 'import-newlines',
14
+ '@croct',
15
+ ],
16
+ rules: {
17
+ '@croct/argument-spacing': 'error',
18
+ '@croct/complex-expression-spacing': 'error',
19
+ 'array-bracket-newline': [
20
+ 'error',
21
+ 'consistent',
22
+ ],
23
+ 'multiline-ternary': [
24
+ 'error',
25
+ 'always-multiline',
26
+ ],
27
+ 'no-undef-init': 'error',
28
+ 'jest/consistent-test-it': [
29
+ 'error',
30
+ {
31
+ fn: 'it',
32
+ },
33
+ ],
34
+ 'jest/no-large-snapshots': 'off',
35
+ 'jest/prefer-expect-resolves': 'error',
36
+ 'jest/prefer-lowercase-title': [
37
+ 'error',
38
+ {
39
+ ignore: ['describe'],
40
+ },
41
+ ],
42
+ 'jest/prefer-spy-on': 'error',
43
+ 'jest/require-top-level-describe': 'error',
44
+ 'jest/prefer-to-contain': 'error',
45
+ 'jest/prefer-hooks-on-top': 'error',
46
+ 'jest/prefer-equality-matcher': 'error',
47
+ 'jest/no-test-return-statement': 'error',
48
+ 'function-call-argument-newline': [
49
+ 'error',
50
+ 'consistent',
51
+ ],
52
+ 'no-underscore-dangle': 'off',
53
+ 'import/no-default-export': 'error',
54
+ 'array-element-newline': [
55
+ 'error',
56
+ 'consistent',
57
+ ],
58
+ 'import-newlines/enforce': [
59
+ 'error',
60
+ {
61
+ items: 6,
62
+ 'max-len': 120,
63
+ },
64
+ ],
65
+ 'no-smart-quotes/no-smart-quotes': 'error',
66
+ 'no-shadow': 'error',
67
+ 'import/prefer-default-export': 'off',
68
+ 'import/no-extraneous-dependencies': 'off',
69
+ 'no-use-before-define': 'error',
70
+ 'arrow-parens': [
71
+ 'error',
72
+ 'as-needed',
73
+ ],
74
+ 'class-methods-use-this': 'off',
75
+ 'consistent-return': 'off',
76
+ 'default-case': 'off',
77
+ 'import/extensions': [
78
+ 'error',
79
+ 'never',
80
+ ],
81
+ 'import/no-unresolved': 'off',
82
+ indent: [
83
+ 'error',
84
+ 4,
85
+ {
86
+ SwitchCase: 1,
87
+ },
88
+ ],
89
+ 'linebreak-style': [
90
+ 'error',
91
+ 'unix',
92
+ ],
93
+ 'max-classes-per-file': 'off',
94
+ 'max-len': [
95
+ 'error',
96
+ {
97
+ code: 120,
98
+ ignoreStrings: true,
99
+ },
100
+ ],
101
+ 'no-await-in-loop': 'off',
102
+ 'no-bitwise': 'off',
103
+ 'no-continue': 'off',
104
+ 'no-multiple-empty-lines': [
105
+ 'error',
106
+ {
107
+ max: 1,
108
+ maxEOF: 0,
109
+ maxBOF: 0,
110
+ },
111
+ ],
112
+ 'no-plusplus': [
113
+ 'error',
114
+ {
115
+ allowForLoopAfterthoughts: true,
116
+ },
117
+ ],
118
+ 'no-unused-expressions': 'error',
119
+ 'no-unused-vars': 'error',
120
+ 'no-restricted-syntax': [
121
+ 'error',
122
+ 'ForInStatement',
123
+ 'LabeledStatement',
124
+ 'WithStatement',
125
+ ],
126
+ 'object-curly-newline': [
127
+ 'error',
128
+ {
129
+ multiline: true,
130
+ consistent: true,
131
+ },
132
+ ],
133
+ 'object-curly-spacing': [
134
+ 'error',
135
+ 'never',
136
+ ],
137
+ 'require-await': 'error',
138
+ 'object-shorthand': [
139
+ 'error',
140
+ 'never',
141
+ ],
142
+ 'padding-line-between-statements': [
143
+ 'error',
144
+ {
145
+ blankLine: 'always',
146
+ prev: '*',
147
+ next: [
148
+ 'case',
149
+ 'default',
150
+ 'try',
151
+ ],
152
+ },
153
+ {
154
+ blankLine: 'always',
155
+ prev: [
156
+ 'const',
157
+ 'let',
158
+ 'var',
159
+ ],
160
+ next: '*',
161
+ },
162
+ {
163
+ blankLine: 'any',
164
+ prev: [
165
+ 'const',
166
+ 'let',
167
+ 'var',
168
+ ],
169
+ next: [
170
+ 'const',
171
+ 'let',
172
+ 'var',
173
+ ],
174
+ },
175
+ {
176
+ blankLine: 'always',
177
+ prev: '*',
178
+ next: [
179
+ 'return',
180
+ 'if',
181
+ 'function',
182
+ 'block',
183
+ 'block-like',
184
+ ],
185
+ },
186
+ ],
187
+ },
188
+ overrides: [
189
+ {
190
+ files: [
191
+ 'src/**/*.test.js',
192
+ 'test/**/*.js',
193
+ ],
194
+ extends: ['plugin:jest/recommended'],
195
+ plugins: ['jest'],
196
+ rules: {
197
+ 'no-new-object': 'off',
198
+ },
199
+ env: {
200
+ jest: true,
201
+ },
202
+ },
203
+ ],
204
+ };
@@ -0,0 +1,63 @@
1
+ export declare const react: {
2
+ extends: string[];
3
+ plugins: string[];
4
+ rules: {
5
+ '@croct/jsx-attribute-spacing': string;
6
+ 'react/jsx-wrap-multilines': string;
7
+ 'react/display-name': string;
8
+ 'react/jsx-newline': (string | {
9
+ prevent: boolean;
10
+ })[];
11
+ 'react/jsx-no-bind': (string | {
12
+ allowArrowFunctions: boolean;
13
+ allowBind: boolean;
14
+ allowFunctions: boolean;
15
+ })[];
16
+ 'react/no-unstable-nested-components': (string | {
17
+ allowAsProps: boolean;
18
+ })[];
19
+ 'react/jsx-no-useless-fragment': (string | {
20
+ allowExpressions: boolean;
21
+ })[];
22
+ 'react/function-component-definition': string;
23
+ 'testing-library/no-container': string;
24
+ 'testing-library/no-node-access': string;
25
+ 'testing-library/await-async-utils': string;
26
+ 'jsx-a11y/aria-role': (string | {
27
+ ignoreNonDOM: boolean;
28
+ })[];
29
+ 'react/jsx-uses-react': string;
30
+ 'react/react-in-jsx-scope': string;
31
+ 'react/jsx-one-expression-per-line': string;
32
+ 'react/prop-types': string;
33
+ 'react/require-default-props': string;
34
+ 'react/jsx-fragments': string[];
35
+ 'react-hooks/rules-of-hooks': string;
36
+ 'react-hooks/exhaustive-deps': string;
37
+ 'react/jsx-filename-extension': (number | {
38
+ extensions: string[];
39
+ })[];
40
+ 'react/jsx-indent': (string | number)[];
41
+ 'react/jsx-indent-props': string;
42
+ 'react/jsx-props-no-spreading': string;
43
+ 'no-restricted-imports': (string | {
44
+ name: string;
45
+ importNames: string[];
46
+ message: string;
47
+ })[];
48
+ 'import/order': (string | {
49
+ groups: string[];
50
+ pathGroups: {
51
+ pattern: string;
52
+ group: string;
53
+ position: string;
54
+ }[];
55
+ pathGroupsExcludedImportTypes: string[];
56
+ 'newlines-between': string;
57
+ alphabetize: {
58
+ order: string;
59
+ caseInsensitive: boolean;
60
+ };
61
+ })[];
62
+ };
63
+ };
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.react = void 0;
4
+ exports.react = {
5
+ extends: [
6
+ 'airbnb',
7
+ 'plugin:react/recommended',
8
+ 'plugin:testing-library/react',
9
+ 'plugin:jest-dom/recommended',
10
+ 'plugin:jsx-a11y/recommended',
11
+ 'plugin:@croct/javascript',
12
+ ],
13
+ plugins: [
14
+ 'import',
15
+ 'react',
16
+ 'react-hooks',
17
+ 'testing-library',
18
+ 'jest-dom',
19
+ '@croct',
20
+ ],
21
+ rules: {
22
+ '@croct/jsx-attribute-spacing': 'error',
23
+ 'react/jsx-wrap-multilines': 'error',
24
+ 'react/display-name': 'off',
25
+ 'react/jsx-newline': [
26
+ 'error',
27
+ {
28
+ prevent: true,
29
+ },
30
+ ],
31
+ 'react/jsx-no-bind': [
32
+ 'error',
33
+ {
34
+ allowArrowFunctions: true,
35
+ allowBind: false,
36
+ allowFunctions: true,
37
+ },
38
+ ],
39
+ 'react/no-unstable-nested-components': [
40
+ 'error',
41
+ {
42
+ allowAsProps: true,
43
+ },
44
+ ],
45
+ 'react/jsx-no-useless-fragment': [
46
+ 'error',
47
+ {
48
+ allowExpressions: true,
49
+ },
50
+ ],
51
+ 'react/function-component-definition': 'off',
52
+ 'testing-library/no-container': 'off',
53
+ 'testing-library/no-node-access': 'off',
54
+ 'testing-library/await-async-utils': 'off',
55
+ 'jsx-a11y/aria-role': [
56
+ 'error',
57
+ {
58
+ ignoreNonDOM: true,
59
+ },
60
+ ],
61
+ 'react/jsx-uses-react': 'off',
62
+ 'react/react-in-jsx-scope': 'off',
63
+ 'react/jsx-one-expression-per-line': 'off',
64
+ 'react/prop-types': 'off',
65
+ 'react/require-default-props': 'off',
66
+ 'react/jsx-fragments': [
67
+ 'error',
68
+ 'element',
69
+ ],
70
+ 'react-hooks/rules-of-hooks': 'error',
71
+ 'react-hooks/exhaustive-deps': 'warn',
72
+ 'react/jsx-filename-extension': [
73
+ 1,
74
+ {
75
+ extensions: [
76
+ '.tsx',
77
+ ],
78
+ },
79
+ ],
80
+ 'react/jsx-indent': [
81
+ 'error',
82
+ 4,
83
+ ],
84
+ 'react/jsx-indent-props': 'off',
85
+ 'react/jsx-props-no-spreading': 'off',
86
+ 'no-restricted-imports': [
87
+ 'error',
88
+ {
89
+ name: 'react',
90
+ importNames: [
91
+ 'default',
92
+ ],
93
+ message: 'The React runtime is automatically imported, '
94
+ + 'you can simply omit the import declaration in this case.',
95
+ },
96
+ ],
97
+ 'import/order': [
98
+ 'error',
99
+ {
100
+ groups: [
101
+ 'builtin',
102
+ 'external',
103
+ 'internal',
104
+ ],
105
+ pathGroups: [
106
+ {
107
+ pattern: 'react',
108
+ group: 'external',
109
+ position: 'before',
110
+ },
111
+ ],
112
+ pathGroupsExcludedImportTypes: [
113
+ 'react',
114
+ ],
115
+ 'newlines-between': 'never',
116
+ alphabetize: {
117
+ order: 'asc',
118
+ caseInsensitive: true,
119
+ },
120
+ },
121
+ ],
122
+ },
123
+ };
@@ -0,0 +1,74 @@
1
+ export declare const typescript: {
2
+ extends: string[];
3
+ plugins: string[];
4
+ rules: {
5
+ '@typescript-eslint/array-type': (string | {
6
+ default: string;
7
+ })[];
8
+ '@typescript-eslint/prefer-as-const': string;
9
+ '@typescript-eslint/adjacent-overload-signatures': string;
10
+ '@typescript-eslint/type-annotation-spacing': string;
11
+ '@typescript-eslint/semi': string[];
12
+ '@typescript-eslint/strict-boolean-expressions': (string | {
13
+ allowString: boolean;
14
+ allowNumber: boolean;
15
+ allowNullableObject: boolean;
16
+ })[];
17
+ '@typescript-eslint/prefer-regexp-exec': string;
18
+ '@typescript-eslint/prefer-optional-chain': string;
19
+ 'no-shadow': string;
20
+ '@typescript-eslint/no-shadow': (string | {
21
+ ignoreTypeValueShadow: boolean;
22
+ ignoreFunctionTypeParameterNameValueShadow: boolean;
23
+ })[];
24
+ '@typescript-eslint/no-empty-interface': string;
25
+ '@typescript-eslint/explicit-member-accessibility': string[];
26
+ '@typescript-eslint/explicit-module-boundary-types': string;
27
+ '@typescript-eslint/explicit-function-return-type': string[];
28
+ '@typescript-eslint/no-explicit-any': string;
29
+ 'no-use-before-define': string;
30
+ '@typescript-eslint/no-use-before-define': string;
31
+ 'no-unused-expressions': string;
32
+ '@typescript-eslint/no-unused-expressions': string;
33
+ indent: (string | number | {
34
+ SwitchCase: number;
35
+ })[];
36
+ '@typescript-eslint/no-unused-vars': string;
37
+ 'no-unused-vars': string;
38
+ '@typescript-eslint/no-non-null-assertion': string;
39
+ 'object-curly-spacing': string;
40
+ '@typescript-eslint/object-curly-spacing': string;
41
+ '@typescript-eslint/member-delimiter-style': (string | {
42
+ multiline: {
43
+ delimiter: string;
44
+ requireLast: boolean;
45
+ };
46
+ singleline: {
47
+ delimiter: string;
48
+ requireLast: boolean;
49
+ };
50
+ overrides: {
51
+ interface: {
52
+ singleline: {
53
+ delimiter: string;
54
+ };
55
+ multiline: {
56
+ delimiter: string;
57
+ };
58
+ };
59
+ };
60
+ })[];
61
+ 'no-undef': string;
62
+ };
63
+ overrides: {
64
+ files: string[];
65
+ extends: string[];
66
+ plugins: string[];
67
+ rules: {
68
+ 'no-new-object': string;
69
+ };
70
+ env: {
71
+ jest: boolean;
72
+ };
73
+ }[];
74
+ };
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typescript = void 0;
4
+ exports.typescript = {
5
+ extends: [
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'plugin:@croct/javascript',
8
+ ],
9
+ plugins: [
10
+ '@typescript-eslint',
11
+ '@croct',
12
+ ],
13
+ rules: {
14
+ '@typescript-eslint/array-type': [
15
+ 'error',
16
+ {
17
+ default: 'array-simple',
18
+ },
19
+ ],
20
+ '@typescript-eslint/prefer-as-const': 'error',
21
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
22
+ '@typescript-eslint/type-annotation-spacing': 'error',
23
+ '@typescript-eslint/semi': ['error', 'always'],
24
+ '@typescript-eslint/strict-boolean-expressions': [
25
+ 'error',
26
+ {
27
+ allowString: false,
28
+ allowNumber: false,
29
+ allowNullableObject: false,
30
+ },
31
+ ],
32
+ '@typescript-eslint/prefer-regexp-exec': 'error',
33
+ '@typescript-eslint/prefer-optional-chain': 'error',
34
+ 'no-shadow': 'off',
35
+ '@typescript-eslint/no-shadow': [
36
+ 'error',
37
+ {
38
+ ignoreTypeValueShadow: true,
39
+ ignoreFunctionTypeParameterNameValueShadow: true,
40
+ },
41
+ ],
42
+ '@typescript-eslint/no-empty-interface': 'off',
43
+ '@typescript-eslint/explicit-member-accessibility': [
44
+ 'error',
45
+ ],
46
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
47
+ '@typescript-eslint/explicit-function-return-type': [
48
+ 'error',
49
+ ],
50
+ '@typescript-eslint/no-explicit-any': 'off',
51
+ 'no-use-before-define': 'off',
52
+ '@typescript-eslint/no-use-before-define': 'error',
53
+ 'no-unused-expressions': 'off',
54
+ '@typescript-eslint/no-unused-expressions': 'error',
55
+ indent: [
56
+ 'error',
57
+ 4,
58
+ {
59
+ SwitchCase: 1,
60
+ },
61
+ ],
62
+ '@typescript-eslint/no-unused-vars': 'error',
63
+ 'no-unused-vars': 'off',
64
+ '@typescript-eslint/no-non-null-assertion': 'off',
65
+ 'object-curly-spacing': 'off',
66
+ '@typescript-eslint/object-curly-spacing': 'error',
67
+ '@typescript-eslint/member-delimiter-style': [
68
+ 'error',
69
+ {
70
+ multiline: {
71
+ delimiter: 'comma',
72
+ requireLast: true,
73
+ },
74
+ singleline: {
75
+ delimiter: 'comma',
76
+ requireLast: false,
77
+ },
78
+ overrides: {
79
+ interface: {
80
+ singleline: {
81
+ delimiter: 'semi',
82
+ },
83
+ multiline: {
84
+ delimiter: 'semi',
85
+ },
86
+ },
87
+ },
88
+ },
89
+ ],
90
+ 'no-undef': 'off',
91
+ },
92
+ overrides: [
93
+ {
94
+ files: [
95
+ 'src/**/*.test.ts',
96
+ 'test/**/*.ts',
97
+ ],
98
+ extends: ['plugin:jest/recommended'],
99
+ plugins: ['jest'],
100
+ rules: {
101
+ 'no-new-object': 'off',
102
+ },
103
+ env: {
104
+ jest: true,
105
+ },
106
+ },
107
+ ],
108
+ };