@flarian/frontend-preset 1.2.0 → 1.3.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.
- package/README.md +155 -1
- package/dist/eslint/config/all.cjs +10 -1
- package/dist/eslint/config/all.d.cts +6 -1
- package/dist/eslint/config/all.d.mts +6 -1
- package/dist/eslint/config/all.d.ts +6 -1
- package/dist/eslint/config/all.mjs +15 -6
- package/dist/eslint/config/base.cjs +2 -2
- package/dist/eslint/config/base.d.cts +2 -2
- package/dist/eslint/config/base.d.mts +2 -2
- package/dist/eslint/config/base.d.ts +2 -2
- package/dist/eslint/config/base.mjs +2 -2
- package/dist/eslint/config/imports.cjs +2 -2
- package/dist/eslint/config/imports.d.cts +2 -2
- package/dist/eslint/config/imports.d.mts +2 -2
- package/dist/eslint/config/imports.d.ts +2 -2
- package/dist/eslint/config/imports.mjs +2 -2
- package/dist/eslint/config/json.cjs +2 -2
- package/dist/eslint/config/json.d.cts +2 -2
- package/dist/eslint/config/json.d.mts +2 -2
- package/dist/eslint/config/json.d.ts +2 -2
- package/dist/eslint/config/json.mjs +2 -2
- package/dist/eslint/config/jsx.cjs +2 -2
- package/dist/eslint/config/jsx.d.cts +2 -2
- package/dist/eslint/config/jsx.d.mts +2 -2
- package/dist/eslint/config/jsx.d.ts +2 -2
- package/dist/eslint/config/jsx.mjs +2 -2
- package/dist/eslint/config/prettier.cjs +22 -0
- package/dist/eslint/config/prettier.d.cts +5 -0
- package/dist/eslint/config/prettier.d.mts +5 -0
- package/dist/eslint/config/prettier.d.ts +5 -0
- package/dist/eslint/config/prettier.mjs +15 -0
- package/dist/eslint/config/react.cjs +54 -0
- package/dist/eslint/config/react.d.cts +5 -0
- package/dist/eslint/config/react.d.mts +5 -0
- package/dist/eslint/config/react.d.ts +5 -0
- package/dist/eslint/config/react.mjs +47 -0
- package/dist/eslint/config/vue.cjs +2 -16
- package/dist/eslint/config/vue.d.cts +2 -2
- package/dist/eslint/config/vue.d.mts +2 -2
- package/dist/eslint/config/vue.d.ts +2 -2
- package/dist/eslint/config/vue.mjs +2 -14
- package/dist/eslint/index.cjs +7 -0
- package/dist/eslint/index.d.cts +2 -0
- package/dist/eslint/index.d.mts +2 -0
- package/dist/eslint/index.d.ts +2 -0
- package/dist/eslint/index.mjs +5 -0
- package/dist/index.cjs +12 -4
- package/dist/index.d.cts +7 -2
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +12 -4
- package/dist/shared/frontend-preset.0jMq7xRp.d.cts +13 -0
- package/dist/shared/frontend-preset.BOIuEWn5.d.cts +23 -0
- package/dist/shared/{frontend-preset.6R8Uetz9.cjs → frontend-preset.BPbLrmoT.cjs} +4 -0
- package/dist/shared/frontend-preset.BhlqScTP.cjs +545 -0
- package/dist/shared/frontend-preset.CtWMCAnj.d.ts +23 -0
- package/dist/shared/frontend-preset.DFe94ri5.mjs +12 -0
- package/dist/shared/frontend-preset.DrUk0z26.mjs +22 -0
- package/dist/shared/frontend-preset.DwWnly25.cjs +14 -0
- package/dist/shared/frontend-preset.LUquEVxB.d.ts +13 -0
- package/dist/shared/frontend-preset.UJ8T0exL.mjs +541 -0
- package/dist/shared/frontend-preset.XIsgQ85Y.d.mts +23 -0
- package/dist/shared/frontend-preset.bJz2J5gD.d.mts +13 -0
- package/dist/stylelint/config/all.cjs +9 -0
- package/dist/stylelint/config/all.d.cts +94 -0
- package/dist/stylelint/config/all.d.mts +94 -0
- package/dist/stylelint/config/all.d.ts +94 -0
- package/dist/stylelint/config/all.mjs +7 -0
- package/dist/stylelint/config/less.cjs +15 -0
- package/dist/stylelint/config/less.d.cts +47 -0
- package/dist/stylelint/config/less.d.mts +47 -0
- package/dist/stylelint/config/less.d.ts +47 -0
- package/dist/stylelint/config/less.mjs +13 -0
- package/dist/stylelint/config/scss.cjs +15 -0
- package/dist/stylelint/config/scss.d.cts +47 -0
- package/dist/stylelint/config/scss.d.mts +47 -0
- package/dist/stylelint/config/scss.d.ts +47 -0
- package/dist/stylelint/config/scss.mjs +13 -0
- package/dist/stylelint/index.cjs +7 -2
- package/dist/stylelint/index.d.cts +3 -2
- package/dist/stylelint/index.d.mts +3 -1
- package/dist/stylelint/index.d.ts +3 -2
- package/dist/stylelint/index.mjs +4 -1
- package/package.json +31 -38
- package/dist/shared/frontend-preset.94Nv3dry.d.mts +0 -19
- package/dist/shared/frontend-preset.BHJqNuKK.mjs +0 -10
- package/dist/shared/frontend-preset.BRKQrSpw.cjs +0 -13
- package/dist/shared/frontend-preset.BpKna_XX.d.ts +0 -19
- package/dist/shared/frontend-preset.CHBOSLHa.d.cts +0 -11
- package/dist/shared/frontend-preset.CHBOSLHa.d.mts +0 -11
- package/dist/shared/frontend-preset.CHBOSLHa.d.ts +0 -11
- package/dist/shared/frontend-preset.DUPjVIaV.d.cts +0 -19
- package/dist/shared/frontend-preset.DebS_mJq.mjs +0 -18
package/README.md
CHANGED
|
@@ -1 +1,155 @@
|
|
|
1
|
-
# frontend-preset
|
|
1
|
+
# frontend-preset
|
|
2
|
+
|
|
3
|
+
## Поддерживаемые форматы:
|
|
4
|
+
- .js
|
|
5
|
+
- .jsx
|
|
6
|
+
- .ts
|
|
7
|
+
- .tsx
|
|
8
|
+
- .json
|
|
9
|
+
- .css
|
|
10
|
+
- .less
|
|
11
|
+
- .scss
|
|
12
|
+
- .vue
|
|
13
|
+
- .pug
|
|
14
|
+
- .yml
|
|
15
|
+
- .yaml
|
|
16
|
+
|
|
17
|
+
## Установка
|
|
18
|
+
```sh
|
|
19
|
+
pnpm add @flarian/frontend-preset
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Расширения vsCode:
|
|
23
|
+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
24
|
+
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
25
|
+
- [Stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)
|
|
26
|
+
- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
|
|
27
|
+
|
|
28
|
+
## Примеры конфигураций:
|
|
29
|
+
### eslint.config.ts
|
|
30
|
+
```ts
|
|
31
|
+
import { all } from '@flarian/frontend-preset/eslint';
|
|
32
|
+
|
|
33
|
+
export default [
|
|
34
|
+
...all.withApp,
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
ignores: ['dist/**', 'node_modules/**', 'pnpm-lock.yaml'],
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### prettier.config.mjs
|
|
44
|
+
```js
|
|
45
|
+
import { all } from '@flarian/frontend-preset/prettier';
|
|
46
|
+
|
|
47
|
+
export default all;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### stylelint.config.mjs
|
|
51
|
+
```js
|
|
52
|
+
import { all } from '@flarian/frontend-preset/stylelint';
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
extends: [all.lessConfig, all.scssConfig],
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## .editorconfig
|
|
60
|
+
```ini
|
|
61
|
+
root = true
|
|
62
|
+
|
|
63
|
+
# Блок настроек для всех типов файлов
|
|
64
|
+
[*]
|
|
65
|
+
charset = utf-8
|
|
66
|
+
end_of_line = lf
|
|
67
|
+
indent_size = 4
|
|
68
|
+
indent_style = tab
|
|
69
|
+
insert_final_newline = true
|
|
70
|
+
trim_trailing_whitespace = true
|
|
71
|
+
|
|
72
|
+
# Блок настроек для Markdown
|
|
73
|
+
[*.{md,markdown}]
|
|
74
|
+
trim_trailing_whitespace = false
|
|
75
|
+
|
|
76
|
+
# Блок настроек для файлов JavaScript и TypeScript
|
|
77
|
+
[*.{js,ts,jsx,tsx,cjs,mjs,vue}]
|
|
78
|
+
indent_style = tab
|
|
79
|
+
indent_size = 4
|
|
80
|
+
|
|
81
|
+
# Блок настроек для файлов css
|
|
82
|
+
[*.{css,less}]
|
|
83
|
+
indent_style = tab
|
|
84
|
+
indent_size = 4
|
|
85
|
+
|
|
86
|
+
# Блок настроек для файлов JSON
|
|
87
|
+
[*.{json}]
|
|
88
|
+
indent_style = tab
|
|
89
|
+
indent_size = 4
|
|
90
|
+
|
|
91
|
+
# Блок настроек для YAML
|
|
92
|
+
[*.{yaml,yml}]
|
|
93
|
+
indent_style = space
|
|
94
|
+
indent_size = 2
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Пример конфигурации для VSCode:
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
/* Language settings */
|
|
101
|
+
"[css]": {
|
|
102
|
+
"editor.defaultFormatter": "stylelint.vscode-stylelint",
|
|
103
|
+
"editor.formatOnSave": true
|
|
104
|
+
},
|
|
105
|
+
"[javascript]": {
|
|
106
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
107
|
+
"editor.formatOnSave": true,
|
|
108
|
+
"editor.suggest.insertMode": "replace"
|
|
109
|
+
},
|
|
110
|
+
"[json]": {
|
|
111
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
112
|
+
"editor.formatOnSave": true
|
|
113
|
+
},
|
|
114
|
+
"[jsonc]": {
|
|
115
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
116
|
+
"editor.formatOnSave": true
|
|
117
|
+
},
|
|
118
|
+
"[less]": {
|
|
119
|
+
"editor.defaultFormatter": "stylelint.vscode-stylelint",
|
|
120
|
+
"editor.formatOnSave": true
|
|
121
|
+
},
|
|
122
|
+
"[typescript]": {
|
|
123
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
124
|
+
"editor.formatOnSave": true
|
|
125
|
+
},
|
|
126
|
+
"[vue]": {
|
|
127
|
+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
128
|
+
"editor.formatOnSave": true
|
|
129
|
+
},
|
|
130
|
+
"[yaml]": {
|
|
131
|
+
"editor.defaultFormatter": "redhat.vscode-yaml",
|
|
132
|
+
"editor.formatOnSave": true
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
/* Editor */
|
|
136
|
+
"editor.accessibilitySupport": "off",
|
|
137
|
+
"editor.codeActionsOnSave": {
|
|
138
|
+
"source.fixAll.eslint": "explicit",
|
|
139
|
+
"source.fixAll.stylelint": "always"
|
|
140
|
+
},
|
|
141
|
+
|
|
142
|
+
/* ESLint */
|
|
143
|
+
"eslint.format.enable": true,
|
|
144
|
+
"eslint.validate": ["json", "jsonc", "javascript", "typescript", "vue", "yaml", "yml"],
|
|
145
|
+
|
|
146
|
+
/* JSON */
|
|
147
|
+
"json.format.enable": true,
|
|
148
|
+
"json.format.keepLines": false,
|
|
149
|
+
"json.validate.enable": false,
|
|
150
|
+
|
|
151
|
+
/* Stylelint */
|
|
152
|
+
"stylelint.packageManager": "pnpm",
|
|
153
|
+
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"],
|
|
154
|
+
}
|
|
155
|
+
```
|
|
@@ -4,6 +4,8 @@ const eslint_config_base = require('./base.cjs');
|
|
|
4
4
|
const eslint_config_imports = require('./imports.cjs');
|
|
5
5
|
const eslint_config_json = require('./json.cjs');
|
|
6
6
|
const eslint_config_jsx = require('./jsx.cjs');
|
|
7
|
+
const eslint_config_prettier = require('./prettier.cjs');
|
|
8
|
+
const eslint_config_react = require('./react.cjs');
|
|
7
9
|
const eslint_config_vue = require('./vue.cjs');
|
|
8
10
|
require('globals');
|
|
9
11
|
require('typescript-eslint');
|
|
@@ -11,11 +13,18 @@ require('@eslint/js');
|
|
|
11
13
|
require('@stylistic/eslint-plugin');
|
|
12
14
|
require('eslint-plugin-simple-import-sort');
|
|
13
15
|
require('eslint-plugin-jsonc');
|
|
16
|
+
require('../../prettier/config/base.cjs');
|
|
14
17
|
require('eslint-config-prettier');
|
|
15
18
|
require('eslint-plugin-prettier');
|
|
19
|
+
require('eslint-plugin-react');
|
|
20
|
+
require('eslint-plugin-react-hooks');
|
|
16
21
|
require('eslint-plugin-vue');
|
|
17
22
|
require('vue-eslint-parser');
|
|
18
23
|
|
|
19
|
-
const
|
|
24
|
+
const withNode = [...eslint_config_base, ...eslint_config_imports, ...eslint_config_json, ...eslint_config_prettier];
|
|
25
|
+
const withApp = [...withNode, ...eslint_config_jsx];
|
|
26
|
+
const withReact = [...withApp, ...eslint_config_react];
|
|
27
|
+
const withVue = [...withApp, ...eslint_config_vue];
|
|
28
|
+
const all = { withNode, withApp, withReact, withVue };
|
|
20
29
|
|
|
21
30
|
module.exports = all;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
|
|
3
|
-
declare const _default:
|
|
3
|
+
declare const _default: {
|
|
4
|
+
withNode: Linter.Config<Linter.RulesRecord>[];
|
|
5
|
+
withApp: Linter.Config<Linter.RulesRecord>[];
|
|
6
|
+
withReact: Linter.Config<Linter.RulesRecord>[];
|
|
7
|
+
withVue: Linter.Config<Linter.RulesRecord>[];
|
|
8
|
+
};
|
|
4
9
|
|
|
5
10
|
export = _default;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
|
|
3
|
-
declare const _default:
|
|
3
|
+
declare const _default: {
|
|
4
|
+
withNode: Linter.Config<Linter.RulesRecord>[];
|
|
5
|
+
withApp: Linter.Config<Linter.RulesRecord>[];
|
|
6
|
+
withReact: Linter.Config<Linter.RulesRecord>[];
|
|
7
|
+
withVue: Linter.Config<Linter.RulesRecord>[];
|
|
8
|
+
};
|
|
4
9
|
|
|
5
10
|
export { _default as default };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
|
|
3
|
-
declare const _default:
|
|
3
|
+
declare const _default: {
|
|
4
|
+
withNode: Linter.Config<Linter.RulesRecord>[];
|
|
5
|
+
withApp: Linter.Config<Linter.RulesRecord>[];
|
|
6
|
+
withReact: Linter.Config<Linter.RulesRecord>[];
|
|
7
|
+
withVue: Linter.Config<Linter.RulesRecord>[];
|
|
8
|
+
};
|
|
4
9
|
|
|
5
10
|
export = _default;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import baseConfig from './base.mjs';
|
|
2
|
+
import importsConfig from './imports.mjs';
|
|
3
|
+
import jsonConfig from './json.mjs';
|
|
4
|
+
import jsxConfig from './jsx.mjs';
|
|
5
|
+
import prettierConfig from './prettier.mjs';
|
|
6
|
+
import reactConfig from './react.mjs';
|
|
7
|
+
import vueConfig from './vue.mjs';
|
|
6
8
|
import 'globals';
|
|
7
9
|
import 'typescript-eslint';
|
|
8
10
|
import '@eslint/js';
|
|
9
11
|
import '@stylistic/eslint-plugin';
|
|
10
12
|
import 'eslint-plugin-simple-import-sort';
|
|
11
13
|
import 'eslint-plugin-jsonc';
|
|
14
|
+
import '../../prettier/config/base.mjs';
|
|
12
15
|
import 'eslint-config-prettier';
|
|
13
16
|
import 'eslint-plugin-prettier';
|
|
17
|
+
import 'eslint-plugin-react';
|
|
18
|
+
import 'eslint-plugin-react-hooks';
|
|
14
19
|
import 'eslint-plugin-vue';
|
|
15
20
|
import 'vue-eslint-parser';
|
|
16
21
|
|
|
17
|
-
const
|
|
22
|
+
const withNode = [...baseConfig, ...importsConfig, ...jsonConfig, ...prettierConfig];
|
|
23
|
+
const withApp = [...withNode, ...jsxConfig];
|
|
24
|
+
const withReact = [...withApp, ...reactConfig];
|
|
25
|
+
const withVue = [...withApp, ...vueConfig];
|
|
26
|
+
const all = { withNode, withApp, withReact, withVue };
|
|
18
27
|
|
|
19
28
|
export { all as default };
|
|
@@ -573,7 +573,7 @@ const esLintTypeScriptRules = {
|
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
575
|
|
|
576
|
-
const
|
|
576
|
+
const baseConfig = [
|
|
577
577
|
{
|
|
578
578
|
languageOptions: {
|
|
579
579
|
globals: { ...globals__default.browser, ...globals__default.node }
|
|
@@ -586,4 +586,4 @@ const base = [
|
|
|
586
586
|
esLintStylisticRules
|
|
587
587
|
];
|
|
588
588
|
|
|
589
|
-
module.exports =
|
|
589
|
+
module.exports = baseConfig;
|
|
@@ -564,7 +564,7 @@ const esLintTypeScriptRules = {
|
|
|
564
564
|
}
|
|
565
565
|
};
|
|
566
566
|
|
|
567
|
-
const
|
|
567
|
+
const baseConfig = [
|
|
568
568
|
{
|
|
569
569
|
languageOptions: {
|
|
570
570
|
globals: { ...globals.browser, ...globals.node }
|
|
@@ -577,4 +577,4 @@ const base = [
|
|
|
577
577
|
esLintStylisticRules
|
|
578
578
|
];
|
|
579
579
|
|
|
580
|
-
export {
|
|
580
|
+
export { baseConfig as default };
|
|
@@ -118,7 +118,7 @@ const esLintJsonTsconfigRules = {
|
|
|
118
118
|
}
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
const
|
|
121
|
+
const jsonConfig = [
|
|
122
122
|
...pluginJsonc__default.configs["flat/base"],
|
|
123
123
|
...pluginJsonc__default.configs["flat/recommended-with-json"],
|
|
124
124
|
...pluginJsonc__default.configs["flat/recommended-with-json5"],
|
|
@@ -128,4 +128,4 @@ const json = [
|
|
|
128
128
|
esLintJsonTsconfigRules
|
|
129
129
|
];
|
|
130
130
|
|
|
131
|
-
module.exports =
|
|
131
|
+
module.exports = jsonConfig;
|
|
@@ -112,7 +112,7 @@ const esLintJsonTsconfigRules = {
|
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
const
|
|
115
|
+
const jsonConfig = [
|
|
116
116
|
...pluginJsonc.configs["flat/base"],
|
|
117
117
|
...pluginJsonc.configs["flat/recommended-with-json"],
|
|
118
118
|
...pluginJsonc.configs["flat/recommended-with-json5"],
|
|
@@ -122,4 +122,4 @@ const json = [
|
|
|
122
122
|
esLintJsonTsconfigRules
|
|
123
123
|
];
|
|
124
124
|
|
|
125
|
-
export {
|
|
125
|
+
export { jsonConfig as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const prettier_config_base = require('../../prettier/config/base.cjs');
|
|
4
|
+
const pluginPrettier = require('eslint-config-prettier');
|
|
5
|
+
const prettier = require('eslint-plugin-prettier');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
8
|
+
|
|
9
|
+
const pluginPrettier__default = /*#__PURE__*/_interopDefaultCompat(pluginPrettier);
|
|
10
|
+
const prettier__default = /*#__PURE__*/_interopDefaultCompat(prettier);
|
|
11
|
+
|
|
12
|
+
const prettierConfig = [
|
|
13
|
+
{
|
|
14
|
+
plugins: { prettier: prettier__default },
|
|
15
|
+
rules: {
|
|
16
|
+
...pluginPrettier__default.rules,
|
|
17
|
+
"prettier/prettier": ["warn", prettier_config_base]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
module.exports = prettierConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import baseConfig from '../../prettier/config/base.mjs';
|
|
2
|
+
import pluginPrettier from 'eslint-config-prettier';
|
|
3
|
+
import prettier from 'eslint-plugin-prettier';
|
|
4
|
+
|
|
5
|
+
const prettierConfig = [
|
|
6
|
+
{
|
|
7
|
+
plugins: { prettier },
|
|
8
|
+
rules: {
|
|
9
|
+
...pluginPrettier.rules,
|
|
10
|
+
"prettier/prettier": ["warn", baseConfig]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
export { prettierConfig as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const pluginReact = require('eslint-plugin-react');
|
|
4
|
+
const pluginReactHooks = require('eslint-plugin-react-hooks');
|
|
5
|
+
|
|
6
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
7
|
+
|
|
8
|
+
const pluginReact__default = /*#__PURE__*/_interopDefaultCompat(pluginReact);
|
|
9
|
+
const pluginReactHooks__default = /*#__PURE__*/_interopDefaultCompat(pluginReactHooks);
|
|
10
|
+
|
|
11
|
+
const esLintReactRules = {
|
|
12
|
+
files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
13
|
+
plugins: {
|
|
14
|
+
react: pluginReact__default
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
"react/default-props-match-prop-types": "off",
|
|
18
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
19
|
+
"react/jsx-filename-extension": [
|
|
20
|
+
"error",
|
|
21
|
+
{
|
|
22
|
+
extensions: [".tsx"]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"react/jsx-props-no-spreading": "off",
|
|
26
|
+
"react/jsx-indent-props": ["error", "tab"],
|
|
27
|
+
"react/indent": ["error", "tab"],
|
|
28
|
+
"react/no-array-index-key": "error",
|
|
29
|
+
"react/no-multi-comp": "error",
|
|
30
|
+
"react/no-unsafe": "error",
|
|
31
|
+
"react/prefer-stateless-function": "error",
|
|
32
|
+
"react/prop-types": "off"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const esLintReactHooksRules = {
|
|
37
|
+
files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
38
|
+
plugins: {
|
|
39
|
+
"react-hooks": pluginReactHooks__default
|
|
40
|
+
},
|
|
41
|
+
rules: {
|
|
42
|
+
"react-hooks/rules-of-hooks": "error",
|
|
43
|
+
"react-hooks/exhaustive-deps": "warn"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const reactConfig = [
|
|
48
|
+
pluginReact__default.configs.flat.recommended,
|
|
49
|
+
pluginReact__default.configs.flat["jsx-runtime"],
|
|
50
|
+
esLintReactRules,
|
|
51
|
+
esLintReactHooksRules
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
module.exports = reactConfig;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import pluginReact from 'eslint-plugin-react';
|
|
2
|
+
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
3
|
+
|
|
4
|
+
const esLintReactRules = {
|
|
5
|
+
files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
6
|
+
plugins: {
|
|
7
|
+
react: pluginReact
|
|
8
|
+
},
|
|
9
|
+
rules: {
|
|
10
|
+
"react/default-props-match-prop-types": "off",
|
|
11
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
12
|
+
"react/jsx-filename-extension": [
|
|
13
|
+
"error",
|
|
14
|
+
{
|
|
15
|
+
extensions: [".tsx"]
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"react/jsx-props-no-spreading": "off",
|
|
19
|
+
"react/jsx-indent-props": ["error", "tab"],
|
|
20
|
+
"react/indent": ["error", "tab"],
|
|
21
|
+
"react/no-array-index-key": "error",
|
|
22
|
+
"react/no-multi-comp": "error",
|
|
23
|
+
"react/no-unsafe": "error",
|
|
24
|
+
"react/prefer-stateless-function": "error",
|
|
25
|
+
"react/prop-types": "off"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const esLintReactHooksRules = {
|
|
30
|
+
files: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx"],
|
|
31
|
+
plugins: {
|
|
32
|
+
"react-hooks": pluginReactHooks
|
|
33
|
+
},
|
|
34
|
+
rules: {
|
|
35
|
+
"react-hooks/rules-of-hooks": "error",
|
|
36
|
+
"react-hooks/exhaustive-deps": "warn"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const reactConfig = [
|
|
41
|
+
pluginReact.configs.flat.recommended,
|
|
42
|
+
pluginReact.configs.flat["jsx-runtime"],
|
|
43
|
+
esLintReactRules,
|
|
44
|
+
esLintReactHooksRules
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
export { reactConfig as default };
|