@lidofinance/eslint-config 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "root": true,
3
+ "plugins": [
4
+ "prettier"
5
+ ],
6
+ "extends": [
7
+ "./auto-hard.js"
8
+ ],
9
+ "rules": {
10
+ "prettier/prettier": "error"
11
+ }
12
+ }
package/README.md ADDED
@@ -0,0 +1,10 @@
1
+ This is pre-release stage software for evaluation purposes; full release will come soon.
2
+
3
+ Please, do not use it unless you specifically know what you are doing.
4
+
5
+ ---
6
+
7
+ Behavior changes are dependent upon:
8
+
9
+ - presence of React, Jest, Next.js, Typescript in dependencies/devDependencies
10
+ - Typescript `strict` flag in tsconfig
package/all-hard.js ADDED
@@ -0,0 +1,12 @@
1
+ const buildConfig = require('./lib/build-config')
2
+ const rulesets = require('./rulesets/hard')
3
+
4
+ module.exports = buildConfig(
5
+ {
6
+ typescript: true,
7
+ react: true,
8
+ next: true,
9
+ jest: true,
10
+ },
11
+ rulesets
12
+ )
package/all.js ADDED
@@ -0,0 +1,12 @@
1
+ const buildConfig = require('./lib/build-config')
2
+ const rulesets = require('./rulesets/easy')
3
+
4
+ module.exports = buildConfig(
5
+ {
6
+ typescript: true,
7
+ react: true,
8
+ next: true,
9
+ jest: true,
10
+ },
11
+ rulesets
12
+ )
package/auto-hard.js ADDED
@@ -0,0 +1,5 @@
1
+ const buildConfig = require('./lib/build-config')
2
+ const rulesets = require('./rulesets/hard')
3
+ const env = require('./lib/env')
4
+
5
+ module.exports = buildConfig(env, rulesets)
package/auto.js ADDED
@@ -0,0 +1,5 @@
1
+ const buildConfig = require('./lib/build-config')
2
+ const rulesets = require('./rulesets/easy')
3
+ const env = require('./lib/env')
4
+
5
+ module.exports = buildConfig(env, rulesets)
@@ -0,0 +1,219 @@
1
+ const ts = require('typescript')
2
+
3
+ const generalLoosenRules = {
4
+ 'unicorn/consistent-function-scoping': 'off',
5
+ 'unicorn/error-message': 'off',
6
+ 'sonarjs/no-identical-conditions': 'off',
7
+ 'sonarjs/no-identical-expressions': 'off',
8
+ 'sonarjs/no-identical-functions': 'off',
9
+ }
10
+ const loosenTsRules = {
11
+ '@typescript-eslint/no-unsafe-argument': 'off',
12
+ '@typescript-eslint/no-unsafe-assignment': 'off',
13
+ '@typescript-eslint/no-unsafe-call': 'off',
14
+ '@typescript-eslint/no-unsafe-member-access': 'off',
15
+ '@typescript-eslint/no-unsafe-return': 'off',
16
+ '@typescript-eslint/require-await': 'off',
17
+ '@typescript-eslint/await-thenable': 'off',
18
+ '@typescript-eslint/no-explicit-any': 'off',
19
+ }
20
+ const loosenReactRules = {
21
+ // loosen some rules
22
+ 'react/prop-types': 'off',
23
+ 'react/react-in-jsx-scope': 'off',
24
+ }
25
+
26
+ module.exports = function buildConfig(env, { nextRules, tsDisableRules, tsRules, reactRules, defaultRules }) {
27
+ const config = {
28
+ extends: ['eslint:recommended'],
29
+ env: {
30
+ es2022: true,
31
+ browser: env.react,
32
+ node: true,
33
+ },
34
+ // future: add @brettz9, css-modules, eslint-comments plugins
35
+ plugins: ['sonarjs', 'unicorn', 'import', 'promise'],
36
+ settings: {
37
+ 'import/resolver': {
38
+ [require.resolve('eslint-import-resolver-node')]: {
39
+ extensions: ['.js', '.jsx'],
40
+ },
41
+ },
42
+ },
43
+ rules: defaultRules,
44
+ overrides: [],
45
+ }
46
+
47
+ const loosenRules = {
48
+ ...generalLoosenRules,
49
+ ...(env.react ? loosenReactRules : {}),
50
+ ...(env.typescript ? loosenTsRules : {}),
51
+ }
52
+
53
+ if (env.react) {
54
+ Object.assign(config, {
55
+ plugins: [...config.plugins, 'react', 'react-hooks'],
56
+ rules: {
57
+ ...config.rules,
58
+ ...reactRules,
59
+ },
60
+ settings: {
61
+ ...config.settings,
62
+ react: {
63
+ version: 'detect',
64
+ },
65
+ },
66
+ overrides: [
67
+ ...config.overrides,
68
+ {
69
+ files: ['*.stories.*', '*.test.*'],
70
+ rules: loosenRules,
71
+ },
72
+ ],
73
+ })
74
+ }
75
+
76
+ if (env.next) {
77
+ Object.assign(config, {
78
+ plugins: [...config.plugins, '@next/next'],
79
+ rules: {
80
+ ...config.rules,
81
+ ...nextRules,
82
+ },
83
+ })
84
+ }
85
+
86
+ // order is important here
87
+ if (env.jest) {
88
+ Object.assign(config, {
89
+ plugins: [...config.plugins, 'jest'],
90
+ overrides: [
91
+ ...config.overrides,
92
+ {
93
+ extends: ['plugin:jest/recommended'],
94
+ files: ['__test__/**', 'test/**', '*.spec.*'],
95
+ env: {
96
+ 'jest/globals': true,
97
+ },
98
+ rules: {
99
+ ...loosenRules,
100
+ // sometimes there are problems with version detection causing this rule to crash ESLint
101
+ 'jest/no-deprecated-functions': 'off',
102
+ },
103
+ },
104
+ ],
105
+ })
106
+ }
107
+
108
+ if (env.typescript) {
109
+ let tsconfigPath
110
+ const extraTsRules = {}
111
+
112
+ try {
113
+ // eslint-disable-next-line @typescript-eslint/unbound-method
114
+ tsconfigPath = ts.findConfigFile(process.cwd(), ts.sys.fileExists, 'tsconfig.json')
115
+ // eslint-disable-next-line @typescript-eslint/unbound-method
116
+ const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile)
117
+ if (config) {
118
+ Object.assign(tsRules, {
119
+ '@typescript-eslint/await-thenable': 'warn',
120
+ '@typescript-eslint/no-floating-promises': 'error',
121
+ 'no-implied-eval': 'off',
122
+ '@typescript-eslint/no-implied-eval': 'error',
123
+ '@typescript-eslint/no-misused-promises': 'warn',
124
+ '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
125
+ 'require-await': 'off',
126
+ '@typescript-eslint/require-await': 'error',
127
+ '@typescript-eslint/restrict-plus-operands': 'warn',
128
+ '@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
129
+ })
130
+ }
131
+ if (config.compilerOptions?.strict) {
132
+ Object.assign(extraTsRules, {
133
+ '@typescript-eslint/no-explicit-any': 'error',
134
+ '@typescript-eslint/no-unsafe-argument': 'error',
135
+ '@typescript-eslint/no-unsafe-assignment': 'error',
136
+ '@typescript-eslint/no-unsafe-call': 'error',
137
+ '@typescript-eslint/no-unsafe-member-access': 'error',
138
+ '@typescript-eslint/no-unsafe-return': 'error',
139
+ '@typescript-eslint/restrict-template-expressions': 'error',
140
+ })
141
+ }
142
+ } catch {
143
+ void 0
144
+ }
145
+
146
+ Object.assign(config, {
147
+ plugins: [...config.plugins, '@typescript-eslint'],
148
+ parser: '@typescript-eslint/parser',
149
+ parserOptions: {
150
+ sourceType: 'module',
151
+ project: tsconfigPath,
152
+ ecmaFeatures: {
153
+ jsx: env.react,
154
+ },
155
+ warnOnUnsupportedTypeScriptVersion: true,
156
+ },
157
+ settings: {
158
+ ...config.settings,
159
+ 'import/resolver': {
160
+ ...config.settings['import/resolver'],
161
+ [require.resolve('eslint-import-resolver-typescript')]: {
162
+ alwaysTryTypes: true,
163
+ },
164
+ },
165
+ },
166
+ rules: {
167
+ ...config.rules,
168
+ ...tsRules,
169
+ ...extraTsRules,
170
+ },
171
+ overrides: [
172
+ ...config.overrides,
173
+ // ESLint can only apply one override per file, and takes first one matched,
174
+ // so multiple overrides should be combined.
175
+ // order is important.
176
+ {
177
+ files: ['*.stories.ts', '*.stories.tsx', '*.stories.mts', '*.stories.cts'],
178
+ rules: {
179
+ ...config.rules,
180
+ ...tsDisableRules,
181
+ ...tsRules,
182
+ ...loosenRules,
183
+ },
184
+ },
185
+ {
186
+ files: [
187
+ '*.test.ts',
188
+ '*.test.tsx',
189
+ '*.test.mts',
190
+ '*.test.cts',
191
+ '__test__/**/*.ts',
192
+ '__test__/**/*.tsx',
193
+ '__test__/**/*.mts',
194
+ '__test__/**/*.cts',
195
+ ],
196
+ extends: ['plugin:jest/recommended'],
197
+ env: {
198
+ 'jest/globals': true,
199
+ },
200
+ rules: {
201
+ ...loosenRules,
202
+ ...config.rules,
203
+ ...tsDisableRules,
204
+ ...tsRules,
205
+ 'jest/no-deprecated-functions': 'off',
206
+ },
207
+ },
208
+ {
209
+ files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
210
+ rules: {
211
+ ...tsDisableRules,
212
+ },
213
+ },
214
+ ],
215
+ })
216
+ }
217
+
218
+ return config
219
+ }
package/lib/env.js ADDED
@@ -0,0 +1,29 @@
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+
4
+ let packageJsonPath = process.cwd()
5
+
6
+ while (!fs.existsSync(path.join(packageJsonPath, 'package.json'))) {
7
+ packageJsonPath = path.dirname(packageJsonPath)
8
+ if (packageJsonPath === path.resolve('/')) {
9
+ packageJsonPath = null
10
+ break
11
+ }
12
+ }
13
+
14
+ const packageJson = packageJsonPath === null ? null : require(path.join(packageJsonPath, 'package.json'))
15
+
16
+ const has = (...libs) =>
17
+ libs.some((name) => {
18
+ if (packageJsonPath === null) {
19
+ return false
20
+ }
21
+ return !!packageJson.dependencies?.[name] || !!packageJson.devDependencies?.[name]
22
+ })
23
+
24
+ module.exports = {
25
+ react: has('react'),
26
+ next: has('next'),
27
+ typescript: has('typescript'),
28
+ jest: has('jest'),
29
+ }
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@lidofinance/eslint-config",
3
+ "version": "0.0.0",
4
+ "main": "auto.js",
5
+ "license": "unlicensed (yet)",
6
+ "dependencies": {
7
+ "typescript": "4.6"
8
+ },
9
+ "scripts": {
10
+ "lint": "eslint --fix ."
11
+ },
12
+ "peerDependencies": {
13
+ "@typescript-eslint/eslint-plugin": "^5.19.0",
14
+ "@typescript-eslint/parser": "^5.19.0",
15
+ "eslint": "^8.13.0",
16
+ "eslint-import-resolver-typescript": "^2.7.1",
17
+ "eslint-plugin-eslint-comments": "^3.2.0",
18
+ "eslint-plugin-import": "^2.26.0",
19
+ "eslint-plugin-jest": "^26.1.4",
20
+ "eslint-plugin-promise": "^6.0.0",
21
+ "eslint-plugin-react": "^7.29.4",
22
+ "eslint-plugin-react-hooks": "^4.4.0",
23
+ "eslint-plugin-sonarjs": "^0.13.0",
24
+ "eslint-plugin-unicorn": "^42.0.0",
25
+ "@next/eslint-plugin-next": "^12.1.6",
26
+ "typescript": "4.6"
27
+ },
28
+ "devDependencies": {
29
+ "@typescript-eslint/eslint-plugin": "^5.19.0",
30
+ "@typescript-eslint/parser": "^5.19.0",
31
+ "eslint": "^8.13.0",
32
+ "eslint-plugin-prettier": "^4.0.0",
33
+ "eslint-import-resolver-typescript": "^2.7.1",
34
+ "eslint-plugin-import": "^2.26.0",
35
+ "eslint-plugin-jest": "^26.1.4",
36
+ "eslint-plugin-promise": "^6.0.0",
37
+ "eslint-plugin-react": "^7.29.4",
38
+ "eslint-plugin-react-hooks": "^4.4.0",
39
+ "eslint-plugin-sonarjs": "^0.13.0",
40
+ "eslint-plugin-unicorn": "^42.0.0",
41
+ "@next/eslint-plugin-next": "^12.1.6",
42
+ "typescript": "4.6"
43
+ }
44
+ }
@@ -0,0 +1,202 @@
1
+ // this extends eslint:recommended
2
+ const defaultRules = {
3
+ 'prefer-const': 'warn',
4
+ 'no-useless-escape': 'warn',
5
+ 'no-unused-vars': ['error', { ignoreRestSiblings: true }],
6
+ 'no-empty-function': 'off',
7
+ 'promise/no-return-wrap': 'error',
8
+ 'promise/param-names': 'warn',
9
+ // analysis/correctness
10
+ 'import/no-unresolved': 'error',
11
+ 'import/named': 'error',
12
+ 'import/namespace': 'error',
13
+ 'import/default': 'error',
14
+ 'import/export': 'error',
15
+ // red flags (thus, warnings)
16
+ 'import/no-named-as-default': 'off',
17
+ 'import/no-named-as-default-member': 'off',
18
+ 'import/no-duplicates': 'off',
19
+ 'import/no-extraneous-dependencies': 'error',
20
+ 'sonarjs/max-switch-cases': 'error',
21
+ 'sonarjs/no-all-duplicated-branches': 'error',
22
+ 'sonarjs/no-collapsible-if': 'error',
23
+ 'sonarjs/no-collection-size-mischeck': 'error',
24
+ 'sonarjs/no-duplicated-branches': 'error',
25
+ 'sonarjs/no-element-overwrite': 'error',
26
+ 'sonarjs/no-empty-collection': 'warn',
27
+ 'sonarjs/no-extra-arguments': 'warn',
28
+ 'sonarjs/no-gratuitous-expressions': 'warn',
29
+ 'sonarjs/no-identical-conditions': 'warn',
30
+ 'sonarjs/no-identical-expressions': 'warn',
31
+ 'sonarjs/no-identical-functions': 'warn',
32
+ 'sonarjs/no-ignored-return': 'warn',
33
+ 'sonarjs/no-nested-switch': 'error',
34
+ 'sonarjs/no-nested-template-literals': 'error',
35
+ 'sonarjs/no-one-iteration-loop': 'error',
36
+ 'sonarjs/no-redundant-boolean': 'error',
37
+ 'sonarjs/no-redundant-jump': 'error',
38
+ 'sonarjs/no-same-line-conditional': 'error',
39
+ 'sonarjs/no-small-switch': 'error',
40
+ 'sonarjs/no-unused-collection': 'error',
41
+ 'sonarjs/no-use-of-empty-return-value': 'error',
42
+ 'sonarjs/no-useless-catch': 'warn',
43
+ 'sonarjs/non-existent-operator': 'error',
44
+ 'sonarjs/prefer-object-literal': 'error',
45
+ 'sonarjs/prefer-single-boolean-return': 'error',
46
+ 'sonarjs/prefer-while': 'error',
47
+ 'unicorn/consistent-function-scoping': 'error',
48
+ 'unicorn/empty-brace-spaces': 'error',
49
+ 'unicorn/error-message': 'error',
50
+ 'unicorn/escape-case': 'error',
51
+ 'unicorn/expiring-todo-comments': 'error',
52
+ 'unicorn/explicit-length-check': 'error',
53
+ 'unicorn/import-style': 'error',
54
+ 'unicorn/new-for-builtins': 'error',
55
+ 'unicorn/no-array-method-this-argument': 'error',
56
+ 'unicorn/no-array-push-push': 'warn',
57
+ 'unicorn/no-console-spaces': 'error',
58
+ 'unicorn/no-document-cookie': 'error',
59
+ 'unicorn/no-empty-file': 'error',
60
+ 'unicorn/no-for-loop': 'warn',
61
+ 'unicorn/no-hex-escape': 'error',
62
+ 'unicorn/no-instanceof-array': 'error',
63
+ 'unicorn/no-invalid-remove-event-listener': 'error',
64
+ 'unicorn/no-nested-ternary': 'error',
65
+ 'unicorn/no-new-array': 'error',
66
+ 'unicorn/no-new-buffer': 'error',
67
+ 'unicorn/no-object-as-default-parameter': 'error',
68
+ 'unicorn/no-process-exit': 'off', // this is app-specific
69
+ 'unicorn/no-static-only-class': 'error',
70
+ 'unicorn/no-thenable': 'error',
71
+ 'unicorn/no-this-assignment': 'error',
72
+ 'unicorn/no-unreadable-array-destructuring': 'error',
73
+ 'unicorn/no-unreadable-iife': 'error',
74
+ 'unicorn/no-useless-length-check': 'warn',
75
+ 'unicorn/no-useless-promise-resolve-reject': 'warn',
76
+ 'unicorn/no-useless-spread': 'warn',
77
+ 'unicorn/no-useless-switch-case': 'warn',
78
+ 'unicorn/no-zero-fractions': 'error',
79
+ 'unicorn/number-literal-case': 'error',
80
+ 'unicorn/prefer-add-event-listener': 'warn',
81
+ 'unicorn/prefer-array-find': 'warn',
82
+ 'unicorn/prefer-array-flat': 'warn',
83
+ 'unicorn/prefer-array-flat-map': 'warn',
84
+ 'unicorn/prefer-array-index-of': 'warn',
85
+ 'unicorn/prefer-array-some': 'warn',
86
+ 'unicorn/relative-url-style': 'error',
87
+ 'unicorn/require-array-join-separator': 'error',
88
+ 'unicorn/require-number-to-fixed-digits-argument': 'error',
89
+ 'unicorn/template-indent': 'error',
90
+ 'unicorn/throw-new-error': 'error',
91
+ }
92
+
93
+ const nextRules = {
94
+ 'react/react-in-jsx-scope': 'off',
95
+ '@next/next/no-css-tags': 'warn',
96
+ '@next/next/no-sync-scripts': 'warn',
97
+ '@next/next/no-html-link-for-pages': 'warn',
98
+ '@next/next/no-img-element': 'warn',
99
+ '@next/next/no-head-element': 'warn',
100
+ '@next/next/no-unwanted-polyfillio': 'warn',
101
+ '@next/next/no-page-custom-font': 'warn',
102
+ '@next/next/no-title-in-document-head': 'warn',
103
+ '@next/next/google-font-display': 'warn',
104
+ '@next/next/google-font-preconnect': 'warn',
105
+ '@next/next/next-script-for-ga': 'warn',
106
+ '@next/next/no-document-import-in-page': 'error',
107
+ '@next/next/no-head-import-in-document': 'error',
108
+ '@next/next/no-script-component-in-head': 'error',
109
+ '@next/next/no-server-import-in-page': 'error',
110
+ '@next/next/no-typos': 'warn',
111
+ '@next/next/no-duplicate-head': 'error',
112
+ '@next/next/inline-script-id': 'error',
113
+ '@next/next/no-before-interactive-script-outside-document': 'warn',
114
+ '@next/next/no-assign-module-variable': 'error',
115
+ }
116
+ const tsDisableRules = {
117
+ 'import/named': 'off', // https://github.com/import-js/eslint-plugin-import/blob/main/config/typescript.js#L29
118
+ 'constructor-super': 'off', // ts(2335) & ts(2377)
119
+ 'getter-return': 'off', // ts(2378)
120
+ 'no-const-assign': 'off', // ts(2588)
121
+ 'no-dupe-args': 'off', // ts(2300)
122
+ 'no-dupe-class-members': 'off', // ts(2393) & ts(2300)
123
+ 'no-dupe-keys': 'off', // ts(1117)
124
+ 'no-func-assign': 'off', // ts(2539)
125
+ 'no-import-assign': 'off', // ts(2539) & ts(2540)
126
+ 'no-new-symbol': 'off', // ts(2588)
127
+ 'no-obj-calls': 'off', // ts(2349)
128
+ 'no-redeclare': 'off', // ts(2451)
129
+ 'no-setter-return': 'off', // ts(2408)
130
+ 'no-this-before-super': 'off', // ts(2376)
131
+ 'no-undef': 'off', // ts(2304)
132
+ 'no-unreachable': 'off', // ts(7027)
133
+ 'no-unsafe-negation': 'off', // ts(2365) & ts(2360) & ts(2358)
134
+ 'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
135
+ 'prefer-const': 'error', // ts provides better types with const
136
+ 'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
137
+ 'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
138
+ 'valid-typeof': 'off', // ts(2367)
139
+ }
140
+ const tsRules = {
141
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
142
+ '@typescript-eslint/ban-ts-comment': 'error',
143
+ '@typescript-eslint/ban-types': 'error',
144
+ 'no-array-constructor': 'off',
145
+ '@typescript-eslint/no-array-constructor': 'error',
146
+ 'no-empty-function': 'off',
147
+ '@typescript-eslint/no-empty-function': defaultRules['no-empty-function'],
148
+ '@typescript-eslint/no-empty-interface': 'off',
149
+ '@typescript-eslint/no-explicit-any': 'off',
150
+ '@typescript-eslint/no-extra-non-null-assertion': 'error',
151
+ 'no-extra-semi': 'off',
152
+ '@typescript-eslint/no-extra-semi': 'error',
153
+ '@typescript-eslint/no-inferrable-types': 'error',
154
+ 'no-loss-of-precision': 'off',
155
+ '@typescript-eslint/no-loss-of-precision': 'error',
156
+ '@typescript-eslint/no-misused-new': 'error',
157
+ '@typescript-eslint/no-namespace': 'error',
158
+ '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
159
+ '@typescript-eslint/no-non-null-assertion': 'warn',
160
+ '@typescript-eslint/no-this-alias': 'error',
161
+ '@typescript-eslint/no-unnecessary-type-constraint': 'warn',
162
+ 'no-unused-vars': 'off',
163
+ '@typescript-eslint/no-unused-vars': defaultRules['no-unused-vars'],
164
+ '@typescript-eslint/prefer-as-const': 'error',
165
+ '@typescript-eslint/prefer-namespace-keyword': 'error',
166
+ '@typescript-eslint/triple-slash-reference': 'error',
167
+ '@typescript-eslint/no-for-in-array': 'error',
168
+ }
169
+ const reactRules = {
170
+ 'react/display-name': 'error',
171
+ 'react/jsx-key': 'error',
172
+ 'react/jsx-no-comment-textnodes': 'error',
173
+ 'react/jsx-no-duplicate-props': 'error',
174
+ 'react/jsx-no-target-blank': 'error',
175
+ 'react/jsx-no-undef': 'error',
176
+ 'react/jsx-uses-react': 'error',
177
+ 'react/jsx-uses-vars': 'error',
178
+ 'react/no-children-prop': 'error',
179
+ 'react/no-danger-with-children': 'error',
180
+ 'react/no-deprecated': 'error',
181
+ 'react/no-direct-mutation-state': 'error',
182
+ 'react/no-find-dom-node': 'error',
183
+ 'react/no-is-mounted': 'error',
184
+ 'react/no-render-return-value': 'error',
185
+ 'react/no-string-refs': 'error',
186
+ 'react/no-unescaped-entities': 'error',
187
+ 'react/no-unknown-property': 'error',
188
+ 'react/no-unsafe': 'off',
189
+ 'react/prop-types': 'off',
190
+ 'react/react-in-jsx-scope': 'error',
191
+ 'react/require-render-return': 'error',
192
+ 'react-hooks/rules-of-hooks': 'error',
193
+ 'react-hooks/exhaustive-deps': 'warn',
194
+ }
195
+
196
+ module.exports = {
197
+ nextRules,
198
+ tsDisableRules,
199
+ tsRules,
200
+ reactRules,
201
+ defaultRules,
202
+ }
@@ -0,0 +1,73 @@
1
+ const { nextRules, tsDisableRules, tsRules, reactRules, defaultRules } = require('./easy')
2
+
3
+ module.exports = {
4
+ nextRules: {
5
+ ...nextRules,
6
+ },
7
+ tsDisableRules,
8
+ tsRules,
9
+ reactRules: {
10
+ ...reactRules,
11
+ 'react/prop-types': 'error',
12
+ },
13
+ defaultRules: {
14
+ ...defaultRules,
15
+ 'promise/always-return': 'error',
16
+ 'promise/catch-or-return': 'error',
17
+ 'promise/no-native': 'off',
18
+ 'promise/no-nesting': 'warn',
19
+ 'promise/no-promise-in-callback': 'warn',
20
+ 'promise/no-callback-in-promise': 'warn',
21
+ 'promise/no-new-statics': 'error',
22
+ 'promise/no-return-in-finally': 'warn',
23
+ 'promise/valid-params': 'warn',
24
+ 'import/no-named-as-default': 'warn',
25
+ 'import/no-named-as-default-member': 'warn',
26
+ 'import/no-duplicates': 'warn',
27
+ 'sonarjs/cognitive-complexity': 'warn',
28
+ 'sonarjs/prefer-immediate-return': 'error',
29
+ 'unicorn/consistent-destructuring': 'error',
30
+ 'unicorn/custom-error-definition': 'error',
31
+ 'unicorn/no-abusive-eslint-disable': 'error',
32
+ 'no-nested-ternary': 'error',
33
+ 'unicorn/no-unsafe-regex': 'error',
34
+ 'unicorn/no-unused-properties': 'error',
35
+ 'unicorn/no-useless-fallback-in-spread': 'error',
36
+ 'unicorn/numeric-separators-style': 'warn',
37
+ 'unicorn/prefer-at': 'warn',
38
+ 'unicorn/prefer-code-point': 'warn',
39
+ 'unicorn/prefer-date-now': 'warn',
40
+ 'unicorn/prefer-default-parameters': 'warn',
41
+ 'unicorn/prefer-dom-node-append': 'warn',
42
+ 'unicorn/prefer-dom-node-dataset': 'warn',
43
+ 'unicorn/prefer-dom-node-remove': 'warn',
44
+ 'unicorn/prefer-dom-node-text-content': 'warn',
45
+ 'unicorn/prefer-export-from': 'warn',
46
+ 'unicorn/prefer-includes': 'warn',
47
+ 'unicorn/prefer-json-parse-buffer': 'warn',
48
+ 'unicorn/prefer-keyboard-event-key': 'warn',
49
+ 'unicorn/prefer-math-trunc': 'warn',
50
+ 'unicorn/prefer-modern-dom-apis': 'warn',
51
+ 'unicorn/prefer-modern-math-apis': 'warn',
52
+ 'unicorn/prefer-native-coercion-functions': 'warn',
53
+ 'unicorn/prefer-negative-index': 'warn',
54
+ 'unicorn/prefer-number-properties': 'warn',
55
+ 'unicorn/prefer-object-from-entries': 'warn',
56
+ 'unicorn/prefer-optional-catch-binding': 'warn',
57
+ 'unicorn/prefer-prototype-methods': 'warn',
58
+ 'unicorn/prefer-query-selector': 'warn',
59
+ 'unicorn/prefer-reflect-apply': 'warn',
60
+ 'unicorn/prefer-regexp-test': 'warn',
61
+ 'unicorn/prefer-set-has': 'warn',
62
+ 'unicorn/prefer-spread': 'warn',
63
+ 'unicorn/prefer-string-replace-all': 'warn',
64
+ 'unicorn/prefer-string-slice': 'warn',
65
+ 'unicorn/prefer-string-starts-ends-with': 'warn',
66
+ 'unicorn/prefer-string-trim-start-end': 'warn',
67
+ 'unicorn/prefer-switch': 'warn',
68
+ 'unicorn/prefer-ternary': 'warn',
69
+ 'unicorn/prefer-top-level-await': 'warn',
70
+ 'unicorn/prefer-type-error': 'warn',
71
+ 'unicorn/string-content': 'error',
72
+ },
73
+ }