@paratco/eslint-config 0.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.
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "printWidth": 120,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "semi": true,
7
+ "singleQuote": false,
8
+ "quoteProps": "preserve",
9
+ "jsxSingleQuote": false,
10
+ "trailingComma": "none",
11
+ "bracketSpacing": true,
12
+ "bracketSameLine": false,
13
+ "arrowParens": "always",
14
+ "requirePragma": false,
15
+ "insertPragma": false,
16
+ "proseWrap": "preserve",
17
+ "htmlWhitespaceSensitivity": "css",
18
+ "vueIndentScriptAndStyle": false,
19
+ "endOfLine": "lf",
20
+ "embeddedLanguageFormatting": "auto",
21
+ "singleAttributePerLine": false
22
+ }
package/index.js ADDED
@@ -0,0 +1,81 @@
1
+ import eslint from "@eslint/js";
2
+ import tseslint from "typescript-eslint";
3
+ import globals from "globals";
4
+
5
+ // Plugins
6
+ import react from "eslint-plugin-react";
7
+ import reactHooks from "eslint-plugin-react-hooks";
8
+ import reactRefresh from "eslint-plugin-react-refresh";
9
+ import eslintConfigPrettier from "eslint-config-prettier";
10
+
11
+ // Custom Rules
12
+ import typescriptRules from "./lints/typescript/index.js";
13
+ import reactRules from "./lints/react/index.js";
14
+
15
+ export default tseslint.config(
16
+ eslint.configs.recommended,
17
+ ...tseslint.configs.strictTypeChecked,
18
+ ...tseslint.configs.stylisticTypeChecked,
19
+
20
+ // TypeScript Rules
21
+ {
22
+ files: ["**/*.{ts,tsx}"],
23
+ languageOptions: {
24
+ parserOptions: {
25
+ ecmaFeatures: {
26
+ jsx: true
27
+ }
28
+ },
29
+ globals: {
30
+ ...globals.browser
31
+ }
32
+ },
33
+ rules: {
34
+ ...typescriptRules
35
+ }
36
+ },
37
+
38
+ // React Plugin
39
+ {
40
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
41
+ plugins: {
42
+ react: react,
43
+ "react-hooks": reactHooks,
44
+ "react-refresh": reactRefresh
45
+ },
46
+ settings: {
47
+ react: {
48
+ version: "detect"
49
+ }
50
+ },
51
+ languageOptions: {
52
+ parserOptions: {
53
+ ecmaFeatures: {
54
+ jsx: true
55
+ }
56
+ },
57
+ globals: {
58
+ ...globals.browser
59
+ }
60
+ },
61
+ rules: {
62
+ ...reactRules,
63
+ // ...react.configs.recommended.rules,
64
+ ...reactHooks.configs.recommended.rules,
65
+
66
+ // Enforce Rules of Hooks
67
+ "react-hooks/rules-of-hooks": ["error"],
68
+ // Verify the list of the dependencies for Hooks like useEffect and similar
69
+ "react-hooks/exhaustive-deps": ["error"],
70
+
71
+ // React Refresh
72
+ "react-refresh/only-export-components": ["warn", { "allowConstantExport": true }]
73
+ }
74
+ },
75
+
76
+ {
77
+ ignores: ["lints"]
78
+ },
79
+
80
+ eslintConfigPrettier
81
+ );
@@ -0,0 +1,421 @@
1
+ export default {
2
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/boolean-prop-naming.md
3
+ // Enforces consistent naming for boolean props
4
+ "react/boolean-prop-naming": ["error"],
5
+
6
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md
7
+ // Disallow usage of button elements without an explicit type attribute
8
+ "react/button-has-type": ["error"],
9
+
10
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/checked-requires-onchange-or-readonly.md
11
+ // Enforce using onChange or readonly attribute when checked is used
12
+ "react/checked-requires-onchange-or-readonly": ["off"],
13
+
14
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/default-props-match-prop-types.md
15
+ // Enforce all defaultProps have a corresponding non-required PropType
16
+ "react/default-props-match-prop-types": ["error"],
17
+
18
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
19
+ // Enforce consistent usage of destructuring assignment of props, state, and context
20
+ "react/destructuring-assignment": ["warn"],
21
+
22
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md
23
+ // Disallow missing displayName in a React component definition
24
+ "react/display-name": ["error"],
25
+
26
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-component-props.md
27
+ // Disallow certain props on components
28
+ "react/forbid-component-props": ["off"],
29
+
30
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md
31
+ // Disallow certain props on DOM Nodes
32
+ "react/forbid-dom-props": ["off"],
33
+
34
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-elements.md
35
+ // Disallow certain elements
36
+ "react/forbid-elements": ["off"],
37
+
38
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-foreign-prop-types.md
39
+ // Disallow using another component's propTypes
40
+ "react/forbid-foreign-prop-types": ["error"],
41
+
42
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/forbid-prop-types.md
43
+ // Disallow certain propTypes
44
+ "react/forbid-prop-types": ["error"],
45
+
46
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
47
+ // Enforce a specific function type for function components
48
+ "react/function-component-definition": ["warn"],
49
+
50
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/hook-use-state.md
51
+ // Ensure destructuring and symmetric naming of useState hook value and setter variables
52
+ "react/hook-use-state": ["error"],
53
+
54
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/iframe-missing-sandbox.md
55
+ // Enforce sandbox attribute on iframe elements
56
+ "react/iframe-missing-sandbox": ["error"],
57
+
58
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
59
+ // Enforce boolean attributes notation in JSX
60
+ "react/jsx-boolean-value": ["warn", "always"],
61
+
62
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md
63
+ // Enforce or disallow spaces inside curly braces in JSX attributes and expressions
64
+ "react/jsx-child-element-spacing": ["error"],
65
+
66
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
67
+ // Enforce closing bracket location in JSX
68
+ // Use similar stylistic rule instead
69
+ "react/jsx-closing-bracket-location": ["off"],
70
+
71
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
72
+ // Enforce closing tag location for multiline JSX
73
+ // Use similar stylistic rule instead
74
+ "react/jsx-closing-tag-location": ["off"],
75
+
76
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
77
+ // Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes
78
+ // Use similar stylistic rule instead
79
+ "react/jsx-curly-brace-presence": ["off"],
80
+
81
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
82
+ // Enforce consistent linebreaks in curly braces in JSX attributes and expressions
83
+ // Use similar stylistic rule instead
84
+ "react/jsx-curly-newline": ["off"],
85
+
86
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
87
+ // Enforce or disallow spaces inside curly braces in JSX attributes and expressions
88
+ // Use similar stylistic rule instead
89
+ "react/jsx-curly-spacing": ["off"],
90
+
91
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
92
+ // Enforce or disallow spaces around equal signs in JSX attributes
93
+ // Use similar stylistic rule instead
94
+ "react/jsx-equals-spacing": ["off"],
95
+
96
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
97
+ // Disallow file extensions that may contain JSX
98
+ "react/jsx-filename-extension": ["error", { allow: "always", extensions: [".tsx"] }],
99
+
100
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
101
+ // Enforce proper position of the first property in JSX
102
+ // Use similar stylistic rule instead
103
+ "react/jsx-first-prop-new-line": ["off"],
104
+
105
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
106
+ // Enforce shorthand or standard form for React fragments
107
+ "react/jsx-fragments": ["warn"],
108
+
109
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
110
+ // Enforce event handler naming conventions in JSX
111
+ "react/jsx-handler-names": ["error"],
112
+
113
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
114
+ // Enforce JSX indentation
115
+ // Use similar stylistic rule instead
116
+ "react/jsx-indent": ["off"],
117
+
118
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
119
+ // Enforce props indentation in JSX
120
+ // Use similar stylistic rule instead
121
+ "react/jsx-indent-props": ["off"],
122
+
123
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
124
+ // Disallow missing key props in iterators/collection literals
125
+ "react/jsx-key": ["error"],
126
+
127
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md
128
+ // Enforce JSX maximum depth
129
+ "react/jsx-max-depth": ["off"],
130
+
131
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
132
+ // Enforce maximum of props on a single line in JSX
133
+ // Use similar stylistic rule instead
134
+ "react/jsx-max-props-per-line": ["off"],
135
+
136
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-newline.md
137
+ // Require or prevent a new line after jsx elements and expressions
138
+ // Use similar stylistic rule instead
139
+ "react/jsx-newline": ["off"],
140
+
141
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
142
+ // Disallow .bind() or arrow functions in JSX props
143
+ "react/jsx-no-bind": [
144
+ "error",
145
+ {
146
+ allowArrowFunctions: true
147
+ }
148
+ ],
149
+
150
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
151
+ // Disallow comments from being inserted as text nodes
152
+ "react/jsx-no-comment-textnodes": ["error"],
153
+
154
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-constructed-context-values.md
155
+ // Disallows JSX context provider values from taking values that will cause needless renders
156
+ "react/jsx-no-constructed-context-values": ["error"],
157
+
158
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
159
+ // Disallow duplicate properties in JSX
160
+ "react/jsx-no-duplicate-props": ["error"],
161
+
162
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-leaked-render.md
163
+ // Disallow problematic leaked values from being rendered
164
+ "react/jsx-no-leaked-render": ["warn"],
165
+
166
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
167
+ // Disallow usage of string literals in JSX
168
+ "react/jsx-no-literals": ["off"],
169
+
170
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-script-url.md
171
+ // Disallow usage of javascript: URLs
172
+ "react/jsx-no-script-url": ["error"],
173
+
174
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
175
+ // Disallow target="_blank" attribute without rel="noreferrer"
176
+ "react/jsx-no-target-blank": ["warn"],
177
+
178
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
179
+ // Disallow undeclared variables in JSX
180
+ "react/jsx-no-undef": ["error"],
181
+
182
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-no-useless-fragment.md
183
+ // Disallow unnecessary fragments
184
+ "react/jsx-no-useless-fragment": ["warn"],
185
+
186
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
187
+ // Require one JSX element per line
188
+ // Use similar stylistic rule instead
189
+ "react/jsx-one-expression-per-line": ["off"],
190
+
191
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
192
+ // Enforce PascalCase for user-defined JSX components
193
+ // Use similar stylistic rule instead
194
+ "react/jsx-pascal-case": ["off"],
195
+
196
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
197
+ // Disallow multiple spaces between inline JSX props
198
+ // Use similar stylistic rule instead
199
+ "react/jsx-props-no-multi-spaces": ["off"],
200
+
201
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
202
+ // Disallow JSX prop spreading
203
+ "react/jsx-props-no-spreading": ["off"],
204
+
205
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
206
+ // Enforce props alphabetical sorting
207
+ // Use similar stylistic rule instead
208
+ "react/jsx-sort-props": ["off"],
209
+
210
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
211
+ // Enforce whitespace in and around the JSX opening and closing brackets
212
+ // Use similar stylistic rule instead
213
+ "react/jsx-tag-spacing": ["off"],
214
+
215
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
216
+ // Disallow React to be incorrectly marked as unused
217
+ "react/jsx-uses-react": ["error"],
218
+
219
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
220
+ // Disallow variables used in JSX to be incorrectly marked as unused
221
+ "react/jsx-uses-vars": ["error"],
222
+
223
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
224
+ // Disallow missing parentheses around multiline JSX
225
+ // Use similar stylistic rule instead
226
+ "react/jsx-wrap-multilines": ["off"],
227
+
228
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-access-state-in-setstate.md
229
+ // Disallow when this.state is accessed within setState
230
+ "react/no-access-state-in-setstate": ["error"],
231
+
232
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-adjacent-inline-elements.md
233
+ // Disallow adjacent inline elements not separated by whitespace.
234
+ "react/no-adjacent-inline-elements": ["error"],
235
+
236
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-array-index-key.md
237
+ // Disallow usage of Array index in keys
238
+ "react/no-array-index-key": ["error"],
239
+
240
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-arrow-function-lifecycle.md
241
+ // Lifecycle methods should be methods on the prototype, not class fields
242
+ "react/no-arrow-function-lifecycle": ["warn"],
243
+
244
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-children-prop.md
245
+ // Disallow passing of children as props
246
+ "react/no-children-prop": ["error"],
247
+
248
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger.md
249
+ // Disallow usage of dangerous JSX properties
250
+ "react/no-danger": ["error"],
251
+
252
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-danger-with-children.md
253
+ // Disallow when a DOM element is using both children and dangerouslySetInnerHTML
254
+ "react/no-danger-with-children": ["error"],
255
+
256
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-deprecated.md
257
+ // Disallow usage of deprecated methods
258
+ "react/no-deprecated": ["error"],
259
+
260
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-mount-set-state.md
261
+ // Disallow usage of setState in componentDidMount
262
+ "react/no-did-mount-set-state": ["error", "disallow-in-func"],
263
+
264
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-did-update-set-state.md
265
+ // Disallow usage of setState in componentDidUpdate
266
+ "react/no-did-update-set-state": ["error", "disallow-in-func"],
267
+
268
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-direct-mutation-state.md
269
+ // Disallow direct mutation of this.state
270
+ "react/no-direct-mutation-state": ["error"],
271
+
272
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md
273
+ // Disallow usage of findDOMNode
274
+ "react/no-find-dom-node": ["error"],
275
+
276
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-invalid-html-attribute.md
277
+ // Disallow usage of invalid attributes
278
+ "react/no-invalid-html-attribute": ["error"],
279
+
280
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-is-mounted.md
281
+ // Disallow usage of isMounted
282
+ "react/no-is-mounted": ["error"],
283
+
284
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-multi-comp.md
285
+ // Disallow multiple component definition per file
286
+ "react/no-multi-comp": ["off"],
287
+
288
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-namespace.md
289
+ // Enforce that namespaces are not used in React elements
290
+ "react/no-namespace": ["error"],
291
+
292
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-object-type-as-default-prop.md
293
+ // Disallow usage of referential-type variables as default param in functional component
294
+ "react/no-object-type-as-default-prop": ["error"],
295
+
296
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-redundant-should-component-update.md
297
+ // Disallow usage of shouldComponentUpdate when extending React.PureComponent
298
+ "react/no-redundant-should-component-update": ["error"],
299
+
300
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-render-return-value.md
301
+ // Disallow usage of the return value of ReactDOM.render
302
+ "react/no-render-return-value": ["error"],
303
+
304
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-set-state.md
305
+ // Disallow usage of setState
306
+ "react/no-set-state": ["error"],
307
+
308
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-string-refs.md
309
+ // Disallow using string references
310
+ "react/no-string-refs": ["error", { noTemplateLiterals: true }],
311
+
312
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
313
+ // Disallow this from being used in stateless functional components
314
+ "react/no-this-in-sfc": ["error"],
315
+
316
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-typos.md
317
+ // Disallow common typos
318
+ "react/no-typos": ["error"],
319
+
320
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md
321
+ // Disallow unescaped HTML entities from appearing in markup
322
+ "react/no-unescaped-entities": ["error"],
323
+
324
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md
325
+ // Disallow usage of unknown DOM property
326
+ "react/no-unknown-property": ["warn"],
327
+
328
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
329
+ // Disallow usage of unsafe lifecycle methods
330
+ // Disabled in recommended configs
331
+ "react/no-unsafe": ["off"],
332
+
333
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unstable-nested-components.md
334
+ // Disallow creating unstable components inside components
335
+ "react/no-unstable-nested-components": ["error"],
336
+
337
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-class-component-methods.md
338
+ // Disallow declaring unused methods of component class
339
+ "react/no-unused-class-component-methods": ["error"],
340
+
341
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md
342
+ // Disallow definitions of unused propTypes
343
+ "react/no-unused-prop-types": ["error"],
344
+
345
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
346
+ // Disallow definitions of unused state
347
+ "react/no-unused-state": ["error"],
348
+
349
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-will-update-set-state.md
350
+ // Disallow usage of setState in componentWillUpdate
351
+ "react/no-will-update-set-state": ["error", "disallow-in-func"],
352
+
353
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-es6-class.md
354
+ // Enforce ES5 or ES6 class for React Components
355
+ "react/prefer-es6-class": ["error"],
356
+
357
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-exact-props.md
358
+ // Prefer exact prop type definitions
359
+ "react/prefer-exact-props": ["error"],
360
+
361
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
362
+ // Enforce that props are read-only
363
+ "react/prefer-read-only-props": ["warn"],
364
+
365
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
366
+ // Enforce stateless components to be written as a pure function
367
+ "react/prefer-stateless-function": ["error"],
368
+
369
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/prop-types.md
370
+ // Disallow missing props validation in a React component definition
371
+ "react/prop-types": ["error"],
372
+
373
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md
374
+ // Disallow missing React when using JSX
375
+ // Disable this rule because react 17 doesn't need to import React to use JSX
376
+ "react/react-in-jsx-scope": ["off"],
377
+
378
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-default-props.md
379
+ // Enforce a defaultProps definition for every prop that is not a required prop
380
+ "react/require-default-props": ["off"],
381
+
382
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-optimization.md
383
+ // Enforce React components to have a shouldComponentUpdate method
384
+ "react/require-optimization": ["error"],
385
+
386
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/require-render-return.md
387
+ // Enforce ES5 or ES6 class for returning value in render function
388
+ "react/require-render-return": ["error"],
389
+
390
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
391
+ // Disallow extra closing tags for components without children
392
+ "react/self-closing-comp": ["warn"],
393
+
394
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
395
+ // Enforce component methods order
396
+ "react/sort-comp": ["error"],
397
+
398
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-default-props.md
399
+ // Enforce defaultProps declarations alphabetical sorting
400
+ "react/sort-default-props": ["off"],
401
+
402
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
403
+ // Enforce propTypes declarations alphabetical sorting
404
+ "react/sort-prop-types": ["off"],
405
+
406
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
407
+ // Enforce class component state initialization style
408
+ "react/state-in-constructor": ["error"],
409
+
410
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
411
+ // Enforces where React component static properties should be positioned.
412
+ "react/static-property-placement": ["error"],
413
+
414
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
415
+ // Enforce style prop value is an object
416
+ "react/style-prop-object": ["error"],
417
+
418
+ // https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
419
+ // Disallow void DOM elements (e.g. <img />, <br />) from receiving children
420
+ "react/void-dom-elements-no-children": ["error"]
421
+ };
@@ -0,0 +1,237 @@
1
+ export default {
2
+ // Enforce that class methods utilize this.
3
+ // https://typescript-eslint.io/rules/class-methods-use-this
4
+ // Note: you must disable the base rule as it can report incorrect errors
5
+ "class-methods-use-this": "off",
6
+ "@typescript-eslint/class-methods-use-this": [
7
+ "error",
8
+ {
9
+ ignoreOverrideMethods: true,
10
+ ignoreClassesThatImplementAnInterface: true
11
+ }
12
+ ],
13
+
14
+ // Require return statements to either always or never specify values
15
+ // https://typescript-eslint.io/rules/consistent-return/
16
+ // Note: you must disable the base rule as it can report incorrect errors
17
+ "consistent-return": "off",
18
+ "@typescript-eslint/consistent-return": ["error"],
19
+
20
+ // Enforce consistent usage of type exports.
21
+ // https://typescript-eslint.io/rules/consistent-type-exports
22
+ "@typescript-eslint/consistent-type-exports": [
23
+ "error",
24
+ {
25
+ fixMixedExportsWithInlineTypeSpecifier: true
26
+ }
27
+ ],
28
+
29
+ // Enforce consistent usage of type imports.
30
+ // https://typescript-eslint.io/rules/consistent-type-imports
31
+ "@typescript-eslint/consistent-type-imports": ["error"],
32
+
33
+ // Enforce default parameters to be last.
34
+ // https://typescript-eslint.io/rules/default-param-last
35
+ // Note: you must disable the base rule as it can report incorrect errors
36
+ "default-param-last": "off",
37
+ "@typescript-eslint/default-param-last": ["error"],
38
+
39
+ // Require explicit return types on functions and class methods.
40
+ // https://typescript-eslint.io/rules/explicit-function-return-type
41
+ "@typescript-eslint/explicit-function-return-type": [
42
+ "error",
43
+ {
44
+ allowExpressions: true
45
+ }
46
+ ],
47
+
48
+ // Require explicit accessibility modifiers on class properties and methods.
49
+ // https://typescript-eslint.io/rules/explicit-member-accessibility
50
+ "@typescript-eslint/explicit-member-accessibility": [
51
+ "error",
52
+ {
53
+ "overrides": {
54
+ "constructors": "off"
55
+ }
56
+ }
57
+ ],
58
+
59
+ // Require explicit return and argument types on exported functions' and classes' public class methods.
60
+ // https://typescript-eslint.io/rules/explicit-module-boundary-types
61
+ "@typescript-eslint/explicit-module-boundary-types": ["error"],
62
+
63
+ // Require or disallow initialization in variable declarations.
64
+ // https://typescript-eslint.io/rules/init-declarations
65
+ // Note: you must disable the base rule as it can report incorrect errors
66
+ "init-declarations": "off",
67
+ "@typescript-eslint/init-declarations": ["off"],
68
+
69
+ // Enforce a maximum number of parameters in function definitions.
70
+ // https://typescript-eslint.io/rules/max-params
71
+ // Note: you must disable the base rule as it can report incorrect errors
72
+ "max-params": "off",
73
+ "@typescript-eslint/max-params": ["off"],
74
+
75
+ // Require a consistent member declaration order.
76
+ // https://typescript-eslint.io/rules/member-ordering
77
+ "@typescript-eslint/member-ordering": [
78
+ "error",
79
+ { "default": ["constructor", "field", "static-method", "method", "signature"] }
80
+ ],
81
+
82
+ // Enforce using a particular method signature syntax.
83
+ // https://typescript-eslint.io/rules/method-signature-style
84
+ "@typescript-eslint/method-signature-style": ["error"],
85
+
86
+ // Enforce naming conventions for everything across a codebase.
87
+ // https://typescript-eslint.io/rules/naming-convention
88
+ // TODO: We can split this rule. for components it enforces PascalCase and functions camelCase
89
+ "@typescript-eslint/naming-convention": [
90
+ "error",
91
+ {
92
+ selector: "function",
93
+ format: ["PascalCase", "camelCase"]
94
+ }
95
+ ],
96
+
97
+ // Disallow duplicate class members.
98
+ // https://typescript-eslint.io/rules/no-dupe-class-members
99
+ // Note: you must disable the base rule as it can report incorrect errors
100
+ "no-dupe-class-members": "error",
101
+ "@typescript-eslint/no-dupe-class-members": ["error"],
102
+
103
+ // Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers.
104
+ // https://typescript-eslint.io/rules/no-import-type-side-effects
105
+ "@typescript-eslint/no-import-type-side-effects": ["error"],
106
+
107
+ // Disallow this keywords outside of classes or class-like objects.
108
+ // https://typescript-eslint.io/rules/no-invalid-this
109
+ // Note: you must disable the base rule as it can report incorrect errors
110
+ "no-invalid-this": "off",
111
+ "@typescript-eslint/no-invalid-this": ["error"],
112
+
113
+ // Disallow function declarations that contain unsafe references inside loop statements.
114
+ // https://typescript-eslint.io/rules/no-loop-func
115
+ // Note: you must disable the base rule as it can report incorrect errors
116
+ "no-loop-func": "off",
117
+ "@typescript-eslint/no-loop-func": ["error"],
118
+
119
+ // Disallow magic numbers.
120
+ // https://typescript-eslint.io/rules/no-magic-numbers
121
+ // Note: you must disable the base rule as it can report incorrect errors
122
+ "no-magic-numbers": "off",
123
+ "@typescript-eslint/no-magic-numbers": ["off"],
124
+
125
+ // Disallow variable redeclaration.
126
+ // https://typescript-eslint.io/rules/no-redeclare
127
+ // Note: you must disable the base rule as it can report incorrect errors
128
+ "no-redeclare": "off",
129
+ "@typescript-eslint/no-redeclare": ["off"],
130
+
131
+ // Disallow invocation of require().
132
+ // https://typescript-eslint.io/rules/no-require-imports
133
+ "@typescript-eslint/no-require-imports": ["error"],
134
+
135
+ // Disallow specified modules when loaded by import.
136
+ // https://typescript-eslint.io/rules/no-restricted-imports
137
+ // Note: you must disable the base rule as it can report incorrect errors
138
+ "no-restricted-imports": "off",
139
+ "@typescript-eslint/no-restricted-imports": ["off"],
140
+
141
+ // Disallow variable declarations from shadowing variables declared in the outer scope.
142
+ // https://typescript-eslint.io/rules/no-shadow
143
+ // Note: you must disable the base rule as it can report incorrect errors
144
+ "no-shadow": "off",
145
+ "@typescript-eslint/no-shadow": ["error"],
146
+
147
+ // Disallow unnecessary namespace qualifiers.
148
+ // https://typescript-eslint.io/rules/no-unnecessary-qualifier
149
+ "@typescript-eslint/no-unnecessary-qualifier": ["warn"],
150
+
151
+ // Require unary negation to take a number.
152
+ // https://typescript-eslint.io/rules/no-unsafe-unary-minus
153
+ "@typescript-eslint/no-unsafe-unary-minus": ["error"],
154
+
155
+ // Disallow unused expressions.
156
+ // https://typescript-eslint.io/rules/no-unused-expressions
157
+ // Note: you must disable the base rule as it can report incorrect errors
158
+ "no-unused-expressions": "off",
159
+ "@typescript-eslint/no-unused-expressions": ["off"],
160
+
161
+ // Disallow the use of variables before they are defined.
162
+ // https://typescript-eslint.io/rules/no-use-before-define
163
+ // Note: you must disable the base rule as it can report incorrect errors
164
+ "no-use-before-define": "off",
165
+ "@typescript-eslint/no-use-before-define": ["error"],
166
+
167
+ // Disallow empty exports that don't change anything in a module file.
168
+ // https://typescript-eslint.io/rules/no-useless-empty-export
169
+ "@typescript-eslint/no-useless-empty-export": ["warn"],
170
+
171
+ // Require or disallow parameter properties in class constructors.
172
+ // https://typescript-eslint.io/rules/parameter-properties
173
+ "@typescript-eslint/parameter-properties": ["error"],
174
+
175
+ // Require destructuring from arrays and/or objects.
176
+ // https://typescript-eslint.io/rules/prefer-destructuring
177
+ // Note: you must disable the base rule as it can report incorrect errors
178
+ "prefer-destructuring": "off",
179
+ "@typescript-eslint/prefer-destructuring": ["off"],
180
+
181
+ // Require each enum member value to be explicitly initialized.
182
+ // https://typescript-eslint.io/rules/prefer-enum-initializers
183
+ "@typescript-eslint/prefer-enum-initializers": ["off"],
184
+
185
+ // Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0] when looking for a single result.
186
+ // https://typescript-eslint.io/rules/prefer-find
187
+ "@typescript-eslint/prefer-find": ["warn"],
188
+
189
+ // Require private members to be marked as readonly if they're never modified outside the constructor.
190
+ // https://typescript-eslint.io/rules/prefer-readonly
191
+ "@typescript-eslint/prefer-readonly": ["warn"],
192
+
193
+ // Require function parameters to be typed as readonly to prevent accidental mutation of inputs.
194
+ // https://typescript-eslint.io/rules/prefer-readonly-parameter-types
195
+ "@typescript-eslint/prefer-readonly-parameter-types": ["off"],
196
+
197
+ // Enforce RegExp#exec over String#match if no global flag is provided.
198
+ // https://typescript-eslint.io/rules/prefer-regexp-exec
199
+ "@typescript-eslint/prefer-regexp-exec": ["warn"],
200
+
201
+ // Require any function or method that returns a Promise to be marked async.
202
+ // https://typescript-eslint.io/rules/promise-function-async
203
+ "@typescript-eslint/promise-function-async": ["error"],
204
+
205
+ // Require Array#sort and Array#toSorted calls to always provide a compareFunction.
206
+ // https://typescript-eslint.io/rules/require-array-sort-compare
207
+ "@typescript-eslint/require-array-sort-compare": ["error"],
208
+
209
+ // Enforce consistent returning of awaited values.
210
+ // https://typescript-eslint.io/rules/return-await
211
+ // Note: you must disable the base rule as it can report incorrect errors
212
+ "no-return-await": "off",
213
+ "@typescript-eslint/return-await": ["off"],
214
+
215
+ // Enforce constituents of a type union/intersection to be sorted alphabetically.
216
+ // https://typescript-eslint.io/rules/sort-type-constituents
217
+ "@typescript-eslint/sort-type-constituents": ["warn"],
218
+
219
+ // Disallow certain types in boolean expressions.
220
+ // https://typescript-eslint.io/rules/strict-boolean-expressions
221
+ "@typescript-eslint/strict-boolean-expressions": [
222
+ "error",
223
+ {
224
+ allowString: false,
225
+ allowNumber: false,
226
+ allowNullableObject: false
227
+ }
228
+ ],
229
+
230
+ // Require switch-case statements to be exhaustive.
231
+ // https://typescript-eslint.io/rules/switch-exhaustiveness-check
232
+ "@typescript-eslint/switch-exhaustiveness-check": ["error"],
233
+
234
+ // Require type annotations in certain places.
235
+ // https://typescript-eslint.io/rules/typedef
236
+ "@typescript-eslint/typedef": ["off"]
237
+ };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@paratco/eslint-config",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "index.js",
6
+ "author": "Paratco",
7
+ "license": "ISC",
8
+ "description": "Paratco ESLint Config",
9
+ "keywords": [
10
+ "eslint",
11
+ "eslint-config",
12
+ "react",
13
+ "lint"
14
+ ],
15
+ "scripts": {
16
+ "lint": "eslint . --report-unused-disable-directives-severity error --max-warnings 0",
17
+ "format": "prettier --write src/"
18
+ },
19
+ "peerDependencies": {
20
+ "@eslint/js": "^9.3.0",
21
+ "eslint": "^8.57.0",
22
+ "eslint-config-prettier": "^9.1.0",
23
+ "eslint-plugin-react": "^7.34.1",
24
+ "eslint-plugin-react-hooks": "^4.6.2",
25
+ "eslint-plugin-react-refresh": "^0.4.7",
26
+ "prettier": "^3.2.5",
27
+ "typescript-eslint": "^7.9.0"
28
+ },
29
+ "devDependencies": {
30
+ "@eslint/js": "^9.3.0",
31
+ "eslint": "^8.57.0",
32
+ "eslint-config-prettier": "^9.1.0",
33
+ "eslint-plugin-react": "^7.34.1",
34
+ "eslint-plugin-react-hooks": "^4.6.2",
35
+ "eslint-plugin-react-refresh": "^0.4.7",
36
+ "prettier": "^3.2.5",
37
+ "typescript": "^5.4.5",
38
+ "typescript-eslint": "^7.9.0"
39
+ }
40
+ }