@morgs32/eslint-config 2.0.1 → 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 +125 -4
  2. package/package.json +2 -1
package/.eslintrc.js CHANGED
@@ -8,16 +8,20 @@ module.exports = {
8
8
  "**/dist",
9
9
  ],
10
10
  plugins: [
11
+ "import",
11
12
  "unused-imports",
12
- "react"
13
+ "react",
14
+ "react-hooks",
15
+ "jsx-a11y",
16
+ "@typescript-eslint"
13
17
  ],
18
+
14
19
  rules: {
15
20
  "spaced-comment": ["error", "always", { "markers": ["/"] }],
16
21
  "unused-imports/no-unused-imports": "error",
17
22
  "comma-spacing": ["error", { "before": false, "after": true }],
18
23
  "react/jsx-indent": ["error", 2],
19
24
  "space-infix-ops": ["error"],
20
- "react-hooks/rules-of-hooks": 0, // Checks rules of Hooks
21
25
  quotes: ["error", "double"],
22
26
  "space-before-blocks": "error",
23
27
  "keyword-spacing": "error",
@@ -117,6 +121,7 @@ module.exports = {
117
121
  "no-this-before-super": "warn",
118
122
  "no-throw-literal": "warn",
119
123
  "no-undef": "error",
124
+ // "no-restricted-globals": ["error"].concat(restrictedGlobals),
120
125
  "no-unreachable": "warn",
121
126
  "no-unused-expressions": [
122
127
  "error",
@@ -159,7 +164,35 @@ module.exports = {
159
164
  "react-hooks/exhaustive-deps": "warn",
160
165
  "require-yield": "warn",
161
166
  "rest-spread-spacing": ["warn", "never"],
162
-
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 }],
163
196
  "react/jsx-no-comment-textnodes": "warn",
164
197
  "react/jsx-no-duplicate-props": "warn",
165
198
  "react/jsx-no-target-blank": "warn",
@@ -180,8 +213,35 @@ module.exports = {
180
213
  "react/no-is-mounted": "warn",
181
214
  "react/no-typos": "error",
182
215
  "react/require-render-return": "error",
183
- "react/style-prop-object": "warn"
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
  {
@@ -190,5 +250,66 @@ module.exports = {
190
250
  "import/no-anonymous-default-export": "off",
191
251
  },
192
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",
312
+ },
313
+ },
193
314
  ],
194
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morgs32/eslint-config",
3
- "version": "2.0.1",
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"