@morgs32/eslint-config 2.0.0 → 2.0.2

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