Skip to content

Commit 649a3c2

Browse files
committed
feat: add code format plugin
1 parent 627ef6c commit 649a3c2

9 files changed

+5185
-875
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[**]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
end_of_line = lf
10+
11+
[**.md]
12+
trim_trailing_whitespace = false

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
mocks/mockServiceWorker.js

.prettierrc.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"arrowParens": "avoid",
3+
"importOrder": ["^(react|react-router-dom)$", "<THIRD_PARTY_MODULES>", "^@/(.*)$", "^/", "^[./]"],
4+
"importOrderSeparation": true,
5+
"importOrderSortSpecifiers": true,
6+
"jsxSingleQuote": true,
7+
"plugins": [
8+
"prettier-plugin-organize-imports",
9+
"prettier-plugin-packagejson",
10+
"prettier-plugin-sort-json",
11+
"@trivago/prettier-plugin-sort-imports"
12+
],
13+
"printWidth": 100,
14+
"proseWrap": "preserve",
15+
"semi": false,
16+
"singleQuote": true,
17+
"tabWidth": 2,
18+
"trailingComma": "all",
19+
"useTabs": false
20+
}

.stylelintrc.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": ["stylelint-config-standard", "stylelint-config-recess-order"],
3+
"plugins": ["stylelint-less"],
4+
"rules": {
5+
"at-rule-no-unknown": null,
6+
"color-no-invalid-hex": true,
7+
"less/color-no-invalid-hex": true
8+
}
9+
}

eslint.config.js

+48-18
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,58 @@
1-
import js from '@eslint/js'
1+
import pluginJs from '@eslint/js'
2+
import vitest from '@vitest/eslint-plugin'
3+
import jsxA11y from 'eslint-plugin-jsx-a11y'
4+
import pluginReact from 'eslint-plugin-react'
5+
import pluginReactHooks from 'eslint-plugin-react-hooks'
6+
import pluginPromise from 'eslint-plugin-promise'
27
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
8+
// eslint-disable-next-line import/no-unresolved
59
import tseslint from 'typescript-eslint'
10+
import pluginImport from 'eslint-plugin-import';
611

7-
export default tseslint.config(
8-
{ ignores: ['dist'] },
12+
13+
export default [
14+
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
15+
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
16+
pluginJs.configs.recommended,
17+
...tseslint.configs.recommended,
18+
pluginPromise.configs['flat/recommended'],
19+
pluginReact.configs.flat.recommended,
20+
pluginReact.configs.flat['jsx-runtime'],
21+
pluginImport.flatConfigs.recommended,
22+
{
23+
files: ['src/**/*.{ts,tsx}'],
24+
plugins: { 'react-hooks': pluginReactHooks },
25+
rules: { 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn' },
26+
},
27+
{
28+
ignores: ['dist/', 'public/', 'history/'],
29+
},
30+
{
31+
files: ['**/*.test.{tsx,ts}'],
32+
plugins: {
33+
vitest,
34+
},
35+
rules: vitest.configs.recommended.rules,
36+
},
937
{
10-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
38+
...jsxA11y.flatConfigs.recommended,
39+
plugins: { 'jsx-a11y': jsxA11y },
1240
languageOptions: {
13-
ecmaVersion: 2020,
14-
globals: globals.browser,
41+
...jsxA11y.flatConfigs.recommended.languageOptions,
42+
globals: { ...globals.serviceworker, ...globals.browser },
1543
},
16-
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
44+
},
45+
{
46+
settings: {
47+
react: { version: 'detect' },
1948
},
2049
rules: {
21-
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
24-
{ allowConstantExport: true },
25-
],
50+
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
51+
'prefer-const': 'error',
52+
eqeqeq: 'error',
53+
'no-duplicate-imports': 'error',
54+
'react/prop-types': 0,
55+
'react/forbid-dom-props': ['error', { forbid: ['style'] }],
2656
},
2757
},
28-
)
58+
]

0 commit comments

Comments
 (0)