@fullstacksjs/eslint-config 10.11.1 → 11.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.
Files changed (51) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +6 -4
  3. package/package.json +28 -50
  4. package/src/index.js +89 -0
  5. package/src/init.d.ts +22 -0
  6. package/src/modules/base.js +187 -0
  7. package/src/modules/cypress.js +23 -0
  8. package/{esm.js → src/modules/esm.js} +1 -1
  9. package/src/modules/fp.js +16 -0
  10. package/src/modules/graphql.js +84 -0
  11. package/src/modules/ignores.js +39 -0
  12. package/src/modules/imports.js +100 -0
  13. package/src/modules/jest.js +74 -0
  14. package/src/modules/next.js +32 -0
  15. package/src/modules/node.js +33 -0
  16. package/src/modules/playwright.js +30 -0
  17. package/src/modules/prettier.js +93 -0
  18. package/src/modules/promise.js +27 -0
  19. package/src/modules/react.js +151 -0
  20. package/src/modules/storybook.js +34 -0
  21. package/src/modules/strict.js +16 -0
  22. package/src/modules/tailwind.js +19 -0
  23. package/src/modules/tests.js +48 -0
  24. package/src/modules/typescript.js +255 -0
  25. package/src/modules/vitest.js +84 -0
  26. package/src/utils/conditions.js +20 -0
  27. package/src/utils/globs.js +40 -0
  28. package/base.js +0 -246
  29. package/cypress.js +0 -31
  30. package/expensive-rules.js +0 -4
  31. package/fp.js +0 -23
  32. package/graphql.js +0 -79
  33. package/import.js +0 -64
  34. package/index.js +0 -20
  35. package/init.d.ts +0 -22
  36. package/init.js +0 -64
  37. package/jest.js +0 -80
  38. package/next.js +0 -27
  39. package/node.js +0 -43
  40. package/prettier.js +0 -8
  41. package/promise.js +0 -21
  42. package/react.js +0 -147
  43. package/registerOpts.js +0 -20
  44. package/storybook.js +0 -31
  45. package/strict.js +0 -15
  46. package/tailwind.js +0 -15
  47. package/test.js +0 -40
  48. package/typecheck.js +0 -89
  49. package/typescript.js +0 -169
  50. package/utils.js +0 -21
  51. /package/{naming-convention.js → src/utils/naming-convention.js} +0 -0
package/base.js DELETED
@@ -1,246 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- parserOptions: {
4
- ecmaVersion: 'latest',
5
- sourceType: 'module',
6
- },
7
- reportUnusedDisableDirectives: true,
8
- env: {
9
- browser: true,
10
- node: true,
11
- es6: true,
12
- },
13
- rules: {
14
- 'accessor-pairs': 'error',
15
- 'array-callback-return': 'error',
16
- 'arrow-body-style': ['off', 'as-needed'], // Annoying
17
- 'block-scoped-var': 'error',
18
- 'brace-style': 'off', // prettier
19
- 'camelcase': ['warn', { properties: 'always' }],
20
- 'capitalized-comments': 'off',
21
- 'class-methods-use-this': 'off',
22
- 'comma-spacing': ['warn', { after: true, before: false }],
23
- 'complexity': ['error', 14],
24
- 'consistent-return': 'off',
25
- 'consistent-this': 'off',
26
- 'constructor-super': 'error',
27
- 'default-case': 'error',
28
- 'default-case-last': 'error',
29
- 'default-param-last': 'warn',
30
- 'dot-notation': 'error',
31
- 'eqeqeq': ['error', 'smart'],
32
- 'for-direction': 'error',
33
- 'func-name-matching': 'error',
34
- 'func-names': 'error',
35
- 'func-style': 'off',
36
- 'getter-return': ['error', { allowImplicit: true }],
37
- 'grouped-accessor-pairs': 'off',
38
- 'guard-for-in': 'error',
39
- 'id-denylist': 'off',
40
- 'id-length': 'off',
41
- 'id-match': ['error', '^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$'], // __filename, camelCase, PascalCase, CONST_VALUE, stream$, $el
42
- 'init-declarations': 'off',
43
- 'line-comment-position': 'off',
44
- 'linebreak-style': ['error', 'unix'],
45
- 'lines-around-comment': 'off',
46
- 'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: false }],
47
- 'logical-assignment-operators': 'off',
48
- 'max-classes-per-file': 'off',
49
- 'max-depth': ['error', 4],
50
- 'max-lines': ['error', { max: 2500, skipBlankLines: false, skipComments: false }],
51
- 'max-lines-per-function': ['error', 150],
52
- 'max-nested-callbacks': ['error', 7],
53
- 'max-params': ['error', 7],
54
- 'max-statements': ['error', 40],
55
- 'max-statements-per-line': ['error', { max: 1 }],
56
- 'multiline-comment-style': 'off',
57
- 'new-cap': 'off',
58
- 'no-alert': 'error',
59
- 'no-array-constructor': 'error',
60
- 'no-async-promise-executor': 'off',
61
- 'no-await-in-loop': 'error',
62
- 'no-bitwise': 'error',
63
- 'no-caller': 'error',
64
- 'no-case-declarations': 'error',
65
- 'no-class-assign': 'error',
66
- 'no-compare-neg-zero': 'error',
67
- 'no-cond-assign': 'error',
68
- 'no-console': 'off',
69
- 'no-const-assign': 'error',
70
- 'no-constant-binary-expression': 'warn',
71
- 'no-constant-condition': 'error',
72
- 'no-constructor-return': 'error',
73
- 'no-continue': 'off',
74
- 'no-control-regex': 'error',
75
- 'no-debugger': 'error',
76
- 'no-delete-var': 'error',
77
- 'no-div-regex': 'error',
78
- 'no-dupe-args': 'error',
79
- 'no-dupe-class-members': 'error',
80
- 'no-dupe-else-if': 'error',
81
- 'no-dupe-keys': 'error',
82
- 'no-duplicate-case': 'error',
83
- 'no-duplicate-imports': 'off', // Handled by import plugin
84
- 'no-else-return': 'off',
85
- 'no-empty': 'error',
86
- 'no-empty-character-class': 'error',
87
- 'no-empty-function': 'off',
88
- 'no-empty-pattern': 'error',
89
- 'no-empty-static-block': 'warn',
90
- 'no-eq-null': 'off',
91
- 'no-eval': 'error',
92
- 'no-ex-assign': 'error',
93
- 'no-extend-native': 'error',
94
- 'no-extra-bind': 'error',
95
- 'no-extra-boolean-cast': 'off',
96
- 'no-extra-label': 'error',
97
- 'no-fallthrough': 'error',
98
- 'no-floating-decimal': 'error',
99
- 'no-func-assign': 'error',
100
- 'no-global-assign': 'error',
101
- 'no-implicit-coercion': 'off',
102
- 'no-implicit-globals': 'error',
103
- 'no-implied-eval': 'error',
104
- 'no-import-assign': 'error',
105
- 'no-inline-comments': 'off',
106
- 'no-inner-declarations': 'error',
107
- 'no-invalid-regexp': 'error',
108
- 'no-invalid-this': 'warn',
109
- 'no-irregular-whitespace': 'error',
110
- 'no-iterator': 'error',
111
- 'no-label-var': 'error',
112
- 'no-labels': 'error',
113
- 'no-lone-blocks': 'error',
114
- 'no-lonely-if': 'error',
115
- 'no-loop-func': 'error',
116
- 'no-loss-of-precision': 'warn',
117
- 'no-magic-numbers': 'off',
118
- 'no-misleading-character-class': 'off',
119
- 'no-multi-assign': 'error',
120
- 'no-multi-str': 'error',
121
- 'no-negated-condition': 'off',
122
- 'no-nested-ternary': 'off',
123
- 'no-new': 'error',
124
- 'no-new-func': 'error',
125
- 'no-new-native-nonconstructor': 'error',
126
- 'no-new-object': 'error',
127
- 'no-new-symbol': 'error',
128
- 'no-new-wrappers': 'error',
129
- 'no-nonoctal-decimal-escape': 'error',
130
- 'no-obj-calls': 'error',
131
- 'no-octal': 'error',
132
- 'no-octal-escape': 'error',
133
- 'no-param-reassign': 'off',
134
- 'no-plusplus': 'off',
135
- 'no-promise-executor-return': 'error',
136
- 'no-proto': 'error',
137
- 'no-prototype-builtins': 'off',
138
- 'no-redeclare': 'error',
139
- 'no-regex-spaces': 'error',
140
- 'no-restricted-exports': 'off',
141
- 'no-restricted-globals': ['error', 'event', 'fdescribe'],
142
- 'no-restricted-imports': 'off',
143
- 'no-restricted-properties': 'off',
144
- 'no-restricted-syntax': ['error', 'WithStatement'],
145
- 'no-return-assign': 'error',
146
- 'no-return-await': 'error',
147
- 'no-script-url': 'error',
148
- 'no-self-assign': 'error',
149
- 'no-self-compare': 'error',
150
- 'no-sequences': 'error',
151
- 'no-setter-return': 'error',
152
- 'no-shadow': 'error',
153
- 'no-shadow-restricted-names': 'error',
154
- 'no-sparse-arrays': 'error',
155
- 'no-template-curly-in-string': 'off', // Some libs need curly in string for internal templates.
156
- 'no-ternary': 'off',
157
- 'no-this-before-super': 'error',
158
- 'no-throw-literal': 'error',
159
- 'no-undef': 'error',
160
- 'no-undef-init': 'error',
161
- 'no-undefined': 'off',
162
- 'no-underscore-dangle': 'off',
163
- 'no-unexpected-multiline': 'error',
164
- 'no-unmodified-loop-condition': 'error',
165
- 'no-unneeded-ternary': 'error',
166
- 'no-unreachable': 'error',
167
- 'no-unreachable-loop': 'error',
168
- 'no-unsafe-finally': 'error',
169
- 'no-unsafe-negation': 'error',
170
- 'no-unsafe-optional-chaining': 'error',
171
- 'no-unused-expressions': 'off',
172
- 'no-unused-labels': 'error',
173
- 'no-unused-private-class-members': 'warn',
174
- 'no-unused-vars': [
175
- 'error',
176
- { argsIgnorePattern: '^_', varsIgnorePattern: '^ignore(d)?', args: 'after-used', ignoreRestSiblings: true },
177
- ],
178
- 'no-use-before-define': ['error', 'nofunc'],
179
- 'no-useless-backreference': 'error',
180
- 'no-useless-call': 'error',
181
- 'no-useless-catch': 'error',
182
- 'no-useless-computed-key': 'error',
183
- 'no-useless-concat': 'error',
184
- 'no-useless-constructor': 'error',
185
- 'no-useless-escape': 'error',
186
- 'no-useless-rename': 'error',
187
- 'no-useless-return': 'error',
188
- 'no-var': 'warn',
189
- 'no-void': 'off',
190
- 'no-warning-comments': ['warn', { terms: ['fixme'], location: 'anywhere' }],
191
- 'no-with': 'off',
192
- 'object-shorthand': ['error', 'properties'],
193
- 'one-var': ['error', { uninitialized: 'never', initialized: 'never' }],
194
- 'operator-assignment': 'off',
195
- 'padding-line-between-statements': 'off',
196
- 'prefer-arrow-callback': ['warn', { allowNamedFunctions: true, allowUnboundThis: true }],
197
- 'prefer-const': 'warn',
198
- 'prefer-destructuring': 'off',
199
- 'prefer-exponentiation-operator': 'warn',
200
- 'prefer-named-capture-group': 'off',
201
- 'prefer-numeric-literals': 'error',
202
- 'prefer-object-has-own': 'warn',
203
- 'prefer-object-spread': 'off',
204
- 'prefer-promise-reject-errors': 'off',
205
- 'prefer-regex-literals': 'off',
206
- 'prefer-rest-params': 'error',
207
- 'prefer-spread': 'error',
208
- 'prefer-template': 'error',
209
- 'radix': 'error',
210
- 'require-atomic-updates': 'off',
211
- 'require-await': 'error',
212
- 'require-unicode-regexp': 'off',
213
- 'require-yield': 'error',
214
- 'sort-keys': 'off',
215
- 'sort-vars': 'off',
216
- 'spaced-comment': ['warn', 'always', { markers: ['/'] }], // ignore typescript triple-slash
217
- 'strict': 'error',
218
- 'symbol-description': 'error',
219
- 'use-isnan': 'error',
220
- 'valid-typeof': 'error',
221
- 'vars-on-top': 'error',
222
- 'yoda': 'error',
223
-
224
- ...(global.fullstacksjs?.typescript && {
225
- 'key-spacing': 'off',
226
- 'camelcase': 'off',
227
- 'default-param-last': 'off',
228
- 'init-declarations': 'off',
229
- 'lines-between-class-members': 'off',
230
- 'no-invalid-this': 'off',
231
- 'no-loop-func': 'off',
232
- 'no-redeclare': 'off',
233
- 'no-restricted-imports': 'off',
234
- 'no-shadow': 'off',
235
- 'no-unused-vars': 'off',
236
- 'no-use-before-define': 'off',
237
- 'no-useless-constructor': 'off',
238
- 'object-curly-spacing': 'off',
239
- 'padding-line-between-statements': 'off',
240
- 'space-before-blocks': 'off',
241
- 'dot-notation': 'off',
242
- 'no-throw-literal': 'off',
243
- 'require-await': 'off',
244
- }),
245
- },
246
- };
package/cypress.js DELETED
@@ -1,31 +0,0 @@
1
- const { exts } = require('./utils');
2
-
3
- /**
4
- * @type { import('eslint').Linter.Config }
5
- */
6
- module.exports = {
7
- overrides: [
8
- {
9
- files: [`**/cypress/**/*.${exts}`, `**/*.cy.${exts}`],
10
- plugins: ['jest', 'jest-formatting', 'cypress'],
11
- env: {
12
- 'cypress/globals': true,
13
- },
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
- 'cypress/unsafe-to-chain-command': 'error',
24
-
25
- ...(global.fullstacksjs?.typescript && {
26
- '@typescript-eslint/no-namespace': 0,
27
- }),
28
- },
29
- },
30
- ],
31
- };
@@ -1,4 +0,0 @@
1
- module.exports = config => {
2
- if (global.fullstacksjs?.disableExpensiveRules) return 'off';
3
- return config;
4
- };
package/fp.js DELETED
@@ -1,23 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- plugins: ['fp'],
4
- rules: {
5
- 'fp/no-arguments': 'error',
6
- 'fp/no-class': 'off',
7
- 'fp/no-delete': 'off',
8
- 'fp/no-events': 'off',
9
- 'fp/no-get-set': 'off',
10
- 'fp/no-let': 'error',
11
- 'fp/no-loops': 'error',
12
- 'fp/no-mutating-assign': 'error',
13
- 'fp/no-mutating-methods': 'off',
14
- 'fp/no-mutation': 'off',
15
- 'fp/no-nil': 'off',
16
- 'fp/no-proxy': 'off',
17
- 'fp/no-rest-parameters': 'off',
18
- 'fp/no-this': 'off',
19
- 'fp/no-throw': 'off',
20
- 'fp/no-unused-expression': 'off',
21
- 'fp/no-valueof-field': 'off',
22
- },
23
- };
package/graphql.js DELETED
@@ -1,79 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- overrides: [
4
- {
5
- files: ['*.graphql', '*.gql'],
6
- parser: '@graphql-eslint/eslint-plugin',
7
- plugins: ['@graphql-eslint'],
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-import-fragment': 'off',
54
- '@graphql-eslint/require-nullable-fields-with-oneof': 'warn',
55
- '@graphql-eslint/require-nullable-result-in-root': 'off',
56
- '@graphql-eslint/require-type-pattern-with-oneof': 'warn',
57
- '@graphql-eslint/scalar-leafs': 'warn',
58
- '@graphql-eslint/selection-set-depth': 'off',
59
- '@graphql-eslint/strict-id-in-types': 'warn',
60
- '@graphql-eslint/unique-argument-names': 'warn',
61
- '@graphql-eslint/unique-directive-names-per-location': 'warn',
62
- '@graphql-eslint/unique-directive-names': 'warn',
63
- '@graphql-eslint/unique-enum-value-names': 'warn',
64
- '@graphql-eslint/unique-field-definition-names': 'warn',
65
- '@graphql-eslint/unique-fragment-name': 'warn',
66
- '@graphql-eslint/unique-input-field-names': 'warn',
67
- '@graphql-eslint/unique-operation-name': 'warn',
68
- '@graphql-eslint/unique-operation-types': 'warn',
69
- '@graphql-eslint/unique-type-names': 'warn',
70
- '@graphql-eslint/unique-variable-names': 'warn',
71
- '@graphql-eslint/value-literals-of-correct-type': 'warn',
72
- '@graphql-eslint/variables-are-input-types': 'warn',
73
- '@graphql-eslint/variables-in-allowed-position': 'warn',
74
-
75
- 'spaced-comment': 'off',
76
- },
77
- },
78
- ],
79
- };
package/import.js DELETED
@@ -1,64 +0,0 @@
1
- const expensiveRules = require('./expensive-rules');
2
-
3
- /** @type { import('eslint').Linter.Config } */
4
- module.exports = {
5
- plugins: ['import', 'simple-import-sort'],
6
- settings: {
7
- 'import/resolver': {
8
- node: {
9
- extensions: ['.mjs', '.js', '.json', '.jsx'],
10
- },
11
- },
12
- 'import/core-modules': [],
13
- 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$'],
14
- },
15
- rules: {
16
- 'import/consistent-type-specifier-style': ['warn', 'prefer-top-level'],
17
- 'import/default': expensiveRules('error'),
18
- 'import/dynamic-import-chunkname': 'off',
19
- 'import/export': expensiveRules('error'),
20
- 'import/exports-last': 'off',
21
- 'import/extensions': ['error', 'always', { js: 'never', jsx: 'never', ts: 'never', tsx: 'never' }],
22
- 'import/first': 'error',
23
- 'import/group-exports': 'off',
24
- 'import/max-dependencies': ['off', { ignoreTypeImports: true }],
25
- 'import/named': expensiveRules('error'),
26
- 'import/namespace': expensiveRules('error'),
27
- 'import/newline-after-import': 'warn',
28
- 'import/no-absolute-path': 'error',
29
- 'import/no-amd': 'error',
30
- 'import/no-anonymous-default-export': 'off',
31
- 'import/no-commonjs': 'off',
32
- 'import/no-cycle': expensiveRules(['error', { maxDepth: Infinity }]),
33
- 'import/no-default-export': 'off',
34
- 'import/no-deprecated': expensiveRules('warn'),
35
- 'import/no-duplicates': 'error',
36
- 'import/no-dynamic-require': 'off',
37
- 'import/no-empty-named-blocks': 'error',
38
- 'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
39
- 'import/no-import-module-exports': 'off',
40
- 'import/no-internal-modules': 'off',
41
- 'import/no-mutable-exports': 'error',
42
- 'import/no-named-as-default': 'error',
43
- 'import/no-named-as-default-member': expensiveRules('error'),
44
- 'import/no-named-default': 'error',
45
- 'import/no-named-export': 'off',
46
- 'import/no-namespace': 'off',
47
- 'import/no-nodejs-modules': 'off',
48
- 'import/no-relative-packages': 'error',
49
- 'import/no-relative-parent-imports': 'off',
50
- 'import/no-restricted-paths': 'off',
51
- 'import/no-self-import': 'error',
52
- 'import/no-unassigned-import': 'off',
53
- 'import/no-unresolved': ['error', { caseSensitiveStrict: true }],
54
- 'import/no-unused-modules': 'off',
55
- 'import/no-useless-path-segments': 'warn',
56
- 'import/no-webpack-loader-syntax': 'error',
57
- 'import/order': ['off', { groups: ['builtin', ['external', 'internal'], 'parent', ['sibling', 'index']] }], // collision
58
- 'import/prefer-default-export': 'off',
59
- 'import/unambiguous': 'off',
60
- 'simple-import-sort/exports': 'warn',
61
- 'simple-import-sort/imports': 'warn',
62
- 'sort-imports': 'off',
63
- },
64
- };
package/index.js DELETED
@@ -1,20 +0,0 @@
1
- require('./registerOpts');
2
-
3
- /** @type { import('eslint').Linter.Config } */
4
- module.exports = {
5
- extends: [
6
- require.resolve('./base'),
7
- require.resolve('./fp'),
8
- require.resolve('./import'),
9
- require.resolve('./node'),
10
- require.resolve('./promise'),
11
- require.resolve('./storybook'),
12
- require.resolve('./jest'),
13
- global.fullstacksjs?.tailwind && require.resolve('./tailwind'),
14
- global.fullstacksjs?.react && require.resolve('./react'),
15
- global.fullstacksjs?.next && require.resolve('./next'),
16
- global.fullstacksjs?.typescript && require.resolve('./typescript'),
17
- global.fullstacksjs?.cypress && require.resolve('./cypress'),
18
- require.resolve('./prettier'),
19
- ].filter(Boolean),
20
- };
package/init.d.ts DELETED
@@ -1,22 +0,0 @@
1
- type Config = import('eslint').Linter.Config;
2
- export interface Options extends Config {
3
- modules: {
4
- auto?: boolean;
5
- react?: boolean;
6
- next?: boolean;
7
- typescript?: { parserProject: string[] | string; resolverProject: string[] | string };
8
- tailwind?: boolean;
9
- node?: boolean;
10
- strict?: boolean;
11
- import?: boolean;
12
- esm?: boolean;
13
- graphql?: boolean;
14
- test?: boolean;
15
- cypress?: boolean;
16
- storybook?: boolean;
17
- prettier?: boolean;
18
- disableExpensiveRules?: boolean;
19
- };
20
- }
21
-
22
- export declare const init: (opts: Options) => import('eslint').Linter.Config;
package/init.js DELETED
@@ -1,64 +0,0 @@
1
- const merge = require('deepmerge');
2
-
3
- /** @param { import('./init.d').Options } opts */
4
- // eslint-disable-next-line complexity
5
- function init(opts = {}) {
6
- const { modules = {}, extends: extraExtends = [], ...eslintConfig } = opts;
7
- if (modules.auto) {
8
- require('./registerOpts');
9
- global.fullstacksjs = merge(global.fullstacksjs, modules);
10
- } else {
11
- global.fullstacksjs = modules;
12
- }
13
- opts = global.fullstacksjs;
14
-
15
- /** @type { import('eslint').Linter.Config } */
16
- const config = Object.assign(
17
- {
18
- extends: [
19
- require.resolve('./base'),
20
- require.resolve('./promise'),
21
- require.resolve('./fp'),
22
- opts.tailwind && require.resolve('./tailwind'),
23
- opts.node && require.resolve('./node'),
24
- opts.graphql && require.resolve('./graphql'),
25
- opts.import && require.resolve('./import'),
26
- opts.typescript && require.resolve('./typescript'),
27
- opts.react && require.resolve('./react.js'),
28
- opts.next && require.resolve('./next.js'),
29
- opts.storybook && require.resolve('./storybook'),
30
- opts.cypress && require.resolve('./cypress'),
31
- opts.test && require.resolve('./jest'),
32
- opts.esm && require.resolve('./esm'),
33
- opts.strict && require.resolve('./strict'),
34
- opts.prettier && require.resolve('./prettier'),
35
- opts.typescript && require.resolve('./typecheck.js'),
36
- ]
37
- .concat(extraExtends)
38
- .filter(Boolean),
39
- parserOptions: {},
40
- settings: {},
41
- },
42
- eslintConfig,
43
- );
44
-
45
- if (opts.typescript) {
46
- config.parserOptions = merge(config.parserOptions, {
47
- project: opts.typescript.parserProject ?? true,
48
- });
49
- }
50
-
51
- if (opts.typescript?.resolverProject) {
52
- config.settings = merge(config.settings, {
53
- 'import/resolver': {
54
- typescript: {
55
- project: opts.typescript.resolverProject,
56
- },
57
- },
58
- });
59
- }
60
-
61
- return config;
62
- }
63
-
64
- module.exports.init = init;
package/jest.js DELETED
@@ -1,80 +0,0 @@
1
- const { exts } = require('./utils');
2
-
3
- const dirs = '+(test|tests|__test__|__tests__|spec|specs)';
4
-
5
- /**
6
- * @type { import('eslint').Linter.Config }
7
- */
8
- module.exports = {
9
- overrides: [
10
- {
11
- files: [`**/${dirs}/**/*.${exts}`, `**/**/*.+(spec|test|e2e-spec|e2e-test).${exts}`],
12
- plugins: ['jest', 'jest-formatting'],
13
- env: {
14
- 'jest/globals': true,
15
- },
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-confusing-set-timeout': 'warn',
27
- 'jest/no-done-callback': 'warn',
28
- 'jest/no-expect-resolves': 'off',
29
- 'jest/no-export': 'error',
30
- 'jest/no-hooks': 'off',
31
- 'jest/no-interpolation-in-snapshots': 'error',
32
- 'jest/no-jasmine-globals': 'off',
33
- 'jest/no-large-snapshots': ['warn', { maxSize: 300 }],
34
- 'jest/no-mocks-import': 'error',
35
- 'jest/no-restricted-jest-methods': 'off',
36
- 'jest/no-restricted-matchers': 'error',
37
- 'jest/no-standalone-expect': 'off',
38
- 'jest/no-test-callback': 'off',
39
- 'jest/no-test-prefixes': 'error',
40
- 'jest/no-test-return-statement': 'off',
41
- 'jest/no-truthy-falsy': 'off',
42
- 'jest/prefer-called-with': 'error',
43
- 'jest/prefer-each': 'warn',
44
- 'jest/prefer-expect-assertions': 'off',
45
- 'jest/prefer-expect-resolves': 'warn',
46
- 'jest/prefer-hooks-on-top': 'error',
47
- 'jest/prefer-inline-snapshots': 'off',
48
- 'jest/prefer-lowercase-title': 'off',
49
- 'jest/prefer-mock-promise-shorthand': 'warn',
50
- 'jest/prefer-snapshot-hint': 'warn',
51
- 'jest/prefer-spy-on': 'off',
52
- 'jest/prefer-strict-equal': 'off',
53
- 'jest/prefer-to-be-null': 'off',
54
- 'jest/prefer-to-be-undefined': 'off',
55
- 'jest/prefer-to-be': 'warn',
56
- 'jest/prefer-to-contain': 'warn',
57
- 'jest/prefer-to-have-length': 'warn',
58
- 'jest/prefer-todo': 'warn',
59
- 'jest/require-hook': 'off',
60
- 'jest/require-to-throw-message': 'off',
61
- 'jest/require-top-level-describe': 'off',
62
- 'jest/valid-describe-callback': 'error',
63
- 'jest/valid-expect-in-promise': 'error',
64
- 'jest/valid-expect': 'error',
65
- 'jest/valid-title': 'warn',
66
-
67
- 'jest/no-deprecated-functions': 'off',
68
- ...(global.fullstacksjs?.jest && {
69
- 'jest/no-deprecated-functions': 'error',
70
- }),
71
-
72
- ...(global.fullstacksjs?.typescript?.resolverProject && {
73
- '@typescript-eslint/unbound-method': 'off',
74
- 'jest/unbound-method': 'error',
75
- 'jest/no-untyped-mock-factory': 'warn',
76
- }),
77
- },
78
- },
79
- ],
80
- };