@shakuroinc/eslint-config-react 5.1.1 → 6.0.1

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,28 +1,13 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
1
2
  module.exports = {
2
- plugins: [
3
- '@typescript-eslint',
4
- 'react',
5
- 'react-hooks',
6
- 'jsx-a11y',
7
- 'simple-import-sort',
8
- 'tailwindcss',
9
- ],
3
+ plugins: ['react', 'react-hooks', 'jsx-a11y', 'tailwindcss'],
10
4
 
11
5
  extends: [
12
- 'plugin:@typescript-eslint/recommended',
6
+ '@shakuroinc/eslint-config-base',
13
7
  'plugin:react/recommended',
14
- 'plugin:prettier/recommended',
15
8
  'plugin:jsx-a11y/recommended',
16
9
  ],
17
10
 
18
- parserOptions: {
19
- ecmaVersion: 2020,
20
- sourceType: 'module',
21
- ecmaFeatures: {
22
- jsx: true,
23
- },
24
- },
25
-
26
11
  settings: {
27
12
  react: {
28
13
  version: 'detect',
@@ -33,99 +18,6 @@ module.exports = {
33
18
  },
34
19
 
35
20
  rules: {
36
- '@typescript-eslint/ban-ts-ignore': 0,
37
- '@typescript-eslint/explicit-function-return-type': 0,
38
- '@typescript-eslint/explicit-member-accessibility': 0,
39
- '@typescript-eslint/explicit-module-boundary-types': 0,
40
- '@typescript-eslint/interface-name-prefix': 0,
41
- '@typescript-eslint/naming-convention': [
42
- 'error',
43
- {
44
- selector: 'default',
45
- format: ['PascalCase', 'camelCase'],
46
- leadingUnderscore: 'forbid',
47
- trailingUnderscore: 'forbid',
48
- },
49
- {
50
- selector: ['variable', 'property'],
51
- format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
52
- leadingUnderscore: 'forbid',
53
- trailingUnderscore: 'forbid',
54
- },
55
- {
56
- selector: 'typeLike',
57
- format: ['PascalCase'],
58
- },
59
- {
60
- selector: ['enumMember', 'enum'],
61
- format: ['camelCase', 'UPPER_CASE', 'snake_case', 'PascalCase'],
62
- },
63
- {
64
- selector: 'property',
65
- filter: '^__html$',
66
- format: null,
67
- },
68
- ],
69
- '@typescript-eslint/no-empty-function': 0,
70
- '@typescript-eslint/no-explicit-any': 0,
71
- '@typescript-eslint/no-object-literal-type-assertion': 0,
72
- '@typescript-eslint/padding-line-between-statements': [
73
- 'error',
74
- {
75
- blankLine: 'always',
76
- prev: ['interface', 'type'],
77
- next: '*',
78
- },
79
- { blankLine: 'always', prev: '*', next: ['return'] },
80
- { blankLine: 'always', prev: 'function', next: 'function' },
81
- { blankLine: 'always', prev: 'multiline-const', next: '*' },
82
- {
83
- blankLine: 'always',
84
- prev: 'import',
85
- next: [
86
- 'interface',
87
- 'type',
88
- 'block',
89
- 'block-like',
90
- 'case',
91
- 'class',
92
- 'const',
93
- 'export',
94
- 'expression',
95
- 'for',
96
- 'function',
97
- 'if',
98
- 'let',
99
- 'return',
100
- 'throw',
101
- 'try',
102
- 'while',
103
- ],
104
- },
105
- {
106
- blankLine: 'always',
107
- prev: [
108
- 'import',
109
- 'interface',
110
- 'type',
111
- 'block',
112
- 'block-like',
113
- 'case',
114
- 'class',
115
- 'const',
116
- 'expression',
117
- 'for',
118
- 'function',
119
- 'if',
120
- 'let',
121
- 'return',
122
- 'throw',
123
- 'try',
124
- 'while',
125
- ],
126
- next: 'export',
127
- },
128
- ],
129
21
  'jsx-a11y/anchor-is-valid': [
130
22
  'error',
131
23
  {
@@ -134,33 +26,6 @@ module.exports = {
134
26
  aspects: ['invalidHref', 'preferButton'],
135
27
  },
136
28
  ],
137
- curly: ['error', 'multi-line'],
138
- 'import/order': 0,
139
- 'no-duplicate-imports': 2,
140
- 'no-restricted-imports': [
141
- 'error',
142
- {
143
- paths: ['ui'],
144
- patterns: [
145
- {
146
- group: ['@sh/app', '@sh/app/*'],
147
- message: 'Importing from `app` package is disallowed for architecture reasons',
148
- },
149
- ],
150
- },
151
- ],
152
- 'import/no-restricted-paths': [
153
- 'error',
154
- {
155
- zones: [
156
- {
157
- target: 'ui',
158
- from: 'app',
159
- message: 'Importing from `app` package is disallowed for architecture reasons',
160
- },
161
- ],
162
- },
163
- ],
164
29
  'react-hooks/exhaustive-deps': 2,
165
30
  'react-hooks/rules-of-hooks': 2,
166
31
  'react/button-has-type': 2,
@@ -172,7 +37,10 @@ module.exports = {
172
37
  'sort-imports': 0,
173
38
  'react/function-component-definition': [
174
39
  2,
175
- { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' },
40
+ {
41
+ namedComponents: 'arrow-function',
42
+ unnamedComponents: 'arrow-function',
43
+ },
176
44
  ],
177
45
  'react/jsx-curly-brace-presence': [
178
46
  2,
@@ -183,29 +51,13 @@ module.exports = {
183
51
  ],
184
52
  'react/jsx-sort-props': [
185
53
  2,
186
- { ignoreCase: true, callbacksLast: true, shorthandLast: false, reservedFirst: true },
187
- ],
188
- 'max-lines': [
189
- 'error',
190
- {
191
- max: 300,
192
- skipComments: true,
193
- },
194
- ],
195
- 'simple-import-sort/imports': [
196
- 1,
197
54
  {
198
- groups: [
199
- ['^\\u0000'],
200
- ['^react', '^next', '^[^.]'],
201
- ['^@shakuroinc/', '^@sh/'],
202
- ['^libs$', '^libs/', '^features/'],
203
- ['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
204
- ['^.+\\.s?css$'],
205
- ],
55
+ ignoreCase: true,
56
+ callbacksLast: true,
57
+ shorthandLast: false,
58
+ reservedFirst: true,
206
59
  },
207
60
  ],
208
- 'simple-import-sort/exports': 1,
209
61
  'tailwindcss/classnames-order': 2,
210
62
  'tailwindcss/no-contradicting-classname': 2,
211
63
  'tailwindcss/no-custom-classname': 1,
@@ -0,0 +1,42 @@
1
+ {
2
+ "typescript.tsdk": "node_modules/typescript/lib",
3
+ "eslint.validate": [
4
+ "markdown",
5
+ "mdx",
6
+ "javascript",
7
+ "javascriptreact",
8
+ "typescript",
9
+ "typescriptreact"
10
+ ],
11
+ "eslint.options": {
12
+ "extensions": [".mdx", ".js", ".jsx", ".ts", ".tsx"]
13
+ },
14
+ "editor.formatOnSave": true,
15
+ "[javascript]": {
16
+ "editor.formatOnSave": false
17
+ },
18
+ "[javascriptreact]": {
19
+ "editor.formatOnSave": false
20
+ },
21
+ "[typescript]": {
22
+ "editor.formatOnSave": false
23
+ },
24
+ "[typescriptreact]": {
25
+ "editor.formatOnSave": false
26
+ },
27
+ "editor.codeActionsOnSave": {
28
+ "eslint.autoFixOnSave": true,
29
+ "source.fixAll.eslint": true
30
+ },
31
+ "window.title": "@shakuroinc/eslint-config-react | ${activeEditorShort}${separator}${rootName}",
32
+ "tailwindCSS.emmetCompletions": true,
33
+ "tailwindCSS.experimental.classRegex": [
34
+ "ClassName='([^']*)", // prefixClassName='...'
35
+ "ClassName=\"([^']*)", // prefixClassName="..."
36
+ ["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] // clsx(...)
37
+ ],
38
+ "cSpell.words": [
39
+ "clsx",
40
+ "shakuroinc"
41
+ ]
42
+ }
package/README.md CHANGED
@@ -1,15 +1,32 @@
1
1
  # @shakuroinc/eslint-config-react
2
2
 
3
- This package provides Shakuro's eslint and prettier as an extensible shared config.
3
+ [Shakuro](https://shakuro.com/) eslint and prettier extensible basic config.
4
4
 
5
5
  ## Usage
6
6
 
7
- - install main package: ` yarn add -D @shakuroinc/eslint-config-react` or `npm i -D @shakuroinc/eslint-config-react`
7
+ ### Install package:
8
8
 
9
- - install package dependencies: `npx install-peerdeps @shakuroinc/eslint-config-react -d -Y` (if you using yarn workspaces `npx install-peerdeps @shakuroinc/eslint-config-react -d -Y --extra-args "--ignore-workspace-root-check"`)
9
+ `yarn add -D @shakuroinc/eslint-config-react`
10
10
 
11
- - add `"extends": "@shakuroinc/eslint-config-react"` to your `.eslintrc` file
11
+ ### Install package dependencies:
12
12
 
13
- - extend some rules if needed
13
+ `npx install-peerdeps @shakuroinc/eslint-config-react -d -Y`
14
14
 
15
- - setup prettier: `.prettierrc.js` with: `module.exports = { ...require("@shakuroinc/eslint-config-react/prettier.config") }`
15
+ > if you using yarn workspaces `npx install-peerdeps @shakuroinc/eslint-config-react -d -Y --extra-args "--ignore-workspace-root-check"`
16
+
17
+ ### Configure `eslint`:
18
+
19
+ ```js
20
+ // .eslintrc.js
21
+ module.exports = {
22
+ extends: ['@shakuroinc/eslint-config-react'],
23
+ // extend config if needed
24
+ };
25
+ ```
26
+
27
+ ### Configure prettier:
28
+
29
+ ```js
30
+ // .prettierrc.js
31
+ module.exports = { ...require('@shakuroinc/eslint-config-react/prettier.config') };
32
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shakuroinc/eslint-config-react",
3
- "version": "5.1.1",
3
+ "version": "6.0.1",
4
4
  "main": ".eslintrc.js",
5
5
  "author": "Shakuro team",
6
6
  "license": "MIT",
@@ -8,13 +8,20 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/shakurocom/eslint-config-react"
10
10
  },
11
+ "scripts": {
12
+ "lint": "eslint . --ext .ts,.tsx,.js,.mdx,.md --ignore-path .gitignore",
13
+ "release": "git push --tags && npm publish --access public --new-version"
14
+ },
11
15
  "dependencies": {},
12
16
  "devDependencies": {
17
+ "@shakuroinc/eslint-config-base": "^1.0.2",
13
18
  "@typescript-eslint/eslint-plugin": "^5.45.0",
14
19
  "@typescript-eslint/parser": "^5.45.0",
15
20
  "eslint": "^8.29.0",
16
21
  "eslint-config-prettier": "^8.5.0",
22
+ "eslint-import-resolver-typescript": "^3.5.2",
17
23
  "eslint-mdx": "^2.0.5",
24
+ "eslint-plugin-import": "^2.26.0",
18
25
  "eslint-plugin-jsx-a11y": "^6.6.1",
19
26
  "eslint-plugin-mdx": "^2.0.5",
20
27
  "eslint-plugin-prettier": "^4.2.1",
@@ -23,14 +30,19 @@
23
30
  "eslint-plugin-simple-import-sort": "^8.0.0",
24
31
  "eslint-plugin-tailwindcss": "^3.7.1",
25
32
  "prettier": "^2.8.0",
26
- "prettier-plugin-tailwindcss": "^0.2.0"
33
+ "prettier-plugin-tailwindcss": "^0.2.0",
34
+ "react": "^18.2.0",
35
+ "typescript": "^4.9.3"
27
36
  },
28
37
  "peerDependencies": {
38
+ "@shakuroinc/eslint-config-base": "^1.0.2",
29
39
  "@typescript-eslint/eslint-plugin": "^5.45.0",
30
40
  "@typescript-eslint/parser": "^5.45.0",
31
41
  "eslint": "^8.29.0",
32
42
  "eslint-config-prettier": "^8.5.0",
43
+ "eslint-import-resolver-typescript": "^3.5.2",
33
44
  "eslint-mdx": "^2.0.5",
45
+ "eslint-plugin-import": "^2.26.0",
34
46
  "eslint-plugin-jsx-a11y": "^6.6.1",
35
47
  "eslint-plugin-mdx": "^2.0.5",
36
48
  "eslint-plugin-prettier": "^4.2.1",
@@ -38,7 +50,6 @@
38
50
  "eslint-plugin-react-hooks": "^4.6.0",
39
51
  "eslint-plugin-simple-import-sort": "^8.0.0",
40
52
  "eslint-plugin-tailwindcss": "^3.7.1",
41
- "prettier": "^2.8.0",
42
53
  "prettier-plugin-tailwindcss": "^0.2.0"
43
54
  },
44
55
  "lint-staged": {
@@ -1,10 +1,7 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ const baseConfig = require('@shakuroinc/eslint-config-base/prettier.config');
3
+
1
4
  module.exports = {
2
- arrowParens: 'avoid',
3
- bracketSpacing: true,
4
- plugins: [require('prettier-plugin-tailwindcss')],
5
- printWidth: 100,
6
- semi: true,
7
- singleQuote: true,
8
- tabWidth: 2,
9
- trailingComma: 'all',
5
+ ...baseConfig,
6
+ plugins: [...(baseConfig.plugins ?? []), require('prettier-plugin-tailwindcss')],
10
7
  };