@morgs32/eslint-config 2.0.7 → 2.0.9

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 (2) hide show
  1. package/base.eslintrc.js +336 -0
  2. package/package.json +5 -5
@@ -0,0 +1,336 @@
1
+ // @ts-check
2
+ module.exports = {
3
+ extends: ['next/core-web-vitals'],
4
+ ignorePatterns: ['**/lib', '**/dist'],
5
+ settings: {
6
+ react: {
7
+ version: 'detect',
8
+ },
9
+ },
10
+ plugins: [
11
+ 'import',
12
+ 'unused-imports',
13
+ 'react',
14
+ 'react-hooks',
15
+ 'jsx-a11y',
16
+ '@typescript-eslint',
17
+ 'jest',
18
+ 'testing-library',
19
+ 'prettier',
20
+ ],
21
+ rules: {
22
+ 'prettier/prettier': 'error',
23
+ 'spaced-comment': ['error', 'always', { markers: ['/'] }],
24
+ 'unused-imports/no-unused-imports': 'error',
25
+ 'comma-spacing': ['error', { before: false, after: true }],
26
+ 'react/jsx-indent': ['error', 2],
27
+ 'space-infix-ops': ['error'],
28
+ quotes: ['error', 'single'],
29
+ 'space-before-blocks': 'error',
30
+ 'keyword-spacing': 'error',
31
+ 'object-curly-spacing': ['error', 'always'],
32
+ 'react/jsx-indent-props': [2, 2],
33
+ 'react/jsx-first-prop-new-line': [2, 'multiline'],
34
+
35
+ // https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
36
+ 'array-callback-return': 'warn',
37
+ 'default-case': ['warn', { commentPattern: '^no default$' }],
38
+ 'dot-location': ['warn', 'property'],
39
+ eqeqeq: ['warn', 'smart'],
40
+ 'new-parens': 'warn',
41
+ 'no-array-constructor': 'warn',
42
+ 'no-caller': 'warn',
43
+ 'no-cond-assign': ['warn', 'except-parens'],
44
+ 'no-const-assign': 'warn',
45
+ 'no-control-regex': 'warn',
46
+ 'no-delete-var': 'warn',
47
+ 'no-dupe-args': 'warn',
48
+ 'no-dupe-class-members': 'warn',
49
+ 'no-dupe-keys': 'warn',
50
+ 'no-duplicate-case': 'warn',
51
+ 'no-empty-character-class': 'warn',
52
+ 'no-empty-pattern': 'warn',
53
+ 'no-eval': 'warn',
54
+ 'no-ex-assign': 'warn',
55
+ 'no-extend-native': 'warn',
56
+ 'no-extra-bind': 'warn',
57
+ 'no-extra-label': 'warn',
58
+ 'no-fallthrough': 'warn',
59
+ 'no-func-assign': 'warn',
60
+ 'no-implied-eval': 'warn',
61
+ 'no-invalid-regexp': 'warn',
62
+ 'no-iterator': 'warn',
63
+ 'no-label-var': 'warn',
64
+ 'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],
65
+ 'no-lone-blocks': 'warn',
66
+ 'no-loop-func': 'warn',
67
+ 'no-mixed-operators': [
68
+ 'warn',
69
+ {
70
+ groups: [
71
+ ['&', '|', '^', '~', '<<', '>>', '>>>'],
72
+ ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
73
+ ['&&', '||'],
74
+ ['in', 'instanceof'],
75
+ ],
76
+ allowSamePrecedence: false,
77
+ },
78
+ ],
79
+ 'no-multi-str': 'warn',
80
+ 'no-global-assign': 'warn',
81
+ 'no-unsafe-negation': 'warn',
82
+ 'no-new-func': 'warn',
83
+ 'no-new-object': 'warn',
84
+ 'no-new-symbol': 'warn',
85
+ 'no-new-wrappers': 'warn',
86
+ 'no-obj-calls': 'warn',
87
+ 'no-octal': 'warn',
88
+ 'no-octal-escape': 'warn',
89
+ 'no-redeclare': 'warn',
90
+ 'no-regex-spaces': 'warn',
91
+ 'no-restricted-syntax': ['warn', 'WithStatement'],
92
+ 'no-script-url': 'warn',
93
+ 'no-self-assign': 'warn',
94
+ 'no-self-compare': 'warn',
95
+ 'no-sequences': 'warn',
96
+ 'no-shadow-restricted-names': 'warn',
97
+ 'no-sparse-arrays': 'warn',
98
+ 'no-template-curly-in-string': 'warn',
99
+ 'no-this-before-super': 'warn',
100
+ 'no-throw-literal': 'warn',
101
+ 'no-undef': 'error',
102
+ // "no-restricted-globals": ["error"].concat(restrictedGlobals),
103
+ 'no-unreachable': 'warn',
104
+ 'no-unused-expressions': [
105
+ 'error',
106
+ {
107
+ allowShortCircuit: true,
108
+ allowTernary: true,
109
+ allowTaggedTemplates: true,
110
+ },
111
+ ],
112
+ 'no-unused-labels': 'warn',
113
+ 'no-unused-vars': [
114
+ 'warn',
115
+ {
116
+ args: 'none',
117
+ ignoreRestSiblings: true,
118
+ },
119
+ ],
120
+ 'no-use-before-define': [
121
+ 'warn',
122
+ {
123
+ functions: false,
124
+ classes: false,
125
+ variables: false,
126
+ },
127
+ ],
128
+ 'no-useless-computed-key': 'warn',
129
+ 'no-useless-concat': 'warn',
130
+ 'no-useless-constructor': 'warn',
131
+ 'no-useless-escape': 'warn',
132
+ 'no-useless-rename': [
133
+ 'warn',
134
+ {
135
+ ignoreDestructuring: false,
136
+ ignoreImport: false,
137
+ ignoreExport: false,
138
+ },
139
+ ],
140
+ 'no-with': 'warn',
141
+ 'no-whitespace-before-property': 'warn',
142
+ 'react-hooks/exhaustive-deps': 'warn',
143
+ 'require-yield': 'warn',
144
+ 'rest-spread-spacing': ['warn', 'never'],
145
+ strict: ['warn', 'never'],
146
+ 'unicode-bom': ['warn', 'never'],
147
+ 'use-isnan': 'warn',
148
+ 'valid-typeof': 'warn',
149
+ 'no-restricted-properties': [
150
+ 'error',
151
+ {
152
+ object: 'require',
153
+ property: 'ensure',
154
+ message:
155
+ 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
156
+ },
157
+ {
158
+ object: 'System',
159
+ property: 'import',
160
+ message:
161
+ 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
162
+ },
163
+ ],
164
+ 'getter-return': 'warn',
165
+
166
+ // https://github.com/benmosher/eslint-plugin-import/tree/master/docs/rules
167
+ 'import/first': 'error',
168
+ 'import/no-amd': 'error',
169
+ 'import/no-anonymous-default-export': 'warn',
170
+ 'import/no-webpack-loader-syntax': 'error',
171
+
172
+ // https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules
173
+ 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
174
+ 'react/jsx-no-comment-textnodes': 'warn',
175
+ 'react/jsx-no-duplicate-props': 'warn',
176
+ 'react/jsx-no-target-blank': 'warn',
177
+ 'react/jsx-no-undef': 'error',
178
+ 'react/jsx-pascal-case': [
179
+ 'warn',
180
+ {
181
+ allowAllCaps: true,
182
+ ignore: [],
183
+ },
184
+ ],
185
+ 'react/no-danger-with-children': 'warn',
186
+ // Disabled because of undesirable warnings
187
+ // See https://github.com/facebook/create-react-app/issues/5204 for
188
+ // blockers until its re-enabled
189
+ // 'react/no-deprecated': 'warn',
190
+ 'react/no-direct-mutation-state': 'warn',
191
+ 'react/no-is-mounted': 'warn',
192
+ 'react/no-typos': 'error',
193
+ 'react/require-render-return': 'error',
194
+ 'react/style-prop-object': 'warn',
195
+
196
+ // https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules
197
+ 'jsx-a11y/alt-text': 'warn',
198
+ 'jsx-a11y/anchor-has-content': 'warn',
199
+ 'jsx-a11y/anchor-is-valid': [
200
+ 'warn',
201
+ {
202
+ aspects: ['noHref', 'invalidHref'],
203
+ },
204
+ ],
205
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
206
+ 'jsx-a11y/aria-props': 'warn',
207
+ 'jsx-a11y/aria-proptypes': 'warn',
208
+ 'jsx-a11y/aria-role': ['warn', { ignoreNonDOM: true }],
209
+ 'jsx-a11y/aria-unsupported-elements': 'warn',
210
+ 'jsx-a11y/heading-has-content': 'warn',
211
+ 'jsx-a11y/iframe-has-title': 'warn',
212
+ 'jsx-a11y/img-redundant-alt': 'warn',
213
+ 'jsx-a11y/no-access-key': 'warn',
214
+ 'jsx-a11y/no-distracting-elements': 'warn',
215
+ 'jsx-a11y/no-redundant-roles': 'warn',
216
+ 'jsx-a11y/role-has-required-aria-props': 'warn',
217
+ 'jsx-a11y/role-supports-aria-props': 'warn',
218
+ 'jsx-a11y/scope': 'warn',
219
+
220
+ // https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
221
+ 'react-hooks/rules-of-hooks': 'error',
222
+ },
223
+ overrides: [
224
+ {
225
+ files: ['**/*.stories.*'],
226
+ rules: {
227
+ 'import/no-anonymous-default-export': 'off',
228
+ },
229
+ },
230
+
231
+ // https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/jest.js
232
+ {
233
+ files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
234
+ env: {
235
+ 'jest/globals': true,
236
+ },
237
+ // A subset of the recommended rules:
238
+ rules: {
239
+ // https://github.com/jest-community/eslint-plugin-jest
240
+ 'jest/no-conditional-expect': 'error',
241
+ 'jest/no-identical-title': 'error',
242
+ 'jest/no-interpolation-in-snapshots': 'error',
243
+ 'jest/no-jasmine-globals': 'error',
244
+ 'jest/no-mocks-import': 'error',
245
+ 'jest/valid-describe-callback': 'error',
246
+ 'jest/valid-expect': 'error',
247
+ 'jest/valid-expect-in-promise': 'error',
248
+ 'jest/valid-title': 'warn',
249
+
250
+ // https://github.com/testing-library/eslint-plugin-testing-library
251
+ 'testing-library/await-async-query': 'error',
252
+ 'testing-library/await-async-utils': 'error',
253
+ 'testing-library/no-await-sync-query': 'error',
254
+ 'testing-library/no-container': 'error',
255
+ 'testing-library/no-debugging-utils': 'error',
256
+ 'testing-library/no-dom-import': ['error', 'react'],
257
+ 'testing-library/no-node-access': 'error',
258
+ 'testing-library/no-promise-in-fire-event': 'error',
259
+ 'testing-library/no-render-in-setup': 'error',
260
+ 'testing-library/no-unnecessary-act': 'error',
261
+ 'testing-library/no-wait-for-empty-callback': 'error',
262
+ 'testing-library/no-wait-for-multiple-assertions': 'error',
263
+ 'testing-library/no-wait-for-side-effects': 'error',
264
+ 'testing-library/no-wait-for-snapshot': 'error',
265
+ 'testing-library/prefer-find-by': 'error',
266
+ 'testing-library/prefer-presence-queries': 'error',
267
+ 'testing-library/prefer-query-by-disappearance': 'error',
268
+ 'testing-library/prefer-screen-queries': 'error',
269
+ 'testing-library/render-result-naming-convention': 'error',
270
+ },
271
+ },
272
+
273
+ // https://github.com/facebook/create-react-app/blob/main/packages/eslint-config-react-app/index.js
274
+ {
275
+ files: ['**/*.ts?(x)'],
276
+ // parser: "@typescript-eslint/parser",
277
+ // parserOptions: {
278
+ // ecmaVersion: 2018,
279
+ // sourceType: "module",
280
+ // ecmaFeatures: {
281
+ // jsx: true,
282
+ // },
283
+
284
+ // // typescript-eslint specific options
285
+ // warnOnUnsupportedTypeScriptVersion: true,
286
+ // },
287
+ // plugins: ["@typescript-eslint"],
288
+ // If adding a typescript-eslint version of an existing ESLint rule,
289
+ // make sure to disable the ESLint rule here.
290
+ rules: {
291
+ // TypeScript's `noFallthroughCasesInSwitch` option is more robust (#6906)
292
+ 'default-case': 'off',
293
+ // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
294
+ 'no-dupe-class-members': 'off',
295
+ // 'tsc' already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
296
+ 'no-undef': 'off',
297
+
298
+ // Add TypeScript specific rules (and turn off ESLint equivalents)
299
+ '@typescript-eslint/consistent-type-assertions': 'warn',
300
+ 'no-array-constructor': 'off',
301
+ '@typescript-eslint/no-array-constructor': 'warn',
302
+ 'no-redeclare': 'off',
303
+ '@typescript-eslint/no-redeclare': 'warn',
304
+ 'no-use-before-define': 'off',
305
+ '@typescript-eslint/no-use-before-define': [
306
+ 'warn',
307
+ {
308
+ functions: false,
309
+ classes: false,
310
+ variables: false,
311
+ typedefs: false,
312
+ },
313
+ ],
314
+ 'no-unused-expressions': 'off',
315
+ '@typescript-eslint/no-unused-expressions': [
316
+ 'error',
317
+ {
318
+ allowShortCircuit: true,
319
+ allowTernary: true,
320
+ allowTaggedTemplates: true,
321
+ },
322
+ ],
323
+ 'no-unused-vars': 'off',
324
+ '@typescript-eslint/no-unused-vars': [
325
+ 'warn',
326
+ {
327
+ args: 'none',
328
+ ignoreRestSiblings: true,
329
+ },
330
+ ],
331
+ 'no-useless-constructor': 'off',
332
+ '@typescript-eslint/no-useless-constructor': 'warn',
333
+ },
334
+ },
335
+ ],
336
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@morgs32/eslint-config",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "",
5
5
  "main": ".eslintrc.js",
6
6
  "files": [
7
- ".eslintrc.js"
7
+ "*.eslintrc.js"
8
8
  ],
9
9
  "scripts": {
10
10
  "lint": "eslint ."
@@ -27,12 +27,12 @@
27
27
  "eslint-plugin-prettier": "^5.0.0",
28
28
  "eslint-plugin-react": "^7.33.1",
29
29
  "eslint-plugin-testing-library": "^5.11.0",
30
- "eslint-plugin-unused-imports": "^3.0.0"
30
+ "eslint-plugin-unused-imports": "^3.0.0",
31
+ "next": ">13.0.0",
32
+ "react": ">17.0.0"
31
33
  },
32
34
  "peerDependencies": {
33
35
  "eslint": "*",
34
- "next": "*",
35
- "react": "*",
36
36
  "typescript": "*"
37
37
  },
38
38
  "devDependencies": {