@shakuroinc/eslint-config-react 6.0.1 → 6.0.3

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
@@ -1,13 +1,33 @@
1
1
  /* eslint-disable @typescript-eslint/naming-convention */
2
2
  module.exports = {
3
- plugins: ['react', 'react-hooks', 'jsx-a11y', 'tailwindcss'],
3
+ parser: '@typescript-eslint/parser',
4
+
5
+ plugins: [
6
+ '@typescript-eslint',
7
+ 'react',
8
+ 'react-hooks',
9
+ 'jsx-a11y',
10
+ 'simple-import-sort',
11
+ 'tailwindcss',
12
+ ],
4
13
 
5
14
  extends: [
6
- '@shakuroinc/eslint-config-base',
7
- 'plugin:react/recommended',
15
+ 'plugin:@typescript-eslint/recommended',
16
+ 'plugin:import/recommended',
17
+ 'plugin:import/typescript',
8
18
  'plugin:jsx-a11y/recommended',
19
+ 'plugin:prettier/recommended',
20
+ 'plugin:react/recommended',
9
21
  ],
10
22
 
23
+ parserOptions: {
24
+ ecmaVersion: 2020,
25
+ sourceType: 'module',
26
+ ecmaFeatures: {
27
+ jsx: true,
28
+ },
29
+ },
30
+
11
31
  settings: {
12
32
  react: {
13
33
  version: 'detect',
@@ -18,6 +38,99 @@ module.exports = {
18
38
  },
19
39
 
20
40
  rules: {
41
+ '@typescript-eslint/ban-ts-ignore': 0,
42
+ '@typescript-eslint/explicit-function-return-type': 0,
43
+ '@typescript-eslint/explicit-member-accessibility': 0,
44
+ '@typescript-eslint/explicit-module-boundary-types': 0,
45
+ '@typescript-eslint/interface-name-prefix': 0,
46
+ '@typescript-eslint/naming-convention': [
47
+ 'error',
48
+ {
49
+ selector: 'default',
50
+ format: ['PascalCase', 'camelCase'],
51
+ leadingUnderscore: 'forbid',
52
+ trailingUnderscore: 'forbid',
53
+ },
54
+ {
55
+ selector: ['variable', 'property'],
56
+ format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
57
+ leadingUnderscore: 'forbid',
58
+ trailingUnderscore: 'forbid',
59
+ },
60
+ {
61
+ selector: 'typeLike',
62
+ format: ['PascalCase'],
63
+ },
64
+ {
65
+ selector: ['enumMember', 'enum'],
66
+ format: ['camelCase', 'UPPER_CASE', 'snake_case', 'PascalCase'],
67
+ },
68
+ {
69
+ selector: 'property',
70
+ filter: '^__html$',
71
+ format: null,
72
+ },
73
+ ],
74
+ '@typescript-eslint/no-empty-function': 0,
75
+ '@typescript-eslint/no-explicit-any': 0,
76
+ '@typescript-eslint/no-object-literal-type-assertion': 0,
77
+ '@typescript-eslint/padding-line-between-statements': [
78
+ 'error',
79
+ {
80
+ blankLine: 'always',
81
+ prev: ['interface', 'type'],
82
+ next: '*',
83
+ },
84
+ { blankLine: 'always', prev: '*', next: ['return'] },
85
+ { blankLine: 'always', prev: 'function', next: 'function' },
86
+ { blankLine: 'always', prev: 'multiline-const', next: '*' },
87
+ {
88
+ blankLine: 'always',
89
+ prev: 'import',
90
+ next: [
91
+ 'interface',
92
+ 'type',
93
+ 'block',
94
+ 'block-like',
95
+ 'case',
96
+ 'class',
97
+ 'const',
98
+ 'export',
99
+ 'expression',
100
+ 'for',
101
+ 'function',
102
+ 'if',
103
+ 'let',
104
+ 'return',
105
+ 'throw',
106
+ 'try',
107
+ 'while',
108
+ ],
109
+ },
110
+ {
111
+ blankLine: 'always',
112
+ prev: [
113
+ 'import',
114
+ 'interface',
115
+ 'type',
116
+ 'block',
117
+ 'block-like',
118
+ 'case',
119
+ 'class',
120
+ 'const',
121
+ 'expression',
122
+ 'for',
123
+ 'function',
124
+ 'if',
125
+ 'let',
126
+ 'return',
127
+ 'throw',
128
+ 'try',
129
+ 'while',
130
+ ],
131
+ next: 'export',
132
+ },
133
+ ],
21
134
  'jsx-a11y/anchor-is-valid': [
22
135
  'error',
23
136
  {
@@ -26,6 +139,33 @@ module.exports = {
26
139
  aspects: ['invalidHref', 'preferButton'],
27
140
  },
28
141
  ],
142
+ curly: ['error', 'multi-line'],
143
+ 'import/order': 0,
144
+ 'no-duplicate-imports': 2,
145
+ 'no-restricted-imports': [
146
+ 'error',
147
+ {
148
+ paths: ['ui'],
149
+ patterns: [
150
+ {
151
+ group: ['@sh/app', '@sh/app/*'],
152
+ message: 'Importing from `app` package is disallowed for architecture reasons',
153
+ },
154
+ ],
155
+ },
156
+ ],
157
+ 'import/no-restricted-paths': [
158
+ 'error',
159
+ {
160
+ zones: [
161
+ {
162
+ target: 'ui',
163
+ from: 'app',
164
+ message: 'Importing from `app` package is disallowed for architecture reasons',
165
+ },
166
+ ],
167
+ },
168
+ ],
29
169
  'react-hooks/exhaustive-deps': 2,
30
170
  'react-hooks/rules-of-hooks': 2,
31
171
  'react/button-has-type': 2,
@@ -37,10 +177,7 @@ module.exports = {
37
177
  'sort-imports': 0,
38
178
  'react/function-component-definition': [
39
179
  2,
40
- {
41
- namedComponents: 'arrow-function',
42
- unnamedComponents: 'arrow-function',
43
- },
180
+ { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' },
44
181
  ],
45
182
  'react/jsx-curly-brace-presence': [
46
183
  2,
@@ -51,13 +188,29 @@ module.exports = {
51
188
  ],
52
189
  'react/jsx-sort-props': [
53
190
  2,
191
+ { ignoreCase: true, callbacksLast: true, shorthandLast: false, reservedFirst: true },
192
+ ],
193
+ 'max-lines': [
194
+ 'error',
195
+ {
196
+ max: 300,
197
+ skipComments: true,
198
+ },
199
+ ],
200
+ 'simple-import-sort/imports': [
201
+ 1,
54
202
  {
55
- ignoreCase: true,
56
- callbacksLast: true,
57
- shorthandLast: false,
58
- reservedFirst: true,
203
+ groups: [
204
+ ['^\\u0000'],
205
+ ['^react', '^next', '^[^.]'],
206
+ ['^@shakuroinc/', '^@sh/'],
207
+ ['^libs$', '^libs/', '^features/'],
208
+ ['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
209
+ ['^.+\\.s?css$'],
210
+ ],
59
211
  },
60
212
  ],
213
+ 'simple-import-sort/exports': 1,
61
214
  'tailwindcss/classnames-order': 2,
62
215
  'tailwindcss/no-contradicting-classname': 2,
63
216
  'tailwindcss/no-custom-classname': 1,
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.1",
3
+ "version": "6.0.3",
4
4
  "main": ".eslintrc.js",
5
5
  "author": "Shakuro team",
6
6
  "license": "MIT",
@@ -10,11 +10,10 @@
10
10
  },
11
11
  "scripts": {
12
12
  "lint": "eslint . --ext .ts,.tsx,.js,.mdx,.md --ignore-path .gitignore",
13
- "release": "git push --tags && npm publish --access public --new-version"
13
+ "release": "git push origin master --tags && npm publish --access public --new-version"
14
14
  },
15
15
  "dependencies": {},
16
16
  "devDependencies": {
17
- "@shakuroinc/eslint-config-base": "^1.0.2",
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.2",
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
  };