@shakuroinc/eslint-config-react 6.0.2 → 6.0.4

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/.eslintrc.js CHANGED
@@ -13,9 +13,9 @@ module.exports = {
13
13
 
14
14
  extends: [
15
15
  'plugin:@typescript-eslint/recommended',
16
- 'plugin:react/recommended',
17
- 'plugin:prettier/recommended',
18
16
  'plugin:jsx-a11y/recommended',
17
+ 'plugin:prettier/recommended',
18
+ 'plugin:react/recommended',
19
19
  ],
20
20
 
21
21
  parserOptions: {
@@ -26,7 +26,109 @@ module.exports = {
26
26
  },
27
27
  },
28
28
 
29
+ settings: {
30
+ react: {
31
+ version: 'detect',
32
+ },
33
+ tailwindcss: {
34
+ officialSorting: true,
35
+ },
36
+ },
37
+
29
38
  rules: {
39
+ '@typescript-eslint/ban-ts-ignore': 0,
40
+ '@typescript-eslint/explicit-function-return-type': 0,
41
+ '@typescript-eslint/explicit-member-accessibility': 0,
42
+ '@typescript-eslint/explicit-module-boundary-types': 0,
43
+ '@typescript-eslint/interface-name-prefix': 0,
44
+ '@typescript-eslint/naming-convention': [
45
+ 'error',
46
+ {
47
+ selector: 'default',
48
+ format: ['PascalCase', 'camelCase'],
49
+ leadingUnderscore: 'forbid',
50
+ trailingUnderscore: 'forbid',
51
+ },
52
+ {
53
+ selector: ['variable', 'property'],
54
+ format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
55
+ leadingUnderscore: 'forbid',
56
+ trailingUnderscore: 'forbid',
57
+ },
58
+ {
59
+ selector: 'typeLike',
60
+ format: ['PascalCase'],
61
+ },
62
+ {
63
+ selector: ['enumMember', 'enum'],
64
+ format: ['camelCase', 'UPPER_CASE', 'snake_case', 'PascalCase'],
65
+ },
66
+ {
67
+ selector: 'property',
68
+ filter: '^__html$',
69
+ format: null,
70
+ },
71
+ ],
72
+ '@typescript-eslint/no-empty-function': 0,
73
+ '@typescript-eslint/no-explicit-any': 0,
74
+ '@typescript-eslint/no-object-literal-type-assertion': 0,
75
+ '@typescript-eslint/padding-line-between-statements': [
76
+ 'error',
77
+ {
78
+ blankLine: 'always',
79
+ prev: ['interface', 'type'],
80
+ next: '*',
81
+ },
82
+ { blankLine: 'always', prev: '*', next: ['return'] },
83
+ { blankLine: 'always', prev: 'function', next: 'function' },
84
+ { blankLine: 'always', prev: 'multiline-const', next: '*' },
85
+ {
86
+ blankLine: 'always',
87
+ prev: 'import',
88
+ next: [
89
+ 'interface',
90
+ 'type',
91
+ 'block',
92
+ 'block-like',
93
+ 'case',
94
+ 'class',
95
+ 'const',
96
+ 'export',
97
+ 'expression',
98
+ 'for',
99
+ 'function',
100
+ 'if',
101
+ 'let',
102
+ 'return',
103
+ 'throw',
104
+ 'try',
105
+ 'while',
106
+ ],
107
+ },
108
+ {
109
+ blankLine: 'always',
110
+ prev: [
111
+ 'import',
112
+ 'interface',
113
+ 'type',
114
+ 'block',
115
+ 'block-like',
116
+ 'case',
117
+ 'class',
118
+ 'const',
119
+ 'expression',
120
+ 'for',
121
+ 'function',
122
+ 'if',
123
+ 'let',
124
+ 'return',
125
+ 'throw',
126
+ 'try',
127
+ 'while',
128
+ ],
129
+ next: 'export',
130
+ },
131
+ ],
30
132
  'jsx-a11y/anchor-is-valid': [
31
133
  'error',
32
134
  {
@@ -35,6 +137,20 @@ module.exports = {
35
137
  aspects: ['invalidHref', 'preferButton'],
36
138
  },
37
139
  ],
140
+ curly: ['error', 'multi-line'],
141
+ 'no-duplicate-imports': 2,
142
+ 'no-restricted-imports': [
143
+ 'error',
144
+ {
145
+ paths: ['ui'],
146
+ patterns: [
147
+ {
148
+ group: ['@sh/app', '@sh/app/*'],
149
+ message: 'Importing from `app` package is disallowed for architecture reasons',
150
+ },
151
+ ],
152
+ },
153
+ ],
38
154
  'react-hooks/exhaustive-deps': 2,
39
155
  'react-hooks/rules-of-hooks': 2,
40
156
  'react/button-has-type': 2,
@@ -46,10 +162,7 @@ module.exports = {
46
162
  'sort-imports': 0,
47
163
  'react/function-component-definition': [
48
164
  2,
49
- {
50
- namedComponents: 'arrow-function',
51
- unnamedComponents: 'arrow-function',
52
- },
165
+ { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' },
53
166
  ],
54
167
  'react/jsx-curly-brace-presence': [
55
168
  2,
@@ -60,19 +173,54 @@ module.exports = {
60
173
  ],
61
174
  'react/jsx-sort-props': [
62
175
  2,
176
+ { ignoreCase: true, callbacksLast: true, shorthandLast: false, reservedFirst: true },
177
+ ],
178
+ 'max-lines': [
179
+ 'error',
180
+ {
181
+ max: 300,
182
+ skipComments: true,
183
+ },
184
+ ],
185
+ 'simple-import-sort/imports': [
186
+ 1,
63
187
  {
64
- ignoreCase: true,
65
- callbacksLast: true,
66
- shorthandLast: false,
67
- reservedFirst: true,
188
+ groups: [
189
+ ['^\\u0000'],
190
+ ['^react', '^next', '^[^.]'],
191
+ ['^@shakuroinc/', '^@sh/'],
192
+ ['^libs$', '^libs/', '^features/'],
193
+ ['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
194
+ ['^.+\\.s?css$'],
195
+ ],
68
196
  },
69
197
  ],
198
+ 'simple-import-sort/exports': 1,
70
199
  'tailwindcss/classnames-order': 2,
71
200
  'tailwindcss/no-contradicting-classname': 2,
72
201
  'tailwindcss/no-custom-classname': 1,
73
202
  },
74
203
 
75
204
  overrides: [
205
+ {
206
+ files: ['*js?x', '*ts?x'],
207
+ extends: ['plugin:import/recommended', 'plugin:import/typescript'],
208
+ rules: {
209
+ 'import/order': 0,
210
+ 'import/no-restricted-paths': [
211
+ 'error',
212
+ {
213
+ zones: [
214
+ {
215
+ target: 'ui',
216
+ from: 'app',
217
+ message: 'Importing from `app` package is disallowed for architecture reasons',
218
+ },
219
+ ],
220
+ },
221
+ ],
222
+ },
223
+ },
76
224
  {
77
225
  files: ['*.mdx', '*.md'],
78
226
  extends: 'plugin:mdx/recommended',
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @shakuroinc/eslint-config-react
2
2
 
3
- [Shakuro](https://shakuro.com/) eslint and prettier extensible basic config.
3
+ [Shakuro](https://shakuro.com/) eslint (with React and tailwindcss support) and prettier extensible basic config.
4
4
 
5
5
  ## Usage
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shakuroinc/eslint-config-react",
3
- "version": "6.0.2",
3
+ "version": "6.0.4",
4
4
  "main": ".eslintrc.js",
5
5
  "author": "Shakuro team",
6
6
  "license": "MIT",
@@ -14,7 +14,6 @@
14
14
  },
15
15
  "dependencies": {},
16
16
  "devDependencies": {
17
- "@shakuroinc/eslint-config-base": "^1.0.4",
18
17
  "@typescript-eslint/eslint-plugin": "^5.45.0",
19
18
  "@typescript-eslint/parser": "^5.45.0",
20
19
  "eslint": "^8.29.0",
@@ -35,7 +34,6 @@
35
34
  "typescript": "^4.9.3"
36
35
  },
37
36
  "peerDependencies": {
38
- "@shakuroinc/eslint-config-base": "^1.0.4",
39
37
  "@typescript-eslint/eslint-plugin": "^5.45.0",
40
38
  "@typescript-eslint/parser": "^5.45.0",
41
39
  "eslint": "^8.29.0",
@@ -1,7 +1,11 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
- const baseConfig = require('@shakuroinc/eslint-config-base/prettier.config');
3
-
4
2
  module.exports = {
5
- ...baseConfig,
6
- plugins: [...(baseConfig.plugins ?? []), require('prettier-plugin-tailwindcss')],
3
+ arrowParens: 'avoid',
4
+ bracketSpacing: true,
5
+ plugins: [require('prettier-plugin-tailwindcss')],
6
+ printWidth: 100,
7
+ semi: true,
8
+ singleQuote: true,
9
+ tabWidth: 2,
10
+ trailingComma: 'all',
7
11
  };