@fullstacksjs/eslint-config 8.13.0 → 9.0.1
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/base.js +213 -25
- package/cypress.js +17 -2
- package/{rules/fp.js → fp.js} +2 -0
- package/graphql.js +67 -1
- package/{rules/import.js → import.js} +11 -0
- package/index.js +10 -4
- package/init.js +57 -0
- package/jest.js +67 -2
- package/{rules/naming-convention.js → naming-convention.js} +0 -0
- package/{rules/node.js → node.js} +2 -0
- package/package.json +13 -12
- package/prettier.js +8 -0
- package/{rules/promise.js → promise.js} +2 -0
- package/react.js +129 -1
- package/registerOpts.js +16 -0
- package/storybook.js +17 -1
- package/strict.js +15 -0
- package/{rules/test.js → test.js} +12 -7
- package/typecheck.js +65 -1
- package/typescript.js +77 -13
- package/utils.js +20 -0
- package/nextjs.js +0 -31
- package/packages.js +0 -9
- package/rules/base.js +0 -87
- package/rules/cypress.js +0 -16
- package/rules/es2015.js +0 -30
- package/rules/forbidden.js +0 -39
- package/rules/graphql.js +0 -70
- package/rules/jest.js +0 -65
- package/rules/jsx-a11y.js +0 -40
- package/rules/react-hooks.js +0 -6
- package/rules/react.js +0 -92
- package/rules/storybook.js +0 -19
- package/rules/strict.js +0 -66
- package/rules/style.js +0 -61
- package/rules/typecheck.js +0 -67
- package/rules/typescript.js +0 -162
- package/rules/variables.js +0 -23
package/base.js
CHANGED
|
@@ -1,35 +1,223 @@
|
|
|
1
1
|
/** @type { import('eslint').Linter.Config } */
|
|
2
2
|
module.exports = {
|
|
3
|
-
plugins: ['prettier', 'import', 'simple-import-sort', 'promise', 'node', 'fp'],
|
|
4
3
|
parserOptions: {
|
|
5
|
-
ecmaVersion:
|
|
4
|
+
ecmaVersion: 'latest',
|
|
6
5
|
sourceType: 'module',
|
|
7
|
-
requireConfigFile: false,
|
|
8
|
-
},
|
|
9
|
-
settings: {
|
|
10
|
-
'import/resolver': {
|
|
11
|
-
node: {
|
|
12
|
-
extensions: ['.mjs', '.js', '.json', '.jsx'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
'import/core-modules': [],
|
|
16
|
-
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
|
|
17
6
|
},
|
|
18
7
|
env: {
|
|
19
8
|
browser: true,
|
|
20
|
-
es6: true,
|
|
21
9
|
node: true,
|
|
10
|
+
es6: true,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
'accessor-pairs': 'error',
|
|
14
|
+
'array-callback-return': 'error',
|
|
15
|
+
'arrow-body-style': ['off', 'as-needed'], // Annoying
|
|
16
|
+
'block-scoped-var': 'error',
|
|
17
|
+
'brace-style': 'off', // prettier
|
|
18
|
+
'camelcase': ['warn', { properties: 'always' }],
|
|
19
|
+
'capitalized-comments': 'off',
|
|
20
|
+
'class-methods-use-this': 'off',
|
|
21
|
+
'comma-spacing': ['warn', { after: true, before: false }],
|
|
22
|
+
'complexity': ['error', 14],
|
|
23
|
+
'consistent-return': 'off',
|
|
24
|
+
'consistent-this': 'off',
|
|
25
|
+
'constructor-super': 'error',
|
|
26
|
+
'default-case': 'error',
|
|
27
|
+
'default-case-last': 'error',
|
|
28
|
+
'default-param-last': 'warn',
|
|
29
|
+
'dot-notation': 'error',
|
|
30
|
+
'eqeqeq': ['error', 'smart'],
|
|
31
|
+
'for-direction': 'error',
|
|
32
|
+
'func-name-matching': 'error',
|
|
33
|
+
'func-names': 'error',
|
|
34
|
+
'func-style': 'off',
|
|
35
|
+
'getter-return': ['error', { allowImplicit: true }],
|
|
36
|
+
'grouped-accessor-pairs': 'off',
|
|
37
|
+
'guard-for-in': 'error',
|
|
38
|
+
'id-denylist': 'off',
|
|
39
|
+
'id-length': 'off',
|
|
40
|
+
'id-match': ['error', '^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$'], // __filename, camelCase, PascalCase, CONST_VALUE, stream$, $el
|
|
41
|
+
'init-declarations': 'off',
|
|
42
|
+
'line-comment-position': 'off',
|
|
43
|
+
'linebreak-style': ['error', 'unix'],
|
|
44
|
+
'lines-around-comment': 'off',
|
|
45
|
+
'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: false }],
|
|
46
|
+
'logical-assignment-operators': 'off',
|
|
47
|
+
'max-classes-per-file': 'off',
|
|
48
|
+
'max-depth': ['error', 4],
|
|
49
|
+
'max-lines': ['error', { max: 2500, skipBlankLines: false, skipComments: false }],
|
|
50
|
+
'max-lines-per-function': ['error', 150],
|
|
51
|
+
'max-nested-callbacks': ['error', 7],
|
|
52
|
+
'max-params': ['error', 7],
|
|
53
|
+
'max-statements': ['error', 40],
|
|
54
|
+
'max-statements-per-line': ['error', { max: 1 }],
|
|
55
|
+
'multiline-comment-style': 'off',
|
|
56
|
+
'new-cap': 'off',
|
|
57
|
+
'no-alert': 'error',
|
|
58
|
+
'no-array-constructor': 'error',
|
|
59
|
+
'no-async-promise-executor': 'off',
|
|
60
|
+
'no-await-in-loop': 'error',
|
|
61
|
+
'no-bitwise': 'error',
|
|
62
|
+
'no-caller': 'error',
|
|
63
|
+
'no-case-declarations': 'error',
|
|
64
|
+
'no-class-assign': 'error',
|
|
65
|
+
'no-compare-neg-zero': 'error',
|
|
66
|
+
'no-cond-assign': 'error',
|
|
67
|
+
'no-console': 'off',
|
|
68
|
+
'no-const-assign': 'error',
|
|
69
|
+
'no-constant-binary-expression': 'warn',
|
|
70
|
+
'no-constant-condition': 'error',
|
|
71
|
+
'no-constructor-return': 'error',
|
|
72
|
+
'no-continue': 'off',
|
|
73
|
+
'no-control-regex': 'error',
|
|
74
|
+
'no-debugger': 'error',
|
|
75
|
+
'no-delete-var': 'error',
|
|
76
|
+
'no-div-regex': 'error',
|
|
77
|
+
'no-dupe-args': 'error',
|
|
78
|
+
'no-dupe-class-members': 'error',
|
|
79
|
+
'no-dupe-else-if': 'error',
|
|
80
|
+
'no-dupe-keys': 'error',
|
|
81
|
+
'no-duplicate-case': 'error',
|
|
82
|
+
'no-duplicate-imports': 'off', // Handled by import plugin
|
|
83
|
+
'no-else-return': 'off',
|
|
84
|
+
'no-empty': 'error',
|
|
85
|
+
'no-empty-character-class': 'error',
|
|
86
|
+
'no-empty-function': 'off',
|
|
87
|
+
'no-empty-pattern': 'error',
|
|
88
|
+
'no-empty-static-block': 'warn',
|
|
89
|
+
'no-eq-null': 'off',
|
|
90
|
+
'no-eval': 'error',
|
|
91
|
+
'no-ex-assign': 'error',
|
|
92
|
+
'no-extend-native': 'error',
|
|
93
|
+
'no-extra-bind': 'error',
|
|
94
|
+
'no-extra-boolean-cast': 'off',
|
|
95
|
+
'no-extra-label': 'error',
|
|
96
|
+
'no-fallthrough': 'error',
|
|
97
|
+
'no-floating-decimal': 'error',
|
|
98
|
+
'no-func-assign': 'error',
|
|
99
|
+
'no-global-assign': 'error',
|
|
100
|
+
'no-implicit-coercion': 'off',
|
|
101
|
+
'no-implicit-globals': 'error',
|
|
102
|
+
'no-implied-eval': 'error',
|
|
103
|
+
'no-import-assign': 'error',
|
|
104
|
+
'no-inline-comments': 'off',
|
|
105
|
+
'no-inner-declarations': 'error',
|
|
106
|
+
'no-invalid-regexp': 'error',
|
|
107
|
+
'no-invalid-this': 'warn',
|
|
108
|
+
'no-irregular-whitespace': 'error',
|
|
109
|
+
'no-iterator': 'error',
|
|
110
|
+
'no-label-var': 'error',
|
|
111
|
+
'no-labels': 'error',
|
|
112
|
+
'no-lone-blocks': 'error',
|
|
113
|
+
'no-lonely-if': 'error',
|
|
114
|
+
'no-loop-func': 'error',
|
|
115
|
+
'no-loss-of-precision': 'warn',
|
|
116
|
+
'no-magic-numbers': 'off',
|
|
117
|
+
'no-misleading-character-class': 'off',
|
|
118
|
+
'no-multi-assign': 'error',
|
|
119
|
+
'no-multi-str': 'error',
|
|
120
|
+
'no-negated-condition': 'off',
|
|
121
|
+
'no-nested-ternary': 'off',
|
|
122
|
+
'no-new': 'error',
|
|
123
|
+
'no-new-func': 'error',
|
|
124
|
+
'no-new-native-nonconstructor': 'error',
|
|
125
|
+
'no-new-object': 'error',
|
|
126
|
+
'no-new-symbol': 'error',
|
|
127
|
+
'no-new-wrappers': 'error',
|
|
128
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
129
|
+
'no-obj-calls': 'error',
|
|
130
|
+
'no-octal': 'error',
|
|
131
|
+
'no-octal-escape': 'error',
|
|
132
|
+
'no-param-reassign': 'off',
|
|
133
|
+
'no-plusplus': 'off',
|
|
134
|
+
'no-promise-executor-return': 'error',
|
|
135
|
+
'no-proto': 'error',
|
|
136
|
+
'no-prototype-builtins': 'off',
|
|
137
|
+
'no-redeclare': 'error',
|
|
138
|
+
'no-regex-spaces': 'error',
|
|
139
|
+
'no-restricted-exports': 'off',
|
|
140
|
+
'no-restricted-globals': ['error', 'event', 'fdescribe'],
|
|
141
|
+
'no-restricted-imports': 'off',
|
|
142
|
+
'no-restricted-properties': 'off',
|
|
143
|
+
'no-restricted-syntax': ['error', 'WithStatement'],
|
|
144
|
+
'no-return-assign': 'error',
|
|
145
|
+
'no-return-await': 'error',
|
|
146
|
+
'no-script-url': 'error',
|
|
147
|
+
'no-self-assign': 'error',
|
|
148
|
+
'no-self-compare': 'error',
|
|
149
|
+
'no-sequences': 'error',
|
|
150
|
+
'no-setter-return': 'error',
|
|
151
|
+
'no-shadow': 'error',
|
|
152
|
+
'no-shadow-restricted-names': 'error',
|
|
153
|
+
'no-sparse-arrays': 'error',
|
|
154
|
+
'no-template-curly-in-string': 'off', // Some libs need curly in string for internal templates.
|
|
155
|
+
'no-ternary': 'off',
|
|
156
|
+
'no-this-before-super': 'error',
|
|
157
|
+
'no-throw-literal': 'error',
|
|
158
|
+
'no-undef': 'error',
|
|
159
|
+
'no-undef-init': 'error',
|
|
160
|
+
'no-undefined': 'off',
|
|
161
|
+
'no-underscore-dangle': 'off',
|
|
162
|
+
'no-unexpected-multiline': 'error',
|
|
163
|
+
'no-unmodified-loop-condition': 'error',
|
|
164
|
+
'no-unneeded-ternary': 'error',
|
|
165
|
+
'no-unreachable': 'error',
|
|
166
|
+
'no-unreachable-loop': 'error',
|
|
167
|
+
'no-unsafe-finally': 'error',
|
|
168
|
+
'no-unsafe-negation': 'error',
|
|
169
|
+
'no-unsafe-optional-chaining': 'error',
|
|
170
|
+
'no-unused-expressions': 'off',
|
|
171
|
+
'no-unused-labels': 'error',
|
|
172
|
+
'no-unused-private-class-members': 'warn',
|
|
173
|
+
'no-unused-vars': [
|
|
174
|
+
'error',
|
|
175
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^ignore(d)?', args: 'after-used', ignoreRestSiblings: true },
|
|
176
|
+
],
|
|
177
|
+
'no-use-before-define': ['error', 'nofunc'],
|
|
178
|
+
'no-useless-backreference': 'error',
|
|
179
|
+
'no-useless-call': 'error',
|
|
180
|
+
'no-useless-catch': 'error',
|
|
181
|
+
'no-useless-computed-key': 'error',
|
|
182
|
+
'no-useless-concat': 'error',
|
|
183
|
+
'no-useless-constructor': 'error',
|
|
184
|
+
'no-useless-escape': 'error',
|
|
185
|
+
'no-useless-rename': 'error',
|
|
186
|
+
'no-useless-return': 'error',
|
|
187
|
+
'no-var': 'warn',
|
|
188
|
+
'no-void': 'off',
|
|
189
|
+
'no-warning-comments': ['warn', { terms: ['fixme'], location: 'anywhere' }],
|
|
190
|
+
'no-with': 'off',
|
|
191
|
+
'object-shorthand': ['error', 'properties'],
|
|
192
|
+
'one-var': ['error', { uninitialized: 'never', initialized: 'never' }],
|
|
193
|
+
'operator-assignment': 'off',
|
|
194
|
+
'padding-line-between-statements': 'off',
|
|
195
|
+
'prefer-arrow-callback': ['warn', { allowNamedFunctions: true, allowUnboundThis: true }],
|
|
196
|
+
'prefer-const': 'warn',
|
|
197
|
+
'prefer-destructuring': 'off',
|
|
198
|
+
'prefer-exponentiation-operator': 'warn',
|
|
199
|
+
'prefer-named-capture-group': 'off',
|
|
200
|
+
'prefer-numeric-literals': 'error',
|
|
201
|
+
'prefer-object-has-own': 'warn',
|
|
202
|
+
'prefer-object-spread': 'warn',
|
|
203
|
+
'prefer-promise-reject-errors': 'off',
|
|
204
|
+
'prefer-regex-literals': 'off',
|
|
205
|
+
'prefer-rest-params': 'error',
|
|
206
|
+
'prefer-spread': 'error',
|
|
207
|
+
'prefer-template': 'error',
|
|
208
|
+
'radix': 'error',
|
|
209
|
+
'require-atomic-updates': 'off',
|
|
210
|
+
'require-await': 'error',
|
|
211
|
+
'require-unicode-regexp': 'off',
|
|
212
|
+
'require-yield': 'error',
|
|
213
|
+
'sort-keys': 'off',
|
|
214
|
+
'sort-vars': 'off',
|
|
215
|
+
'spaced-comment': ['warn', 'always', { markers: ['/'] }], // ignore typescript triple-slash
|
|
216
|
+
'strict': 'error',
|
|
217
|
+
'symbol-description': 'error',
|
|
218
|
+
'use-isnan': 'error',
|
|
219
|
+
'valid-typeof': 'error',
|
|
220
|
+
'vars-on-top': 'error',
|
|
221
|
+
'yoda': 'error',
|
|
22
222
|
},
|
|
23
|
-
extends: [
|
|
24
|
-
'./rules/base',
|
|
25
|
-
'./rules/es2015',
|
|
26
|
-
'./rules/forbidden',
|
|
27
|
-
'./rules/import',
|
|
28
|
-
'./rules/style',
|
|
29
|
-
'./rules/variables',
|
|
30
|
-
'./rules/fp',
|
|
31
|
-
'./rules/promise',
|
|
32
|
-
'./rules/node',
|
|
33
|
-
'prettier',
|
|
34
|
-
],
|
|
35
223
|
};
|
package/cypress.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const { exts } = require('./utils');
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @type { import('eslint').Linter.Config }
|
|
5
|
+
*/
|
|
4
6
|
module.exports = {
|
|
5
7
|
overrides: [
|
|
6
8
|
{
|
|
@@ -9,7 +11,20 @@ module.exports = {
|
|
|
9
11
|
env: {
|
|
10
12
|
'cypress/globals': true,
|
|
11
13
|
},
|
|
12
|
-
extends: ['./
|
|
14
|
+
extends: [require.resolve('./test')],
|
|
15
|
+
rules: {
|
|
16
|
+
'cypress/assertion-before-screenshot': 'warn',
|
|
17
|
+
'cypress/no-assigning-return-values': 'error',
|
|
18
|
+
'cypress/no-async-tests': 'error',
|
|
19
|
+
'cypress/no-force': 'warn',
|
|
20
|
+
'cypress/no-pause': 'error',
|
|
21
|
+
'cypress/no-unnecessary-waiting': 'error',
|
|
22
|
+
'cypress/require-data-selectors': 'off',
|
|
23
|
+
|
|
24
|
+
...(global.fullstacksjs?.typescript && {
|
|
25
|
+
'@typescript-eslint/no-namespace': 0,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
13
28
|
},
|
|
14
29
|
],
|
|
15
30
|
};
|
package/{rules/fp.js → fp.js}
RENAMED
package/graphql.js
CHANGED
|
@@ -5,7 +5,73 @@ module.exports = {
|
|
|
5
5
|
files: ['*.graphql', '*.gql'],
|
|
6
6
|
parser: '@graphql-eslint/eslint-plugin',
|
|
7
7
|
plugins: ['@graphql-eslint'],
|
|
8
|
-
|
|
8
|
+
rules: {
|
|
9
|
+
'@graphql-eslint/alphabetize': ['warn', { fields: ['ObjectTypeDefinition'] }],
|
|
10
|
+
'@graphql-eslint/description-style': 'warn',
|
|
11
|
+
'@graphql-eslint/executable-definitions': 'off',
|
|
12
|
+
'@graphql-eslint/fields-on-correct-type': 'warn',
|
|
13
|
+
'@graphql-eslint/fragments-on-composite-type': 'warn',
|
|
14
|
+
'@graphql-eslint/input-name': 'warn',
|
|
15
|
+
'@graphql-eslint/known-argument-names': 'warn',
|
|
16
|
+
'@graphql-eslint/known-directives': 'warn',
|
|
17
|
+
'@graphql-eslint/known-fragment-names': 'warn',
|
|
18
|
+
'@graphql-eslint/known-type-names': 'warn',
|
|
19
|
+
'@graphql-eslint/lone-anonymous-operation': 'warn',
|
|
20
|
+
'@graphql-eslint/lone-executable-definition': 'off',
|
|
21
|
+
'@graphql-eslint/lone-schema-definition': 'warn',
|
|
22
|
+
'@graphql-eslint/match-document-filename': ['warn', { query: 'camelCase', mutation: 'camelCase', subscription: 'camelCase' }],
|
|
23
|
+
'@graphql-eslint/naming-convention': 'warn',
|
|
24
|
+
'@graphql-eslint/no-anonymous-operations': 'warn',
|
|
25
|
+
'@graphql-eslint/no-case-insensitive-enum-values-duplicates': 'warn',
|
|
26
|
+
'@graphql-eslint/no-deprecated': 'warn',
|
|
27
|
+
'@graphql-eslint/no-duplicate-fields': 'warn',
|
|
28
|
+
'@graphql-eslint/no-fragment-cycles': 'warn',
|
|
29
|
+
'@graphql-eslint/no-hashtag-description': 'warn',
|
|
30
|
+
'@graphql-eslint/no-one-place-fragments': 'off',
|
|
31
|
+
'@graphql-eslint/no-root-type': 'off',
|
|
32
|
+
'@graphql-eslint/no-scalar-result-type-on-mutation': 'warn',
|
|
33
|
+
'@graphql-eslint/no-typename-prefix': 'warn',
|
|
34
|
+
'@graphql-eslint/no-undefined-variables': 'warn',
|
|
35
|
+
'@graphql-eslint/no-unreachable-types': 'warn',
|
|
36
|
+
'@graphql-eslint/no-unused-fields': 'warn',
|
|
37
|
+
'@graphql-eslint/no-unused-fragments': 'warn',
|
|
38
|
+
'@graphql-eslint/no-unused-variables': 'warn',
|
|
39
|
+
'@graphql-eslint/one-field-subscriptions': 'warn',
|
|
40
|
+
'@graphql-eslint/overlapping-fields-can-be-merged': 'warn',
|
|
41
|
+
'@graphql-eslint/possible-fragment-spread': 'warn',
|
|
42
|
+
'@graphql-eslint/possible-type-extension': 'warn',
|
|
43
|
+
'@graphql-eslint/provided-required-arguments': 'warn',
|
|
44
|
+
'@graphql-eslint/relay-arguments': 'warn',
|
|
45
|
+
'@graphql-eslint/relay-connection-types': 'warn',
|
|
46
|
+
'@graphql-eslint/relay-edge-types': 'warn',
|
|
47
|
+
'@graphql-eslint/relay-page-info': 'warn',
|
|
48
|
+
'@graphql-eslint/require-deprecation-date': 'warn',
|
|
49
|
+
'@graphql-eslint/require-deprecation-reason': 'warn',
|
|
50
|
+
'@graphql-eslint/require-description': 'off',
|
|
51
|
+
'@graphql-eslint/require-field-of-type-query-in-mutation-result': 'warn',
|
|
52
|
+
'@graphql-eslint/require-id-when-available': 'warn',
|
|
53
|
+
'@graphql-eslint/require-nullable-fields-with-oneof': 'warn',
|
|
54
|
+
'@graphql-eslint/require-type-pattern-with-oneof': 'warn',
|
|
55
|
+
'@graphql-eslint/scalar-leafs': 'warn',
|
|
56
|
+
'@graphql-eslint/selection-set-depth': 'off',
|
|
57
|
+
'@graphql-eslint/strict-id-in-types': 'warn',
|
|
58
|
+
'@graphql-eslint/unique-argument-names': 'warn',
|
|
59
|
+
'@graphql-eslint/unique-directive-names': 'warn',
|
|
60
|
+
'@graphql-eslint/unique-directive-names-per-location': 'warn',
|
|
61
|
+
'@graphql-eslint/unique-enum-value-names': 'warn',
|
|
62
|
+
'@graphql-eslint/unique-field-definition-names': 'warn',
|
|
63
|
+
'@graphql-eslint/unique-fragment-name': 'warn',
|
|
64
|
+
'@graphql-eslint/unique-input-field-names': 'warn',
|
|
65
|
+
'@graphql-eslint/unique-operation-name': 'warn',
|
|
66
|
+
'@graphql-eslint/unique-operation-types': 'warn',
|
|
67
|
+
'@graphql-eslint/unique-type-names': 'warn',
|
|
68
|
+
'@graphql-eslint/unique-variable-names': 'warn',
|
|
69
|
+
'@graphql-eslint/value-literals-of-correct-type': 'warn',
|
|
70
|
+
'@graphql-eslint/variables-are-input-types': 'warn',
|
|
71
|
+
'@graphql-eslint/variables-in-allowed-position': 'warn',
|
|
72
|
+
|
|
73
|
+
'spaced-comment': 'off',
|
|
74
|
+
},
|
|
9
75
|
},
|
|
10
76
|
],
|
|
11
77
|
};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
/** @type { import('eslint').Linter.Config } */
|
|
1
2
|
module.exports = {
|
|
3
|
+
plugins: ['import', 'simple-import-sort'],
|
|
4
|
+
settings: {
|
|
5
|
+
'import/resolver': {
|
|
6
|
+
node: {
|
|
7
|
+
extensions: ['.mjs', '.js', '.json', '.jsx'],
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
'import/core-modules': [],
|
|
11
|
+
'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
|
|
12
|
+
},
|
|
2
13
|
rules: {
|
|
3
14
|
'import/consistent-type-specifier-style': ['warn', 'prefer-inline'],
|
|
4
15
|
'import/default': 'error',
|
package/index.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
require('./registerOpts');
|
|
2
2
|
const { compact } = require('@fullstacksjs/toolbox');
|
|
3
|
+
const { hasDep } = require('./utils');
|
|
3
4
|
|
|
4
5
|
/** @type { import('eslint').Linter.Config } */
|
|
5
6
|
module.exports = {
|
|
6
7
|
extends: compact([
|
|
7
8
|
require.resolve('./base'),
|
|
9
|
+
require.resolve('./fp'),
|
|
10
|
+
require.resolve('./import'),
|
|
11
|
+
require.resolve('./node'),
|
|
12
|
+
require.resolve('./promise'),
|
|
8
13
|
require.resolve('./storybook'),
|
|
9
14
|
require.resolve('./jest'),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
hasDep('react') && !hasDep('next') && require.resolve('./react'),
|
|
16
|
+
hasDep('typescript') && require.resolve('./typescript'),
|
|
17
|
+
hasDep('cypress') && require.resolve('./cypress'),
|
|
18
|
+
require.resolve('./prettier'),
|
|
13
19
|
]),
|
|
14
20
|
};
|
package/init.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const { compact } = require('@fullstacksjs/toolbox');
|
|
2
|
+
require('./registerOpts');
|
|
3
|
+
const merge = require('deepmerge');
|
|
4
|
+
|
|
5
|
+
/** @param { import('./index.d').Options } opts */
|
|
6
|
+
function init(opts = {}) {
|
|
7
|
+
const { extends: extendsOverrides, ...overrides } = opts.overrides;
|
|
8
|
+
global.fullstacksjs = merge(global.fullstacksjs, opts);
|
|
9
|
+
|
|
10
|
+
/** @type { import('eslint').Linter.Config } */
|
|
11
|
+
const config = {
|
|
12
|
+
extends: compact([
|
|
13
|
+
require.resolve('./base'),
|
|
14
|
+
require.resolve('./promise'),
|
|
15
|
+
require.resolve('./fp'),
|
|
16
|
+
opts.node && require.resolve('./node'),
|
|
17
|
+
opts.cypress && require.resolve('./cypress'),
|
|
18
|
+
opts.test && require.resolve('./jest'),
|
|
19
|
+
opts.graphql && require.resolve('./graphql'),
|
|
20
|
+
opts.storybook && require.resolve('./storybook'),
|
|
21
|
+
opts.importModule && require.resolve('./import'),
|
|
22
|
+
opts.typescript && require.resolve('./typescript'),
|
|
23
|
+
opts.esm && require.resolve('./esm'),
|
|
24
|
+
opts.strict && require.resolve('./strict'),
|
|
25
|
+
require.resolve('./prettier'),
|
|
26
|
+
...extendsOverrides,
|
|
27
|
+
]),
|
|
28
|
+
...overrides,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
if (opts.react === 'raw') config.extends.push(require.resolve('./react.js'));
|
|
32
|
+
|
|
33
|
+
if (opts.typescript.parserProject) {
|
|
34
|
+
config.parserOptions = {
|
|
35
|
+
...config.parserOptions,
|
|
36
|
+
project: opts.typescript.parserProject,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (opts.typescript.resolverProject) {
|
|
41
|
+
config.extends.push(require.resolve('./typecheck.js'));
|
|
42
|
+
config.settings = {
|
|
43
|
+
...config.settings,
|
|
44
|
+
'import/resolver': {
|
|
45
|
+
...config.settings['import/resolver'],
|
|
46
|
+
typescript: {
|
|
47
|
+
...config.settings['import/resolver'].typescript,
|
|
48
|
+
project: opts.typescript.parserProject,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return config;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = init;
|
package/jest.js
CHANGED
|
@@ -2,7 +2,9 @@ const { exts } = require('./utils');
|
|
|
2
2
|
|
|
3
3
|
const dirs = '+(test|tests|__test__|__tests__|spec|specs)';
|
|
4
4
|
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* @type { import('eslint').Linter.Config }
|
|
7
|
+
*/
|
|
6
8
|
module.exports = {
|
|
7
9
|
overrides: [
|
|
8
10
|
{
|
|
@@ -11,7 +13,70 @@ module.exports = {
|
|
|
11
13
|
env: {
|
|
12
14
|
'jest/globals': true,
|
|
13
15
|
},
|
|
14
|
-
extends: ['./
|
|
16
|
+
extends: [require.resolve('./test')],
|
|
17
|
+
rules: {
|
|
18
|
+
'jest/consistent-test-it': 'off',
|
|
19
|
+
'jest/expect-expect': 'off',
|
|
20
|
+
'jest/lowercase-name': 'off',
|
|
21
|
+
'jest/max-nested-describe': ['error', { max: 2 }],
|
|
22
|
+
'jest/no-alias-methods': 'error',
|
|
23
|
+
'jest/no-commented-out-tests': 'warn',
|
|
24
|
+
'jest/no-conditional-expect': 'error',
|
|
25
|
+
'jest/no-conditional-in-test': 'error',
|
|
26
|
+
'jest/no-done-callback': 'warn',
|
|
27
|
+
'jest/no-expect-resolves': 'off',
|
|
28
|
+
'jest/no-export': 'error',
|
|
29
|
+
'jest/no-hooks': 'off',
|
|
30
|
+
'jest/no-interpolation-in-snapshots': 'error',
|
|
31
|
+
'jest/no-jasmine-globals': 'off',
|
|
32
|
+
'jest/no-large-snapshots': ['warn', { maxSize: 300 }],
|
|
33
|
+
'jest/no-mocks-import': 'error',
|
|
34
|
+
'jest/no-restricted-jest-methods': 'off',
|
|
35
|
+
'jest/no-restricted-matchers': 'error',
|
|
36
|
+
'jest/no-standalone-expect': 'off',
|
|
37
|
+
'jest/no-test-callback': 'off',
|
|
38
|
+
'jest/no-test-prefixes': 'error',
|
|
39
|
+
'jest/no-test-return-statement': 'off',
|
|
40
|
+
'jest/no-truthy-falsy': 'off',
|
|
41
|
+
'jest/prefer-called-with': 'error',
|
|
42
|
+
'jest/prefer-each': 'warn',
|
|
43
|
+
'jest/prefer-expect-assertions': 'off',
|
|
44
|
+
'jest/prefer-expect-resolves': 'warn',
|
|
45
|
+
'jest/prefer-hooks-on-top': 'error',
|
|
46
|
+
'jest/prefer-inline-snapshots': 'off',
|
|
47
|
+
'jest/prefer-mock-promise-shorthand': 'warn',
|
|
48
|
+
'jest/prefer-lowercase-title': 'off',
|
|
49
|
+
'jest/prefer-snapshot-hint': 'warn',
|
|
50
|
+
'jest/prefer-spy-on': 'off',
|
|
51
|
+
'jest/prefer-strict-equal': 'off',
|
|
52
|
+
'jest/prefer-to-be-null': 'off',
|
|
53
|
+
'jest/prefer-to-be-undefined': 'off',
|
|
54
|
+
'jest/prefer-to-be': 'warn',
|
|
55
|
+
'jest/prefer-to-contain': 'warn',
|
|
56
|
+
'jest/prefer-to-have-length': 'warn',
|
|
57
|
+
'jest/prefer-todo': 'warn',
|
|
58
|
+
'jest/require-hook': 'off',
|
|
59
|
+
'jest/require-to-throw-message': 'off',
|
|
60
|
+
'jest/require-top-level-describe': 'off',
|
|
61
|
+
'jest/valid-describe-callback': 'error',
|
|
62
|
+
'jest/valid-expect-in-promise': 'error',
|
|
63
|
+
'jest/valid-expect': 'error',
|
|
64
|
+
'jest/valid-title': 'warn',
|
|
65
|
+
|
|
66
|
+
'jest/no-deprecated-functions': 'off',
|
|
67
|
+
...(global.fullstacksjs?.jest && {
|
|
68
|
+
'jest/no-deprecated-functions': 'error',
|
|
69
|
+
}),
|
|
70
|
+
|
|
71
|
+
...(global.fullstacksjs?.typescript && {
|
|
72
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
73
|
+
'jest/unbound-method': 'error',
|
|
74
|
+
'jest/no-untyped-mock-factory': 'warn',
|
|
75
|
+
}),
|
|
76
|
+
|
|
77
|
+
// conflicts
|
|
78
|
+
'fp/no-let': 'off',
|
|
79
|
+
},
|
|
15
80
|
},
|
|
16
81
|
],
|
|
17
82
|
};
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstacksjs/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "fullstacks <fullstacksjs@gmail.com>",
|
|
6
6
|
"description": "fullstacks eslint config",
|
|
@@ -13,32 +13,32 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"base.js",
|
|
16
|
-
"bin",
|
|
17
16
|
"cypress.js",
|
|
18
17
|
"esm.js",
|
|
18
|
+
"fp.js",
|
|
19
19
|
"graphql.js",
|
|
20
|
+
"import.js",
|
|
20
21
|
"index.js",
|
|
22
|
+
"init.js",
|
|
21
23
|
"jest.js",
|
|
22
|
-
"
|
|
24
|
+
"naming-convention.js",
|
|
25
|
+
"node.js",
|
|
23
26
|
"packages.js",
|
|
27
|
+
"prettier.js",
|
|
28
|
+
"promise.js",
|
|
24
29
|
"react.js",
|
|
25
|
-
"
|
|
30
|
+
"registerOpts.js",
|
|
26
31
|
"storybook.js",
|
|
32
|
+
"strict.js",
|
|
33
|
+
"test.js",
|
|
27
34
|
"typecheck.js",
|
|
28
35
|
"typescript.js",
|
|
29
36
|
"utils.js"
|
|
30
37
|
],
|
|
31
38
|
"scripts": {
|
|
32
39
|
"lint": "eslint .",
|
|
33
|
-
"check-rules:base": "eslint-find-rules --unused ./base.js",
|
|
34
|
-
"check-rules:jest": "eslint-find-rules --no-core --deprecated --unused ./tests/jest.js",
|
|
35
|
-
"check-rules:react": "eslint-find-rules --no-core --unused ./tests/react.js",
|
|
36
|
-
"check-rules:typescript": "eslint-find-rules --no-core --deprecated --unused ./tests/typescript.js",
|
|
37
|
-
"check-rules:cypress": "eslint-find-rules --no-core --deprecated --unused ./tests/cypress.js",
|
|
38
|
-
"check-rules:graphql": "eslint-find-rules --no-core --deprecated --unused ./tests/graphql.js",
|
|
39
|
-
"check-rules:storybook": "eslint-find-rules --no-core --deprecated --unused ./tests/storybook.js",
|
|
40
40
|
"spell": "cspell ./* --no-progress",
|
|
41
|
-
"test": "
|
|
41
|
+
"test": "./tests/test",
|
|
42
42
|
"prepublishOnly": "pinst --disable",
|
|
43
43
|
"postpublish": "pinst --enable",
|
|
44
44
|
"pre-commit": "npm run test && lint-staged"
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@graphql-eslint/eslint-plugin": "3.15.0",
|
|
50
50
|
"@typescript-eslint/eslint-plugin": "5.50.0",
|
|
51
51
|
"@typescript-eslint/parser": "5.50.0",
|
|
52
|
+
"deepmerge": "4.3.0",
|
|
52
53
|
"eslint-config-prettier": "8.6.0",
|
|
53
54
|
"eslint-import-resolver-typescript": "3.5.3",
|
|
54
55
|
"eslint-plugin-cypress": "2.12.1",
|
package/prettier.js
ADDED