@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/next.js DELETED
@@ -1,27 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- extends: ['plugin:@next/next/core-web-vitals'],
4
- rules: {
5
- 'react/function-component-definition': 'off',
6
- '@next/next/google-font-display': 'warn',
7
- '@next/next/google-font-preconnect': 'warn',
8
- '@next/next/inline-script-id': 'warn',
9
- '@next/next/next-script-for-ga': 'warn',
10
- '@next/next/no-assign-module-variable': 'warn',
11
- '@next/next/no-async-client-component': 'warn',
12
- '@next/next/no-before-interactive-script-outside-document': 'warn',
13
- '@next/next/no-css-tags': 'warn',
14
- '@next/next/no-document-import-in-page': 'warn',
15
- '@next/next/no-duplicate-head': 'warn',
16
- '@next/next/no-head-element': 'warn',
17
- '@next/next/no-head-import-in-document': 'warn',
18
- '@next/next/no-html-link-for-pages': 'warn',
19
- '@next/next/no-img-element': 'warn',
20
- '@next/next/no-page-custom-font': 'warn',
21
- '@next/next/no-script-component-in-head': 'warn',
22
- '@next/next/no-styled-jsx-in-document': 'warn',
23
- '@next/next/no-sync-scripts': 'warn',
24
- '@next/next/no-title-in-document-head': 'warn',
25
- '@next/next/no-unwanted-polyfillio': 'warn',
26
- },
27
- };
package/node.js DELETED
@@ -1,43 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- plugins: ['node'],
4
- rules: {
5
- 'node/no-unsupported-features/es-builtins': 'off', // Nice but not a general rule
6
- 'node/no-unsupported-features/es-syntax': 'off', // Nice but not a general rule
7
- 'node/no-unsupported-features/node-builtins': 'off', // Nice but not a general rule
8
- 'node/prefer-global/buffer': 'warn',
9
- 'node/prefer-global/console': 'warn',
10
- 'node/prefer-global/process': 'warn',
11
- 'node/prefer-global/text-decoder': 'warn',
12
- 'node/prefer-global/text-encoder': 'warn',
13
- 'node/prefer-global/url-search-params': 'warn',
14
- 'node/prefer-global/url': 'warn',
15
- 'node/prefer-promises/dns': 'warn',
16
- 'node/prefer-promises/fs': 'warn',
17
- 'node/callback-return': 'off',
18
- 'node/exports-style': ['error', 'module.exports', { allowBatchAssign: false }],
19
- 'node/file-extension-in-import': 'off', // import plugin
20
- 'node/global-require': 'error',
21
- 'node/handle-callback-err': 'warn',
22
- 'node/no-callback-literal': 'off',
23
- 'node/no-deprecated-api': 'error',
24
- 'node/no-exports-assign': 'error',
25
- 'node/no-extraneous-import': 'off', // import plugin
26
- 'node/no-extraneous-require': 'off', // import plugin
27
- 'node/no-missing-import': 'off', // import plugin
28
- 'node/no-missing-require': 'off', // import plugin
29
- 'node/no-mixed-requires': 'warn',
30
- 'node/no-new-require': 'error',
31
- 'node/no-path-concat': 'off',
32
- 'node/no-process-env': 'off',
33
- 'node/no-process-exit': 'off',
34
- 'node/no-restricted-import': 'off',
35
- 'node/no-restricted-require': 'off',
36
- 'node/no-sync': 'off',
37
- 'node/no-unpublished-bin': 'off',
38
- 'node/no-unpublished-import': 'off',
39
- 'node/no-unpublished-require': 'off',
40
- 'node/process-exit-as-throw': 'off',
41
- 'node/shebang': 'off',
42
- },
43
- };
package/prettier.js DELETED
@@ -1,8 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- plugins: ['prettier'],
4
- extends: ['prettier'],
5
- rules: {
6
- 'prettier/prettier': ['error'],
7
- },
8
- };
package/promise.js DELETED
@@ -1,21 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- plugins: ['promise'],
4
- rules: {
5
- 'promise/always-return': 'off',
6
- 'promise/avoid-new': 'off',
7
- 'promise/catch-or-return': 'off',
8
- 'promise/no-callback-in-promise': 'off',
9
- 'promise/no-native': 'off',
10
- 'promise/no-nesting': 'off',
11
- 'promise/no-new-statics': 'error',
12
- 'promise/no-promise-in-callback': 'error',
13
- 'promise/no-return-in-finally': 'warn',
14
- 'promise/no-return-wrap': 'error',
15
- 'promise/param-names': 'warn',
16
- 'promise/prefer-await-to-callbacks': 'off',
17
- 'promise/prefer-await-to-then': 'off',
18
- 'promise/valid-params': 'warn',
19
- 'promise/no-multiple-resolved': 'warn',
20
- },
21
- };
package/react.js DELETED
@@ -1,147 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- plugins: ['react', 'react-hooks', 'jsx-a11y'],
4
- parserOptions: {
5
- ecmaFeatures: {
6
- jsx: true,
7
- },
8
- },
9
- settings: {
10
- react: {
11
- pragma: 'React',
12
- version: 'detect',
13
- },
14
- },
15
- env: {
16
- browser: true,
17
- },
18
- rules: {
19
- 'react/boolean-prop-naming': 'off',
20
- 'react/button-has-type': 'off',
21
- 'react/default-props-match-prop-types': 'off',
22
- 'react/destructuring-assignment': 'off',
23
- 'react/display-name': ['off', { ignoreTranspilerName: false }],
24
- 'react/forbid-component-props': 'off',
25
- 'react/forbid-dom-props': 'off',
26
- 'react/forbid-elements': 'off',
27
- 'react/forbid-foreign-prop-types': 'error',
28
- 'react/forbid-prop-types': 'off',
29
- 'react/function-component-definition': ['warn', { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' }],
30
- 'react/hook-use-state': 'off',
31
- 'react/iframe-missing-sandbox': 'error',
32
- 'react/jsx-boolean-value': 'warn',
33
- 'react/jsx-child-element-spacing': 'warn',
34
- 'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'ignore' }],
35
- 'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
36
- 'react/jsx-fragments': 'off',
37
- 'react/jsx-handler-names': 'off',
38
- 'react/jsx-key': ['error', { "checkFragmentShorthand": true }],
39
- 'react/jsx-max-depth': 'off',
40
- 'react/jsx-newline': 'off',
41
- 'react/jsx-no-bind': 'off',
42
- 'react/jsx-no-comment-textnodes': 'error',
43
- 'react/jsx-no-constructed-context-values': 'error',
44
- 'react/jsx-no-duplicate-props': 'error',
45
- 'react/jsx-no-leaked-render': 'error',
46
- 'react/jsx-no-literals': 'off',
47
- 'react/jsx-no-script-url': 'error',
48
- 'react/jsx-no-target-blank': 'error',
49
- 'react/jsx-no-undef': 'error',
50
- 'react/jsx-no-useless-fragment': 'warn',
51
- 'react/jsx-one-expression-per-line': ['off', { allow: 'literal' }],
52
- 'react/jsx-pascal-case': 'error',
53
- 'react/jsx-props-no-multi-spaces': 'off',
54
- 'react/jsx-props-no-spreading': 'off',
55
- 'react/jsx-sort-props': 'off',
56
- 'react/jsx-uses-react': 'error',
57
- 'react/jsx-uses-vars': 'error',
58
- 'react/no-access-state-in-setstate': 'error',
59
- 'react/no-adjacent-inline-elements': 'error',
60
- 'react/no-array-index-key': 'warn',
61
- 'react/no-arrow-function-lifecycle': 'error',
62
- 'react/no-children-prop': 'off',
63
- 'react/no-danger': 'off',
64
- 'react/no-danger-with-children': 'error',
65
- 'react/no-deprecated': 'error',
66
- 'react/no-did-mount-set-state': 'error',
67
- 'react/no-did-update-set-state': 'error',
68
- 'react/no-direct-mutation-state': 'error',
69
- 'react/no-find-dom-node': 'error',
70
- 'react/no-invalid-html-attribute': 'warn',
71
- 'react/no-is-mounted': 'error',
72
- 'react/no-multi-comp': 'off',
73
- 'react/no-namespace': 'error',
74
- 'react/no-object-type-as-default-prop': 'warn',
75
- 'react/no-redundant-should-component-update': 'error',
76
- 'react/no-render-return-value': 'error',
77
- 'react/no-set-state': 'off',
78
- 'react/no-string-refs': 'error',
79
- 'react/no-this-in-sfc': 'error',
80
- 'react/no-typos': 'error',
81
- 'react/no-unescaped-entities': 'warn',
82
- 'react/no-unknown-property': 'error',
83
- 'react/no-unsafe': 'warn',
84
- 'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
85
- 'react/no-unused-class-component-methods': 'warn',
86
- 'react/no-unused-prop-types': 'error',
87
- 'react/no-unused-state': 'error',
88
- 'react/no-will-update-set-state': 'error',
89
- 'react/prefer-es6-class': 'off',
90
- 'react/prefer-exact-props': 'off',
91
- 'react/prefer-read-only-props': 'off',
92
- 'react/prefer-stateless-function': 'off',
93
- 'react/prop-types': 'off',
94
- 'react/react-in-jsx-scope': 'off', // jsx automatic runtime
95
- 'react/require-default-props': 'off',
96
- 'react/require-optimization': 'off',
97
- 'react/require-render-return': 'error',
98
- 'react/self-closing-comp': 'error',
99
- 'react/sort-comp': 'off',
100
- 'react/sort-default-props': 'warn',
101
- 'react/sort-prop-types': 'off',
102
- 'react/state-in-constructor': 'off',
103
- 'react/static-property-placement': 'off',
104
- 'react/style-prop-object': 'error',
105
- 'react/void-dom-elements-no-children': 'error',
106
-
107
- 'react-hooks/exhaustive-deps': 'warn',
108
- 'react-hooks/rules-of-hooks': 'error',
109
-
110
- 'jsx-a11y/alt-text': 'warn',
111
- 'jsx-a11y/anchor-has-content': 'error',
112
- 'jsx-a11y/anchor-is-valid': 'error',
113
- 'jsx-a11y/aria-activedescendant-has-tabindex': 'error',
114
- 'jsx-a11y/aria-props': 'error',
115
- 'jsx-a11y/aria-proptypes': 'error',
116
- 'jsx-a11y/aria-role': 'error',
117
- 'jsx-a11y/aria-unsupported-elements': 'error',
118
- 'jsx-a11y/autocomplete-valid': 'off',
119
- 'jsx-a11y/click-events-have-key-events': 'error',
120
- 'jsx-a11y/control-has-associated-label': 'off',
121
- 'jsx-a11y/heading-has-content': 'error',
122
- 'jsx-a11y/html-has-lang': 'error',
123
- 'jsx-a11y/iframe-has-title': 'error',
124
- 'jsx-a11y/img-redundant-alt': 'error',
125
- 'jsx-a11y/interactive-supports-focus': 'warn',
126
- 'jsx-a11y/label-has-associated-control': 'error',
127
- 'jsx-a11y/lang': 'error',
128
- 'jsx-a11y/media-has-caption': 'warn',
129
- 'jsx-a11y/mouse-events-have-key-events': 'error',
130
- 'jsx-a11y/no-access-key': 'error',
131
- 'jsx-a11y/no-aria-hidden-on-focusable': 'warn',
132
- 'jsx-a11y/no-autofocus': 'off',
133
- 'jsx-a11y/no-distracting-elements': 'error',
134
- 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'warn',
135
- 'jsx-a11y/no-noninteractive-element-interactions': 'warn',
136
- 'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
137
- 'jsx-a11y/no-noninteractive-tabindex': 'off',
138
- 'jsx-a11y/no-redundant-roles': 'error',
139
- 'jsx-a11y/no-static-element-interactions': 'off',
140
- 'jsx-a11y/role-has-required-aria-props': 'error',
141
- 'jsx-a11y/role-supports-aria-props': 'error',
142
- 'jsx-a11y/scope': 'error',
143
- 'jsx-a11y/tabindex-no-positive': 'warn',
144
- 'jsx-a11y/anchor-ambiguous-text': 'off',
145
- 'jsx-a11y/prefer-tag-over-role': 'off',
146
- },
147
- };
package/registerOpts.js DELETED
@@ -1,20 +0,0 @@
1
- const { hasDep, isEsm } = require('./utils');
2
-
3
- /** @param { import('./init').Options } opts */
4
- const defaultOptions = {
5
- esm: isEsm(),
6
- cypress: hasDep('cypress'),
7
- graphql: hasDep('graphql'),
8
- react: hasDep('react'),
9
- next: hasDep('next'),
10
- storybook: hasDep('@storybook/react'),
11
- test: hasDep('jest') || hasDep('vitest'),
12
- typescript: hasDep('typescript'),
13
- tailwind: hasDep('tailwindcss'),
14
- prettier: hasDep('prettier'),
15
- disableExpensiveRules: false,
16
- import: true,
17
- node: true,
18
- };
19
-
20
- global.fullstacksjs = defaultOptions;
package/storybook.js DELETED
@@ -1,31 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- overrides: [
4
- {
5
- files: ['**/*.stories.+(ts|tsx|js|jsx|mjs|cjs|mdx)', '**/*.story.+(ts|tsx|js|jsx|mjs|cjs|mdx)'],
6
- plugins: ['storybook'],
7
- rules: {
8
- 'storybook/await-interactions': 'error',
9
- 'storybook/context-in-play-function': 'error',
10
- 'storybook/default-exports': 'error',
11
- 'storybook/hierarchy-separator': 'warn',
12
- 'storybook/no-redundant-story-name': 'warn',
13
- 'storybook/no-uninstalled-addons': 'error',
14
- 'storybook/prefer-pascal-case': 'warn',
15
- 'storybook/story-exports': 'error',
16
- 'storybook/use-storybook-expect': 'error',
17
- 'storybook/use-storybook-testing-library': 'error',
18
-
19
- 'storybook/csf-component': 'warn',
20
- 'storybook/no-stories-of': 'warn',
21
- 'storybook/no-title-property-in-meta': 'off',
22
- 'storybook/meta-inline-properties': 'off',
23
-
24
- // Conflicts
25
- '@typescript-eslint/no-confusing-void-expression': 'off',
26
- 'react/jsx-no-useless-fragment': 'off',
27
- 'react-hooks/rules-of-hooks': 'off',
28
- },
29
- },
30
- ],
31
- };
package/strict.js DELETED
@@ -1,15 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- rules: {
4
- 'no-console': 'warn',
5
- 'fp/no-delete': 'error',
6
- 'fp/no-get-set': 'error',
7
- 'fp/no-mutating-methods': 'error',
8
- 'fp/no-mutation': ['error', { commonjs: true, allowThis: true, exceptions: [{ property: 'propTypes' }, { property: 'defaultProps' }] }],
9
- 'fp/no-nil': 'error',
10
- 'fp/no-this': 'error',
11
- 'fp/no-throw': 'error',
12
- 'fp/no-unused-expression': ['error', { allowUseStrict: true }],
13
- '@typescript-eslint/no-non-null-assertion': 'warn',
14
- },
15
- };
package/tailwind.js DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * @type { import('eslint').Linter.Config }
3
- */
4
- module.exports = {
5
- plugins: ['tailwindcss'],
6
- rules: {
7
- 'tailwindcss/classnames-order': 'warn',
8
- 'tailwindcss/enforces-negative-arbitrary-values': 'warn',
9
- 'tailwindcss/enforces-shorthand': 'warn',
10
- 'tailwindcss/migration-from-tailwind-2': 'warn',
11
- 'tailwindcss/no-arbitrary-value': 'off',
12
- 'tailwindcss/no-custom-classname': 'warn',
13
- 'tailwindcss/no-contradicting-classname': 'error',
14
- },
15
- };
package/test.js DELETED
@@ -1,40 +0,0 @@
1
- /**
2
- * @type { import('eslint').Linter.Config }
3
- */
4
- module.exports = {
5
- rules: {
6
- 'jest/prefer-hooks-in-order': 'warn',
7
- 'jest/no-disabled-tests': 'error',
8
- 'jest/no-duplicate-hooks': 'error',
9
- 'jest/no-focused-tests': 'error',
10
- 'jest/no-identical-title': 'error',
11
- 'jest/prefer-comparison-matcher': 'error',
12
- 'jest/prefer-equality-matcher': 'error',
13
- 'jest/max-expects': ['off', { max: 5 }],
14
-
15
- // formatting
16
- 'jest-formatting/padding-around-after-all-blocks': 'warn',
17
- 'jest-formatting/padding-around-after-each-blocks': 'warn',
18
- 'jest-formatting/padding-around-all': 'warn',
19
- 'jest-formatting/padding-around-before-all-blocks': 'warn',
20
- 'jest-formatting/padding-around-before-each-blocks': 'warn',
21
- 'jest-formatting/padding-around-describe-blocks': 'warn',
22
- 'jest-formatting/padding-around-expect-groups': 'warn',
23
- 'jest-formatting/padding-around-test-blocks': 'warn',
24
-
25
- 'max-lines-per-function': 'off',
26
- 'fp/no-let': 'off',
27
- 'fp/no-loops': 'off',
28
- 'no-sparse-arrays': 'off',
29
-
30
- ...(global.fullstacksjs?.react && {
31
- 'react/jsx-no-constructed-context-values': 'off',
32
- }),
33
- ...(global.fullstacksjs?.typescript && {
34
- '@typescript-eslint/method-signature-style': 'off',
35
- '@typescript-eslint/no-namespace ': 'off',
36
- '@typescript-eslint/unbound-method': 'off',
37
- '@typescript-eslint/no-empty-function': 'off',
38
- }),
39
- },
40
- };
package/typecheck.js DELETED
@@ -1,89 +0,0 @@
1
- const expensiveRules = require('./expensive-rules');
2
-
3
- /** @type { import('eslint').Linter.Config } */
4
- module.exports = {
5
- overrides: [
6
- {
7
- files: ['*.ts', '*.tsx'],
8
- rules: {
9
- '@typescript-eslint/await-thenable': 'error',
10
- '@typescript-eslint/consistent-return': 'off',
11
- '@typescript-eslint/consistent-type-exports': 'warn',
12
- '@typescript-eslint/dot-notation': [
13
- 'warn',
14
- {
15
- allowPrivateClassPropertyAccess: false,
16
- allowProtectedClassPropertyAccess: false,
17
- allowIndexSignaturePropertyAccess: true,
18
- },
19
- ],
20
- '@typescript-eslint/no-confusing-void-expression': ['off', { ignoreArrowShorthand: true, ignoreVoidOperator: true }], // Annoying and conflict with @typescript-eslint/no-meaningless-void-operator
21
- '@typescript-eslint/no-duplicate-type-constituents': 'warn',
22
- '@typescript-eslint/no-floating-promises': expensiveRules(['error', { ignoreVoid: true }]),
23
- '@typescript-eslint/no-for-in-array': 'error',
24
- '@typescript-eslint/no-implied-eval': 'error',
25
- '@typescript-eslint/no-meaningless-void-operator': ['warn', { checkNever: false }],
26
- '@typescript-eslint/no-misused-promises': expensiveRules(['warn', { checksVoidReturn: { attributes: false } }]),
27
- '@typescript-eslint/no-mixed-enums': 'error',
28
- '@typescript-eslint/no-redundant-type-constituents': 'warn',
29
- '@typescript-eslint/no-throw-literal': ['warn', { allowThrowingUnknown: false }],
30
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
31
- '@typescript-eslint/no-unsafe-enum-comparison': 'warn',
32
- '@typescript-eslint/no-unnecessary-condition': [
33
- 'warn',
34
- {
35
- allowConstantLoopConditions: false,
36
- allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
37
- },
38
- ],
39
- '@typescript-eslint/no-unnecessary-qualifier': 'error',
40
- '@typescript-eslint/no-unnecessary-type-arguments': 'error',
41
- '@typescript-eslint/no-unnecessary-type-assertion': 'error',
42
- '@typescript-eslint/no-unsafe-unary-minus': 'error',
43
- '@typescript-eslint/no-useless-template-literals': 'warn',
44
- '@typescript-eslint/non-nullable-type-assertion-style': 'warn',
45
- '@typescript-eslint/prefer-includes': 'warn',
46
- '@typescript-eslint/prefer-optional-chain': 'warn',
47
- '@typescript-eslint/prefer-reduce-type-parameter': 'warn',
48
- '@typescript-eslint/prefer-nullish-coalescing': [
49
- 'warn',
50
- {
51
- ignoreConditionalTests: false,
52
- ignoreTernaryTests: false,
53
- ignoreMixedLogicalExpressions: false,
54
- allowRuleToRunWithoutStrictNullChecksIKnowWhatIAmDoing: false,
55
- },
56
- ],
57
- '@typescript-eslint/prefer-regexp-exec': 'warn',
58
- '@typescript-eslint/prefer-promise-reject-errors': 'warn',
59
- '@typescript-eslint/prefer-return-this-type': 'warn',
60
- '@typescript-eslint/prefer-string-starts-ends-with': 'warn',
61
- '@typescript-eslint/restrict-template-expressions': [
62
- 'warn',
63
- { allowNumber: true, allowBoolean: false, allowAny: false, allowNullish: false, allowRegExp: false, allowNever: false },
64
- ],
65
- '@typescript-eslint/require-array-sort-compare': ['error', { ignoreStringArrays: true }],
66
- '@typescript-eslint/require-await': 'error',
67
- '@typescript-eslint/return-await': 'error',
68
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
69
- '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
70
- '@typescript-eslint/naming-convention': [
71
- 'warn',
72
- ...require('./naming-convention'),
73
- // force use is/should/has for boolean variables
74
- {
75
- selector: 'variable',
76
- types: ['boolean'],
77
- format: ['PascalCase'],
78
- prefix: ['is', 'should', 'has', 'can', 'did', 'will', 'enable', 'loading'],
79
- },
80
- ],
81
-
82
- // collisions
83
- 'dot-notation': 'off',
84
- 'prefer-promise-reject-errors': 'off',
85
- 'consistent-return': 'off',
86
- },
87
- },
88
- ],
89
- };
package/typescript.js DELETED
@@ -1,169 +0,0 @@
1
- /** @type { import('eslint').Linter.Config } */
2
- module.exports = {
3
- overrides: [
4
- {
5
- files: ['*.ts', '*.tsx'],
6
- parser: '@typescript-eslint/parser',
7
- plugins: ['@typescript-eslint/eslint-plugin'],
8
- extends: ['plugin:@typescript-eslint/recommended'],
9
- settings: {
10
- 'import/parsers': {
11
- '@typescript-eslint/parser': ['.ts', '.tsx'],
12
- },
13
- 'import/resolver': {
14
- node: {
15
- extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts', '.json', '.mjs'],
16
- },
17
- },
18
- },
19
- rules: {
20
- '@typescript-eslint/adjacent-overload-signatures': 'error',
21
- '@typescript-eslint/array-type': 'error',
22
- '@typescript-eslint/ban-ts-comment': [
23
- 'error',
24
- {
25
- 'ts-expect-error': 'allow-with-description',
26
- 'ts-ignore': 'allow-with-description',
27
- 'ts-nocheck': 'allow-with-description',
28
- 'ts-check': 'allow-with-description',
29
- 'minimumDescriptionLength': 3,
30
- },
31
- ],
32
- '@typescript-eslint/ban-tslint-comment': 'off',
33
- '@typescript-eslint/ban-types': 'error',
34
- '@typescript-eslint/camelcase': 'off',
35
- '@typescript-eslint/class-literal-property-style': ['error', 'getters'],
36
- '@typescript-eslint/consistent-generic-constructors': ['warn', 'constructor'],
37
- '@typescript-eslint/consistent-indexed-object-style': 'off',
38
- '@typescript-eslint/consistent-type-assertions': 'error',
39
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
40
- '@typescript-eslint/consistent-type-imports': [
41
- 'warn',
42
- { prefer: 'type-imports', disallowTypeAnnotations: false, fixStyle: 'separate-type-imports' },
43
- ],
44
- '@typescript-eslint/default-param-last': 'warn',
45
- '@typescript-eslint/explicit-function-return-type': 'off',
46
- '@typescript-eslint/explicit-member-accessibility': 'off',
47
- '@typescript-eslint/explicit-module-boundary-types': 'off',
48
- '@typescript-eslint/generic-type-naming': 'off',
49
- '@typescript-eslint/init-declarations': 'off',
50
- '@typescript-eslint/lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
51
- '@typescript-eslint/member-naming': 'off',
52
- '@typescript-eslint/member-ordering': 'off',
53
- '@typescript-eslint/method-signature-style': ['warn', 'property'],
54
- '@typescript-eslint/naming-convention': ['warn', ...require('./naming-convention')],
55
- '@typescript-eslint/no-array-constructor': 'error',
56
- '@typescript-eslint/no-base-to-string': 'off', // false negative
57
- '@typescript-eslint/no-confusing-non-null-assertion': 'error',
58
- '@typescript-eslint/no-dupe-class-members': 'error',
59
- '@typescript-eslint/no-duplicate-enum-values': 'error',
60
- '@typescript-eslint/no-dynamic-delete': 'error',
61
- '@typescript-eslint/no-empty-function': 'error',
62
- '@typescript-eslint/no-empty-interface': 'off', // Annoying with auto-fix on save.
63
- '@typescript-eslint/no-explicit-any': 'off',
64
- '@typescript-eslint/no-extra-non-null-assertion': 'error',
65
- '@typescript-eslint/no-extraneous-class': ['warn', { allowWithDecorator: true }],
66
- '@typescript-eslint/no-import-type-side-effects': 'warn',
67
- '@typescript-eslint/no-inferrable-types': 'off',
68
- '@typescript-eslint/no-invalid-this': ['error', { capIsConstructor: false }],
69
- '@typescript-eslint/no-invalid-void-type': 'error',
70
- '@typescript-eslint/no-loop-func': 'error',
71
- '@typescript-eslint/no-loss-of-precision': 'error',
72
- '@typescript-eslint/no-magic-numbers': ['off', { ignoreEnums: true }], // Not good enough yet
73
- '@typescript-eslint/no-misused-new': 'error',
74
- '@typescript-eslint/no-namespace': 'error',
75
- '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
76
- '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
77
- '@typescript-eslint/no-non-null-assertion': 'off',
78
- '@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }], // useful in FP.
79
- '@typescript-eslint/no-require-imports': 'error',
80
- '@typescript-eslint/no-restricted-imports': 'off',
81
- '@typescript-eslint/no-shadow': 'error',
82
- '@typescript-eslint/no-this-alias': 'error',
83
- '@typescript-eslint/no-type-alias': 'off',
84
- '@typescript-eslint/no-unnecessary-type-constraint': 'warn',
85
- '@typescript-eslint/no-unsafe-argument': 'off',
86
- '@typescript-eslint/no-unsafe-assignment': 'off',
87
- '@typescript-eslint/no-unsafe-call': 'off',
88
- '@typescript-eslint/no-unsafe-declaration-merging': 'warn',
89
- '@typescript-eslint/no-unsafe-member-access': 'off',
90
- '@typescript-eslint/no-unsafe-return': 'off',
91
- '@typescript-eslint/no-untyped-public-signature': 'off',
92
- '@typescript-eslint/no-unused-expressions': 'error',
93
- '@typescript-eslint/no-unused-vars-experimental': 'off', // Why two rules?
94
- '@typescript-eslint/no-unused-vars': [
95
- 'warn',
96
- { argsIgnorePattern: '^_', varsIgnorePattern: '^([iI]gnore(d)?)|(_+)', args: 'after-used', ignoreRestSiblings: true },
97
- ],
98
- '@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: true }],
99
- '@typescript-eslint/no-useless-constructor': 'error',
100
- '@typescript-eslint/no-useless-empty-export': 'warn',
101
- '@typescript-eslint/no-var-requires': 'error',
102
- '@typescript-eslint/object-curly-spacing': 'warn',
103
- '@typescript-eslint/parameter-properties': 'off',
104
- '@typescript-eslint/padding-line-between-statements': [
105
- 'warn',
106
- {
107
- blankLine: 'always',
108
- prev: '*',
109
- next: ['class', 'for', 'while', 'switch', 'do', 'directive', 'function', 'iife', 'block-like'],
110
- },
111
- { blankLine: 'always', prev: ['block-like', 'block'], next: ['return'] },
112
- { blankLine: 'always', prev: ['block-like'], next: ['const', 'let', 'var'] },
113
- { blankLine: 'always', prev: ['const', 'let', 'var'], next: ['type', 'interface'] },
114
- { blankLine: 'always', prev: ['multiline-const', 'multiline-let', 'multiline-var'], next: ['if'] },
115
- ],
116
- '@typescript-eslint/prefer-as-const': 'warn',
117
- '@typescript-eslint/prefer-enum-initializers': 'off',
118
- '@typescript-eslint/prefer-for-of': 'warn',
119
- '@typescript-eslint/prefer-function-type': 'warn',
120
- '@typescript-eslint/prefer-literal-enum-member': ['error', { allowBitwiseExpressions: true }],
121
- '@typescript-eslint/prefer-namespace-keyword': 'error',
122
- '@typescript-eslint/prefer-readonly-parameter-types': [
123
- 'off',
124
- { checkParameterProperties: true, ignoreInferredTypes: false, treatMethodsAsReadonly: true },
125
- ], // I'm not sure...
126
- '@typescript-eslint/prefer-readonly': 'off',
127
- '@typescript-eslint/prefer-readonlysemi': 'off', // Annoying with auto-fix on save.
128
- '@typescript-eslint/prefer-ts-expect-error': 'off',
129
- '@typescript-eslint/promise-function-async': 'off',
130
- '@typescript-eslint/restrict-plus-operands': 'off',
131
- '@typescript-eslint/sort-type-constituents': [
132
- 'warn',
133
- {
134
- checkIntersections: true,
135
- checkUnions: true,
136
- groupOrder: [
137
- 'named',
138
- 'keyword',
139
- 'operator',
140
- 'literal',
141
- 'function',
142
- 'import',
143
- 'conditional',
144
- 'object',
145
- 'tuple',
146
- 'intersection',
147
- 'union',
148
- 'nullish',
149
- ],
150
- },
151
- ],
152
- '@typescript-eslint/strict-boolean-expressions': 'off', // Annoying
153
- '@typescript-eslint/space-before-blocks': 'off',
154
-
155
- '@typescript-eslint/triple-slash-reference': 'error',
156
- '@typescript-eslint/typedef': ['error', { parameter: false, arrowParameter: false, variableDeclaration: false }],
157
- '@typescript-eslint/unified-signatures': 'error',
158
- '@typescript-eslint/key-spacing': 'off',
159
-
160
- // open issues
161
- 'react/jsx-no-useless-fragment': 'off', // Need useless-fragment for JSX return type
162
- 'import/named': 'off',
163
- 'import/namespace': 'off',
164
- 'import/default': 'off',
165
- 'import/no-named-as-default-member': 'off',
166
- },
167
- },
168
- ],
169
- };