@enormora/eslint-config-react-tsx 0.0.7 → 0.0.8

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/constants.js ADDED
@@ -0,0 +1,4 @@
1
+ export const ecmaVersion = 2022;
2
+ export const indentSize = 4;
3
+ export const javascriptExtensions = ['.js', '.cjs', '.mjs'];
4
+ export const typescriptExtensions = ['.ts', '.cts', '.mts'];
package/package.json CHANGED
@@ -1,17 +1,15 @@
1
1
  {
2
+ "dependencies": {
3
+ "eslint-plugin-react": "7.33.2",
4
+ "eslint-plugin-react-hooks": "4.6.0"
5
+ },
2
6
  "license": "MIT",
7
+ "main": "react-tsx.js",
8
+ "name": "@enormora/eslint-config-react-tsx",
3
9
  "repository": {
4
10
  "type": "git",
5
11
  "url": "git://github.com/enormora/eslint-config.git"
6
12
  },
7
- "name": "@enormora/eslint-config-react-tsx",
8
- "version": "0.0.7",
9
- "dependencies": {
10
- "@enormora/eslint-config-react-jsx": "0.0.7"
11
- },
12
- "main": "react-tsx.js",
13
13
  "type": "module",
14
- "peerDependencies": {
15
- "@enormora/eslint-config-base": "0.0.7"
16
- }
14
+ "version": "0.0.8"
17
15
  }
package/react-jsx.js ADDED
@@ -0,0 +1,39 @@
1
+ import { reactConfig } from './react.js';
2
+ import { javascriptExtensions } from './constants.js';
3
+
4
+ export const reactJsxConfig = {
5
+ languageOptions: {
6
+ parserOptions: {
7
+ ecmaFeatures: {
8
+ jsx: true
9
+ }
10
+ }
11
+ },
12
+ plugins: reactConfig.plugins,
13
+ settings: {
14
+ 'import/parsers': {
15
+ espree: [...javascriptExtensions, '.jsx']
16
+ }
17
+ },
18
+ rules: {
19
+ ...reactConfig.rules,
20
+ 'jsx-quotes': ['error', 'prefer-single'],
21
+ 'react/jsx-key': 'error',
22
+ 'react/jsx-max-depth': ['error', { max: 10 }],
23
+ 'react/jsx-no-comment-textnodes': 'error',
24
+ 'react/jsx-no-duplicate-props': 'error',
25
+ 'react/jsx-no-literals': 'error',
26
+ 'react/jsx-no-script-url': 'error',
27
+ 'react/jsx-no-target-blank': 'error',
28
+ 'react/jsx-no-useless-fragment': 'error',
29
+ 'react/jsx-no-undef': 'error',
30
+ 'react/jsx-pascal-case': 'error',
31
+ 'react/jsx-fragments': ['error', 'element'],
32
+ 'react/jsx-props-no-spreading': 'error',
33
+ 'react/jsx-uses-react': 'error',
34
+ 'react/jsx-uses-vars': 'error',
35
+ 'react/react-in-jsx-scope': 'error',
36
+ 'react/jsx-no-constructed-context-values': 'error',
37
+ 'react/jsx-no-leaked-render': 'error'
38
+ }
39
+ };
package/react-tsx.js CHANGED
@@ -1,5 +1,5 @@
1
- import { reactJsxConfig } from '@enormora/eslint-config-react-jsx/react-jsx.js';
2
- import { javascriptExtensions, typescriptExtensions } from '@enormora/eslint-config-base/constants.js';
1
+ import { reactJsxConfig } from './react-jsx.js';
2
+ import { javascriptExtensions, typescriptExtensions } from './constants.js';
3
3
 
4
4
  export const reactTsxConfig = {
5
5
  languageOptions: reactJsxConfig.languageOptions,
package/react.js ADDED
@@ -0,0 +1,129 @@
1
+ import reactPlugin from 'eslint-plugin-react';
2
+ import hooksPlugin from 'eslint-plugin-react-hooks';
3
+
4
+ export const reactConfig = {
5
+ plugins: {
6
+ react: reactPlugin,
7
+ 'react-hooks': hooksPlugin
8
+ },
9
+ rules: {
10
+ 'react/boolean-prop-naming': 'off',
11
+ 'react/button-has-type': 'error',
12
+ 'react/default-props-match-prop-types': 'off',
13
+ 'react/destructuring-assignment': 'off',
14
+ 'react/display-name': 'error',
15
+ 'react/forbid-component-props': 'off',
16
+ 'react/forbid-dom-props': 'off',
17
+ 'react/forbid-elements': 'off',
18
+ 'react/forbid-foreign-prop-types': 'off',
19
+ 'react/forbid-prop-types': 'off',
20
+ 'react/function-component-definition': 'off',
21
+ 'react/jsx-boolean-value': 'off',
22
+ 'react/jsx-child-element-spacing': 'off',
23
+ 'react/jsx-closing-bracket-location': 'off',
24
+ 'react/jsx-closing-tag-location': 'off',
25
+ 'react/jsx-curly-spacing': 'off',
26
+ 'react/jsx-curly-newline': 'off',
27
+ 'react/jsx-equals-spacing': 'off',
28
+ 'react/jsx-filename-extension': 'off',
29
+ 'react/jsx-first-prop-new-line': 'off',
30
+ 'react/jsx-handler-names': 'off',
31
+ 'react/jsx-indent': 'off',
32
+ 'react/jsx-indent-props': 'off',
33
+ // 'react/jsx-key': 'error',
34
+ 'react/jsx-key': 'off',
35
+ // 'react/jsx-max-depth': ['error', {max: 10}],
36
+ 'react/jsx-max-depth': 'off',
37
+ 'react/jsx-max-props-per-line': 'off',
38
+ 'react/jsx-newline': 'off',
39
+ 'react/jsx-no-bind': 'off',
40
+ // 'react/jsx-no-comment-textnodes': 'error',
41
+ 'react/jsx-no-comment-textnodes': 'off',
42
+ // 'react/jsx-no-duplicate-props': 'error',
43
+ 'react/jsx-no-duplicate-props': 'off',
44
+ // 'react/jsx-no-literals': 'error',
45
+ 'react/jsx-no-literals': 'off',
46
+ // 'react/jsx-no-script-url': 'error',
47
+ 'react/jsx-no-script-url': 'off',
48
+ // 'react/jsx-no-target-blank': 'error',
49
+ 'react/jsx-no-target-blank': 'off',
50
+ // 'react/jsx-no-useless-fragment': 'error',
51
+ 'react/jsx-no-useless-fragment': 'off',
52
+ 'react/jsx-one-expression-per-line': 'off',
53
+ // 'react/jsx-no-undef': 'error',
54
+ 'react/jsx-no-undef': 'off',
55
+ 'react/jsx-curly-brace-presence': 'off',
56
+ // 'react/jsx-pascal-case': 'error',
57
+ 'react/jsx-pascal-case': 'off',
58
+ // 'react/jsx-fragments': ['error', 'element'],
59
+ 'react/jsx-fragments': 'off',
60
+ 'react/jsx-props-no-multi-spaces': 'off',
61
+ // 'react/jsx-props-no-spreading': 'error',
62
+ 'react/jsx-props-no-spreading': 'off',
63
+ 'react/jsx-sort-props': 'off',
64
+ 'react/jsx-tag-spacing': 'off',
65
+ // 'react/jsx-uses-react': 'error',
66
+ 'react/jsx-uses-react': 'off',
67
+ // 'react/jsx-uses-vars': 'error',
68
+ 'react/jsx-uses-vars': 'off',
69
+ 'react/jsx-wrap-multilines': 'off',
70
+ 'react/no-access-state-in-setstate': 'error',
71
+ 'react/no-adjacent-inline-elements': 'off',
72
+ 'react/no-array-index-key': 'off',
73
+ 'react/no-children-prop': 'off',
74
+ 'react/no-danger': 'error',
75
+ 'react/no-danger-with-children': 'error',
76
+ 'react/no-deprecated': 'error',
77
+ 'react/no-did-mount-set-state': 'error',
78
+ 'react/no-did-update-set-state': 'error',
79
+ 'react/no-direct-mutation-state': 'error',
80
+ 'react/no-find-dom-node': 'error',
81
+ 'react/no-is-mounted': 'error',
82
+ 'react/no-multi-comp': 'off',
83
+ 'react/no-set-state': 'off',
84
+ 'react/no-string-refs': 'error',
85
+ 'react/no-redundant-should-component-update': 'error',
86
+ 'react/no-render-return-value': 'error',
87
+ 'react/no-this-in-sfc': 'error',
88
+ 'react/no-typos': 'off',
89
+ 'react/no-unescaped-entities': 'off',
90
+ 'react/no-unknown-property': 'error',
91
+ 'react/no-unsafe': 'error',
92
+ 'react/no-unused-prop-types': 'off',
93
+ 'react/no-unused-state': 'error',
94
+ 'react/no-will-update-set-state': 'error',
95
+ 'react/prefer-es6-class': 'off',
96
+ 'react/prefer-read-only-props': 'off',
97
+ 'react/prefer-stateless-function': 'error',
98
+ 'react/prop-types': 'off',
99
+ // 'react/react-in-jsx-scope': 'error',
100
+ 'react/react-in-jsx-scope': 'off',
101
+ 'react/require-default-props': 'off',
102
+ 'react/require-optimization': 'off',
103
+ 'react/require-render-return': 'error',
104
+ 'react/self-closing-comp': 'off',
105
+ 'react/sort-comp': 'off',
106
+ 'react/sort-prop-types': 'off',
107
+ 'react/state-in-constructor': 'off',
108
+ 'react/static-property-placement': 'off',
109
+ 'react/style-prop-object': 'off',
110
+ 'react/void-dom-elements-no-children': 'error',
111
+ // 'react/jsx-no-constructed-context-values': 'error',
112
+ 'react/jsx-no-constructed-context-values': 'off',
113
+ 'react/no-unstable-nested-components': 'error',
114
+ 'react/prefer-exact-props': 'off',
115
+ 'react/no-namespace': 'error',
116
+ 'react/no-invalid-html-attribute': 'off',
117
+ 'react/no-arrow-function-lifecycle': 'off',
118
+ 'react/no-unused-class-component-methods': 'off',
119
+ 'react/hook-use-state': 'off',
120
+ 'react/iframe-missing-sandbox': 'error',
121
+ // 'react/jsx-no-leaked-render': 'error',
122
+ 'react/jsx-no-leaked-render': 'off',
123
+ 'react/no-object-type-as-default-prop': 'warn',
124
+ 'react/sort-default-props': 'off',
125
+
126
+ 'react-hooks/rules-of-hooks': 'error',
127
+ 'react-hooks/exhaustive-deps': 'error'
128
+ }
129
+ };